Class HibernateWorkflowTemplateDAO

    • Field Summary

      • Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO

        ENTITY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      WorkflowTemplate createFromFile​(File file)
      De-serialize a template from a file
      void delete​(long id, int code)  
      WorkflowTemplate 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.
      List<WorkflowTemplate> findAll​(long tenantId)  
      List<WorkflowTemplate> findAll​(long tenantId, Long userId)
      This method loads all the workflows
      List<WorkflowTemplate> findAllByName​(long tenantId, String name)
      This method finds all the workflow templates by name
      List<WorkflowTemplate> findAllDeployed​(Long tenantId, Long userId)
      This method loads all the workflows already deployed
      WorkflowTemplate findById​(long id)  
      WorkflowTemplate findByName​(long tenantId, String name)
      This method finds a workflow template by name (the latest version is returned)
      WorkflowTemplate findByNameAndVersion​(long tenantId, String name, int version)
      This method finds a workflow template by name (the latest version is returned)
      WorkflowTemplate 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> getEnabledPermissions​(long workflowId, long userId)
      Finds all permissions of a user enabled on the specified workflow
      void initialize​(WorkflowTemplate template)  
      boolean isReadEnable​(long workflowId, long userId)
      This method is looking up for read rights for a workflow and an user
      boolean isWriteEnable​(long workflowId, long userId)
      Returns if a workflow is writable for a user
      void setUserDAO​(com.logicaldoc.core.security.dao.UserDAO userDAO)  
      void store​(WorkflowTemplate entity)  
      WorkflowTemplate storeNewVersion​(WorkflowTemplate wfTemplate)
      Saves the passed workflow as a new version
      • Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO

        bulkUpdate, bulkUpdate, delete, deleteAll, deleteAll, findAll, findAllIds, findAllIds, findById, findByObjectQuery, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, getSessionFactory, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForString, setSessionFactory
      • Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO

        bulkUpdate, bulkUpdate, delete, deleteAll, deleteAll, findAll, findAllIds, findAllIds, findById, findByObjectQuery, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForString
    • Method Detail

      • setUserDAO

        public void setUserDAO​(com.logicaldoc.core.security.dao.UserDAO userDAO)
      • findAll

        public List<WorkflowTemplate> findAll​(long tenantId)
        Specified by:
        findAll in interface com.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>
        Overrides:
        findAll in class com.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>
      • findAll

        public List<WorkflowTemplate> findAll​(long tenantId,
                                              Long userId)
        Description copied from interface: WorkflowTemplateDAO
        This method loads all the workflows
        Specified by:
        findAll in interface WorkflowTemplateDAO
        Parameters:
        tenantId - tenant specification
        userId - optional user specification
        Returns:
        list of persistence workflow template
      • findAllDeployed

        public List<WorkflowTemplate> findAllDeployed​(Long tenantId,
                                                      Long userId)
        Description copied from interface: WorkflowTemplateDAO
        This method loads all the workflows already deployed
        Specified by:
        findAllDeployed in interface WorkflowTemplateDAO
        Parameters:
        tenantId - optional tenant specification
        userId - optional user specification
        Returns:
        list of persistence workflow template
      • findById

        public WorkflowTemplate findById​(long id)
                                  throws com.logicaldoc.core.PersistenceException
        Specified by:
        findById in interface com.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>
        Overrides:
        findById in class com.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>
        Throws:
        com.logicaldoc.core.PersistenceException
      • deploy

        public WorkflowTemplate deploy​(WorkflowTemplate wfTemplate)
                                throws com.logicaldoc.core.PersistenceException
        Description copied from interface: WorkflowTemplateDAO
        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.
        Specified by:
        deploy in interface WorkflowTemplateDAO
        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: WorkflowTemplateDAO
        Saves the passed workflow as a new version
        Specified by:
        storeNewVersion in interface WorkflowTemplateDAO
        Parameters:
        wfTemplate - The persistence workflow template
        Returns:
        the next version of the template
        Throws:
        com.logicaldoc.core.PersistenceException - error at data layer
      • findAllByName

        public List<WorkflowTemplate> findAllByName​(long tenantId,
                                                    String name)
        Description copied from interface: WorkflowTemplateDAO
        This method finds all the workflow templates by name
        Specified by:
        findAllByName in interface WorkflowTemplateDAO
        Parameters:
        tenantId - identifier of the tenant
        name - name of the workflow template
        Returns:
        list of templates with same name ordered by descending version
      • findByNameAndVersion

        public WorkflowTemplate findByNameAndVersion​(long tenantId,
                                                     String name,
                                                     int version)
        Description copied from interface: WorkflowTemplateDAO
        This method finds a workflow template by name (the latest version is returned)
        Specified by:
        findByNameAndVersion in interface WorkflowTemplateDAO
        Parameters:
        tenantId - identifier of the tenant
        name - name of the workflow template
        version - what version to pick
        Returns:
        WorkflowTemplate with given name, latest version
      • delete

        public void delete​(long id,
                           int code)
                    throws com.logicaldoc.core.PersistenceException
        Specified by:
        delete in interface com.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>
        Overrides:
        delete in class com.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>
        Throws:
        com.logicaldoc.core.PersistenceException
      • isWriteEnable

        public boolean isWriteEnable​(long workflowId,
                                     long userId)
        Description copied from interface: WorkflowTemplateDAO
        Returns if a workflow is writable for a user
        Specified by:
        isWriteEnable in interface WorkflowTemplateDAO
        Parameters:
        workflowId - check this workflow
        userId - privileges for this should be checked
        Returns:
        if the user can edit the workflow
      • isReadEnable

        public boolean isReadEnable​(long workflowId,
                                    long userId)
        Description copied from interface: WorkflowTemplateDAO
        This method is looking up for read rights for a workflow and an user
        Specified by:
        isReadEnable in interface WorkflowTemplateDAO
        Parameters:
        workflowId - ID of the workflow
        userId - ID of the user
        Returns:
        if the user can access the template
      • getEnabledPermissions

        public Set<com.logicaldoc.core.security.Permission> getEnabledPermissions​(long workflowId,
                                                                                  long userId)
        Description copied from interface: WorkflowTemplateDAO
        Finds all permissions of a user enabled on the specified workflow
        Specified by:
        getEnabledPermissions in interface WorkflowTemplateDAO
        Parameters:
        workflowId - ID of the workflow
        userId - ID of the user
        Returns:
        Collection of enabled permissions
      • initialize

        public void initialize​(WorkflowTemplate template)
        Specified by:
        initialize in interface com.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>
        Overrides:
        initialize in class com.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>
      • store

        public void store​(WorkflowTemplate entity)
                   throws com.logicaldoc.core.PersistenceException
        Specified by:
        store in interface com.logicaldoc.core.PersistentObjectDAO<WorkflowTemplate>
        Overrides:
        store in class com.logicaldoc.core.HibernatePersistentObjectDAO<WorkflowTemplate>
        Throws:
        com.logicaldoc.core.PersistenceException