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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToCollection
(DocumentModel collection, List<DocumentModel> documentListToBeAdded, CoreSession session) Add a list of document to a collection.void
addToCollection
(DocumentModel collection, DocumentModel documentToBeAdded, CoreSession session) Add a document to a collection.void
addToNewCollection
(String newTitle, String newDescription, List<DocumentModel> documentListToBeAdded, CoreSession session) Add a list of document to a new collection.void
addToNewCollection
(String newTitle, String newDescription, DocumentModel documentToBeAdded, CoreSession session) Add a document to a new collection.boolean
canAddToCollection
(DocumentModel collection, CoreSession session) Check that a document is a collection and that the given core session has permission to add document inside.boolean
canManage
(DocumentModel collection, CoreSession session) Check that the given core session has permission to manage the collection.void
checkCanAddToCollection
(DocumentModel collection, DocumentModel documentToBeAdded, CoreSession session) protected void
checkCanCollectInCollection
(DocumentModel collection, CoreSession session) protected DocumentModel
createCollection
(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 void
void
doRemoveFromCollection
(DocumentModel documentToBeRemoved, String collectionId, CoreSession session) protected void
fireEvent
(DocumentModel doc, CoreSession session, String eventName, Map<String, Serializable> props) getUserDefaultCollections
(CoreSession session) Get user collections root document.getUserDefaultCollections
(DocumentModel context, CoreSession session) Deprecated.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.boolean
hasVisibleCollection
(DocumentModel collectionMember, CoreSession session) Check that the given core session has READ permission on at least one collection of the given document.boolean
Check that a document can be added to a collection.boolean
isCollected
(DocumentModel doc) Check that a document has already been added to a collection.boolean
Check that a document is a collection.boolean
isInCollection
(DocumentModel collection, DocumentModel document, CoreSession session) Check whether a document is in a given collection.boolean
moveMembers
(CoreSession session, DocumentModel collection, DocumentModel member1, DocumentModel member2) Move the member1 right after the member2 within the collection.void
processCopiedCollection
(DocumentModel collection) Update all documents referenced by a collection to add a reference back the collection.void
processRemovedCollection
(DocumentModel collection) Update all documents referenced by a collection to remove the reference to the collection.void
processRemovedCollectionMember
(DocumentModel collectionMember) Update all collections referenced by a document.void
processRestoredCollection
(DocumentModel collection, DocumentModel version) Restore the collection members of the version.void
removeAllFromCollection
(DocumentModel collection, List<DocumentModel> documentListToBeRemoved, CoreSession session) Remove a list of document from a given collection.void
removeFromCollection
(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, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:CollectionManager
Add a document to a collection.- Specified by:
addToCollection
in 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:CollectionManager
Add a list of document to a collection.- Specified by:
addToCollection
in 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:CollectionManager
Add a document to a new collection.- Specified by:
addToNewCollection
in 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:CollectionManager
Add a list of document to a new collection.- Specified by:
addToNewCollection
in 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:CollectionManager
Check that a document is a collection and that the given core session has permission to add document inside.- Specified by:
canAddToCollection
in 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:CollectionManager
Check that the given core session has permission to manage the collection.- Specified by:
canManage
in 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
@Deprecated public DocumentModel getUserDefaultCollections(DocumentModel context, CoreSession session) Deprecated.- Specified by:
getUserDefaultCollections
in interfaceCollectionManager
-
getUserDefaultCollections
Description copied from interface:CollectionManager
Get user collections root document.- Specified by:
getUserDefaultCollections
in 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:CollectionManager
Get 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:
getVisibleCollection
in 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:CollectionManager
Get 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:
getVisibleCollection
in 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:CollectionManager
Check that the given core session has READ permission on at least one collection of the given document.- Specified by:
hasVisibleCollection
in 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:CollectionManager
Check that a document can be added to a collection.- Specified by:
isCollectable
in interfaceCollectionManager
- Parameters:
doc
- the document- Returns:
- true if the document can be added to the collection
-
isCollected
Description copied from interface:CollectionManager
Check that a document has already been added to a collection.- Specified by:
isCollected
in interfaceCollectionManager
- Parameters:
doc
- the document- Returns:
- true if the document has already been added to a collection
-
isCollection
Description copied from interface:CollectionManager
Check that a document is a collection.- Specified by:
isCollection
in 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:CollectionManager
Check whether a document is in a given collection.- Specified by:
isInCollection
in interfaceCollectionManager
- Parameters:
collection
- the collectiondocument
- the document to checksession
- the session
-
processCopiedCollection
Description copied from interface:CollectionManager
Update 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:
processCopiedCollection
in interfaceCollectionManager
- Parameters:
collection
- the collection
-
processRemovedCollection
Description copied from interface:CollectionManager
Update 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:
processRemovedCollection
in interfaceCollectionManager
- Parameters:
collection
- the collection
-
processRemovedCollectionMember
Description copied from interface:CollectionManager
Update 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:
processRemovedCollectionMember
in interfaceCollectionManager
- Parameters:
collectionMember
- the document
-
processRestoredCollection
Description copied from interface:CollectionManager
Restore the collection members of the version.- Specified by:
processRestoredCollection
in interfaceCollectionManager
- Parameters:
collection
- the collectionversion
- the version
-
removeAllFromCollection
public void removeAllFromCollection(DocumentModel collection, List<DocumentModel> documentListToBeRemoved, CoreSession session) Description copied from interface:CollectionManager
Remove a list of document from a given collection.- Specified by:
removeAllFromCollection
in 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:CollectionManager
Remove a document from a collection.- Specified by:
removeFromCollection
in 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:
doRemoveFromCollection
in interfaceCollectionManager
-
createCollection
public DocumentModel createCollection(CoreSession session, String title, String description, String path) Description copied from interface:CollectionManager
Create a collection with a given name, description and path.- Specified by:
createCollection
in 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:CollectionManager
Move 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:
moveMembers
in interfaceCollectionManager
- Parameters:
session
- the sessioncollection
- the collectionmember1
- the member1member2
- the member2- Returns:
- true if successfully moved
-