Interface TrashStorage
public interface TrashStorage
This service used to move documents to trash foder or restore
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintCounts the total number of deleted documents in the trash.List<javax.jcr.Node> getAllLinks(javax.jcr.Node node, String linkType) Get all linksList<javax.jcr.Node> getAllNodeInTrash(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) Get all nodes in trash locationList<javax.jcr.Node> getAllNodeInTrashByUser(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider, String userName) Get all nodes by user in trash locationjavax.jcr.NodegetNodeByTrashId(String trashId) GetNodein trash folder by trashIdList<javax.jcr.Node> getTrashElements(TrashElementNodeFilter trashElementNodeFilter) Retrieves a list of trash elements that match the specified filter.javax.jcr.NodeGet the trash hone's nodebooleanisInTrash(javax.jcr.Node node) Check whether a given node is in Trash or notmoveToTrash(javax.jcr.Node node, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) Move node to trash locationmoveToTrash(javax.jcr.Node node, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider, int deep) Move node to trash location with deepvoidremoveRelations(javax.jcr.Node node, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) Removes all 'relationable' property of nodes that have relation to this nodevoidrestoreFromTrash(String trashNodePath, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) Restore node from trashvoidupdateRestorePath(String oldPath, String newPath) Updates the restore paths of nodes in the trash workspace when a parent folder has been renamed.
-
Field Details
-
FILE_REMOVE_ACTIVITY
- See Also:
-
-
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 trashsessionProvider- 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:
trueif node is in Trash,falseotherwise.- Throws:
javax.jcr.RepositoryException
-
getTrashHomeNode
javax.jcr.Node getTrashHomeNode()Get the trash hone's node- Returns:
Nodethe node of trash home
-
getNodeByTrashId
GetNodein trash folder by trashId- Parameters:
trashId- ID of node will return- Returns:
Nodein trash folder with thrashId,nullif thrashId doesn't exist in trash folder- Throws:
javax.jcr.RepositoryException
-
getAllLinks
Get all links- Parameters:
node-linkType-- Returns:
ListofNode
-
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
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:restoreWorkspaceproperty starts with the givenoldPath, and replaces that prefix withnewPath. 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 theexo:restoreWorkspacepropertynewPath- 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
-