Package com.logicaldoc.core.document.dao
Class HibernateVersionDAO
- java.lang.Object
-
- com.logicaldoc.core.HibernatePersistentObjectDAO<Version>
-
- com.logicaldoc.core.document.dao.HibernateVersionDAO
-
- All Implemented Interfaces:
VersionDAO
,PersistentObjectDAO<Version>
public class HibernateVersionDAO extends HibernatePersistentObjectDAO<Version> implements VersionDAO
Hibernate implementation ofDocumentDAO
- Since:
- 3.0
- Author:
- Marco Meschieri - LogicalDOC
-
-
Field Summary
-
Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO
ENTITY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(long versionId, int delCode)
This method deletes an entity and you can give a deletion codeList<Version>
findByDocId(long docId)
Finds all versions of the given documentVersion
findByFileVersion(long docId, String fileVersion)
This method finds a the first version with the given fileVersionVersion
findByVersion(long docId, String version)
This method finds a version by the document's ID an the version code.void
initialize(Version version)
Doesn't do anything by defaultvoid
setFolderDAO(FolderDAO folderDAO)
void
setStorer(Storer storer)
void
store(Version version)
This method persists the given version.void
updateDigest(Version version)
Updates the version's digest (SHA-1)-
Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO
bulkUpdate, bulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, 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 class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, bulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, 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
-
findByDocId
public List<Version> findByDocId(long docId)
Description copied from interface:VersionDAO
Finds all versions of the given document- Specified by:
findByDocId
in interfaceVersionDAO
- Parameters:
docId
- The document's id- Returns:
- The list of versions ordered by descending date
-
findByVersion
public Version findByVersion(long docId, String version)
Description copied from interface:VersionDAO
This method finds a version by the document's ID an the version code.- Specified by:
findByVersion
in interfaceVersionDAO
- Parameters:
docId
- ID of the documentversion
- the version code- Returns:
- the found version
-
findByFileVersion
public Version findByFileVersion(long docId, String fileVersion)
Description copied from interface:VersionDAO
This method finds a the first version with the given fileVersion- Specified by:
findByFileVersion
in interfaceVersionDAO
- Parameters:
docId
- ID of the documentfileVersion
- the fileVersion code- Returns:
- the found version
-
initialize
public void initialize(Version version)
Description copied from class:HibernatePersistentObjectDAO
Doesn't do anything by default- Specified by:
initialize
in interfacePersistentObjectDAO<Version>
- Overrides:
initialize
in classHibernatePersistentObjectDAO<Version>
- Parameters:
version
- The entity to be initialised
-
store
public void store(Version version) throws PersistenceException
This method persists the given version. Checks if is necessary to delete some document versions reading the context property 'document.maxversions' and the maxVersions property of the owning workspace.- Specified by:
store
in interfacePersistentObjectDAO<Version>
- Overrides:
store
in classHibernatePersistentObjectDAO<Version>
- Parameters:
version
- version to be stored.- Throws:
PersistenceException
- error at data layer
-
updateDigest
public void updateDigest(Version version)
Description copied from interface:VersionDAO
Updates the version's digest (SHA-1)- Specified by:
updateDigest
in interfaceVersionDAO
- Parameters:
version
- The version to be processed
-
setStorer
public void setStorer(Storer storer)
-
delete
public void delete(long versionId, int delCode) throws PersistenceException
Description copied from interface:PersistentObjectDAO
This method deletes an entity and you can give a deletion code- Specified by:
delete
in interfacePersistentObjectDAO<Version>
- Overrides:
delete
in classHibernatePersistentObjectDAO<Version>
- Parameters:
versionId
- ID of the entity which should be deleteddelCode
- Deletion code- Throws:
PersistenceException
- raised in case of errors in the database
-
setFolderDAO
public void setFolderDAO(FolderDAO folderDAO)
-
-