Package com.logicaldoc.core.metadata
Class HibernateTemplateDAO
java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Template>
com.logicaldoc.core.metadata.HibernateTemplateDAO
- All Implemented Interfaces:
- TemplateDAO,- PersistentObjectDAO<Template>
@Repository("templateDAO")
public class HibernateTemplateDAO
extends HibernatePersistentObjectDAO<Template>
implements TemplateDAO
Hibernate implementation of 
TemplateDAO- Since:
- 3.0
- Author:
- Marco Meschieri - LogicalDOC
- 
Field SummaryFields inherited from interface com.logicaldoc.core.PersistentObjectDAOENTITY
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionCreates a clone of an existing templateintcountDocs(long id) Counts the total number of documents using this templateintcountFolders(long id) voiddelete(long id, int code) This method deletes an entity and you can give a deletion codefindAll()Finds all entities in the databasefindAll(long tenantId) Finds all entities in a specific tenant.findByName(String name, long tenantId) This method finds a template by namefindByType(int type, long tenantId) This method finds a template by typegetAllowedPermissions(long templateId, long userId) Finds all permissions of a user enabled on the specified templatevoidinitialize(Template template) Doesn't do anything by defaultbooleanisReadEnable(long templateId, long userId) This method is looking up for read rights for a template and an userbooleanisWriteEnable(long templateId, long userId) Returns if a template is writable for a uservoidThis method persists the entity objectMethods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, evict, evict, 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, queryForString, setSessionFactoryMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.logicaldoc.core.PersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, evict, evict, 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, queryForString
- 
Constructor Details- 
HibernateTemplateDAOpublic HibernateTemplateDAO()
 
- 
- 
Method Details- 
findAllDescription copied from interface:PersistentObjectDAOFinds all entities in the database- Specified by:
- findAllin interface- PersistentObjectDAO<Template>
- Overrides:
- findAllin class- HibernatePersistentObjectDAO<Template>
- Returns:
- The list of all entities
 
- 
findAllDescription copied from interface:PersistentObjectDAOFinds all entities in a specific tenant.- Specified by:
- findAllin interface- PersistentObjectDAO<Template>
- Overrides:
- findAllin class- HibernatePersistentObjectDAO<Template>
- Parameters:
- tenantId- Identifier of the tenant to search in
- Returns:
- The list of all entities
 
- 
findByNameDescription copied from interface:TemplateDAOThis method finds a template by name- Specified by:
- findByNamein interface- TemplateDAO
- Parameters:
- name- Name of the template
- tenantId- ID of the owning tenant
- Returns:
- Template with given name
- Throws:
- PersistenceException- Error in the data layer
 
- 
deleteDescription copied from interface:PersistentObjectDAOThis method deletes an entity and you can give a deletion code- Specified by:
- deletein interface- PersistentObjectDAO<Template>
- Overrides:
- deletein class- HibernatePersistentObjectDAO<Template>
- Parameters:
- id- ID of the entity which should be deleted
- code- Deletion code
- Throws:
- PersistenceException- raised in case of errors in the database
 
- 
storeDescription copied from interface:PersistentObjectDAOThis method persists the entity object- Specified by:
- storein interface- PersistentObjectDAO<Template>
- Overrides:
- storein class- HibernatePersistentObjectDAO<Template>
- Parameters:
- template- entity to be stored
- Throws:
- PersistenceException- raised in case of errors in the database
 
- 
countFolderspublic int countFolders(long id) 
- 
countDocsDescription copied from interface:TemplateDAOCounts the total number of documents using this template- Specified by:
- countDocsin interface- TemplateDAO
- Parameters:
- id- The template ID
- Returns:
- the documents count
- Throws:
- PersistenceException- Error in the data layer
 
- 
findByTypeDescription copied from interface:TemplateDAOThis method finds a template by type- Specified by:
- findByTypein interface- TemplateDAO
- Parameters:
- type- Type of the template
- tenantId- ID of the owning tenant
- Returns:
- Template with given type
- Throws:
- PersistenceException- Error in the data layer
 
- 
initializeDescription copied from class:HibernatePersistentObjectDAODoesn't do anything by default- Specified by:
- initializein interface- PersistentObjectDAO<Template>
- Specified by:
- initializein interface- TemplateDAO
- Overrides:
- initializein class- HibernatePersistentObjectDAO<Template>
- Parameters:
- template- The entity to be initialised
 
- 
isWriteEnablepublic boolean isWriteEnable(long templateId, long userId) Description copied from interface:TemplateDAOReturns if a template is writable for a user- Specified by:
- isWriteEnablein interface- TemplateDAO
- Parameters:
- templateId- check this template
- userId- privileges for this should be checked
- Returns:
- if the user can edit the template
 
- 
isReadEnablepublic boolean isReadEnable(long templateId, long userId) Description copied from interface:TemplateDAOThis method is looking up for read rights for a template and an user- Specified by:
- isReadEnablein interface- TemplateDAO
- Parameters:
- templateId- ID of the template
- userId- ID of the user
- Returns:
- if the user can access the template
 
- 
getAllowedPermissionsDescription copied from interface:TemplateDAOFinds all permissions of a user enabled on the specified template- Specified by:
- getAllowedPermissionsin interface- TemplateDAO
- Parameters:
- templateId- ID of the template
- userId- ID of the user
- Returns:
- Collection of enabled permissions
 
- 
cloneDescription copied from interface:TemplateDAOCreates a clone of an existing template- Specified by:
- clonein interface- TemplateDAO
- Parameters:
- id- Identifier of the original template
- cloneName- Name of the cloned template
- Returns:
- the created clone
- Throws:
- PersistenceException- Error in the data layer
 
 
-