Interface TrashStorage


public interface TrashStorage
This service used to move documents to trash foder or restore
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Counts the total number of deleted documents in the trash.
    List<javax.jcr.Node>
    getAllLinks(javax.jcr.Node node, String linkType)
    Get all links
    List<javax.jcr.Node>
    getAllNodeInTrash(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider)
    Get all nodes in trash location
    List<javax.jcr.Node>
    getAllNodeInTrashByUser(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider, String userName)
    Get all nodes by user in trash location
    javax.jcr.Node
    Get Node in trash folder by trashId
    List<javax.jcr.Node>
    getTrashElements(TrashElementNodeFilter trashElementNodeFilter)
    Retrieves a list of trash elements that match the specified filter.
    javax.jcr.Node
    Get the trash hone's node
    boolean
    isInTrash(javax.jcr.Node node)
    Check whether a given node is in Trash or not
    moveToTrash(javax.jcr.Node node, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider)
    Move node to trash location
    moveToTrash(javax.jcr.Node node, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider, int deep)
    Move node to trash location with deep
    void
    removeRelations(javax.jcr.Node node, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider)
    Removes all 'relationable' property of nodes that have relation to this node
    void
    restoreFromTrash(String trashNodePath, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider)
    Restore node from trash
    void
    updateRestorePath(String oldPath, String newPath)
    Updates the restore paths of nodes in the trash workspace when a parent folder has been renamed.
  • Field Details

  • Method Details

    • moveToTrash

      String moveToTrash(javax.jcr.Node node, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) throws javax.jcr.RepositoryException
      Move node to trash location
      Parameters:
      node - Node will be moved to trash
      sessionProvider - User session provider which will be used to get session
      Returns:
      -1: move failed. trashId if moved succesfully
      Throws:
      javax.jcr.RepositoryException
    • moveToTrash

      String moveToTrash(javax.jcr.Node node, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider, int deep) throws javax.jcr.RepositoryException
      Move node to trash location with deep
      Parameters:
      node -
      sessionProvider -
      deep -
      Returns:
      -1: move failed. trashId if moved succesfully
      Throws:
      javax.jcr.RepositoryException
    • restoreFromTrash

      void restoreFromTrash(String trashNodePath, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) throws javax.jcr.RepositoryException
      Restore node from trash
      Parameters:
      trashNodePath - The path.
      sessionProvider - The session provider.
      Throws:
      javax.jcr.RepositoryException
    • getAllNodeInTrash

      List<javax.jcr.Node> getAllNodeInTrash(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) throws javax.jcr.RepositoryException
      Get all nodes in trash location
      Parameters:
      sessionProvider -
      Returns:
      All nodes in trash
      Throws:
      javax.jcr.RepositoryException
    • getAllNodeInTrashByUser

      List<javax.jcr.Node> getAllNodeInTrashByUser(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider, String userName) throws javax.jcr.RepositoryException
      Get all nodes by user in trash location
      Parameters:
      sessionProvider -
      userName -
      Returns:
      all node in trash which moved by user
      Throws:
      javax.jcr.RepositoryException
    • removeRelations

      void removeRelations(javax.jcr.Node node, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) throws javax.jcr.RepositoryException
      Removes all 'relationable' property of nodes that have relation to this node
      Parameters:
      node -
      sessionProvider -
      Throws:
      javax.jcr.RepositoryException
    • isInTrash

      boolean isInTrash(javax.jcr.Node node) throws javax.jcr.RepositoryException
      Check whether a given node is in Trash or not
      Parameters:
      node - a specify node
      Returns:
      true if node is in Trash, false otherwise.
      Throws:
      javax.jcr.RepositoryException
    • getTrashHomeNode

      javax.jcr.Node getTrashHomeNode()
      Get the trash hone's node
      Returns:
      Node the node of trash home
    • getNodeByTrashId

      javax.jcr.Node getNodeByTrashId(String trashId) throws javax.jcr.RepositoryException
      Get Node in trash folder by trashId
      Parameters:
      trashId - ID of node will return
      Returns:
      Node in trash folder with thrashId, null if thrashId doesn't exist in trash folder
      Throws:
      javax.jcr.RepositoryException
    • getAllLinks

      List<javax.jcr.Node> getAllLinks(javax.jcr.Node node, String linkType)
      Get all links
      Parameters:
      node -
      linkType -
      Returns:
      List of Node
    • getTrashElements

      List<javax.jcr.Node> getTrashElements(TrashElementNodeFilter trashElementNodeFilter) throws javax.jcr.RepositoryException
      Retrieves a list of trash elements that match the specified filter.
      Parameters:
      trashElementNodeFilter - the filter used to find trash elements
      Returns:
      a list of nodes representing the trash elements
      Throws:
      javax.jcr.RepositoryException - if an error occurs while accessing the repository
    • countDeletedDocuments

      int countDeletedDocuments()
      Counts the total number of deleted documents in the trash.
      Returns:
      the total count of deleted documents
    • updateRestorePath

      void updateRestorePath(String oldPath, String newPath) throws javax.jcr.RepositoryException
      Updates the restore paths of nodes in the trash workspace when a parent folder has been renamed.

      This method searches for all nodes whose exo:restoreWorkspace property starts with the given oldPath, and replaces that prefix with newPath. This ensures that nodes in the trash can be restored correctly even after the original folder has been moved or renamed.

      Parameters:
      oldPath - the old path prefix to look for in the exo:restoreWorkspace property
      newPath - the new path prefix to replace the old path with
      Throws:
      javax.jcr.RepositoryException - if an error occurs while accessing or updating nodes in the repository