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 of FolderDAO
Since:
6.0
Author:
Marco Meschieri - LogicalDOC
  • Method Details

    • store

      public void store(Folder folder) throws PersistenceException
      Description copied from interface: PersistentObjectDAO
      This method persists the entity object
      Specified by:
      store in interface PersistentObjectDAO<Folder>
      Overrides:
      store in class HibernatePersistentObjectDAO<Folder>
      Parameters:
      folder - entity to be stored
      Throws:
      PersistenceException - raised in case of errors in the database
    • store

      public void store(Folder folder, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Same as store(Folder, boolean, FolderHistory)
      Specified by:
      store in interface FolderDAO
      Parameters:
      folder - the folder to store
      transaction - current session informations
      Throws:
      PersistenceException - error at data layer
    • findByUserId

      public List<Folder> findByUserId(long userId) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds authorized folders for a user
      Specified by:
      findByUserId in interface FolderDAO
      Parameters:
      userId - ID of the user
      Returns:
      List of found folders
      Throws:
      PersistenceException - error at data layer
    • findByUserId

      public List<Folder> findByUserId(long userId, long parentId) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds direct children of a folder.
      Specified by:
      findByUserId in 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
      Throws:
      PersistenceException - error at data layer
    • findChildren

      public List<Folder> findChildren(long parentId, Integer max) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds direct children of a folder
      Specified by:
      findChildren in interface FolderDAO
      Parameters:
      parentId - Folder ID of the folder which children are wanted
      max - Optional, maximum number of children
      Returns:
      List of found folders
      Throws:
      PersistenceException - Error in the database
    • findChildren

      public List<Folder> findChildren(long parentId, long userId) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds direct children of a folder accessible by the given user
      Specified by:
      findChildren in 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
      Throws:
      PersistenceException - error at data layer
    • findByParentId

      public List<Folder> findByParentId(long parentId)
      Description copied from interface: FolderDAO
      Finds all children(direct and indirect) by parentId
      Specified by:
      findByParentId in interface FolderDAO
      Parameters:
      parentId - identifier of the parent folder
      Returns:
      List of found folders
    • findIdsByParentId

      public List<Long> findIdsByParentId(long parentId)
      Description copied from interface: FolderDAO
      Finds all children(direct and indirect) by parentId
      Specified by:
      findIdsByParentId in interface FolderDAO
      Parameters:
      parentId - identifier of the parent folder
      Returns:
      list of folder IDs
    • isPrintAllowed

      public boolean isPrintAllowed(long folderId, long userId) throws PersistenceException
      Specified by:
      isPrintAllowed in interface FolderDAO
      Throws:
      PersistenceException
    • isWriteAllowed

      public boolean isWriteAllowed(long folderId, long userId) throws PersistenceException
      Description copied from interface: FolderDAO
      This method is looking up for writing rights for a folder and an user.
      Specified by:
      isWriteAllowed in interface FolderDAO
      Parameters:
      folderId - ID of the folder
      userId - ID of the user
      Returns:
      if the write permission is granted
      Throws:
      PersistenceException - error at data layer
    • isDownloadllowed

      public boolean isDownloadllowed(long id, long userId) throws PersistenceException
      Specified by:
      isDownloadllowed in interface FolderDAO
      Throws:
      PersistenceException
    • isMoveAllowed

      public boolean isMoveAllowed(long id, long userId) throws PersistenceException
      Specified by:
      isMoveAllowed in interface FolderDAO
      Throws:
      PersistenceException
    • isPreviewAllowed

      public boolean isPreviewAllowed(long id, long userId) throws PersistenceException
      Specified by:
      isPreviewAllowed in interface FolderDAO
      Throws:
      PersistenceException
    • isReadAllowed

      public boolean isReadAllowed(long folderId, long userId) throws PersistenceException
      Specified by:
      isReadAllowed in interface FolderDAO
      Throws:
      PersistenceException
    • findFolderIdByUserId

      public Collection<Long> findFolderIdByUserId(long userId, Long parentId, boolean tree) throws PersistenceException
      Description copied from interface: FolderDAO
      This method selects only the folder ID from the folders for which a user is authorized.
      Specified by:
      findFolderIdByUserId in 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.
      Throws:
      PersistenceException - error at data layer
    • hasWriteAccess

      public boolean hasWriteAccess(Folder folder, long userId) throws PersistenceException
      Description copied from interface: FolderDAO
      Checks that the user has write access to the folder and all its sub-items
      Specified by:
      hasWriteAccess in interface FolderDAO
      Parameters:
      folder - the folder
      userId - identifier of the document
      Returns:
      if the user has write permission
      Throws:
      PersistenceException - error at data layer
    • findByGroupId

      public List<Folder> findByGroupId(long groupId) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds all folders accessible by the passed group
      Specified by:
      findByGroupId in interface FolderDAO
      Parameters:
      groupId - The group id
      Returns:
      The List of folders
      Throws:
      PersistenceException - error at data layer
    • findIdByUserId

      public List<Long> findIdByUserId(long userId, long parentId) throws PersistenceException
      Description copied from interface: FolderDAO
      This 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:
      findIdByUserId in interface FolderDAO
      Parameters:
      userId - ID of the user
      parentId - Parent folder
      Returns:
      List of selected folder ID's.
      Throws:
      PersistenceException - error at data layer
    • findByName

      public List<Folder> findByName(String name, Long tenantId) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds all folders by folder name
      Specified by:
      findByName in interface FolderDAO
      Parameters:
      name - name of the folder
      tenantId - Specification of the owning tenant (optional).
      Returns:
      List of folders with given folder name.
      Throws:
      PersistenceException - error at data layer
    • findByName

      public List<Folder> findByName(Folder parent, String name, Long tenantId, boolean caseSensitive) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds all folders by folder text, contained in the parent folder.
      Specified by:
      findByName in 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
      Throws:
      PersistenceException - error at data layer
    • computePath

      public String computePath(long folderId) throws PersistenceException
      Description copied from interface: FolderDAO
      Dynamically computes the path for the specified folder. The path is a sequence of IDS in the form: /4/55897/99870
      Specified by:
      computePath in interface FolderDAO
      Parameters:
      folderId - identifier of the folder
      Returns:
      the folder's path
      Throws:
      PersistenceException - error at data layer
    • computePath

      public String computePath(Folder folder) throws PersistenceException
      Description copied from interface: FolderDAO
      Dynamically computes the path for the specified folder. The path is a sequence of IDS in the form: /4/55897/99870
      Specified by:
      computePath in interface FolderDAO
      Parameters:
      folder - the folder to process
      Returns:
      the folder's path
      Throws:
      PersistenceException - error at data layer
    • computePathExtended

      public String computePathExtended(long folderId) throws PersistenceException
      Description copied from interface: FolderDAO
      Dynamically computes the path extended for the specified folder. The path extended is a human readable path in the form: /folder1/folder2/folder3
      Specified by:
      computePathExtended in interface FolderDAO
      Parameters:
      folderId - the folder's identifier
      Returns:
      The path extended
      Throws:
      PersistenceException - error at data layer
    • computePathExtended

      public String computePathExtended(Folder folder) throws PersistenceException
      Description copied from interface: FolderDAO
      Dynamically computes the path extended for the specified folder. The path extended is a human readable path in the form: /folder1/folder2/folder3
      Specified by:
      computePathExtended in interface FolderDAO
      Parameters:
      folder - the folder to process
      Returns:
      The path extended
      Throws:
      PersistenceException - error at data layer
    • saveFolderHistory

      public 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:
      saveFolderHistory in interface FolderDAO
      Parameters:
      folder - the folder to persist
      transaction - informations about the session PersistenceException error at data layer
      Throws:
      PersistenceException - error at data layer
    • findByNameAndParentId

      public List<Folder> findByNameAndParentId(String name, long parentId) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds that folder that lies under a specific parent (given by the id) an with a given name(like operator is used)
      Specified by:
      findByNameAndParentId in interface FolderDAO
      Parameters:
      name - name of the dolder
      parentId - identifier of the parent folder
      Returns:
      list of folders
      Throws:
      PersistenceException - error at data layer
    • findParents

      public List<Folder> findParents(long folderId) throws PersistenceException
      Description copied from interface: FolderDAO
      Returns 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:
      findParents in interface FolderDAO
      Parameters:
      folderId - ID of the folder
      Returns:
      the hierarchy of parent folders
      Throws:
      PersistenceException - error at data layer
    • findWorkspace

      public Folder findWorkspace(long folderId) throws PersistenceException
      Description copied from interface: FolderDAO
      Returns the workspace that contains the given folder
      Specified by:
      findWorkspace in interface FolderDAO
      Parameters:
      folderId - ID of the folder
      Returns:
      the workspace containing the given folder
      Throws:
      PersistenceException - error at data layer
    • isPermissionAllowed

      public boolean isPermissionAllowed(Permission permission, long folderId, long userId) throws PersistenceException
      Description copied from interface: FolderDAO
      This method checks if the given permission is allowed for a folder and an user.
      Specified by:
      isPermissionAllowed in 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
      Throws:
      PersistenceException - error at data layer
    • restore

      public void restore(long folderId, long parentId, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Restores a previously deleted folder
      Specified by:
      restore in interface FolderDAO
      Parameters:
      folderId - The folder identifier
      parentId - The parent folder to restore in
      transaction - Current session informations
      Throws:
      PersistenceException - error at data layer
    • getEnabledPermissions

      public Set<Permission> getEnabledPermissions(long folderId, long userId) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds all permissions of a user enabled on the specified folder
      Specified by:
      getEnabledPermissions in interface FolderDAO
      Parameters:
      folderId - ID of the folder
      userId - ID of the user
      Returns:
      Collection of enabled permissions
      Throws:
      PersistenceException - error at data layer
    • findFolderIdByUserIdInPath

      public Collection<Long> findFolderIdByUserIdInPath(long userId, long parentId) throws PersistenceException
      Description copied from interface: FolderDAO
      This method selects only the folder ID from the folders for which a user is authorized.
      Specified by:
      findFolderIdByUserIdInPath in interface FolderDAO
      Parameters:
      userId - ID of the user.
      parentId - The id of the parent folder to inspect
      Returns:
      List of selected folder IDs.
      Throws:
      PersistenceException - error at data layer
    • findFolderIdByUserIdAndPermission

      public Collection<Long> findFolderIdByUserIdAndPermission(long userId, Permission permission, Long parentId, boolean tree) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds all folders ids with a specific permission enabled on the specifies user
      Specified by:
      findFolderIdByUserIdAndPermission in 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.
      Throws:
      PersistenceException - error at data layer
    • deleteAll

      public void deleteAll(Collection<Folder> folders, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Shortcut for deleteAll(folders, 1, transaction)
      Specified by:
      deleteAll in interface FolderDAO
      Parameters:
      folders - the folders
      transaction - current session informations
      Throws:
      PersistenceException - error at data layer
    • deleteAll

      public void deleteAll(Collection<Folder> folders, int code, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      For each folder, save the folder delete history entry for each folder and delete the folder
      Specified by:
      deleteAll in 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 - error at data layer
    • delete

      public void delete(long folderId, int code) throws PersistenceException
      Description copied from interface: PersistentObjectDAO
      This method deletes an entity and you can give a deletion code
      Specified by:
      delete in interface PersistentObjectDAO<Folder>
      Overrides:
      delete in class HibernatePersistentObjectDAO<Folder>
      Parameters:
      folderId - ID of the entity which should be deleted
      code - Deletion code
      Throws:
      PersistenceException - raised in case of errors in the database
    • delete

      public void delete(long folderId, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Shortcut for delete(id, 1, transaction)
      Specified by:
      delete in interface FolderDAO
      Parameters:
      folderId - the folder identifier
      transaction - the session informations
      Throws:
      PersistenceException - error at data layer
    • delete

      public void delete(long folderId, int delCode, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      This method deletes the folder object and insert a new folder history entry
      Specified by:
      delete in interface FolderDAO
      Parameters:
      folderId - The id of the folder to delete
      delCode - The deletion code
      transaction - entry to log the event
      Throws:
      PersistenceException - error at data layer
    • applySecurityToTree

      public void applySecurityToTree(long rootId, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Propagates the security policies of a node to the whole sub-tree
      Specified by:
      applySecurityToTree in interface FolderDAO
      Parameters:
      rootId - identifier of the root folder
      transaction - session informations
      Throws:
      PersistenceException - error at data layer
    • createAlias

      public Folder createAlias(long parentId, long foldRef, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Creates a new folder folder alias
      Specified by:
      createAlias in 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 - error at data layer
    • create

      public Folder create(Folder parent, Folder folderVO, boolean inheritSecurity, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Creates a new folder in the parent Folder
      Specified by:
      create in 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 - error at data layer
    • createPath

      public Folder createPath(Folder parent, String path, boolean inheritSecurity, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Creates 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:
      createPath in 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 - error at data layer
    • findByPathExtended

      public Folder findByPathExtended(String pathExtended, long tenantId) throws PersistenceException
      Description copied from interface: FolderDAO
      Retrieval of a folder by the extended path
      Specified by:
      findByPathExtended in interface FolderDAO
      Parameters:
      pathExtended - the path extended
      tenantId - identifier of the tenant
      Returns:
      The folder that matched the given path
      Throws:
      PersistenceException - error at data layer
    • copy

      public Folder copy(Folder source, Folder target, String newName, boolean foldersOnly, String securityOption, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Copies a folder into another folder
      Specified by:
      copy in 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 - error at data layer
    • move

      public void move(Folder source, Folder target, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Moves a folder into another folder
      Specified by:
      move in interface FolderDAO
      Parameters:
      source - The folder to move
      target - The target folder
      transaction - entry to log the event (set the user)
      Throws:
      PersistenceException - error at data layer
    • deleteTree

      public List<Folder> deleteTree(long folderId, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Shortcut for deleteTree(folderId, 1, transaction)
      Specified by:
      deleteTree in 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:
      PersistenceException - error at data layer
    • deleteTree

      public List<Folder> deleteTree(long folderId, int delCode, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Delete 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:
      deleteTree in 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:
      PersistenceException - error at data layer
    • deleteTree

      public List<Folder> deleteTree(Folder folder, int delCode, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Deletes 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:
      deleteTree in 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 - error at data layer
    • findFolderIdInTree

      public Set<Long> findFolderIdInTree(long rootId, boolean includeDeleted)
      Description copied from interface: FolderDAO
      Retrieve all the ids of the folders in a given tree
      Specified by:
      findFolderIdInTree in 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
    • findFolderIdInPath

      public Set<Long> findFolderIdInPath(long rootId, boolean includeDeleted) throws PersistenceException
      Description copied from interface: FolderDAO
      Retrieve all the ids of the folders in a given tree using the path attribute
      Specified by:
      findFolderIdInPath in 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
      Throws:
      PersistenceException - error at data layer
    • find

      public List<Folder> find(String name, Long tenantId) throws PersistenceException
      Description copied from interface: FolderDAO
      Useful method that allows to find all folders that contains the given name into their text.
      Specified by:
      find in interface FolderDAO
      Parameters:
      name - The name to be found
      tenantId - The tenant to search in
      Returns:
      List of folders that contains the given name into their text.
      Throws:
      PersistenceException - error at data layer
    • isInPath

      public boolean isInPath(long folderId, long targetId) throws PersistenceException
      Description copied from interface: FolderDAO
      Checks if a folder with the given folderId is parent of the folder with the given targetId
      Specified by:
      isInPath in interface FolderDAO
      Parameters:
      folderId - The folder to be checked
      targetId - The target folder
      Returns:
      True if the folder with the given parentId is parent of the folder with the given childId
      Throws:
      PersistenceException - error at data layer
    • count

      public int count(boolean computeDeleted)
      Description copied from interface: FolderDAO
      Counts the number of folders
      Specified by:
      count in interface FolderDAO
      Parameters:
      computeDeleted - if the deleted folders have to be taken int account
      Returns:
      the number of folders
    • findWorkspaces

      public List<Folder> findWorkspaces(long tenantId) throws PersistenceException
      Description copied from interface: FolderDAO
      Retrieves all the workspaces in the system, that are the first-level folders of type Folder.TYPE_WORKSPACE
      Specified by:
      findWorkspaces in interface FolderDAO
      Parameters:
      tenantId - identifier of the tenant
      Returns:
      list of folders
      Throws:
      PersistenceException - error at data layer
    • initialize

      public void initialize(Folder folder)
      Description copied from class: HibernatePersistentObjectDAO
      Doesn't do anything by default
      Specified by:
      initialize in interface FolderDAO
      Specified by:
      initialize in interface PersistentObjectDAO<Folder>
      Overrides:
      initialize in class HibernatePersistentObjectDAO<Folder>
      Parameters:
      folder - The entity to be initialised
    • findDeleted

      public List<Folder> findDeleted(long userId, Integer maxHits)
      Description copied from interface: FolderDAO
      Finds all deleted folders of a specific user.
      Specified by:
      findDeleted in interface FolderDAO
      Parameters:
      userId - The user that performed the deletion
      maxHits - Optional defines the max number of returned hits
      Returns:
      The folders list
    • findRoot

      public Folder findRoot(long tenantId) throws PersistenceException
      Description copied from interface: FolderDAO
      Retrieves the root folder of the given tenant
      Specified by:
      findRoot in interface FolderDAO
      Parameters:
      tenantId - identifier of the tenant
      Returns:
      the root folder
      Throws:
      PersistenceException - error at data layer
    • findDefaultWorkspace

      public Folder findDefaultWorkspace(long tenantId) throws PersistenceException
      Description copied from interface: FolderDAO
      Retrieves the Default workspace of the given tenant
      Specified by:
      findDefaultWorkspace in interface FolderDAO
      Parameters:
      tenantId - identifier of the tenant
      Returns:
      The default workspace
      Throws:
      PersistenceException - error at data layer
    • updateSecurityRef

      public void updateSecurityRef(long folderId, long rightsFolderId, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Changes the securityRef of the given folder, all the other folders that inherits from this one will be changed accordingly.
      Specified by:
      updateSecurityRef in interface FolderDAO
      Parameters:
      folderId - identifier of the folder
      rightsFolderId - id of the folder to inherit from
      transaction - session informations
      Throws:
      PersistenceException - error at data layer
    • countDocsInTree

      public long countDocsInTree(long rootId)
      Description copied from interface: FolderDAO
      Counts the number of documents inside a given folder's tree (direct and indirect children)
      Specified by:
      countDocsInTree in interface FolderDAO
      Parameters:
      rootId - identifier of the root folder
      Returns:
      the number of documents contained in the tree
    • computeTreeSize

      public long computeTreeSize(long rootId)
      Description copied from interface: FolderDAO
      Counts the number of documents inside a given folder's tree (direct and indirect children)
      Specified by:
      computeTreeSize in interface FolderDAO
      Parameters:
      rootId - identifier of the root folder
      Returns:
      sum of the sizes of the documents contained in the tree expressed in bytes
    • findAliases

      public List<Folder> findAliases(Long foldRef, long tenantId)
      Description copied from interface: FolderDAO
      Finds all the aliases
      Specified by:
      findAliases in interface FolderDAO
      Parameters:
      foldRef - The referenced folder
      tenantId - The tenant
      Returns:
      Collection of aliases
    • findFolder

      public Folder findFolder(long folderId) throws PersistenceException
      Description copied from interface: FolderDAO
      Gets a folder by a given ID if it is an alias, the referenced folder is returned.
      Specified by:
      findFolder in interface FolderDAO
      Parameters:
      folderId - The ID
      Returns:
      A real folder that is referenced by the given ID
      Throws:
      PersistenceException - error at data layer
    • applyMetadataToTree

      public void applyMetadataToTree(long id, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Propagates the template metadata to the whole subree
      Specified by:
      applyMetadataToTree in interface FolderDAO
      Parameters:
      id - identifier of the folder
      transaction - session informations
      Throws:
      PersistenceException - error at data layer
    • applyTagsToTree

      public void applyTagsToTree(long id, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Propagates the tags to the whole subree
      Specified by:
      applyTagsToTree in interface FolderDAO
      Parameters:
      id - identifier of the folder
      transaction - session informations
      Throws:
      PersistenceException - error at data layer
    • applyGridToTree

      public void applyGridToTree(long id, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Propagates the grid layout of a node to the whole sub-tree
      Specified by:
      applyGridToTree in interface FolderDAO
      Parameters:
      id - identifier of the root folder
      transaction - session informations
      Throws:
      PersistenceException - error at data layer
    • applyStorageToTree

      public void applyStorageToTree(long id, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Propagates the storage setting to the whole subree
      Specified by:
      applyStorageToTree in interface FolderDAO
      Parameters:
      id - identifier of the folder
      transaction - session informations
      Throws:
      PersistenceException - error at data layer
    • applyOCRToTree

      public void applyOCRToTree(long id, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Propagates the OCR settings to the whole subree
      Specified by:
      applyOCRToTree in interface FolderDAO
      Parameters:
      id - identifier of the folder
      transaction - session informations
      Throws:
      PersistenceException - error at data layer
    • findFolderIdByTag

      public List<Long> findFolderIdByTag(String tag)
    • findByUserIdAndTag

      public List<Folder> findByUserIdAndTag(long userId, String tag, Integer max) throws PersistenceException
      Description copied from interface: FolderDAO
      Finds authorized folders for a user having a specified tag.
      Specified by:
      findByUserIdAndTag in 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
      Throws:
      PersistenceException - error at data layer
    • findTags

      public List<String> findTags(long folderId)
      Description copied from interface: FolderDAO
      Retrieves the alphabetically ordered list of all the folder's tags
      Specified by:
      findTags in interface FolderDAO
      Parameters:
      folderId - identifier of the folder
      Returns:
      list of tags
    • merge

      public void merge(Folder source, Folder target, FolderHistory transaction) throws PersistenceException
      Description copied from interface: FolderDAO
      Merges the contents of two folders
      Specified by:
      merge in 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