Package org.exoplatform.onlyoffice
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 implementsExternalizablefor 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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConfig.BuilderThe Class Builder.static classConfig.DocumentThe Onlyoffice Document.static classConfig.EditorThe Onlyoffice Editor.
-
Field Summary
Fields Modifier and Type Field Description protected LongdatabaseIdprotected static SimpleDateFormatDATETIME_FORMATThe Constant DATETIME_FORMAT.protected static StringEMPTYThe Constant EMPTY.protected static StringNO_LANGThe Constant NO_LANG.
-
Constructor Summary
Constructors Modifier Constructor Description Config()Instantiates a new config for use withExternalizablemethods.protectedConfig(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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static StringcallbackUrl(CharSequence baseUrl, String userId, String key)Callback url.voidclosed()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.voidclosing()Mark this config as closing: user already closed this editor but document not yet saved in the storage.static Config.Buildereditor(String documentserverUrl, String documentType, String workspace, String path, String docId)Editor.booleanequals(Object obj)protected static StringfileUrl(CharSequence baseUrl, String userId, String key)File url.ConfigforUser(String id, String name, String lang, String documentserverSecret)Create a copy of this editor but for another given user.LonggetClosedTime()Gets the closedTime.LonggetDatabaseId()StringgetDocId()Gets the document ID in storage.Config.DocumentgetDocument()Gets the document.StringgetDocumentserverJsUrl()Gets the documentserver js url.StringgetDocumentserverUrl()Gets the documentserver url.StringgetDocumentType()Gets the document type.StringgetDownloadUrl()Gets the download url.Config.EditorgetEditorConfig()Gets the editor config.EditorPagegetEditorPage()Gets the editor page.StringgetEditorUrl()Gets the editor absolute URL.StringgetError()Gets the error.URIgetExplorerUri()Gets the explorer page URI.StringgetExplorerUrl()Gets the explorer absolute URL.LonggetOpenedTime()Gets the openedTime.StringgetPath()Gets the path in storage.StringgetPlatformRestUrl()CalendargetPreviousModified()Gets the previous modified.BooleangetSameModifier()Gets the same modifier.StringgetToken()Gets the token.StringgetWorkspace()Gets a workspace of the storage.booleanhasError()Checks for error.BooleanisActivity()Is activity.booleanisClosed()Checks if is editor closed (including closing state).booleanisClosing()Checks if is editor currently closing (saving the document).booleanisCreated()Checks if is created.booleanisOpen()Checks if is editor open.voidopen()Mark this config as open: user opened this editor.voidreadExternal(ObjectInput in)voidsetClosedTime(Long closedTime)Sets the closedTime.voidsetClosing(boolean closing)voidsetDatabaseId(Long databaseId)protected voidsetEditorPage(EditorPage editorPage)Sets the editorPage.protected voidsetEditorUrl(String url)Sets the editor url.voidsetError(String error)Sets the error.voidsetOpen(boolean open)voidsetOpenedTime(Long openedTime)Sets the openedTime.voidsetPreviousModified(Calendar previousModified)Sets the previous modified.voidsetSameModifier(Boolean samemodifier)Sets the same modifier.voidsetToken(String token)Sets the token.StringtoJSON()Return this config as JSON string.StringtoString()voidwriteExternal(ObjectOutput out)
-
-
-
Field Detail
-
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 Detail
-
Config
public Config()
Instantiates a new config for use withExternalizablemethods. 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 URLplatformRestUrl- the platform urleditorUrl- the editor urlexplorerUri- the explorer uridocumentType- the document typeworkspace- the workspacepath- the pathdownloadUrl- the download urleditorPage- the editor pageisActivity- the isActivitydocId- the document IDdocument- the documenteditor- the editor
-
-
Method Detail
-
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 urldocumentType- the document typeworkspace- the workspacepath- the pathdocId- the document ID- Returns:
- the builder
-
fileUrl
protected static String fileUrl(CharSequence baseUrl, String userId, String key)
File url.- Parameters:
baseUrl- the platform urluserId- the user idkey- the key- Returns:
- the string
-
callbackUrl
protected static String callbackUrl(CharSequence baseUrl, String userId, String key)
Callback url.- Parameters:
baseUrl- the platform urluserId- the user idkey- the key- Returns:
- the string
-
getPlatformRestUrl
public String getPlatformRestUrl()
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
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
-
forUser
public Config forUser(String id, String name, String lang, String documentserverSecret)
Create a copy of this editor but for another given user.
-
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
-
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
-
-