public interface TrashService
Modifier and Type | Method and Description |
---|---|
boolean |
canDelete(List<DocumentModel> docs,
Principal principal,
boolean checkProxies)
Is at least one doc deletable?
|
boolean |
canPurgeOrUndelete(List<DocumentModel> docs,
Principal principal)
Are all documents purgeable/undeletable?
|
boolean |
checkDeletePermOnParents(List<DocumentModel> docs)
Is at least one doc deletable according to its container?
|
boolean |
folderAllowsDelete(DocumentModel folder)
Can a child of the folder be deleted?
|
DocumentModel |
getAboveDocument(DocumentModel doc,
Set<Path> paths)
Gets the closest document's ancestor above all the paths.
|
DocumentModelList |
getDocuments(DocumentModel currentDoc)
Get all documents from the trash of the current document.
|
TrashInfo |
getTrashInfo(List<DocumentModel> docs,
Principal principal,
boolean checkProxies,
boolean checkDeleted)
Gets the trash info for a list of documents.
|
String |
mangleName(DocumentModel doc)
Mangles the name of a document to avoid collisions with non-trashed documents when it's in the trash.
|
void |
purgeDocuments(CoreSession session,
List<DocumentRef> docRefs)
Purges (completely deletes) documents .
|
void |
trashDocuments(List<DocumentModel> docs)
Moves documents to the trash, or directly deletes them if their lifecycle does not allow trash use.
|
Set<DocumentRef> |
undeleteDocuments(List<DocumentModel> docs)
Undeletes documents (and ancestors if needed to make them visible).
|
String |
unmangleName(DocumentModel doc)
Unmangles the name of a document in the trash to find its un-trashed name.
|
boolean folderAllowsDelete(DocumentModel folder)
folder
- the foldertrue
if the folder allows its children to be deletedboolean checkDeletePermOnParents(List<DocumentModel> docs)
docs
- the documentstrue
if one doc is in a folder that allows its children to be deletedboolean canDelete(List<DocumentModel> docs, Principal principal, boolean checkProxies)
docs
- the documentsprincipal
- the current user (to check locks)checkProxies
- true
to count proxies as non-deletabletrue
if at least one doc is deletableboolean canPurgeOrUndelete(List<DocumentModel> docs, Principal principal)
Documents need to be in the deleted lifecycle state for this to be true, in addition to the standard permission checks.
docs
- the documentsprincipal
- the current user (to check locks)true
if the documents are purgeable/undeletableTrashInfo getTrashInfo(List<DocumentModel> docs, Principal principal, boolean checkProxies, boolean checkDeleted)
docs
- the documentsprincipal
- the current user (to check locks)checkProxies
- true
to count proxies as non-deletablecheckDeleted
- true
if documents have to be in the deleted state to be considered (otherwise
forbidden)DocumentModel getAboveDocument(DocumentModel doc, Set<Path> paths)
This is used to find what safe document to redirect to when deleting some.
doc
- the documentpaths
- the pathsvoid trashDocuments(List<DocumentModel> docs)
Do nothing if the document current state is deleted.
Placeless documents are deleted immediately.
docs
- the documents to trashvoid purgeDocuments(CoreSession session, List<DocumentRef> docRefs)
session
- the sessiondocRefs
- the documents to purgeSet<DocumentRef> undeleteDocuments(List<DocumentModel> docs)
Also fires async events to undelete the children.
docs
- the documents to undeleteDocumentModelList getDocuments(DocumentModel currentDoc)
currentDoc
- The current/parent document of trash document.String mangleName(DocumentModel doc)
doc
- the documentString unmangleName(DocumentModel doc)
doc
- the trashed documentCopyright © 2018 Nuxeo. All rights reserved.