Package com.logicaldoc.core.folder
Class HibernateFolderDAO
- java.lang.Object
- 
- com.logicaldoc.core.HibernatePersistentObjectDAO<Folder>
- 
- com.logicaldoc.core.folder.HibernateFolderDAO
 
 
- 
- All Implemented Interfaces:
- FolderDAO,- PersistentObjectDAO<Folder>
 
 public class HibernateFolderDAO extends HibernatePersistentObjectDAO<Folder> implements FolderDAO Hibernate implementation ofFolderDAO- Since:
- 6.0
- Author:
- Marco Meschieri - LogicalDOC
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanapplyGridToTree(long id, FolderHistory transaction)Propagates the grid layout of a node to the whole subtreebooleanapplyMetadataToTree(long id, FolderHistory transaction)Propagates the template metadata to the whole subreebooleanapplyOCRToTree(long id, FolderHistory transaction)Propagates the OCR settings to the whole subreebooleanapplyRightToTree(long rootId, FolderHistory transaction)Propagates the security policies of a node to the whole subtreebooleanapplyStorageToTree(long id, FolderHistory transaction)Propagates the storage setting to the whole subreebooleanapplyTagsToTree(long id, FolderHistory transaction)Propagates the tags to the whole subreeStringcomputePath(long folderId)Dynamically computes the path for the specified folder.StringcomputePath(Folder folder)Dynamically computes the path for the specified folder.StringcomputePathExtended(long folderId)Dynamically computes the path extended for the specified folder.StringcomputePathExtended(Folder folder)Dynamically computes the path extended for the specified folder.longcomputeTreeSize(long rootId)Counts the number of documents inside a given folder's tree (direct and indirect children)Foldercopy(Folder source, Folder target, String newName, boolean foldersOnly, String securityOption, FolderHistory transaction)Copies a folder into another folderintcount(boolean computeDeleted)Counts the number of folderslongcountDocsInTree(long rootId)Counts the number of documents inside a given folder's tree (direct and indirect children)Foldercreate(Folder parent, Folder folderVO, boolean inheritSecurity, FolderHistory transaction)Creates a new folder in the parent FolderFoldercreateAlias(long parentId, long foldRef, FolderHistory transaction)Creates a new folder folder aliasFoldercreatePath(Folder parent, String path, boolean inheritSecurity, FolderHistory transaction)Creates the folder for the specified path.booleandelete(long folderId, int code)This method deletes an entity and you can give a deletion codebooleandelete(long folderId, int delCode, FolderHistory transaction)This method deletes the folder object and insert a new folder history entrybooleandelete(long folderId, FolderHistory transaction)Shortcut for delete(id, 1, transaction)voiddeleteAll(Collection<Folder> folders, int code, FolderHistory transaction)For each folder, save the folder delete history entry for each folder and delete the foldervoiddeleteAll(Collection<Folder> folders, FolderHistory transaction)Shortcut for deleteAll(folders, 1, transaction)List<Folder>deleteTree(long folderId, int delCode, FolderHistory transaction)Delete a folder and all its sub-folders that a user can delete.List<Folder>deleteTree(long folderId, FolderHistory transaction)Shortcut for deleteTree(folderId, 1, transaction)List<Folder>deleteTree(Folder folder, int delCode, FolderHistory transaction)Deletes a folder and all its sub-folders that a user can delete.List<Folder>find(String name, Long tenantId)Useful method that allows to find all folders that contains the given name into their text.List<Folder>findAliases(Long foldRef, long tenantId)Finds all the aliasesList<Folder>findByGroupId(long groupId)Finds all folders accessible by the passed groupList<Folder>findByName(Folder parent, String name, Long tenantId, boolean caseSensitive)Finds all folders by folder text, contained in the parent folder.List<Folder>findByName(String name, Long tenantId)Finds all folders by folder nameList<Folder>findByNameAndParentId(String name, long parentId)Finds that folder that lies under a specific parent (given by the id) an with a given name(like operator is used)List<Folder>findByParentId(long parentId)Finds all children(direct and indirect) by parentIdFolderfindByPathExtended(String pathExtended, long tenantId)Retrieval of a folder by the extended pathList<Folder>findByUserId(long userId)Finds authorized folders for a userList<Folder>findByUserId(long userId, long parentId)Finds direct children of a folder.List<Folder>findByUserIdAndTag(long userId, String tag, Integer max)Finds authorized folders for a user having a specified tag.List<Folder>findChildren(long parentId, long userId)Finds direct children of a folder accessible by the given userList<Folder>findChildren(long parentId, Integer max)Finds direct children of a folderFolderfindDefaultWorkspace(long tenantId)Retrieves the Default workspace of the given tenantList<Folder>findDeleted(long userId, Integer maxHits)Finds all deleted folders of a specific user.FolderfindFolder(long folderId)Gets a folder by a given ID if it is an alias, the referenced folder is returned.List<Long>findFolderIdByTag(String tag)Collection<Long>findFolderIdByUserId(long userId, Long parentId, boolean tree)This method selects only the folder ID from the folders for which a user is authorized.Collection<Long>findFolderIdByUserIdAndPermission(long userId, Permission permission, Long parentId, boolean tree)Finds all folders ids with a specific permission enabled on the specifies userList<Long>findFolderIdByUserIdAndTag(long userId, String tag)Collection<Long>findFolderIdByUserIdInPath(long userId, Long parentId)This method selects only the folder ID from the folders for which a user is authorized.Set<Long>findFolderIdInPath(long rootId, boolean includeDeleted)Retrieve all the ids of the folders in a given tree using the path attributeSet<Long>findFolderIdInTree(long rootId, boolean includeDeleted)Retrieve all the ids of the folders in a given treeList<Long>findIdByUserId(long userId, long parentId)This method selects only the folder ID from the folders for which a user is authorized.List<Long>findIdsByParentId(long parentId)Finds all children(direct and indirect) by parentIdList<Folder>findParents(long folderId)Returns a List of folders being a parent of the given folder.FolderfindRoot(long tenantId)Retrieves the root folder of the given tenantList<String>findTags(long folderId)Retrieves the alphabetically ordered list of all the folder's tagsFolderfindWorkspace(long folderId)Returns the workspace that contains the given folderList<Folder>findWorkspaces(long tenantId)Retrieves all the workspaces in the system, that are the first-level folders of typeFolder.TYPE_WORKSPACESet<Permission>getEnabledPermissions(long folderId, long userId)Finds all permissions of a user enabled on the specified folderFolderHistoryDAOgetHistoryDAO()UserDAOgetUserDAO()booleanhasWriteAccess(Folder folder, long userId)Checks that the user has access to the folder and all its sub-itemsvoidinitialize(Folder folder)Doesn't do anything by defaultbooleanisDownloadEnabled(long id, long userId)booleanisInPath(long folderId, long targetId)Checks if a folder with the given folderId is parent of the folder with the given targetIdbooleanisMoveEnabled(long id, long userId)booleanisPermissionEnabled(Permission permission, long folderId, long userId)This method checks if the given permission is enabled for a folder and an user.booleanisPrintEnabled(long folderId, long userId)booleanisReadEnabled(long folderId, long userId)booleanisWriteEnabled(long folderId, long userId)This method is looking up for writing rights for a folder and an user.voidmerge(Folder source, Folder target, FolderHistory transaction)Merges the contents of two foldersvoidmove(Folder source, Folder target, FolderHistory transaction)Moves a folder into another foldervoidrestore(long folderId, long parentId, FolderHistory transaction)Restores a previously deleted foldervoidsaveFolderHistory(Folder folder, FolderHistory transaction)Utility method that logs into the DB the transaction that involved the passed folder.voidsetHistoryDAO(FolderHistoryDAO historyDAO)voidsetListenerManager(FolderListenerManager listenerManager)voidsetStorer(Storer storer)voidsetUserDAO(UserDAO userDAO)booleanstore(Folder folder)This method persists the entity objectbooleanstore(Folder folder, FolderHistory transaction)Same as store(Folder, boolean, FolderHistory)booleanupdateSecurityRef(long folderId, long rightsFolderId, FolderHistory transaction)Changes the securityRef of the given folder, all the other folders that inherits from this one will be changed accordingly.- 
Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, getSessionFactory, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString, setSessionFactory
 - 
Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString
 
- 
 
- 
- 
- 
Method Detail- 
getUserDAOpublic UserDAO getUserDAO() 
 - 
setUserDAOpublic void setUserDAO(UserDAO userDAO) 
 - 
storepublic boolean store(Folder folder) throws PersistenceException Description copied from interface:PersistentObjectDAOThis method persists the entity object- Specified by:
- storein interface- PersistentObjectDAO<Folder>
- Overrides:
- storein class- HibernatePersistentObjectDAO<Folder>
- Parameters:
- folder- entity to be stored
- Returns:
- True if successfully stored in a database
- Throws:
- PersistenceException- raised in case of errors in the database
 
 - 
storepublic boolean store(Folder folder, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAOSame as store(Folder, boolean, FolderHistory)- Specified by:
- storein interface- FolderDAO
- Parameters:
- folder- the folder to store
- transaction- current session informations
- Returns:
- true if the folder has been correctly stored
- Throws:
- PersistenceException- in case of database error
 
 - 
findByUserIdpublic List<Folder> findByUserId(long userId) Description copied from interface:FolderDAOFinds authorized folders for a user- Specified by:
- findByUserIdin interface- FolderDAO
- Parameters:
- userId- ID of the user
- Returns:
- List of found folders
 
 - 
findByUserIdpublic List<Folder> findByUserId(long userId, long parentId) Description copied from interface:FolderDAOFinds direct children of a folder.- Specified by:
- findByUserIdin interface- FolderDAO
- Parameters:
- userId- identifier of the user
- parentId- ID of the folder which children are wanted
- Returns:
- List of found folders sorted by text
 
 - 
findChildrenpublic List<Folder> findChildren(long parentId, Integer max) Description copied from interface:FolderDAOFinds direct children of a folder- Specified by:
- findChildrenin interface- FolderDAO
- Parameters:
- parentId- Folder ID of the folder which children are wanted
- max- Optional, maximum number of children
- Returns:
- List of found folders
 
 - 
findChildrenpublic List<Folder> findChildren(long parentId, long userId) Description copied from interface:FolderDAOFinds direct children of a folder accessible by the given user- Specified by:
- findChildrenin interface- FolderDAO
- Parameters:
- parentId- Folder ID of the folder which children are wanted
- userId- Identifier of the user that must have read access
- Returns:
- List of found folders
 
 - 
findByParentIdpublic List<Folder> findByParentId(long parentId) Description copied from interface:FolderDAOFinds all children(direct and indirect) by parentId- Specified by:
- findByParentIdin interface- FolderDAO
- Parameters:
- parentId- identifier of the parent folder
- Returns:
- List of found folders
 
 - 
findIdsByParentIdpublic List<Long> findIdsByParentId(long parentId) Description copied from interface:FolderDAOFinds all children(direct and indirect) by parentId- Specified by:
- findIdsByParentIdin interface- FolderDAO
- Parameters:
- parentId- identifier of the parent folder
- Returns:
- list of folder IDs
 
 - 
isPrintEnabledpublic boolean isPrintEnabled(long folderId, long userId)- Specified by:
- isPrintEnabledin interface- FolderDAO
 
 - 
isWriteEnabledpublic boolean isWriteEnabled(long folderId, long userId)Description copied from interface:FolderDAOThis method is looking up for writing rights for a folder and an user.- Specified by:
- isWriteEnabledin interface- FolderDAO
- Parameters:
- folderId- ID of the folder
- userId- ID of the user
- Returns:
- if the write permission is granted
 
 - 
isDownloadEnabledpublic boolean isDownloadEnabled(long id, long userId)- Specified by:
- isDownloadEnabledin interface- FolderDAO
 
 - 
isMoveEnabledpublic boolean isMoveEnabled(long id, long userId)- Specified by:
- isMoveEnabledin interface- FolderDAO
 
 - 
isReadEnabledpublic boolean isReadEnabled(long folderId, long userId)- Specified by:
- isReadEnabledin interface- FolderDAO
 
 - 
findFolderIdByUserIdpublic Collection<Long> findFolderIdByUserId(long userId, Long parentId, boolean tree) Description copied from interface:FolderDAOThis method selects only the folder ID from the folders for which a user is authorized.- Specified by:
- findFolderIdByUserIdin interface- FolderDAO
- Parameters:
- userId- ID of the user.
- parentId- The id of the parent folder to inspect (optional)
- tree- If true, the parentId will be interpreted as the root of a tree
- Returns:
- List of selected folder IDs.
 
 - 
hasWriteAccesspublic boolean hasWriteAccess(Folder folder, long userId) Description copied from interface:FolderDAOChecks that the user has access to the folder and all its sub-items- Specified by:
- hasWriteAccessin interface- FolderDAO
- Parameters:
- folder- the folder
- userId- identifier of the document
- Returns:
- if the user has write permission
 
 - 
findByGroupIdpublic List<Folder> findByGroupId(long groupId) Description copied from interface:FolderDAOFinds all folders accessible by the passed group- Specified by:
- findByGroupIdin interface- FolderDAO
- Parameters:
- groupId- The group id
- Returns:
- The List of folders
 
 - 
findIdByUserIdpublic List<Long> findIdByUserId(long userId, long parentId) Description copied from interface:FolderDAOThis method selects only the folder ID from the folders for which a user is authorized. Only folders direct child of the specified parent are returned.- Specified by:
- findIdByUserIdin interface- FolderDAO
- Parameters:
- userId- ID of the user
- parentId- Parent folder
- Returns:
- List of selected folder ID's.
 
 - 
findByNamepublic List<Folder> findByName(String name, Long tenantId) Description copied from interface:FolderDAOFinds all folders by folder name- Specified by:
- findByNamein interface- FolderDAO
- Parameters:
- name- name of the folder
- tenantId- Specification of the owning tenant (optional).
- Returns:
- List of folders with given folder name.
 
 - 
findByNamepublic List<Folder> findByName(Folder parent, String name, Long tenantId, boolean caseSensitive) Description copied from interface:FolderDAOFinds all folders by folder text, contained in the parent folder.- Specified by:
- findByNamein interface- FolderDAO
- Parameters:
- parent- The parent folder(optional)
- name- The folder name to search for
- tenantId- Specification of the owning tenant (optional). If not specified the tenant of parent is used instead
- caseSensitive- true if the search must be case sensitive
- Returns:
- List of folders with given name
 
 - 
computePathpublic String computePath(long folderId) throws PersistenceException Description copied from interface:FolderDAODynamically computes the path for the specified folder. The path is a sequence of IDS in the form: /4/55897/99870- Specified by:
- computePathin interface- FolderDAO
- Parameters:
- folderId- identifier of the folder
- Returns:
- the folder's path
- Throws:
- PersistenceException- error in the database
 
 - 
computePathpublic String computePath(Folder folder) throws PersistenceException Description copied from interface:FolderDAODynamically computes the path for the specified folder. The path is a sequence of IDS in the form: /4/55897/99870- Specified by:
- computePathin interface- FolderDAO
- Parameters:
- folder- the folder to process
- Returns:
- the folder's path
- Throws:
- PersistenceException- error in the database
 
 - 
computePathExtendedpublic String computePathExtended(long folderId) throws PersistenceException Description copied from interface:FolderDAODynamically computes the path extended for the specified folder. The path extended is a human readable path in the form: /folder1/folder2/folder3- Specified by:
- computePathExtendedin interface- FolderDAO
- Parameters:
- folderId- the folder's identifier
- Returns:
- The path extended
- Throws:
- PersistenceException- error in the database
 
 - 
computePathExtendedpublic String computePathExtended(Folder folder) throws PersistenceException Description copied from interface:FolderDAODynamically computes the path extended for the specified folder. The path extended is a human readable path in the form: /folder1/folder2/folder3- Specified by:
- computePathExtendedin interface- FolderDAO
- Parameters:
- folder- the folder to process
- Returns:
- The path extended
- Throws:
- PersistenceException- error in the database
 
 - 
saveFolderHistorypublic void saveFolderHistory(Folder folder, FolderHistory transaction) throws PersistenceException Utility method that logs into the DB the transaction that involved the passed folder. The transaction must be provided with userId and userName- Specified by:
- saveFolderHistoryin interface- FolderDAO
- Parameters:
- folder- the folder to persist
- transaction- informations about the session
- Throws:
- PersistenceException- database error
 
 - 
findByNameAndParentIdpublic List<Folder> findByNameAndParentId(String name, long parentId) Description copied from interface:FolderDAOFinds that folder that lies under a specific parent (given by the id) an with a given name(like operator is used)- Specified by:
- findByNameAndParentIdin interface- FolderDAO
- Parameters:
- name- name of the dolder
- parentId- identifier of the parent folder
- Returns:
- list of folders
 
 - 
findParentspublic List<Folder> findParents(long folderId) Description copied from interface:FolderDAOReturns a List of folders being a parent of the given folder. The list is ordered starting from the root of folders. The list doesn't include the given folder.- Specified by:
- findParentsin interface- FolderDAO
- Parameters:
- folderId- ID of the folder
- Returns:
- the hierarchy of parent folders
 
 - 
findWorkspacepublic Folder findWorkspace(long folderId) throws PersistenceException Description copied from interface:FolderDAOReturns the workspace that contains the given folder- Specified by:
- findWorkspacein interface- FolderDAO
- Parameters:
- folderId- ID of the folder
- Returns:
- the workspace containing the given folder
- Throws:
- PersistenceException- error in the database
 
 - 
isPermissionEnabledpublic boolean isPermissionEnabled(Permission permission, long folderId, long userId) Description copied from interface:FolderDAOThis method checks if the given permission is enabled for a folder and an user.- Specified by:
- isPermissionEnabledin interface- FolderDAO
- Parameters:
- permission- the permission to check
- folderId- ID of the folder
- userId- ID of the user
- Returns:
- if the permission is granted to the user
 
 - 
restorepublic void restore(long folderId, long parentId, FolderHistory transaction) throws PersistenceExceptionDescription copied from interface:FolderDAORestores a previously deleted folder- Specified by:
- restorein interface- FolderDAO
- Parameters:
- folderId- The folder identifier
- parentId- The parent folder to restore in
- transaction- Current session informations
- Throws:
- PersistenceException- in case of database error
 
 - 
getEnabledPermissionspublic Set<Permission> getEnabledPermissions(long folderId, long userId) Description copied from interface:FolderDAOFinds all permissions of a user enabled on the specified folder- Specified by:
- getEnabledPermissionsin interface- FolderDAO
- Parameters:
- folderId- ID of the folder
- userId- ID of the user
- Returns:
- Collection of enabled permissions
 
 - 
findFolderIdByUserIdInPathpublic Collection<Long> findFolderIdByUserIdInPath(long userId, Long parentId) Description copied from interface:FolderDAOThis method selects only the folder ID from the folders for which a user is authorized.- Specified by:
- findFolderIdByUserIdInPathin interface- FolderDAO
- Parameters:
- userId- ID of the user.
- parentId- The id of the parent folder to inspect (optional)
- Returns:
- List of selected folder IDs.
 
 - 
findFolderIdByUserIdAndPermissionpublic Collection<Long> findFolderIdByUserIdAndPermission(long userId, Permission permission, Long parentId, boolean tree) Description copied from interface:FolderDAOFinds all folders ids with a specific permission enabled on the specifies user- Specified by:
- findFolderIdByUserIdAndPermissionin interface- FolderDAO
- Parameters:
- userId- The user identifier
- permission- The permission to check
- parentId- The id of the parent folder to inspect (optional)
- tree- If true, the parentId will be interpreted as the root of a tree
- Returns:
- List of selected folder IDs.
 
 - 
getHistoryDAOpublic FolderHistoryDAO getHistoryDAO() 
 - 
setHistoryDAOpublic void setHistoryDAO(FolderHistoryDAO historyDAO) 
 - 
deleteAllpublic void deleteAll(Collection<Folder> folders, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAOShortcut for deleteAll(folders, 1, transaction)- Specified by:
- deleteAllin interface- FolderDAO
- Parameters:
- folders- the folders
- transaction- current session informations
- Throws:
- PersistenceException- in case of database error
 
 - 
deleteAllpublic void deleteAll(Collection<Folder> folders, int code, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAOFor each folder, save the folder delete history entry for each folder and delete the folder- Specified by:
- deleteAllin interface- FolderDAO
- Parameters:
- folders- List of folder to be delete
- code- The deletion code
- transaction- entry to log the event on each folder
- Throws:
- PersistenceException- in case of database error
 
 - 
deletepublic boolean delete(long folderId, int code) throws PersistenceExceptionDescription copied from interface:PersistentObjectDAOThis method deletes an entity and you can give a deletion code- Specified by:
- deletein interface- PersistentObjectDAO<Folder>
- Overrides:
- deletein class- HibernatePersistentObjectDAO<Folder>
- Parameters:
- folderId- ID of the entity which should be deleted
- code- Deletion code
- Returns:
- if the record has been successfully deleted
- Throws:
- PersistenceException- raised in case of errors in the database
 
 - 
deletepublic boolean delete(long folderId, FolderHistory transaction) throws PersistenceExceptionDescription copied from interface:FolderDAOShortcut for delete(id, 1, transaction)- Specified by:
- deletein interface- FolderDAO
- Parameters:
- folderId- the folder identifier
- transaction- the session informations
- Returns:
- if the folde has been succesfully deleted
- Throws:
- PersistenceException- in case of database error
 
 - 
deletepublic boolean delete(long folderId, int delCode, FolderHistory transaction) throws PersistenceExceptionDescription copied from interface:FolderDAOThis method deletes the folder object and insert a new folder history entry- Specified by:
- deletein interface- FolderDAO
- Parameters:
- folderId- The id of the folder to delete
- delCode- The deletion code
- transaction- entry to log the event
- Returns:
- True if successfully deleted from the database
- Throws:
- PersistenceException- in case of database error
 
 - 
applyRightToTreepublic boolean applyRightToTree(long rootId, FolderHistory transaction)Description copied from interface:FolderDAOPropagates the security policies of a node to the whole subtree- Specified by:
- applyRightToTreein interface- FolderDAO
- Parameters:
- rootId- identifier of the root folder
- transaction- session informations
- Returns:
- if the rights have been correctly applied
 
 - 
createAliaspublic Folder createAlias(long parentId, long foldRef, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAOCreates a new folder folder alias- Specified by:
- createAliasin interface- FolderDAO
- Parameters:
- parentId- The parent folder
- foldRef- The referenced folder
- transaction- optional transaction entry to log the event
- Returns:
- The newly created alias
- Throws:
- PersistenceException- in case of database error
 
 - 
createpublic Folder create(Folder parent, Folder folderVO, boolean inheritSecurity, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAOCreates a new folder in the parent Folder- Specified by:
- createin interface- FolderDAO
- Parameters:
- parent- The parent folder
- folderVO- The folder's metadata
- inheritSecurity- If true the new folder will 'point' to the parent for the security policies.
- transaction- optional transaction entry to log the event
- Returns:
- The newly created folder
- Throws:
- PersistenceException- in case of database error
 
 - 
createPathpublic Folder createPath(Folder parent, String path, boolean inheritSecurity, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAOCreates the folder for the specified path. All unexisting nodes specified in the path will be created. The path must be in any case inside a workspace, if not, the Default one will be used.- Specified by:
- createPathin interface- FolderDAO
- Parameters:
- parent- The parent folder
- path- The folder path(for example /dog/cat/mouse)
- inheritSecurity- If true the new folders will 'point' to the parent for the security policies.
- transaction- optional transaction entry to log the event
- Returns:
- The created folder
- Throws:
- PersistenceException- in case of database error
 
 - 
findByPathExtendedpublic Folder findByPathExtended(String pathExtended, long tenantId) Description copied from interface:FolderDAORetrieval of a folder by the extended path- Specified by:
- findByPathExtendedin interface- FolderDAO
- Parameters:
- pathExtended- the path extended
- tenantId- identifier of the tenant
- Returns:
- The folder that matched the given path
 
 - 
copypublic Folder copy(Folder source, Folder target, String newName, boolean foldersOnly, String securityOption, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAOCopies a folder into another folder- Specified by:
- copyin interface- FolderDAO
- Parameters:
- source- The folder to copy
- target- The target folder
- newName- optional new name of the copied folder
- foldersOnly- True if only the folders tree has to be copied; if false, the documents will also be copied
- securityOption- How to assign the security policies to the newly created folders:- null or none: empty security policies
- inherit: the new folder will point to the parent for the security policies
- replicate: the new folder will have a copy of the security policies of the source folder
 
- transaction- entry to log the event (set the user)
- Returns:
- The new folder created
- Throws:
- PersistenceException- in case of database error
 
 - 
movepublic void move(Folder source, Folder target, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAOMoves a folder into another folder- Specified by:
- movein interface- FolderDAO
- Parameters:
- source- The folder to move
- target- The target folder
- transaction- entry to log the event (set the user)
- Throws:
- PersistenceException- in case of database error
 
 - 
deleteTreepublic List<Folder> deleteTree(long folderId, FolderHistory transaction) throws Exception Description copied from interface:FolderDAOShortcut for deleteTree(folderId, 1, transaction)- Specified by:
- deleteTreein interface- FolderDAO
- Parameters:
- folderId- Folder to delete
- transaction- entry to log the event (set the user)
- Returns:
- List of folders that the user cannot delete(permissions, o immutable documents presents)
- Throws:
- Exception- in case of any error
 
 - 
deleteTreepublic List<Folder> deleteTree(long folderId, int delCode, FolderHistory transaction) throws Exception Description copied from interface:FolderDAODelete a folder and all its sub-folders that a user can delete. After recovering of all sub-folders inside the folder, will be canceled all folders for which the user has the delete permission or there isn't an immutable document inside it.
 Important: All the contained documents will be deleted- Specified by:
- deleteTreein interface- FolderDAO
- Parameters:
- folderId- Folder to delete
- delCode- The deletion code
- transaction- entry to log the event (set the user)
- Returns:
- List of folders that the user cannot delete(permissions, o immutable documents presents)
- Throws:
- Exception- in case of any error
 
 - 
deleteTreepublic List<Folder> deleteTree(Folder folder, int delCode, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAODeletes a folder and all its sub-folders that a user can delete. After recovering of all sub-folders inside the folder, will be canceled all folders for which the user has the delete permission or there isn't an immutable document inside it.
 Important: Remember to delete orphaned documents.- Specified by:
- deleteTreein interface- FolderDAO
- Parameters:
- folder- Folder to delete
- delCode- The deletion code
- transaction- entry to log the event (set the user)
- Returns:
- List of folders that the user cannot delete(permissions, o immutable documents presents)
- Throws:
- PersistenceException- in case of database error
 
 - 
findFolderIdInTreepublic Set<Long> findFolderIdInTree(long rootId, boolean includeDeleted) Description copied from interface:FolderDAORetrieve all the ids of the folders in a given tree- Specified by:
- findFolderIdInTreein interface- FolderDAO
- Parameters:
- rootId- Root of the tree
- includeDeleted- True if the deleted records need to be loaded
- Returns:
- List of selected folder IDs, rootId is included as well
 
 - 
findFolderIdInPathpublic Set<Long> findFolderIdInPath(long rootId, boolean includeDeleted) Description copied from interface:FolderDAORetrieve all the ids of the folders in a given tree using the path attribute- Specified by:
- findFolderIdInPathin interface- FolderDAO
- Parameters:
- rootId- Root of the folder
- includeDeleted- True if the deleted records need to be loaded
- Returns:
- List of selected folder IDs, rootId is included as well
 
 - 
findpublic List<Folder> find(String name, Long tenantId) Description copied from interface:FolderDAOUseful method that allows to find all folders that contains the given name into their text.
 - 
isInPathpublic boolean isInPath(long folderId, long targetId)Description copied from interface:FolderDAOChecks if a folder with the given folderId is parent of the folder with the given targetId
 - 
countpublic int count(boolean computeDeleted) Description copied from interface:FolderDAOCounts the number of folders
 - 
findWorkspacespublic List<Folder> findWorkspaces(long tenantId) Description copied from interface:FolderDAORetrieves all the workspaces in the system, that are the first-level folders of typeFolder.TYPE_WORKSPACE- Specified by:
- findWorkspacesin interface- FolderDAO
- Parameters:
- tenantId- identifier of the tenant
- Returns:
- list of folders
 
 - 
initializepublic void initialize(Folder folder) Description copied from class:HibernatePersistentObjectDAODoesn't do anything by default- Specified by:
- initializein interface- FolderDAO
- Specified by:
- initializein interface- PersistentObjectDAO<Folder>
- Overrides:
- initializein class- HibernatePersistentObjectDAO<Folder>
- Parameters:
- folder- The entity to be initialised
 
 - 
findDeletedpublic List<Folder> findDeleted(long userId, Integer maxHits) Description copied from interface:FolderDAOFinds all deleted folders of a specific user.- Specified by:
- findDeletedin interface- FolderDAO
- Parameters:
- userId- The user that performed the deletion
- maxHits- Optional defines the max number of returned hits
- Returns:
- The folders list
 
 - 
findRootpublic Folder findRoot(long tenantId) Description copied from interface:FolderDAORetrieves the root folder of the given tenant
 - 
findDefaultWorkspacepublic Folder findDefaultWorkspace(long tenantId) Description copied from interface:FolderDAORetrieves the Default workspace of the given tenant- Specified by:
- findDefaultWorkspacein interface- FolderDAO
- Parameters:
- tenantId- identifier of the tenant
- Returns:
- The default workspace
 
 - 
setStorerpublic void setStorer(Storer storer) 
 - 
updateSecurityRefpublic boolean updateSecurityRef(long folderId, long rightsFolderId, FolderHistory transaction)Description copied from interface:FolderDAOChanges the securityRef of the given folder, all the other folders that inherits from this one will be changed accordingly.- Specified by:
- updateSecurityRefin interface- FolderDAO
- Parameters:
- folderId- identifier of the folder
- rightsFolderId- id of the folder to inherit from
- transaction- session informations
- Returns:
- is the update has been successful
 
 - 
countDocsInTreepublic long countDocsInTree(long rootId) Description copied from interface:FolderDAOCounts the number of documents inside a given folder's tree (direct and indirect children)- Specified by:
- countDocsInTreein interface- FolderDAO
- Parameters:
- rootId- identifier of the root folder
- Returns:
- the number of documents contained in the tree
 
 - 
computeTreeSizepublic long computeTreeSize(long rootId) Description copied from interface:FolderDAOCounts the number of documents inside a given folder's tree (direct and indirect children)- Specified by:
- computeTreeSizein interface- FolderDAO
- Parameters:
- rootId- identifier of the root folder
- Returns:
- sum of the sizes of the documents contained in the tree expressed in bytes
 
 - 
findAliasespublic List<Folder> findAliases(Long foldRef, long tenantId) Description copied from interface:FolderDAOFinds all the aliases- Specified by:
- findAliasesin interface- FolderDAO
- Parameters:
- foldRef- The referenced folder
- tenantId- The tenant
- Returns:
- Collection of aliases
 
 - 
findFolderpublic Folder findFolder(long folderId) throws PersistenceException Description copied from interface:FolderDAOGets a folder by a given ID if it is an alias, the referenced folder is returned.- Specified by:
- findFolderin interface- FolderDAO
- Parameters:
- folderId- The ID
- Returns:
- A real folder that is referenced by the given ID
- Throws:
- PersistenceException- error in the database
 
 - 
applyMetadataToTreepublic boolean applyMetadataToTree(long id, FolderHistory transaction)Description copied from interface:FolderDAOPropagates the template metadata to the whole subree- Specified by:
- applyMetadataToTreein interface- FolderDAO
- Parameters:
- id- identifier of the folder
- transaction- session informations
- Returns:
- is the update has been successful
 
 - 
applyTagsToTreepublic boolean applyTagsToTree(long id, FolderHistory transaction)Description copied from interface:FolderDAOPropagates the tags to the whole subree- Specified by:
- applyTagsToTreein interface- FolderDAO
- Parameters:
- id- identifier of the folder
- transaction- session informations
- Returns:
- is the update has been successful
 
 - 
applyGridToTreepublic boolean applyGridToTree(long id, FolderHistory transaction)Description copied from interface:FolderDAOPropagates the grid layout of a node to the whole subtree- Specified by:
- applyGridToTreein interface- FolderDAO
- Parameters:
- id- identifier of the root folder
- transaction- session informations
- Returns:
- if the grid layout has been correctly replicated
 
 - 
applyStorageToTreepublic boolean applyStorageToTree(long id, FolderHistory transaction) throws PersistenceExceptionDescription copied from interface:FolderDAOPropagates the storage setting to the whole subree- Specified by:
- applyStorageToTreein interface- FolderDAO
- Parameters:
- id- identifier of the folder
- transaction- session informations
- Returns:
- is the update has been successful
- Throws:
- PersistenceException- in case of database error
 
 - 
applyOCRToTreepublic boolean applyOCRToTree(long id, FolderHistory transaction) throws PersistenceExceptionDescription copied from interface:FolderDAOPropagates the OCR settings to the whole subree- Specified by:
- applyOCRToTreein interface- FolderDAO
- Parameters:
- id- identifier of the folder
- transaction- session informations
- Returns:
- is the update has been successful
- Throws:
- PersistenceException- in case of database error
 
 - 
findByUserIdAndTagpublic List<Folder> findByUserIdAndTag(long userId, String tag, Integer max) Description copied from interface:FolderDAOFinds authorized folders for a user having a specified tag.- Specified by:
- findByUserIdAndTagin interface- FolderDAO
- Parameters:
- userId- ID of the user
- tag- Tag of the folder
- max- Optional, defines the maximum records number
- Returns:
- Collection of found folders
 
 - 
findTagspublic List<String> findTags(long folderId) Description copied from interface:FolderDAORetrieves the alphabetically ordered list of all the folder's tags
 - 
mergepublic void merge(Folder source, Folder target, FolderHistory transaction) throws PersistenceException Description copied from interface:FolderDAOMerges the contents of two folders- Specified by:
- mergein interface- FolderDAO
- Parameters:
- source- The folder whose contents must be merged inside folderA
- target- The main folder to use as container
- transaction- the session informations
- Throws:
- PersistenceException- in case of database or logical error
 
 - 
setListenerManagerpublic void setListenerManager(FolderListenerManager listenerManager) 
 
- 
 
-