Interface Session<T extends QueryFilter>

    • Field Detail

      • PROP_ALLOW_DELETE_UNDELETABLE_DOCUMENTS

        static final String PROP_ALLOW_DELETE_UNDELETABLE_DOCUMENTS
        INTERNAL framework property allowing deletion of undeletable documents. Should only be used in tests.

        Note that even when this is set, a low-level blob provider may still disallow blob removal.

        Since:
        11.1
        See Also:
        Constant Field Values
      • PROP_RETENTION_STRICT_MODE_ENABLED

        static final String PROP_RETENTION_STRICT_MODE_ENABLED
        Property to enable retention strict mode. False by default.

        In strict mode, nobody can delete documents under retention or legal hold.

        Otherwise users member of the SecurityConstants.RECORDS_CLEANER_GROUP group can delete records.

        Since:
        2023.1
        See Also:
        Constant Field Values
    • Method Detail

      • getRepositoryName

        String getRepositoryName()
        Gets the repository that created this session.
        Returns:
        the repository
      • queryAndFetch

        IterableQueryResult queryAndFetch​(String query,
                                          String queryType,
                                          T queryFilter,
                                          boolean distinctDocuments,
                                          Object[] params)
        Does a query and fetch the individual results as maps.
      • queryProjection

        PartialList<Map<String,​Serializable>> queryProjection​(String query,
                                                                    String queryType,
                                                                    T queryFilter,
                                                                    boolean distinctDocuments,
                                                                    long countUpTo,
                                                                    Object[] params)
        Does a query and fetch the individual results as maps.
        Since:
        7.10-HF25, 8.10-HF06, 9.2
      • scroll

        ScrollResult<String> scroll​(String query,
                                    int batchSize,
                                    int keepAliveSeconds)
        Executes the given query and returns the first batch of results containing id of documents, next batch must be requested within the keepAliveSeconds delay.
        Since:
        8.4
      • scroll

        ScrollResult<String> scroll​(String query,
                                    T queryFilter,
                                    int batchSize,
                                    int keepAliveSeconds)
        Executes the given query and returns the first batch of results containing id of documents, next batch must be requested within the keepAliveSeconds delay.
        Since:
        10.3
      • scroll

        ScrollResult<String> scroll​(String scrollId)
        Get the next batch of result containing id of documents.
        Since:
        8.4
      • getLockManager

        LockManager getLockManager()
        Gets the lock manager for this session.
        Returns:
        the lock manager
        Since:
        7.4
      • save

        void save()
        Saves this session.
      • destroy

        void destroy()
        Destroys this session.
      • getRootDocument

        Document getRootDocument()
        Gets the root document in this repository.
        Returns:
        the root document
      • getNullDocument

        Document getNullDocument()
        Gets the null document, to be used as a fake parent to add placeless children.
        Returns:
        the null document
      • copy

        Document copy​(Document src,
                      Document dst,
                      String name)
        Copies the source document to the given folder.

        If the destination document is not a folder, an exception is thrown.

      • move

        Document move​(Document src,
                      Document dst,
                      String name)
        Moves the source document to the given folder.

        If the destination document is not a folder an exception is thrown.

        Parameters:
        src - the source document to move
        dst - the destination folder
        name - the new name of the document or null if the original name should be preserved
      • createProxy

        Document createProxy​(Document doc,
                             Document folder)
        Creates a generic proxy to the given document inside the given folder.
        Parameters:
        doc - the document
        folder - the folder
        Returns:
        the proxy
      • getProxies

        List<Document> getProxies​(Document doc,
                                  Document folder)
        Finds the proxies for a document. If the folder is not null, the search will be limited to its children.

        If the document is a version, then only proxies to that version will be looked up.

        Parameters:
        doc - the document or version
        folder - the folder, or null
        Returns:
        the list of proxies if any is found otherwise an empty list
        Since:
        1.4.1 for the case where doc is a proxy
      • getProxies

        List<Document> getProxies​(Document doc)
        Finds the proxies for a document. (The document may be a version or a live document)
        Parameters:
        doc - the document or version
        Returns:
        the list of proxies if any is found otherwise an empty list
        Since:
        10.2
      • setProxyTarget

        void setProxyTarget​(Document proxy,
                            Document target)
        Sets a proxies' target.

        The target must have the same version series as the proxy.

        Parameters:
        proxy - the proxy
        target - the new target
        Since:
        5.5
      • importDocument

        Document importDocument​(String uuid,
                                Document parent,
                                String name,
                                String typeName,
                                Map<String,​Serializable> properties)
        Imports a document with a given id and parent.

        The document can then be filled with the normal imported properties.

        Parameters:
        uuid - the document uuid
        parent - the document parent, or null for a version
        name - the document name in its parent
        typeName - the document type, or ecm:proxy for a proxy
        properties - system properties of the document, which will vary depending whether it's a live document, a version or a proxy (see the various IMPORT_* constants of CoreSession)
        Returns:
        a writable Document, even for proxies and versions
      • getVersion

        Document getVersion​(String versionableId,
                            VersionModel versionModel)
        Gets a version of a document, given its versionable id and label.

        The version model contains the label of the version to look for. On return, it is filled with the version's description and creation date.

        Parameters:
        versionableId - the versionable id
        versionModel - the version model
        Returns:
        the version, or null if not found
      • isNegativeAclAllowed

        boolean isNegativeAclAllowed()
        Returns true if negative ACLs are allowed.

        Negative ACLs are ACLs that include an ACE with a deny (isGranted=false). This does not include the full-blocking ACE for Everyone/Everything, which is always allowed.

        Returns:
        true if negative ACLs are allowed
        Since:
        6.0
      • setACP

        void setACP​(Document doc,
                    ACP acp,
                    boolean overwrite)
      • updateReadACLs

        void updateReadACLs​(Collection<String> docIds)
        Updates the Read ACLs for some documents.
        Parameters:
        docIds - the document ids
        Since:
        9.10
      • isFulltextStoredInBlob

        boolean isFulltextStoredInBlob()
        Checks if fulltext extracted from the binary fields is internally stored as a blob.
        Returns:
        true if fulltext from binaries is store as a blob
        Since:
        11.1
      • getBinaryFulltext

        Map<String,​String> getBinaryFulltext​(String id)
        Gets the fulltext extracted from the binary fields.
        Since:
        5.9.3
      • removeDocument

        void removeDocument​(String id)
        Removes a document. In DBS, this removal is done without checking if proxies are targeting the document, or if it has any children.
        Parameters:
        id - the document id
        Since:
        11.1
      • start

        void start()
        Start the transaction.
        Since:
        11.1
      • end

        void end()
        Called just before the transaction is committed or rolled back.
        Since:
        11.1
      • commit

        void commit()
        Commit the transaction.
        Since:
        11.1
      • rollback

        void rollback()
        Rollback the transaction.
        Since:
        11.1