Package org.nuxeo.ecm.core.trash
Class AbstractTrashService
java.lang.Object
org.nuxeo.ecm.core.trash.AbstractTrashService
- All Implemented Interfaces:
TrashService
- Direct Known Subclasses:
PropertyTrashService
Basic implementation of
TrashService.- Since:
- 10.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classPath-based comparator used to put folders before their children. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final PatternMatches names resulting from a collision, suffixed with a time in milliseconds, created by DuplicatedNameFixer.static final StringDeprecated.since 2023protected static final Stringstatic final StringDeprecated.since 2023protected static final PatternMatches names of documents in the trash, created byTrashService.trashDocuments(List).static final StringFields inherited from interface org.nuxeo.ecm.core.api.trash.TrashService
ABOUT_TO_TRASH, ABOUT_TO_UNTRASH, DISABLE_TRASH_RENAMING, DOCUMENT_TRASHED, DOCUMENT_UNTRASHED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanPurgeOrUntrash(List<DocumentModel> docs, NuxeoPrincipal principal) Are all documents purgeable/undeletable?protected voidcheckCanTrash(DocumentModel model) Deprecated.since 2023,AbstractSession.canRemoveDocument(DocumentRef)does this checkprotected DocumentModelgetAboveDocument(DocumentModel doc, Set<Path> rootPaths) getAboveDocument(DocumentModel doc, NuxeoPrincipal principal) Gets the first non trashed ancestor.protected static StringgetDocuments(DocumentModel parent) Get all documents from the trash of the current document.protected StringgetFirstGroup(Pattern pattern, String name) protected TrashInfogetInfo(List<DocumentModel> docs, NuxeoPrincipal principal, boolean checkProxies, boolean checkDeleted) protected TrashInfogetTrashInfo(List<DocumentModel> docs, NuxeoPrincipal principal, boolean checkProxies, boolean checkDeleted) booleanisMangledName(String docName) mangleName(DocumentModel doc) Mangles the name of a document to avoid collisions with non-trashed documents when it's in the trash.protected voidnotifyEvent(CoreSession session, String eventId, DocumentModel doc) protected voidnotifyEvent(CoreSession session, String eventId, DocumentModel doc, boolean immediate) protected voidnotifyEvent(CoreSession session, String eventId, DocumentModel doc, boolean immediate, boolean inline) voidpurgeDocuments(CoreSession session, List<DocumentRef> docRefs) Purges (completely deletes) documents.voidpurgeDocumentsUnder(DocumentModel parent) Purges (completely deletes) trashed documents under the given parent.protected static booleanunderOneOf(Path testedPath, Set<Path> paths) unmangleName(CoreSession session, DocumentRef parentRef, String docName) Unmangles the name of a document in the trash to find its un-trashed name.Unmangles the name of a document in the trash to find its un-trashed name.abstract voiduntrashDocuments(List<DocumentModel> docs) Unmoves documents from the trash.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.ecm.core.api.trash.TrashService
canPurgeOrUntrash, isTrashed, trashDocument, trashDocuments, untrashDocument
-
Field Details
-
TRASHED_QUERY
- See Also:
-
RETENTION_QUERY
Deprecated.since 2023- See Also:
-
LEGAL_HOLD_QUERY
Deprecated.since 2023- See Also:
-
PATH_SEPARATOR
- Since:
- 11.1
- See Also:
-
TRASHED_PATTERN
Matches names of documents in the trash, created byTrashService.trashDocuments(List). -
COLLISION_PATTERN
Matches names resulting from a collision, suffixed with a time in milliseconds, created by DuplicatedNameFixer. We also attempt to remove this when getting a doc out of the trash.
-
-
Constructor Details
-
AbstractTrashService
public AbstractTrashService()
-
-
Method Details
-
canPurgeOrUntrash
Description copied from interface:TrashServiceAre all documents purgeable/undeletable?Documents need to be in the trash for this to be true, in addition to the standard permission checks.
- Specified by:
canPurgeOrUntrashin interfaceTrashService- Parameters:
docs- the documentsprincipal- the current user (to check locks)- Returns:
trueif the documents are purgeable/undeletable
-
getInfo
protected TrashInfo getInfo(List<DocumentModel> docs, NuxeoPrincipal principal, boolean checkProxies, boolean checkDeleted) -
getDocumentLocker
-
getTrashInfo
protected TrashInfo getTrashInfo(List<DocumentModel> docs, NuxeoPrincipal principal, boolean checkProxies, boolean checkDeleted) -
getAboveDocument
-
getAboveDocument
Description copied from interface:TrashServiceGets the first non trashed ancestor.This is used to find what safe document to redirect to when deleting one.
- Specified by:
getAboveDocumentin interfaceTrashService- Parameters:
doc- the trashed documentprincipal- the current user- Returns:
- the first non trashed ancestor
-
underOneOf
-
purgeDocuments
Description copied from interface:TrashServicePurges (completely deletes) documents.- Specified by:
purgeDocumentsin interfaceTrashService- Parameters:
session- the sessiondocRefs- the documents to purge
-
purgeDocumentsUnder
Description copied from interface:TrashServicePurges (completely deletes) trashed documents under the given parent.- Specified by:
purgeDocumentsUnderin interfaceTrashService- Parameters:
parent- The parent document of trashed documents.
-
notifyEvent
-
notifyEvent
protected void notifyEvent(CoreSession session, String eventId, DocumentModel doc, boolean immediate) -
notifyEvent
protected void notifyEvent(CoreSession session, String eventId, DocumentModel doc, boolean immediate, boolean inline) -
getDocuments
Description copied from interface:TrashServiceGet all documents from the trash of the current document.- Specified by:
getDocumentsin interfaceTrashService- Parameters:
parent- The parent document of trash document.- Returns:
- All documents in the trash of the current document.
-
untrashDocuments
Description copied from interface:TrashServiceUnmoves documents from the trash.Also fires async events to untrash the children.
- Specified by:
untrashDocumentsin interfaceTrashService- Parameters:
docs- the documents to untrash
-
isMangledName
- Specified by:
isMangledNamein interfaceTrashService- Parameters:
docName- the document's name- Returns:
- true if the document's name is mangled, false otherwise
-
mangleName
Description copied from interface:TrashServiceMangles the name of a document to avoid collisions with non-trashed documents when it's in the trash.- Specified by:
mangleNamein interfaceTrashService- Parameters:
doc- the document
-
unmangleName
Description copied from interface:TrashServiceUnmangles the name of a document in the trash to find its un-trashed name.- Specified by:
unmangleNamein interfaceTrashService- Parameters:
doc- the trashed document- Returns:
- the unmangled name
-
unmangleName
Description copied from interface:TrashServiceUnmangles the name of a document in the trash to find its un-trashed name.- Specified by:
unmangleNamein interfaceTrashService- Parameters:
session- the session used for collisions checkparentRef- the parent document refdocName- the document name- Returns:
- the unmangled name
-
getFirstGroup
-
checkCanTrash
Deprecated.since 2023,AbstractSession.canRemoveDocument(DocumentRef)does this checkThrows aDocumentExistsExceptionif a descendant document cannot be trashed.- Since:
- 2021.14
-