public interface TrashService
Modifier and Type | Interface and Description |
---|---|
static class |
TrashService.Feature
Features of the implementation of the service.
|
Modifier and Type | Field and Description |
---|---|
static String |
DISABLE_TRASH_RENAMING
Key for
DocumentModel.getContextData(String) which skips the renaming during trash/untrash mechanism when
the value is Boolean.TRUE . |
static String |
DOCUMENT_TRASHED
Event for a document trashed by the user.
|
static String |
DOCUMENT_UNTRASHED
Event for a document untrashed by the user.
|
static String |
IS_TRASHED_FROM_DELETE_TRANSITION
Configuration property to enable backward compatibility to forward the call to the service on
followTransition("deleted").
|
Modifier and Type | Method and Description |
---|---|
default boolean |
canPurgeOrUntrash(DocumentModel doc,
Principal principal)
Is document purgeable/untrashable?
|
boolean |
canPurgeOrUntrash(List<DocumentModel> docs,
Principal principal)
Are all documents purgeable/undeletable?
|
DocumentModel |
getAboveDocument(DocumentModel doc,
Principal principal)
Gets the first non trashed ancestor.
|
DocumentModelList |
getDocuments(DocumentModel parent)
Get all documents from the trash of the current document.
|
boolean |
hasFeature(TrashService.Feature feature)
Checks if a feature is available.
|
boolean |
isTrashed(CoreSession session,
DocumentRef doc) |
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 |
purgeDocumentsUnder(DocumentModel parent)
Purges (completely deletes) trashed documents under the given parent.
|
default void |
trashDocument(DocumentModel doc)
Moves document to the trash.
|
void |
trashDocuments(List<DocumentModel> docs)
Moves documents to the trash.
|
String |
unmangleName(DocumentModel doc)
Unmangles the name of a document in the trash to find its un-trashed name.
|
default void |
untrashDocument(DocumentModel doc)
Unmoves document from the trash.
|
void |
untrashDocuments(List<DocumentModel> docs)
Unmoves documents from the trash.
|
static final String DOCUMENT_TRASHED
static final String DOCUMENT_UNTRASHED
static final String DISABLE_TRASH_RENAMING
DocumentModel.getContextData(String)
which skips the renaming during trash/untrash mechanism when
the value is Boolean.TRUE
.static final String IS_TRASHED_FROM_DELETE_TRANSITION
boolean isTrashed(CoreSession session, DocumentRef doc)
DocumentRef
is trashed.boolean canPurgeOrUntrash(List<DocumentModel> docs, Principal principal)
Documents need to be in the trash 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/undeletabledefault boolean canPurgeOrUntrash(DocumentModel doc, Principal principal)
Documents need to be in the trash for this to be true, in addition to the standard permission checks.
doc
- the documentprincipal
- the current user (to check locks)true
if the documents are purgeable/untrashableDocumentModel getAboveDocument(DocumentModel doc, Principal principal)
This is used to find what safe document to redirect to when deleting one.
doc
- the trashed documentprincipal
- the current uservoid trashDocuments(List<DocumentModel> docs)
Do nothing if the document current state is trashed.
Placeless documents are deleted immediately.
docs
- the documents to trashdefault void trashDocument(DocumentModel doc)
Do nothing if the document current state is trashed.
Placeless documents are deleted immediately.
doc
- the document to trashvoid purgeDocuments(CoreSession session, List<DocumentRef> docRefs)
session
- the sessiondocRefs
- the documents to purgevoid purgeDocumentsUnder(DocumentModel parent)
parent
- The parent document of trashed documents.void untrashDocuments(List<DocumentModel> docs)
Also fires async events to untrash the children.
docs
- the documents to untrashdefault void untrashDocument(DocumentModel doc)
Also fires async events to untrash the children.
doc
- the document to untrashDocumentModelList getDocuments(DocumentModel parent)
parent
- The parent document of trash document.String mangleName(DocumentModel doc)
doc
- the documentString unmangleName(DocumentModel doc)
doc
- the trashed documentboolean hasFeature(TrashService.Feature feature)
Copyright © 2018 Nuxeo. All rights reserved.