Package org.nuxeo.ecm.collections.api
Interface CollectionManager
- All Known Implementing Classes:
CollectionManagerImpl
public interface CollectionManager
- Since:
- 5.9.3
-
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 documentManager) 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.createCollection
(CoreSession session, String title, String description, String path) Create a collection with a given name, description and path.void
doRemoveFromCollection
(DocumentModel documentToBeRemoved, String collectionId, CoreSession session) 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
isCollectable
(DocumentModel document) Check that a document can be added to a collection.boolean
isCollected
(DocumentModel document) Check that a document has already been added to a collection.boolean
isCollection
(DocumentModel document) 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.
-
Method Details
-
addToCollection
void addToCollection(DocumentModel collection, DocumentModel documentToBeAdded, CoreSession session) Add a document to a collection.- Parameters:
collection
- the collectiondocumentToBeAdded
- the document to be addedsession
- the core session
-
addToCollection
void addToCollection(DocumentModel collection, List<DocumentModel> documentListToBeAdded, CoreSession session) Add a list of document to a collection.- Parameters:
collection
- the collectiondocumentListToBeAdded
- the list of document to be addedsession
- the core session
-
addToNewCollection
void addToNewCollection(String newTitle, String newDescription, DocumentModel documentToBeAdded, CoreSession session) Add a document to a new collection.- Parameters:
newTitle
- the title of the new collectionnewDescription
- the description of the new collectiondocumentToBeAdded
- the document to be addedsession
- the core session
-
addToNewCollection
void addToNewCollection(String newTitle, String newDescription, List<DocumentModel> documentListToBeAdded, CoreSession documentManager) Add a list of document to a new collection.- Parameters:
newTitle
- the title of the new collectionnewDescription
- the description of the new collectiondocumentListToBeAdded
- the list of document to be addeddocumentManager
- the core session
-
canAddToCollection
Check that a document is a collection and that the given core session has permission to add document inside.- 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
Check that the given core session has permission to manage the collection.- Parameters:
collection
- the collectionsession
- the core session- Returns:
- true if the core session has permission to manage the collection
-
getVisibleCollection
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).- Parameters:
collectionMember
- the documentsession
- the core session- Returns:
- the list of visible collections the collectionMember belong to
-
getVisibleCollection
List<DocumentModel> getVisibleCollection(DocumentModel collectionMember, int maxResult, CoreSession session) 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.- Parameters:
collectionMember
- the documentmaxResult
- the limitsession
- the core session- Returns:
- the list of maxResult first visible collections the collectionMember belong to
-
hasVisibleCollection
Check that the given core session has READ permission on at least one collection of the given document.- Parameters:
collectionMember
- the documentsession
- the core session- Returns:
- true if collectionMember has at least one collection on which the session has READ permission
-
isCollectable
Check that a document can be added to a collection.- Parameters:
document
- the document- Returns:
- true if the document can be added to the collection
-
isCollected
Check that a document has already been added to a collection.- Parameters:
document
- the document- Returns:
- true if the document has already been added to a collection
-
isCollection
Check that a document is a collection.- Parameters:
document
- the document- Returns:
- true if the document is a collection
-
isInCollection
Check whether a document is in a given collection.- Parameters:
collection
- the collectiondocument
- the document to checksession
- the session- Since:
- 5.9.4
-
moveMembers
boolean moveMembers(CoreSession session, DocumentModel collection, DocumentModel member1, DocumentModel member2) 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.- Parameters:
session
- the sessioncollection
- the collectionmember1
- the member1member2
- the member2- Returns:
- true if successfully moved
- Since:
- 8.4
-
processCopiedCollection
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.- Parameters:
collection
- the collection
-
processRemovedCollection
Update all documents referenced by a collection to remove the reference to the collection. This is used after the complete deletion of a collection.- Parameters:
collection
- the collection
-
processRemovedCollectionMember
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.- Parameters:
collectionMember
- the document
-
processRestoredCollection
Restore the collection members of the version.- Parameters:
collection
- the collectionversion
- the version- Since:
- 7.3
-
removeAllFromCollection
void removeAllFromCollection(DocumentModel collection, List<DocumentModel> documentListToBeRemoved, CoreSession session) Remove a list of document from a given collection.- Parameters:
collection
- the collectiondocumentListToBeRemoved
- the document to be removedsession
- the core session
-
removeFromCollection
void removeFromCollection(DocumentModel collection, DocumentModel documentToBeRemoved, CoreSession session) Remove a document from a collection.- Parameters:
collection
- the collectiondocumentToBeRemoved
- the document to be removedsession
- the core session
-
createCollection
Create a collection with a given name, description and path.- Since:
- 5.9.4
-
getUserDefaultCollections
Deprecated.since 10.3 usegetUserDefaultCollections(CoreSession)
instead- Since:
- 6.0
-
getUserDefaultCollections
Get user collections root document.- Parameters:
session
- the core session- Returns:
- the user collections root document
- Since:
- 10.3
-
doRemoveFromCollection
void doRemoveFromCollection(DocumentModel documentToBeRemoved, String collectionId, CoreSession session) - Since:
- 6.0
-
getUserDefaultCollections(CoreSession)
instead