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>
public class HibernateTemplateDAO
extends HibernatePersistentObjectDAO<Template>
implements TemplateDAO
Hibernate implementation of
TemplateDAO
- Since:
- 3.0
- Author:
- Marco Meschieri - LogicalDOC
-
Field Summary
Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO
ENTITY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreates a clone of an existing templateint
countDocs
(long id) Counts the total number of documents using this templateint
countFolders
(long id) void
delete
(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 typegetEnabledPermissions
(long templateId, long userId) Finds all permissions of a user enabled on the specified templatevoid
initialize
(Template template) Doesn't do anything by defaultboolean
isReadEnable
(long templateId, long userId) This method is looking up for read rights for a template and an userboolean
isWriteEnable
(long templateId, long userId) Returns if a template is writable for a uservoid
setUserDAO
(UserDAO userDAO) void
This method persists the entity objectMethods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, getSessionFactory, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString, setSessionFactory
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString
-
Constructor Details
-
HibernateTemplateDAO
public HibernateTemplateDAO()
-
-
Method Details
-
setUserDAO
-
findAll
Description copied from interface:PersistentObjectDAO
Finds all entities in the database- Specified by:
findAll
in interfacePersistentObjectDAO<Template>
- Overrides:
findAll
in classHibernatePersistentObjectDAO<Template>
- Returns:
- The list of all entities
-
findAll
Description copied from interface:PersistentObjectDAO
Finds all entities in a specific tenant.- Specified by:
findAll
in interfacePersistentObjectDAO<Template>
- Overrides:
findAll
in classHibernatePersistentObjectDAO<Template>
- Parameters:
tenantId
- Identifier of the tenant to search in- Returns:
- The list of all entities
-
findByName
Description copied from interface:TemplateDAO
This method finds a template by name- Specified by:
findByName
in interfaceTemplateDAO
- Parameters:
name
- Name of the templatetenantId
- ID of the owning tenant- Returns:
- Template with given name
- Throws:
PersistenceException
- Error in the data layer
-
delete
Description copied from interface:PersistentObjectDAO
This method deletes an entity and you can give a deletion code- Specified by:
delete
in interfacePersistentObjectDAO<Template>
- Overrides:
delete
in classHibernatePersistentObjectDAO<Template>
- Parameters:
id
- ID of the entity which should be deletedcode
- Deletion code- Throws:
PersistenceException
- raised in case of errors in the database
-
store
Description copied from interface:PersistentObjectDAO
This method persists the entity object- Specified by:
store
in interfacePersistentObjectDAO<Template>
- Overrides:
store
in classHibernatePersistentObjectDAO<Template>
- Parameters:
template
- entity to be stored- Throws:
PersistenceException
- raised in case of errors in the database
-
countFolders
public int countFolders(long id) -
countDocs
Description copied from interface:TemplateDAO
Counts the total number of documents using this template- Specified by:
countDocs
in interfaceTemplateDAO
- Parameters:
id
- The template ID- Returns:
- the documents count
- Throws:
PersistenceException
- Error in the data layer
-
findByType
Description copied from interface:TemplateDAO
This method finds a template by type- Specified by:
findByType
in interfaceTemplateDAO
- Parameters:
type
- Type of the templatetenantId
- ID of the owning tenant- Returns:
- Template with given type
- Throws:
PersistenceException
- Error in the data layer
-
initialize
Description copied from class:HibernatePersistentObjectDAO
Doesn't do anything by default- Specified by:
initialize
in interfacePersistentObjectDAO<Template>
- Specified by:
initialize
in interfaceTemplateDAO
- Overrides:
initialize
in classHibernatePersistentObjectDAO<Template>
- Parameters:
template
- The entity to be initialised
-
isWriteEnable
public boolean isWriteEnable(long templateId, long userId) Description copied from interface:TemplateDAO
Returns if a template is writable for a user- Specified by:
isWriteEnable
in interfaceTemplateDAO
- Parameters:
templateId
- check this templateuserId
- privileges for this should be checked- Returns:
- if the user can edit the template
-
isReadEnable
public boolean isReadEnable(long templateId, long userId) Description copied from interface:TemplateDAO
This method is looking up for read rights for a template and an user- Specified by:
isReadEnable
in interfaceTemplateDAO
- Parameters:
templateId
- ID of the templateuserId
- ID of the user- Returns:
- if the user can access the template
-
getEnabledPermissions
Description copied from interface:TemplateDAO
Finds all permissions of a user enabled on the specified template- Specified by:
getEnabledPermissions
in interfaceTemplateDAO
- Parameters:
templateId
- ID of the templateuserId
- ID of the user- Returns:
- Collection of enabled permissions
-
clone
Description copied from interface:TemplateDAO
Creates a clone of an existing template- Specified by:
clone
in interfaceTemplateDAO
- Parameters:
id
- Identifier of the original templatecloneName
- Name of the cloned template- Returns:
- the created clone
- Throws:
PersistenceException
- Error in the data layer
-