Package com.logicaldoc.impex
Class HibernateArchiveDAO
java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Archive>
com.logicaldoc.impex.HibernateArchiveDAO
- All Implemented Interfaces:
com.logicaldoc.core.PersistentObjectDAO<Archive>
,ArchiveDAO
public class HibernateArchiveDAO
extends com.logicaldoc.core.HibernatePersistentObjectDAO<Archive>
implements ArchiveDAO
Hibernate implementation of the ArchiveDAO.
- Since:
- 4.5
- Author:
- Matteo Caruso - LogicalDOC
-
Field Summary
Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO
ENTITY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(long archiveId, int code) findArchivedIds
(long archiveId) Retrieves the identifiers of all versions archived into an archivefindByMode
(int mode, Long tenantId) Retrieves all the archive with the given modefindByModeAndName
(int mode, String name, Long tenantId) Retrieves all the archive with the given mode and the given namefindByModeAndStatus
(int mode, int status, Long tenantId) Retrieves all the archive with the given mode and the given statusfindByModeAndStatusAndType
(int mode, int status, int type, Long tenantId) Retrieves all the archive with the given mode and the given typefindByModeAndType
(int mode, int type, Long tenantId) Retrieves all the archive with the given mode and the given typefindByName
(String name, long tenantId) Retrieves the archive by the given namefindByStatus
(int status, Long tenantId) Retrieves all the archive with the given statusvoid
initialize
(Archive archive) Initializes lazy loaded collectionsboolean
removeVersions
(long archiveId, Set<Long> versionIds) Performs a bulk update removing all versions from the given archive.void
setCacheManager
(ArchiveCacheManager cacheManager) void
void
This method persists the entity object and updates the whole sizeMethods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, getSessionFactory, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, 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, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForRowSet, queryForRowSet, queryForString
-
Method Details
-
getCacheManager
-
setCacheManager
-
initialize
Description copied from interface:ArchiveDAO
Initializes lazy loaded collections- Specified by:
initialize
in interfaceArchiveDAO
- Specified by:
initialize
in interfacecom.logicaldoc.core.PersistentObjectDAO<Archive>
- Overrides:
initialize
in classcom.logicaldoc.core.HibernatePersistentObjectDAO<Archive>
- Parameters:
archive
- The archive to be initialized
-
findByName
public Archive findByName(String name, long tenantId) throws com.logicaldoc.core.PersistenceException Description copied from interface:ArchiveDAO
Retrieves the archive by the given name- Specified by:
findByName
in interfaceArchiveDAO
- Parameters:
name
- The archive nametenantId
- The tenant of the archive- Returns:
- The archive with the given name
- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-
delete
public void delete(long archiveId, int code) throws com.logicaldoc.core.PersistenceException -
findByStatus
public List<Archive> findByStatus(int status, Long tenantId) throws com.logicaldoc.core.PersistenceException Description copied from interface:ArchiveDAO
Retrieves all the archive with the given status- Specified by:
findByStatus
in interfaceArchiveDAO
- Parameters:
status
- The archive statustenantId
- The archive tenant- Returns:
- A list of archives with the given status
- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-
store
-
store
public void store(Archive archive, boolean updateSize) throws com.logicaldoc.core.PersistenceException Description copied from interface:ArchiveDAO
This method persists the entity object and updates the whole size- Specified by:
store
in interfaceArchiveDAO
- Parameters:
archive
- entity to be stored.updateSize
- true if you want to update archive total size- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-
findArchivedIds
Description copied from interface:ArchiveDAO
Retrieves the identifiers of all versions archived into an archive- Specified by:
findArchivedIds
in interfaceArchiveDAO
- Parameters:
archiveId
- the archive ID- Returns:
- list of identifiers
- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-
findByMode
public List<Archive> findByMode(int mode, Long tenantId) throws com.logicaldoc.core.PersistenceException Description copied from interface:ArchiveDAO
Retrieves all the archive with the given mode- Specified by:
findByMode
in interfaceArchiveDAO
- Parameters:
mode
- The archive modetenantId
- The archive tenant- Returns:
- A list of archives with the given mode
- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-
findByModeAndStatus
public List<Archive> findByModeAndStatus(int mode, int status, Long tenantId) throws com.logicaldoc.core.PersistenceException Description copied from interface:ArchiveDAO
Retrieves all the archive with the given mode and the given status- Specified by:
findByModeAndStatus
in interfaceArchiveDAO
- Parameters:
mode
- The archive modestatus
- The archive statustenantId
- The archive tenant- Returns:
- A list of archives with the given mode and the given status ordered by creation date descending
- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-
findByModeAndType
public List<Archive> findByModeAndType(int mode, int type, Long tenantId) throws com.logicaldoc.core.PersistenceException Description copied from interface:ArchiveDAO
Retrieves all the archive with the given mode and the given type- Specified by:
findByModeAndType
in interfaceArchiveDAO
- Parameters:
mode
- The archive modetype
- The archive typetenantId
- The archive tenant- Returns:
- A list of archives with the given mode and the given type ordered by creation date descending
- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-
findByModeAndName
public List<Archive> findByModeAndName(int mode, String name, Long tenantId) throws com.logicaldoc.core.PersistenceException Description copied from interface:ArchiveDAO
Retrieves all the archive with the given mode and the given name- Specified by:
findByModeAndName
in interfaceArchiveDAO
- Parameters:
mode
- The archive modename
- The archive nametenantId
- The archive tenant- Returns:
- A list of archives with the given mode and the given name
- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-
removeVersions
public boolean removeVersions(long archiveId, Set<Long> versionIds) throws com.logicaldoc.core.PersistenceException Description copied from interface:ArchiveDAO
Performs a bulk update removing all versions from the given archive. The export status of the involved documents is set to UNLOCKED.- Specified by:
removeVersions
in interfaceArchiveDAO
- Parameters:
archiveId
- The archive identifierversionIds
- The set of version ids to be removed- Returns:
- if the versions were correctly removed
- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-
findByModeAndStatusAndType
public List<Archive> findByModeAndStatusAndType(int mode, int status, int type, Long tenantId) throws com.logicaldoc.core.PersistenceException Description copied from interface:ArchiveDAO
Retrieves all the archive with the given mode and the given type- Specified by:
findByModeAndStatusAndType
in interfaceArchiveDAO
- Parameters:
mode
- The archive modestatus
- The archive statustype
- The archive typetenantId
- The archive tenant- Returns:
- A list of archives with the given mode, the given status and the given type ordered by creation date descending
- Throws:
com.logicaldoc.core.PersistenceException
- error in the data layer
-