Package org.nuxeo.ecm.collections.core
Class CollectionManagerImpl
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.collections.core.CollectionManagerImpl
- All Implemented Interfaces:
CollectionManager,Adaptable,Component,Extensible,TimestampedService
- Since:
- 5.9.3
-
Field Summary
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToCollection(DocumentModel collection, List<DocumentModel> documentListToBeAdded, CoreSession session) Add a list of document to a collection.voidaddToCollection(DocumentModel collection, DocumentModel documentToBeAdded, CoreSession session) Add a document to a collection.voidaddToNewCollection(String newTitle, String newDescription, List<DocumentModel> documentListToBeAdded, CoreSession session) Add a list of document to a new collection.voidaddToNewCollection(String newTitle, String newDescription, DocumentModel documentToBeAdded, CoreSession session) Add a document to a new collection.booleancanAddToCollection(DocumentModel collection, CoreSession session) Check that a document is a collection and that the given core session has permission to add document inside.booleancanManage(DocumentModel collection, CoreSession session) Check that the given core session has permission to manage the collection.voidcheckCanAddToCollection(DocumentModel collection, DocumentModel documentToBeAdded, CoreSession session) protected voidcheckCanCollectInCollection(DocumentModel collection, CoreSession session) protected DocumentModelcreateCollection(String newTitle, String newDescription, DocumentModel context, CoreSession session) createCollection(CoreSession session, String title, String description, String path) Create a collection with a given name, description and path.static voidvoiddoRemoveFromCollection(DocumentModel documentToBeRemoved, String collectionId, CoreSession session) protected voidfireEvent(DocumentModel doc, CoreSession session, String eventName, Map<String, Serializable> props) getUserDefaultCollections(CoreSession session) Get user collections root document.getVisibleCollection(DocumentModel collectionMember, int maxResult, CoreSession session) Get the list of collection of a document.getVisibleCollection(DocumentModel collectionMember, CoreSession session) Get the list of collection of a document.booleanhasVisibleCollection(DocumentModel collectionMember, CoreSession session) Check that the given core session has READ permission on at least one collection of the given document.booleanCheck that a document can be added to a collection.booleanisCollected(DocumentModel doc) Check that a document has already been added to a collection.booleanCheck that a document is a collection.booleanisInCollection(DocumentModel collection, DocumentModel document, CoreSession session) Check whether a document is in a given collection.booleanmoveMembers(CoreSession session, DocumentModel collection, DocumentModel member1, DocumentModel member2) Move the member1 right after the member2 within the collection.voidprocessCopiedCollection(DocumentModel collection) Update all documents referenced by a collection to add a reference back the collection.voidprocessRemovedCollection(DocumentModel collection) Update all documents referenced by a collection to remove the reference to the collection.voidprocessRemovedCollectionMember(DocumentModel collectionMember) Update all collections referenced by a document.voidprocessRestoredCollection(DocumentModel collection, DocumentModel version) Restore the collection members of the version.voidremoveAllFromCollection(DocumentModel collection, List<DocumentModel> documentListToBeRemoved, CoreSession session) Remove a list of document from a given collection.voidremoveFromCollection(DocumentModel collection, DocumentModel documentToBeRemoved, CoreSession session) Remove a document from a collection.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterContribution, unregisterExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Constructor Details
-
CollectionManagerImpl
public CollectionManagerImpl()
-
-
Method Details
-
disableEvents
-
addToCollection
public void addToCollection(DocumentModel collection, DocumentModel documentToBeAdded, CoreSession session) throws DocumentSecurityException Description copied from interface:CollectionManagerAdd a document to a collection.- Specified by:
addToCollectionin interfaceCollectionManager- Parameters:
collection- the collectiondocumentToBeAdded- the document to be addedsession- the core session- Throws:
DocumentSecurityException
-
addToCollection
public void addToCollection(DocumentModel collection, List<DocumentModel> documentListToBeAdded, CoreSession session) Description copied from interface:CollectionManagerAdd a list of document to a collection.- Specified by:
addToCollectionin interfaceCollectionManager- Parameters:
collection- the collectiondocumentListToBeAdded- the list of document to be addedsession- the core session
-
addToNewCollection
public void addToNewCollection(String newTitle, String newDescription, DocumentModel documentToBeAdded, CoreSession session) Description copied from interface:CollectionManagerAdd a document to a new collection.- Specified by:
addToNewCollectionin interfaceCollectionManager- Parameters:
newTitle- the title of the new collectionnewDescription- the description of the new collectiondocumentToBeAdded- the document to be addedsession- the core session
-
addToNewCollection
public void addToNewCollection(String newTitle, String newDescription, List<DocumentModel> documentListToBeAdded, CoreSession session) Description copied from interface:CollectionManagerAdd a list of document to a new collection.- Specified by:
addToNewCollectionin interfaceCollectionManager- Parameters:
newTitle- the title of the new collectionnewDescription- the description of the new collectiondocumentListToBeAdded- the list of document to be addedsession- the core session
-
canAddToCollection
Description copied from interface:CollectionManagerCheck that a document is a collection and that the given core session has permission to add document inside.- Specified by:
canAddToCollectionin interfaceCollectionManager- Parameters:
collection- the collectionsession- the core session- Returns:
- true if the given document is a Collection and the core session has permission to add document inside, false otherwise
-
canManage
Description copied from interface:CollectionManagerCheck that the given core session has permission to manage the collection.- Specified by:
canManagein interfaceCollectionManager- Parameters:
collection- the collectionsession- the core session- Returns:
- true if the core session has permission to manage the collection
-
checkCanAddToCollection
public void checkCanAddToCollection(DocumentModel collection, DocumentModel documentToBeAdded, CoreSession session) -
checkCanCollectInCollection
- Since:
- 8.4
-
createCollection
protected DocumentModel createCollection(String newTitle, String newDescription, DocumentModel context, CoreSession session) -
getUserDefaultCollections
Description copied from interface:CollectionManagerGet user collections root document.- Specified by:
getUserDefaultCollectionsin interfaceCollectionManager- Parameters:
session- the core session- Returns:
- the user collections root document
-
getVisibleCollection
public List<DocumentModel> getVisibleCollection(DocumentModel collectionMember, CoreSession session) Description copied from interface:CollectionManagerGet the list of collection of a document. The resulting list will only contain the collections visible by the given core session (i.e. the collections on which the given core session has at least READ permission).- Specified by:
getVisibleCollectionin interfaceCollectionManager- Parameters:
collectionMember- the documentsession- the core session- Returns:
- the list of visible collections the collectionMember belong to
-
getVisibleCollection
public List<DocumentModel> getVisibleCollection(DocumentModel collectionMember, int maxResult, CoreSession session) Description copied from interface:CollectionManagerGet the list of collection of a document. The resulting list will only contain the collections visible by the given core session (i.e. the collections on which the given core session has at least READ permission). The resulting list's size will be limited to masResult.- Specified by:
getVisibleCollectionin interfaceCollectionManager- Parameters:
collectionMember- the documentmaxResult- the limitsession- the core session- Returns:
- the list of maxResult first visible collections the collectionMember belong to
-
hasVisibleCollection
Description copied from interface:CollectionManagerCheck that the given core session has READ permission on at least one collection of the given document.- Specified by:
hasVisibleCollectionin interfaceCollectionManager- Parameters:
collectionMember- the documentsession- the core session- Returns:
- true if collectionMember has at least one collection on which the session has READ permission
-
isCollectable
Description copied from interface:CollectionManagerCheck that a document can be added to a collection.- Specified by:
isCollectablein interfaceCollectionManager- Parameters:
doc- the document- Returns:
- true if the document can be added to the collection
-
isCollected
Description copied from interface:CollectionManagerCheck that a document has already been added to a collection.- Specified by:
isCollectedin interfaceCollectionManager- Parameters:
doc- the document- Returns:
- true if the document has already been added to a collection
-
isCollection
Description copied from interface:CollectionManagerCheck that a document is a collection.- Specified by:
isCollectionin interfaceCollectionManager- Parameters:
doc- the document- Returns:
- true if the document is a collection
-
isInCollection
public boolean isInCollection(DocumentModel collection, DocumentModel document, CoreSession session) Description copied from interface:CollectionManagerCheck whether a document is in a given collection.- Specified by:
isInCollectionin interfaceCollectionManager- Parameters:
collection- the collectiondocument- the document to checksession- the session
-
processCopiedCollection
Description copied from interface:CollectionManagerUpdate all documents referenced by a collection to add a reference back the collection. This is used when a creation is created by copy in order to tell the members of a copied collection that they also belongs to the newly created collection.- Specified by:
processCopiedCollectionin interfaceCollectionManager- Parameters:
collection- the collection
-
processRemovedCollection
Description copied from interface:CollectionManagerUpdate all documents referenced by a collection to remove the reference to the collection. This is used after the complete deletion of a collection.- Specified by:
processRemovedCollectionin interfaceCollectionManager- Parameters:
collection- the collection
-
processRemovedCollectionMember
Description copied from interface:CollectionManagerUpdate all collections referenced by a document. This is used after the complete deletion of a document to remove its reference from all collections it belongs to.- Specified by:
processRemovedCollectionMemberin interfaceCollectionManager- Parameters:
collectionMember- the document
-
processRestoredCollection
Description copied from interface:CollectionManagerRestore the collection members of the version.- Specified by:
processRestoredCollectionin interfaceCollectionManager- Parameters:
collection- the collectionversion- the version
-
removeAllFromCollection
public void removeAllFromCollection(DocumentModel collection, List<DocumentModel> documentListToBeRemoved, CoreSession session) Description copied from interface:CollectionManagerRemove a list of document from a given collection.- Specified by:
removeAllFromCollectionin interfaceCollectionManager- Parameters:
collection- the collectiondocumentListToBeRemoved- the document to be removedsession- the core session
-
removeFromCollection
public void removeFromCollection(DocumentModel collection, DocumentModel documentToBeRemoved, CoreSession session) Description copied from interface:CollectionManagerRemove a document from a collection.- Specified by:
removeFromCollectionin interfaceCollectionManager- Parameters:
collection- the collectiondocumentToBeRemoved- the document to be removedsession- the core session
-
doRemoveFromCollection
public void doRemoveFromCollection(DocumentModel documentToBeRemoved, String collectionId, CoreSession session) - Specified by:
doRemoveFromCollectionin interfaceCollectionManager
-
createCollection
public DocumentModel createCollection(CoreSession session, String title, String description, String path) Description copied from interface:CollectionManagerCreate a collection with a given name, description and path.- Specified by:
createCollectionin interfaceCollectionManager
-
fireEvent
protected void fireEvent(DocumentModel doc, CoreSession session, String eventName, Map<String, Serializable> props) -
moveMembers
public boolean moveMembers(CoreSession session, DocumentModel collection, DocumentModel member1, DocumentModel member2) Description copied from interface:CollectionManagerMove the member1 right after the member2 within the collection. If the member2 is null, then the member1 is moved to first position of the collection.- Specified by:
moveMembersin interfaceCollectionManager- Parameters:
session- the sessioncollection- the collectionmember1- the member1member2- the member2- Returns:
- true if successfully moved
-