Interface CollectionManager

    • Method Detail

      • addToCollection

        void addToCollection​(DocumentModel collection,
                             DocumentModel documentToBeAdded,
                             CoreSession session)
        Add a document to a collection.
        Parameters:
        collection - the collection
        documentToBeAdded - the document to be added
        session - the core session
      • addToCollection

        void addToCollection​(DocumentModel collection,
                             List<DocumentModel> documentListToBeAdded,
                             CoreSession session)
        Add a list of document to a collection.
        Parameters:
        collection - the collection
        documentListToBeAdded - the list of document to be added
        session - 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 collection
        newDescription - the description of the new collection
        documentToBeAdded - the document to be added
        session - 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 collection
        newDescription - the description of the new collection
        documentListToBeAdded - the list of document to be added
        documentManager - the core session
      • canAddToCollection

        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.
        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

        boolean canManage​(DocumentModel collection,
                          CoreSession session)
        Check that the given core session has permission to manage the collection.
        Parameters:
        collection - the collection
        session - the core session
        Returns:
        true if the core session has permission to manage the collection
      • getVisibleCollection

        List<DocumentModel> getVisibleCollection​(DocumentModel collectionMember,
                                                 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).
        Parameters:
        collectionMember - the document
        session - 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 document
        maxResult - the limit
        session - the core session
        Returns:
        the list of maxResult first visible collections the collectionMember belong to
      • hasVisibleCollection

        boolean hasVisibleCollection​(DocumentModel collectionMember,
                                     CoreSession session)
        Check that the given core session has READ permission on at least one collection of the given document.
        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

        boolean isCollectable​(DocumentModel document)
        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

        boolean isCollected​(DocumentModel document)
        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

        boolean isCollection​(DocumentModel document)
        Check that a document is a collection.
        Parameters:
        document - the document
        Returns:
        true if the document is a collection
      • isInCollection

        boolean isInCollection​(DocumentModel collection,
                               DocumentModel document,
                               CoreSession session)
        Check whether a document is in a given collection.
        Parameters:
        collection - the collection
        document - the document to check
        session - 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 session
        collection - the collection
        member1 - the member1
        member2 - the member2
        Returns:
        true if successfully moved
        Since:
        8.4
      • processCopiedCollection

        void processCopiedCollection​(DocumentModel collection)
        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

        void processRemovedCollection​(DocumentModel collection)
        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

        void processRemovedCollectionMember​(DocumentModel collectionMember)
        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

        void processRestoredCollection​(DocumentModel collection,
                                       DocumentModel version)
        Restore the collection members of the version.
        Parameters:
        collection - the collection
        version - 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 collection
        documentListToBeRemoved - the document to be removed
        session - the core session
      • removeFromCollection

        void removeFromCollection​(DocumentModel collection,
                                  DocumentModel documentToBeRemoved,
                                  CoreSession session)
        Remove a document from a collection.
        Parameters:
        collection - the collection
        documentToBeRemoved - the document to be removed
        session - the core session
      • getUserDefaultCollections

        DocumentModel getUserDefaultCollections​(CoreSession session)
        Get user collections root document.
        Parameters:
        session - the core session
        Returns:
        the user collections root document
        Since:
        10.3