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
  • Field Details

  • Method Details

    • 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
    • createEditor

      Config createEditor(String userSchema, String userHost, int userPost, String userId, String workspace, String docId, String mode) throws OnlyofficeEditorException, javax.jcr.RepositoryException
      Create an editor configuration for given user and node.
      Parameters:
      userSchema - the schema
      userHost - the host
      userPost - the user post
      userId - String
      workspace - String
      docId - String a document reference in the workspace, see initDocument(String, String)
      Returns:
      Config instance in case of successful creation or null if local file type not supported.
      Throws:
      OnlyofficeEditorException - if editor exception happened
      javax.jcr.RepositoryException - if storage exception happened
    • 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
    • getContent

      DocumentContent getContent(String userId, String fileKey) throws OnlyofficeEditorException, javax.jcr.RepositoryException
      Get file content.
      Parameters:
      userId - String
      fileKey - String
      Returns:
      DocumentContent
      Throws:
      OnlyofficeEditorException - the onlyoffice editor exception
      javax.jcr.RepositoryException - the repository exception
    • 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.
    • getState

      ChangeState getState(String userId, String fileKey) throws OnlyofficeEditorException
      Local state of editing document.
      Parameters:
      userId - String
      fileKey - String
      Returns:
      ChangeState
      Throws:
      OnlyofficeEditorException - the onlyoffice editor exception
    • 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
    • getDocumentId

      String getDocumentId(javax.jcr.Node node) throws DocumentNotFoundException, javax.jcr.RepositoryException
      Gets the document ID for given node. It will return an ID for use within an editor, otherwise null will be returned.
      Parameters:
      node - the node
      Returns:
      the document ID or null
      Throws:
      DocumentNotFoundException - the document not found exception
      javax.jcr.RepositoryException - the repository exception
      See Also:
    • 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
    • getUser

      Config.Editor.User getUser(String key, String userId)
      Gets a user.
      Parameters:
      key - the key
      userId - the userId
      Returns:
      the user
    • 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
    • getUser

      org.exoplatform.services.organization.User getUser(String username) throws OnlyofficeEditorException
      Gets the user.
      Parameters:
      username - the username
      Returns:
      the user
      Throws:
      OnlyofficeEditorException - the onlyoffice editor exception
    • 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)
    • isDocumentCoedited

      boolean isDocumentCoedited(String key)
      Checks if the document is opened for edition by multiple users
      Parameters:
      key - Document key
      Returns:
      Boolean true if the document is opened for edition by multiple users
    • convertNodeContentToPdf

      byte[] convertNodeContentToPdf(javax.jcr.Node node, String userId)