Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.trash
Interface TrashService

All Known Implementing Classes:
TrashServiceImpl

public interface TrashService

Service containing the logic about deleting/purging/undeleting a document.


Method Summary
 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.
 TrashInfo getTrashInfo(List<DocumentModel> docs, Principal principal, boolean checkProxies, boolean checkDeleted)
          Gets the trash info for a list of documents.
 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).
 

Method Detail

folderAllowsDelete

boolean folderAllowsDelete(DocumentModel folder)
                           throws ClientException
Can a child of the folder be deleted?

Parameters:
folder - the folder
Returns:
true if the folder allows its children to be deleted
Throws:
ClientException

checkDeletePermOnParents

boolean checkDeletePermOnParents(List<DocumentModel> docs)
                                 throws ClientException
Is at least one doc deletable according to its container?

Parameters:
docs - the documents
Returns:
true if one doc is in a folder that allows its children to be deleted
Throws:
ClientException

canDelete

boolean canDelete(List<DocumentModel> docs,
                  Principal principal,
                  boolean checkProxies)
                  throws ClientException
Is at least one doc deletable?

Parameters:
docs - the documents
principal - the current user (to check locks)
checkProxies - true to count proxies as non-deletable
Returns:
true if at least one doc is deletable
Throws:
ClientException

canPurgeOrUndelete

boolean canPurgeOrUndelete(List<DocumentModel> docs,
                           Principal principal)
                           throws ClientException
Are all documents purgeable/undeletable?

Documents need to be in the deleted lifecycle state for this to be true, in addition to the standard permission checks.

Parameters:
docs - the documents
principal - the current user (to check locks)
Returns:
true if the documents are purgeable/undeletable
Throws:
ClientException

getTrashInfo

TrashInfo getTrashInfo(List<DocumentModel> docs,
                       Principal principal,
                       boolean checkProxies,
                       boolean checkDeleted)
                       throws ClientException
Gets the trash info for a list of documents.

Parameters:
docs - the documents
principal - the current user (to check locks)
checkProxies - true to count proxies as non-deletable
checkDeleted - true if documents have to be in the deleted state to be considered (otherwise forbidden)
Returns:
the trash info
Throws:
ClientException

getAboveDocument

DocumentModel getAboveDocument(DocumentModel doc,
                               Set<Path> paths)
                               throws ClientException
Gets the closest document's ancestor above all the paths.

This is used to find what safe document to redirect to when deleting some.

Parameters:
doc - the document
paths - the paths
Returns:
the closer document above doc and above all the paths
Throws:
ClientException

trashDocuments

void trashDocuments(List<DocumentModel> docs)
                    throws ClientException
Moves documents to the trash, or directly deletes them if their lifecycle does not allow trash use.

Parameters:
docs - the documents to trash
Throws:
ClientException

purgeDocuments

void purgeDocuments(CoreSession session,
                    List<DocumentRef> docRefs)
                    throws ClientException
Purges (completely deletes) documents .

Parameters:
session - the session
docRefs - the documents to purge
Throws:
ClientException

undeleteDocuments

Set<DocumentRef> undeleteDocuments(List<DocumentModel> docs)
                                   throws ClientException
Undeletes documents (and ancestors if needed to make them visible).

Also fires async events to undelete the children.

Parameters:
docs - the documents to undelete
Returns:
the set of ancestors whose children have been undeleted (for UI notification)
Throws:
ClientException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.