Class CollectionManagerImpl

java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.collections.core.CollectionManagerImpl
All Implemented Interfaces:
CollectionManager, Adaptable, Component, Extensible, TimestampedService

public class CollectionManagerImpl extends DefaultComponent implements CollectionManager
Since:
5.9.3
  • Constructor Details

    • CollectionManagerImpl

      public CollectionManagerImpl()
  • Method Details

    • disableEvents

      public static void disableEvents(DocumentModel doc)
    • 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 interface CollectionManager
      Parameters:
      collection - the collection
      documentToBeAdded - the document to be added
      session - 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 interface CollectionManager
      Parameters:
      collection - the collection
      documentListToBeAdded - the list of document to be added
      session - 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 interface CollectionManager
      Parameters:
      newTitle - the title of the new collection
      newDescription - the description of the new collection
      documentToBeAdded - the document to be added
      session - 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 interface CollectionManager
      Parameters:
      newTitle - the title of the new collection
      newDescription - the description of the new collection
      documentListToBeAdded - the list of document to be added
      session - the core session
    • canAddToCollection

      public boolean canAddToCollection(DocumentModel collection, CoreSession session)
      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 interface CollectionManager
      Parameters:
      collection - the collection
      session - 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

      public boolean canManage(DocumentModel collection, CoreSession session)
      Description copied from interface: CollectionManager
      Check that the given core session has permission to manage the collection.
      Specified by:
      canManage in interface CollectionManager
      Parameters:
      collection - the collection
      session - 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

      protected void checkCanCollectInCollection(DocumentModel collection, CoreSession session)
      Since:
      8.4
    • createCollection

      protected DocumentModel createCollection(String newTitle, String newDescription, DocumentModel context, CoreSession session)
    • getUserDefaultCollections

      public DocumentModel getUserDefaultCollections(CoreSession session)
      Description copied from interface: CollectionManager
      Get user collections root document.
      Specified by:
      getUserDefaultCollections in interface CollectionManager
      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 interface CollectionManager
      Parameters:
      collectionMember - the document
      session - 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 interface CollectionManager
      Parameters:
      collectionMember - the document
      maxResult - the limit
      session - the core session
      Returns:
      the list of maxResult first visible collections the collectionMember belong to
    • hasVisibleCollection

      public boolean hasVisibleCollection(DocumentModel collectionMember, CoreSession session)
      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 interface CollectionManager
      Parameters:
      collectionMember - the document
      session - the core session
      Returns:
      true if collectionMember has at least one collection on which the session has READ permission
    • isCollectable

      public boolean isCollectable(DocumentModel doc)
      Description copied from interface: CollectionManager
      Check that a document can be added to a collection.
      Specified by:
      isCollectable in interface CollectionManager
      Parameters:
      doc - the document
      Returns:
      true if the document can be added to the collection
    • isCollected

      public boolean isCollected(DocumentModel doc)
      Description copied from interface: CollectionManager
      Check that a document has already been added to a collection.
      Specified by:
      isCollected in interface CollectionManager
      Parameters:
      doc - the document
      Returns:
      true if the document has already been added to a collection
    • isCollection

      public boolean isCollection(DocumentModel doc)
      Description copied from interface: CollectionManager
      Check that a document is a collection.
      Specified by:
      isCollection in interface CollectionManager
      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 interface CollectionManager
      Parameters:
      collection - the collection
      document - the document to check
      session - the session
    • processCopiedCollection

      public void processCopiedCollection(DocumentModel collection)
      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 interface CollectionManager
      Parameters:
      collection - the collection
    • processRemovedCollection

      public void processRemovedCollection(DocumentModel collection)
      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 interface CollectionManager
      Parameters:
      collection - the collection
    • processRemovedCollectionMember

      public void processRemovedCollectionMember(DocumentModel collectionMember)
      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 interface CollectionManager
      Parameters:
      collectionMember - the document
    • processRestoredCollection

      public void processRestoredCollection(DocumentModel collection, DocumentModel version)
      Description copied from interface: CollectionManager
      Restore the collection members of the version.
      Specified by:
      processRestoredCollection in interface CollectionManager
      Parameters:
      collection - the collection
      version - 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 interface CollectionManager
      Parameters:
      collection - the collection
      documentListToBeRemoved - the document to be removed
      session - 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 interface CollectionManager
      Parameters:
      collection - the collection
      documentToBeRemoved - the document to be removed
      session - the core session
    • doRemoveFromCollection

      public void doRemoveFromCollection(DocumentModel documentToBeRemoved, String collectionId, CoreSession session)
      Specified by:
      doRemoveFromCollection in interface CollectionManager
    • 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 interface CollectionManager
    • 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 interface CollectionManager
      Parameters:
      session - the session
      collection - the collection
      member1 - the member1
      member2 - the member2
      Returns:
      true if successfully moved