public abstract class AbstractTrashService extends Object implements TrashService
TrashService
.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractTrashService.PathComparator
Path-based comparator used to put folders before their children.
|
TrashService.Feature
Modifier and Type | Field and Description |
---|---|
protected static Pattern |
COLLISION_PATTERN
Matches names resulting from a collision, suffixed with a time in milliseconds, created by DuplicatedNameFixer.
|
protected static Pattern |
TRASHED_PATTERN
Matches names of documents in the trash, created by
TrashService.trashDocuments(List) . |
static String |
TRASHED_QUERY |
DISABLE_TRASH_RENAMING, DOCUMENT_TRASHED, DOCUMENT_UNTRASHED, IS_ALREADY_CALLED
Constructor and Description |
---|
AbstractTrashService() |
Modifier and Type | Method and Description |
---|---|
boolean |
canDelete(List<DocumentModel> docs,
Principal principal,
boolean checkProxies)
Is at least one doc deletable?
|
boolean |
canPurgeOrUntrash(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 trashed?
|
DocumentModel |
getAboveDocument(DocumentModel doc,
Principal principal)
Gets the first non trashed ancestor.
|
DocumentModel |
getAboveDocument(DocumentModel doc,
Set<Path> rootPaths)
Gets the closest document's ancestor above all the paths.
|
protected static String |
getDocumentLocker(DocumentModel doc) |
DocumentModelList |
getDocuments(DocumentModel parent)
Get all documents from the trash of the current document.
|
protected TrashInfo |
getInfo(List<DocumentModel> docs,
Principal principal,
boolean checkProxies,
boolean checkDeleted) |
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.
|
protected void |
notifyEvent(CoreSession session,
String eventId,
DocumentModel doc) |
protected void |
notifyEvent(CoreSession session,
String eventId,
DocumentModel doc,
Map<String,Serializable> options) |
void |
purgeDocuments(CoreSession session,
List<DocumentRef> docRefs)
Purges (completely deletes) documents.
|
void |
purgeDocumentsUnder(DocumentModel parent)
Purges (completely deletes) trashed documents under the given parent.
|
protected static boolean |
underOneOf(Path testedPath,
Set<Path> paths) |
String |
unmangleName(DocumentModel doc)
Unmangles the name of a document in the trash to find its un-trashed name.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canPurgeOrUndelete, canPurgeOrUntrash, hasFeature, isTrashed, trashDocument, trashDocuments, undeleteDocuments, untrashDocument, untrashDocuments
public static final String TRASHED_QUERY
protected static final Pattern TRASHED_PATTERN
TrashService.trashDocuments(List)
.protected static final Pattern COLLISION_PATTERN
public AbstractTrashService()
public boolean folderAllowsDelete(DocumentModel folder)
TrashService
folderAllowsDelete
in interface TrashService
folder
- the foldertrue
if the folder allows its children to be trashedpublic boolean checkDeletePermOnParents(List<DocumentModel> docs)
TrashService
checkDeletePermOnParents
in interface TrashService
docs
- the documentstrue
if one doc is in a folder that allows its children to be trashedpublic boolean canDelete(List<DocumentModel> docs, Principal principal, boolean checkProxies)
TrashService
canDelete
in interface TrashService
docs
- the documentsprincipal
- the current user (to check locks)checkProxies
- true
to count proxies as non-deletabletrue
if at least one doc is deletablepublic boolean canPurgeOrUntrash(List<DocumentModel> docs, Principal principal)
TrashService
Documents need to be in the trash for this to be true, in addition to the standard permission checks.
canPurgeOrUntrash
in interface TrashService
docs
- the documentsprincipal
- the current user (to check locks)true
if the documents are purgeable/undeletableprotected TrashInfo getInfo(List<DocumentModel> docs, Principal principal, boolean checkProxies, boolean checkDeleted)
protected static String getDocumentLocker(DocumentModel doc)
public TrashInfo getTrashInfo(List<DocumentModel> docs, Principal principal, boolean checkProxies, boolean checkDeleted)
TrashService
getTrashInfo
in interface TrashService
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 trashed state to be considered (otherwise
forbidden)public DocumentModel getAboveDocument(DocumentModel doc, Set<Path> rootPaths)
TrashService
This is used to find what safe document to redirect to when deleting some.
getAboveDocument
in interface TrashService
doc
- the documentrootPaths
- the pathspublic DocumentModel getAboveDocument(DocumentModel doc, Principal principal)
TrashService
This is used to find what safe document to redirect to when deleting one.
getAboveDocument
in interface TrashService
doc
- the trashed documentprincipal
- the current userprotected static boolean underOneOf(Path testedPath, Set<Path> paths)
public void purgeDocuments(CoreSession session, List<DocumentRef> docRefs)
TrashService
purgeDocuments
in interface TrashService
session
- the sessiondocRefs
- the documents to purgepublic void purgeDocumentsUnder(DocumentModel parent)
TrashService
purgeDocumentsUnder
in interface TrashService
parent
- The parent document of trashed documents.protected void notifyEvent(CoreSession session, String eventId, DocumentModel doc)
protected void notifyEvent(CoreSession session, String eventId, DocumentModel doc, Map<String,Serializable> options)
public DocumentModelList getDocuments(DocumentModel parent)
TrashService
getDocuments
in interface TrashService
parent
- The parent document of trash document.public String mangleName(DocumentModel doc)
TrashService
mangleName
in interface TrashService
doc
- the documentpublic String unmangleName(DocumentModel doc)
TrashService
unmangleName
in interface TrashService
doc
- the trashed documentCopyright © 2018 Nuxeo. All rights reserved.