Package com.logicaldoc.workflow.template
Class HibernateWorkflowTemplateDAO
java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>
com.logicaldoc.workflow.template.HibernateWorkflowTemplateDAO
- All Implemented Interfaces:
com.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>,WorkflowTemplateDAO
public class HibernateWorkflowTemplateDAO
extends com.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>
implements WorkflowTemplateDAO
Hibernate implementation of the
WorkflowTemplateDAO.- Since:
- 5.0
- Author:
- Sebastian Wenzky, Matteo Caruso - LogicalDOC
-
Field Summary
Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO
ENTITY -
Method Summary
Modifier and TypeMethodDescriptioncreateFromFile(File file) De-serialize a template from a filevoiddelete(long id, int code) deploy(WorkflowTemplate wfTemplate) This method deploys the given persistence workflow template that is it copies the draft scheme in the currently used scheme and produces a new version.findAll(long tenantId) This method loads all the workflowsfindAllByName(long tenantId, String name) This method finds all the workflow templates by namefindAllDeployed(Long tenantId, Long userId) This method loads all the workflows already deployedfindByName(long tenantId, String name) This method finds a workflow template by name (the latest version is returned)findByNameAndVersion(long tenantId, String name, int version) This method finds a workflow template by name (the latest version is returned)findLastDeployed(long tenantId, String name) This method finds a deployed workflow template by name (the latest deployed version is returned)Set<com.logicaldoc.core.security.Permission> getAllowedPermissions(long workflowId, long userId) Finds all permissions of a user enabled on the specified workflowvoidinitialize(WorkflowTemplate template) booleanisReadEnabled(long workflowId, long userId) This method is looking up for read rights for a workflow and an userbooleanisWriteEnabled(long workflowId, long userId) Returns if a workflow is writable for a uservoidsetUserDAO(com.logicaldoc.core.security.user.UserDAO userDAO) voidstore(WorkflowTemplate entity) storeNewVersion(WorkflowTemplate wfTemplate) Saves the passed workflow as a new versionMethods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, getSessionFactory, isMySQL, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, setSessionFactoryMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, isMySQL, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString
-
Method Details
-
setUserDAO
public void setUserDAO(com.logicaldoc.core.security.user.UserDAO userDAO) -
createFromFile
Description copied from interface:WorkflowTemplateDAODe-serialize a template from a file- Specified by:
createFromFilein interfaceWorkflowTemplateDAO- Parameters:
file- the file storing the template- Returns:
- object representation of the template
-
findAll
public List<WorkflowTemplate> findAll(long tenantId) throws com.logicaldoc.core.PersistenceException - Specified by:
findAllin interfacecom.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>- Overrides:
findAllin classcom.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>- Throws:
com.logicaldoc.core.PersistenceException
-
findAll
public List<WorkflowTemplate> findAll(long tenantId, Long userId) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOThis method loads all the workflows- Specified by:
findAllin interfaceWorkflowTemplateDAO- Parameters:
tenantId- tenant specificationuserId- optional user specification- Returns:
- list of persistence workflow template
- Throws:
com.logicaldoc.core.PersistenceException- Error in the database
-
findAllDeployed
public List<WorkflowTemplate> findAllDeployed(Long tenantId, Long userId) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOThis method loads all the workflows already deployed- Specified by:
findAllDeployedin interfaceWorkflowTemplateDAO- Parameters:
tenantId- optional tenant specificationuserId- optional user specification- Returns:
- list of persistence workflow template
- Throws:
com.logicaldoc.core.PersistenceException- Error in the database
-
deploy
public WorkflowTemplate deploy(WorkflowTemplate wfTemplate) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOThis method deploys the given persistence workflow template that is it copies the draft scheme in the currently used scheme and produces a new version.- Specified by:
deployin interfaceWorkflowTemplateDAO- Parameters:
wfTemplate- The persistence workflow template- Returns:
- the next version of the template
- Throws:
com.logicaldoc.core.PersistenceException- error at data layer
-
storeNewVersion
public WorkflowTemplate storeNewVersion(WorkflowTemplate wfTemplate) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOSaves the passed workflow as a new version- Specified by:
storeNewVersionin interfaceWorkflowTemplateDAO- Parameters:
wfTemplate- The persistence workflow template- Returns:
- the next version of the template
- Throws:
com.logicaldoc.core.PersistenceException- error at data layer
-
findByName
public WorkflowTemplate findByName(long tenantId, String name) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOThis method finds a workflow template by name (the latest version is returned)- Specified by:
findByNamein interfaceWorkflowTemplateDAO- Parameters:
tenantId- identifier of the tenantname- name of the workflow template- Returns:
WorkflowTemplatewith given name, latest version- Throws:
com.logicaldoc.core.PersistenceException- Error in the database
-
findLastDeployed
public WorkflowTemplate findLastDeployed(long tenantId, String name) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOThis method finds a deployed workflow template by name (the latest deployed version is returned)- Specified by:
findLastDeployedin interfaceWorkflowTemplateDAO- Parameters:
tenantId- identifier of the tenantname- name of the workflow template- Returns:
WorkflowTemplatewith given name, latest version- Throws:
com.logicaldoc.core.PersistenceException- Error in the database
-
findAllByName
public List<WorkflowTemplate> findAllByName(long tenantId, String name) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOThis method finds all the workflow templates by name- Specified by:
findAllByNamein interfaceWorkflowTemplateDAO- Parameters:
tenantId- identifier of the tenantname- name of the workflow template- Returns:
- list of templates with same name ordered by descending version
- Throws:
com.logicaldoc.core.PersistenceException- Error in the database
-
findByNameAndVersion
public WorkflowTemplate findByNameAndVersion(long tenantId, String name, int version) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOThis method finds a workflow template by name (the latest version is returned)- Specified by:
findByNameAndVersionin interfaceWorkflowTemplateDAO- Parameters:
tenantId- identifier of the tenantname- name of the workflow templateversion- what version to pick- Returns:
WorkflowTemplatewith given name, latest version- Throws:
com.logicaldoc.core.PersistenceException- Error in the database
-
delete
public void delete(long id, int code) throws com.logicaldoc.core.PersistenceException - Specified by:
deletein interfacecom.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>- Overrides:
deletein classcom.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>- Throws:
com.logicaldoc.core.PersistenceException
-
isWriteEnabled
public boolean isWriteEnabled(long workflowId, long userId) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOReturns if a workflow is writable for a user- Specified by:
isWriteEnabledin interfaceWorkflowTemplateDAO- Parameters:
workflowId- check this workflowuserId- privileges for this should be checked- Returns:
- if the user can edit the workflow
- Throws:
com.logicaldoc.core.PersistenceException- Error in the database
-
isReadEnabled
public boolean isReadEnabled(long workflowId, long userId) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOThis method is looking up for read rights for a workflow and an user- Specified by:
isReadEnabledin interfaceWorkflowTemplateDAO- Parameters:
workflowId- ID of the workflowuserId- ID of the user- Returns:
- if the user can access the template
- Throws:
com.logicaldoc.core.PersistenceException- Error in the database
-
getAllowedPermissions
public Set<com.logicaldoc.core.security.Permission> getAllowedPermissions(long workflowId, long userId) throws com.logicaldoc.core.PersistenceException Description copied from interface:WorkflowTemplateDAOFinds all permissions of a user enabled on the specified workflow- Specified by:
getAllowedPermissionsin interfaceWorkflowTemplateDAO- Parameters:
workflowId- ID of the workflowuserId- ID of the user- Returns:
- Collection of enabled permissions
- Throws:
com.logicaldoc.core.PersistenceException- Error in the database
-
initialize
- Specified by:
initializein interfacecom.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>- Overrides:
initializein classcom.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>
-
store
- Specified by:
storein interfacecom.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>- Overrides:
storein classcom.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>- Throws:
com.logicaldoc.core.PersistenceException
-