Class WebdavDocumentRepository

    • Constructor Detail

      • WebdavDocumentRepository

        public WebdavDocumentRepository()
    • Method Detail

      • createAttachmentNode

        public void createAttachmentNode​(javax.jcr.Session session,
                                         SimpleDocument attachment)
                                  throws javax.jcr.RepositoryException,
                                         IOException
        Description copied from interface: WebdavRepository
        Create a new node for the specified attachment so that the file may be accessed through webdav. For an attachment, it can exist in webdav one, and only one, content language of the attachment.
        Specified by:
        createAttachmentNode in interface WebdavRepository
        Parameters:
        session - the JCR session.
        attachment - the attachment.
        Throws:
        javax.jcr.RepositoryException
        IOException
      • updateNodeAttachment

        public void updateNodeAttachment​(javax.jcr.Session session,
                                         SimpleDocument attachment)
                                  throws javax.jcr.RepositoryException,
                                         IOException
        Description copied from interface: WebdavRepository
        Update the node using the SimpleDocument. For an attachment, it can exist in webdav one, and only one, content language of the attachment.
        Specified by:
        updateNodeAttachment in interface WebdavRepository
        Parameters:
        session - the JCR session.
        attachment - the attachment.
        Throws:
        javax.jcr.RepositoryException
        IOException
      • moveNodeAttachment

        public void moveNodeAttachment​(javax.jcr.Session session,
                                       SimpleDocument attachment,
                                       String targetComponentInstanceId)
                                throws javax.jcr.RepositoryException,
                                       IOException
        Description copied from interface: WebdavRepository
        Move the specified attachment to the specified component instance id.
        Specified by:
        moveNodeAttachment in interface WebdavRepository
        Parameters:
        session - the JCR session.
        attachment - the attachment to move to another component instance identifier.
        targetComponentInstanceId - the identifier of the target component instance.
        Throws:
        javax.jcr.RepositoryException
        IOException
      • getDocumentIdentifierNode

        protected javax.jcr.Node getDocumentIdentifierNode​(javax.jcr.Session session,
                                                           SimpleDocument attachment)
                                                    throws javax.jcr.RepositoryException
        Gets the webdav document identifier node from the specified attachment.
        Parameters:
        session - the JCR session.
        attachment - the attachment from which the webdav document identifier JCR node is searched.
        Returns:
        the node if found, null otherwise.
        Throws:
        javax.jcr.RepositoryException
      • getDocumentContentLanguageNode

        protected javax.jcr.Node getDocumentContentLanguageNode​(javax.jcr.Session session,
                                                                SimpleDocument attachment,
                                                                String language)
                                                         throws javax.jcr.RepositoryException
        Gets the webdav document content language node from the specified attachment.
        Parameters:
        session - the JCR session.
        attachment - the attachment from which the webdav document content language JCR node is searched.
        language - the aimed content language.
        Returns:
        the node if found, null otherwise.
        Throws:
        javax.jcr.RepositoryException
      • deleteAttachmentContentNode

        public void deleteAttachmentContentNode​(javax.jcr.Session session,
                                                SimpleDocument attachment,
                                                String language)
                                         throws javax.jcr.RepositoryException
        Description copied from interface: WebdavRepository
        Delete the node associated to the specified language content attachment.
        Specified by:
        deleteAttachmentContentNode in interface WebdavRepository
        Parameters:
        session - the JCR session.
        attachment - the attachment.
        language - the aimed language content to delete.
        Throws:
        javax.jcr.RepositoryException
      • isNodeLocked

        public boolean isNodeLocked​(javax.jcr.Session session,
                                    SimpleDocument attachment)
                             throws javax.jcr.RepositoryException
        Description copied from interface: WebdavRepository
        Indicate if the node for the specified attachment is currently locked (for example by Office in the case of a webdav online edition).
        Specified by:
        isNodeLocked in interface WebdavRepository
        Parameters:
        session - the JCR session.
        attachment - the attachment.
        Returns:
        true if the node is locked - false otherwise.
        Throws:
        javax.jcr.RepositoryException
      • updateAttachmentBinaryContent

        public void updateAttachmentBinaryContent​(javax.jcr.Session session,
                                                  SimpleDocument attachment)
                                           throws javax.jcr.RepositoryException,
                                                  IOException
        Description copied from interface: WebdavRepository
        Update the file content of the specified attachment without modifying its metadata.
        Specified by:
        updateAttachmentBinaryContent in interface WebdavRepository
        Parameters:
        session - the JCR session.
        attachment - the attachment for which the file content will be updated with the ralated webdav content.
        Throws:
        javax.jcr.RepositoryException
        IOException
      • addFolder

        protected javax.jcr.Node addFolder​(javax.jcr.Node parent,
                                           String name)
                                    throws javax.jcr.RepositoryException
        Add a folder node into the repository
        Parameters:
        parent - the parent node
        name - the name of the new node
        Returns:
        the created node.
        Throws:
        javax.jcr.RepositoryException
      • addExclusiveFolder

        protected javax.jcr.Node addExclusiveFolder​(javax.jcr.Node parent,
                                                    String name)
                                             throws javax.jcr.RepositoryException
        Adds a folder node into the repository and removes all others so that it exists only the folder named like specified. If the folder already exists, the existing is kept and no folder is created, but potential other existing folders are removed.
        Parameters:
        parent - the parent node
        name - the name of the new node
        Returns:
        the created or already existing node.
        Throws:
        javax.jcr.RepositoryException
      • addFile

        protected javax.jcr.Node addFile​(javax.jcr.Node folder,
                                         SimpleDocument attachment)
                                  throws javax.jcr.RepositoryException,
                                         IOException
        Add a file node into the repository
        Parameters:
        folder - the folder node containing the file node.
        attachment - the attachment for the file.
        Returns:
        the created node.
        Throws:
        javax.jcr.RepositoryException
        IOException
      • getContentEditionLanguage

        public String getContentEditionLanguage​(javax.jcr.Session session,
                                                SimpleDocument attachment)
                                         throws javax.jcr.RepositoryException
        Description copied from interface: WebdavRepository
        Gets the current content edition language of the specified attachment. If several webdav document exists (several content languages), then the one which has the highest modified date is taken into account.
        Specified by:
        getContentEditionLanguage in interface WebdavRepository
        Parameters:
        session - the JCR session.
        attachment - the attachment.
        Returns:
        the content edition language if the specified attachment exists in the webdav repository, null otherwise.
        Throws:
        javax.jcr.RepositoryException
      • getContentEditionSize

        public long getContentEditionSize​(javax.jcr.Session session,
                                          SimpleDocument attachment)
                                   throws javax.jcr.RepositoryException
        Description copied from interface: WebdavRepository
        Gets the current content edition size of the specified attachment. If several webdav document exists (several content languages), then the one which has the highest modified date is taken into account.
        Specified by:
        getContentEditionSize in interface WebdavRepository
        Parameters:
        session - the JCR session.
        attachment - the attachment.
        Returns:
        the content edition size if the specified attachment exists in the webdav repository, -1 otherwise.
        Throws:
        javax.jcr.RepositoryException
      • getDescriptor

        public Optional<WebdavContentDescriptor> getDescriptor​(javax.jcr.Session session,
                                                               SimpleDocument attachment)
                                                        throws javax.jcr.RepositoryException
        Description copied from interface: WebdavRepository
        Gets the current webdav descriptor of the specified attachment. If several webdav document exists (several content languages), then the one which has the highest modified date is taken into account.
        Specified by:
        getDescriptor in interface WebdavRepository
        Parameters:
        session - the JCR session.
        attachment - the attachment.
        Returns:
        the optional content edition webdav descriptor if the specified attachment exists in the webdav repository.
        Throws:
        javax.jcr.RepositoryException - on JCR access error.
      • updateContentFrom

        public void updateContentFrom​(javax.jcr.Session session,
                                      SimpleDocument document,
                                      InputStream input)
                               throws javax.jcr.RepositoryException
        Description copied from interface: WebdavRepository
        Updates a document content into the WEBDAV repository.

        If several webdav document exists (several content languages), then the one which has the highest modified date is taken into account.

        Specified by:
        updateContentFrom in interface WebdavRepository
        Parameters:
        session - the JCR session.
        document - the aimed document.
        input - the data to write.
        Throws:
        javax.jcr.RepositoryException
      • loadContentInto

        public void loadContentInto​(javax.jcr.Session session,
                                    SimpleDocument document,
                                    OutputStream output)
                             throws javax.jcr.RepositoryException,
                                    IOException
        Description copied from interface: WebdavRepository
        Reads a document content from the WEBDAV repository and writes it into given output.

        If several webdav document exists (several content languages), then the one which has the highest modified date is taken into account.

        Specified by:
        loadContentInto in interface WebdavRepository
        Parameters:
        session - the JCR session.
        document - the aimed document.
        output - the stream to write into.
        Throws:
        javax.jcr.RepositoryException
        IOException