Interface OnlyofficeEditorService

  • All Known Implementing Classes:
    OnlyofficeEditorServiceImpl

    public interface OnlyofficeEditorService
    Created by The eXo Platform SAS.
    Version:
    $Id: CloudDriveService.java 00000 Feb 14, 2013 pnedonosko $
    Author:
    Peter Nedonosko
    • Method Detail

      • getEditor

        Config getEditor​(String userId,
                         String workspace,
                         String path)
                  throws OnlyofficeEditorException,
                         javax.jcr.RepositoryException
        Return existing editor configuration for given user and node. If editor not open for given node or user then null will be returned. If user not valid then OnlyofficeEditorException will be thrown.
        Parameters:
        userId - String
        workspace - String
        path - String
        Returns:
        Config or null
        Throws:
        OnlyofficeEditorException - the onlyoffice editor exception
        javax.jcr.RepositoryException - the repository exception
      • getEditorByKey

        Config getEditorByKey​(String userId,
                              String key)
                       throws OnlyofficeEditorException,
                              javax.jcr.RepositoryException
        Return existing editor for given temporal key. If editor or user not found then null will be returned. If user not valid then OnlyofficeEditorException will be thrown.
        Parameters:
        userId - the user id
        key - the key, see getEditor(String, String, String)
        Returns:
        the editor by key
        Throws:
        OnlyofficeEditorException - the onlyoffice editor exception
        javax.jcr.RepositoryException - the repository exception
      • createViewer

        Config createViewer​(String userSchema,
                            String userHost,
                            int userPost,
                            String userId,
                            String workspace,
                            String docId)
                     throws OnlyofficeEditorException,
                            javax.jcr.RepositoryException
        Creates the viewer.
        Parameters:
        userSchema - the user schema
        userHost - the user host
        userPost - the user post
        userId - the user id
        workspace - the workspace
        docId - the doc id
        Returns:
        the config
        Throws:
        OnlyofficeEditorException - the onlyoffice editor exception
        javax.jcr.RepositoryException - the repository exception
      • updateDocument

        void updateDocument​(DocumentStatus status)
                     throws OnlyofficeEditorException,
                            javax.jcr.RepositoryException
        Update a configuration associated with given DocumentStatus instance. This operation will close the editor and it will not be usable after that.
        Parameters:
        status - DocumentStatus
        Throws:
        OnlyofficeEditorException - if editor exception happened
        javax.jcr.RepositoryException - if storage exception happened
      • initDocument

        String initDocument​(javax.jcr.Node node)
                     throws javax.jcr.RepositoryException
        Inits the document and returns an ID for use within editors. Node may be saved by this method if ID generation will be required, in this case it should be allowed to edit the node (not locked and user has write permissions).
        Parameters:
        node - the node of the document
        Returns:
        the string with document ID for use within editors
        Throws:
        javax.jcr.RepositoryException - the repository exception
      • initDocument

        String initDocument​(String workspace,
                            String path)
                     throws OnlyofficeEditorException,
                            javax.jcr.RepositoryException
        Inits the document and returns an ID for use within editors. Node will be saved by this method.
        Parameters:
        workspace - the workspace
        path - the path
        Returns:
        the string
        Throws:
        OnlyofficeEditorException - the onlyoffice editor exception
        javax.jcr.RepositoryException - the repository exception
      • getEditorLink

        String getEditorLink​(javax.jcr.Node node,
                             String scheme,
                             String host,
                             int port)
                      throws javax.jcr.RepositoryException,
                             EditorLinkNotFoundException
        Gets the editor page URL for opening at Platform server.
        Parameters:
        node - the node
        scheme - the scheme
        host - the host
        port - the port
        Returns:
        the editor link
        Throws:
        EditorLinkNotFoundException - the editor link not found exceptions
        javax.jcr.RepositoryException - the repository exception
      • getDocument

        javax.jcr.Node getDocument​(String workspace,
                                   String path)
                            throws javax.jcr.RepositoryException,
                                   BadParameterException
        Gets the document node by its path and optionally a repository workspace.
        Parameters:
        workspace - the workspace, can be null, then a default one will be used
        path - the path of a document
        Returns:
        the document or null if nothing found
        Throws:
        javax.jcr.RepositoryException - the repository exception
        BadParameterException - the bad parameter exeption
      • canDownloadBy

        boolean canDownloadBy​(String hostName)
        Check does given host can download document content by this service. It's optional feature, configurable and allow only configured Document server by default.
        Parameters:
        hostName - String
        Returns:
        true if client host with given name can download document content, false otherwise.
      • addListener

        void addListener​(OnlyofficeEditorListener listener)
        Add listener to the service.
        Parameters:
        listener - the listener
      • removeListener

        void removeListener​(OnlyofficeEditorListener listener)
        Remove listener from the service.
        Parameters:
        listener - the listener
      • addTypePlugin

        void addTypePlugin​(org.exoplatform.container.component.ComponentPlugin plugin)
        Adds DocumentTypePlugin to the service to check mimetypes of documents.
        Parameters:
        plugin - - the plugin to be added
      • getVersions

        List<Version> getVersions​(String workspace,
                                  String docId,
                                  int itemParPage,
                                  int pageNum)
                           throws Exception
        get the list of versions of the document with the given id.
        Parameters:
        workspace - the workspace
        docId - the document id
        itemParPage - the versions par page
        pageNum - the page number to load
        Returns:
        list of versions for node
        Throws:
        Exception - the exception
      • canEditDocument

        boolean canEditDocument​(javax.jcr.Node node)
                         throws javax.jcr.RepositoryException
        Checks if the node isn't locked and can be edited by the current user.
        Parameters:
        node - the node
        Returns:
        true, if the current user can edit the node
        Throws:
        javax.jcr.RepositoryException - the repository exeption
      • isDocumentMimeSupported

        boolean isDocumentMimeSupported​(javax.jcr.Node node)
                                 throws javax.jcr.RepositoryException
        Checks if the node has compatible mime-types.
        Parameters:
        node - the node
        Returns:
        true, if the node mime-types are supported
        Throws:
        javax.jcr.RepositoryException - the repository exeption
      • getDocumentById

        javax.jcr.Node getDocumentById​(String workspace,
                                       String uuid)
                                throws javax.jcr.RepositoryException,
                                       DocumentNotFoundException
        Gets the document node by its id and optionally a repository workspace.
        Parameters:
        workspace - the workspace, can be null, then a default one will be used
        uuid - the id of a document
        Returns:
        the document or null if nothing found
        Throws:
        DocumentNotFoundException - the document not found exception
        javax.jcr.RepositoryException - the repository exception
      • downloadVersion

        void downloadVersion​(String userId,
                             String key,
                             boolean coEdited,
                             boolean forcesaved,
                             String comment,
                             String contentUrl)
        Builds status object based on params. Obtains the config
        Parameters:
        userId - the userId
        key - the key
        coEdited - the coEdited
        forcesaved - the forceSaved
        comment - the comment
        contentUrl - the contentUrl
      • getLastModifier

        Config.Editor.User getLastModifier​(String key)
        Gets the last modifier userId.
        Parameters:
        key - the key
        Returns:
        the editor user
      • setLastModifier

        void setLastModifier​(String key,
                             String userId)
        Sets the last modifier userId.
        Parameters:
        key - the key
        userId - the userId
      • forceSave

        void forceSave​(String userId,
                       String key,
                       boolean download,
                       boolean coEdit,
                       boolean forcesaved,
                       String comment)
        Forces saving a document on document server.
        Parameters:
        userId - the userId
        key - the key
        download - the download
        coEdit - the coedit
        forcesaved - the forcesaved
        comment - the comment
      • validateToken

        boolean validateToken​(String token,
                              String key)
        Validates the JWT token received from the document server.
        Parameters:
        token - the token
        key - the document key
        Returns:
        true, if the token is correct, false otherwise
      • updateTitle

        void updateTitle​(String workspace,
                         String docId,
                         String title,
                         String userId)
        Updates title of a document.
        Parameters:
        workspace - the workspace
        docId - the docId
        title - the title
        userId - the userId
      • addFilePreferences

        void addFilePreferences​(javax.jcr.Node node,
                                String userId,
                                String path)
                         throws javax.jcr.RepositoryException
        Adds file preferences (path to symlink)
        Parameters:
        node - the node
        userId - the userId
        path - the path
        Throws:
        javax.jcr.RepositoryException - the repository exception
      • getDocumentServiceSecret

        String getDocumentServiceSecret()
      • closeWithoutModification

        void closeWithoutModification​(String userId,
                                      String key)