Class Config

java.lang.Object
org.exoplatform.onlyoffice.Config
All Implemented Interfaces:
Externalizable, Serializable

public class Config extends Object implements Externalizable
Onlyoffice editor config for its JS API.
This class implements Externalizable for serialization in eXo cache (actual in cluster). Created by The eXo Platform SAS.
Version:
$Id: Editor.java 00000 Feb 12, 2016 pnedonosko $
Author:
Peter Nedonosko
See Also:
  • Field Details

    • DATETIME_FORMAT

      protected static final SimpleDateFormat DATETIME_FORMAT
      The Constant DATETIME_FORMAT.
    • NO_LANG

      protected static final String NO_LANG
      The Constant NO_LANG.
    • EMPTY

      protected static final String EMPTY
      The Constant EMPTY.
    • databaseId

      protected Long databaseId
  • Constructor Details

    • Config

      public Config()
      Instantiates a new config for use with Externalizable methods. User by serialization.
    • Config

      protected Config(String documentserverUrl, String platformRestUrl, String editorUrl, URI explorerUri, String documentType, String workspace, String path, String downloadUrl, EditorPage editorPage, Boolean isActivity, String docId, Config.Document document, Config.Editor editor)
      Editor config constructor.
      Parameters:
      documentserverUrl - the documentserver URL
      platformRestUrl - the platform url
      editorUrl - the editor url
      explorerUri - the explorer uri
      documentType - the document type
      workspace - the workspace
      path - the path
      downloadUrl - the download url
      editorPage - the editor page
      isActivity - the isActivity
      docId - the document ID
      document - the document
      editor - the editor
  • Method Details

    • getDatabaseId

      public Long getDatabaseId()
    • setDatabaseId

      public void setDatabaseId(Long databaseId)
    • editor

      public static Config.Builder editor(String documentserverUrl, String documentType, String workspace, String path, String docId)
      Editor.
      Parameters:
      documentserverUrl - the documentserver url
      documentType - the document type
      workspace - the workspace
      path - the path
      docId - the document ID
      Returns:
      the builder
    • fileUrl

      protected static String fileUrl(CharSequence baseUrl, String userId, String key)
      File url.
      Parameters:
      baseUrl - the platform url
      userId - the user id
      key - the key
      Returns:
      the string
    • callbackUrl

      protected static String callbackUrl(CharSequence baseUrl, String userId, String key)
      Callback url.
      Parameters:
      baseUrl - the platform url
      userId - the user id
      key - the key
      Returns:
      the string
    • getPlatformRestUrl

      public String getPlatformRestUrl()
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • getDocumentserverJsUrl

      public String getDocumentserverJsUrl()
      Gets the documentserver js url.
      Returns:
      the documentserverJsUrl
    • getDocumentserverUrl

      public String getDocumentserverUrl()
      Gets the documentserver url.
      Returns:
      the documentserverUrl
    • getToken

      public String getToken()
      Gets the token.
      Returns:
      the token
    • setToken

      public void setToken(String token)
      Sets the token.
      Parameters:
      token - the token
    • getWorkspace

      public String getWorkspace()
      Gets a workspace of the storage.
      Returns:
      the workspace
    • getPath

      public String getPath()
      Gets the path in storage.
      Returns:
      the path
    • isActivity

      public Boolean isActivity()
      Is activity.
      Returns:
      the isActivity
    • getEditorPage

      public EditorPage getEditorPage()
      Gets the editor page.
      Returns:
      the editorPage
    • getDocId

      public String getDocId()
      Gets the document ID in storage.
      Returns:
      the docId
    • getEditorUrl

      public String getEditorUrl()
      Gets the editor absolute URL.
      Returns:
      the editorUrl
    • getExplorerUrl

      public String getExplorerUrl()
      Gets the explorer absolute URL.
      Returns:
      the explorerUrl
    • getExplorerUri

      public URI getExplorerUri()
      Gets the explorer page URI.
      Returns:
      the explorer URI
    • getDownloadUrl

      public String getDownloadUrl()
      Gets the download url.
      Returns:
      the download url
    • getDocumentType

      public String getDocumentType()
      Gets the document type.
      Returns:
      the documentType
    • getDocument

      public Config.Document getDocument()
      Gets the document.
      Returns:
      the config
    • getOpenedTime

      public Long getOpenedTime()
      Gets the openedTime.
      Returns:
      the openedTime
    • getClosedTime

      public Long getClosedTime()
      Gets the closedTime.
      Returns:
      the closedTime
    • setOpenedTime

      public void setOpenedTime(Long openedTime)
      Sets the openedTime.
      Parameters:
      openedTime - the openedTime
    • setClosedTime

      public void setClosedTime(Long closedTime)
      Sets the closedTime.
      Parameters:
      closedTime - the closedTime
    • setEditorPage

      protected void setEditorPage(EditorPage editorPage)
      Sets the editorPage.
      Parameters:
      editorPage - the editorPage
    • setEditorUrl

      protected void setEditorUrl(String url)
      Sets the editor url.
      Parameters:
      url - the new editor url
    • getEditorConfig

      public Config.Editor getEditorConfig()
      Gets the editor config.
      Returns:
      the editor
    • setPreviousModified

      public void setPreviousModified(Calendar previousModified)
      Sets the previous modified.
      Parameters:
      previousModified - the new previous modified
    • getPreviousModified

      public Calendar getPreviousModified()
      Gets the previous modified.
      Returns:
      the previous modified
    • setSameModifier

      public void setSameModifier(Boolean samemodifier)
      Sets the same modifier.
      Parameters:
      samemodifier - the new same modifier
    • getSameModifier

      public Boolean getSameModifier()
      Gets the same modifier.
      Returns:
      the same modifier
    • getBackTo

      public String getBackTo()
      Gets the backTo.
      Returns:
      the backTo
    • setBackTo

      public void setBackTo(String backTo)
      Sets the backTo.
      Parameters:
      backTo - the backTo
    • forUser

      public Config forUser(String id, String name, String lang, String documentserverSecret)
      Create a copy of this editor but for another given user.
      Parameters:
      id - String
      name - String
      lang - String
      documentserverSecret - the documentserverSecret
      Returns:
      Config an instance of config similar to this but with another user in the editor
    • isCreated

      public boolean isCreated()
      Checks if is created.
      Returns:
      true, if is created
    • isOpen

      public boolean isOpen()
      Checks if is editor open.
      Returns:
      true, if is open
    • isClosed

      public boolean isClosed()
      Checks if is editor closed (including closing state).
      Returns:
      true, if is in closed or closing state
    • isClosing

      public boolean isClosing()
      Checks if is editor currently closing (saving the document). A closing state is a sub-form of closed state.
      Returns:
      true of document in closing (saving) state
    • open

      public void open()
      Mark this config as open: user opened this editor.
    • setOpen

      public void setOpen(boolean open)
    • closing

      public void closing()
      Mark this config as closing: user already closed this editor but document not yet saved in the storage. This state is actual for last user who will save the document submitted by the DS. Note that only already open editor can be set to closing state, otherwise this method will have not effect.
    • setClosing

      public void setClosing(boolean closing)
    • closed

      public void closed()
      Mark this config as closed: the editor closed, if it was last user in the editor, then its document should be saved in the storage.
    • setError

      public void setError(String error)
      Sets the error.
      Parameters:
      error - the new error
    • hasError

      public boolean hasError()
      Checks for error.
      Returns:
      true, if successful
    • getError

      public String getError()
      Gets the error.
      Returns:
      the error
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toJSON

      public String toJSON() throws org.exoplatform.ws.frameworks.json.impl.JsonException
      Return this config as JSON string.
      Returns:
      the string
      Throws:
      org.exoplatform.ws.frameworks.json.impl.JsonException - the json exception