Package org.exoplatform.onlyoffice
Interface OnlyofficeEditorService
-
- All Known Implementing Classes:
OnlyofficeEditorServiceImpl
public interface OnlyofficeEditorServiceCreated by The eXo Platform SAS.- Version:
- $Id: CloudDriveService.java 00000 Feb 14, 2013 pnedonosko $
- Author:
- Peter Nedonosko
-
-
Field Summary
Fields Modifier and Type Field Description static StringEDIT_MODEThe edit mode.static StringEDITOR_CLOSED_EVENTThe editor closed event.static StringEDITOR_ERROR_EVENTThe editor error event.static StringEDITOR_OPENED_EVENTThe editor opened event.static StringEDITOR_SAVED_EVENTThe editor saved event.static StringEDITOR_VERSION_EVENTThe editor version event.static StringVIEW_MODEThe view mode.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddFilePreferences(javax.jcr.Node node, String userId, String path)Adds file preferences (path to symlink)voidaddListener(OnlyofficeEditorListener listener)Add listener to the service.voidaddTypePlugin(org.exoplatform.container.component.ComponentPlugin plugin)Adds DocumentTypePlugin to the service to check mimetypes of documents.booleancanDownloadBy(String hostName)Check does given host can download document content by this service.booleancanEditDocument(javax.jcr.Node node)Checks if the node isn't locked and can be edited by the current user.voidcloseWithoutModification(String userId, String key)ConfigcreateEditor(String userSchema, String userHost, int userPost, String userId, String workspace, String docId)Create an editor configuration for given user and node.ConfigcreateViewer(String userSchema, String userHost, int userPost, String userId, String workspace, String docId)Creates the viewer.voiddownloadVersion(String userId, String key, boolean coEdited, boolean forcesaved, String comment, String contentUrl)Builds status object based on params.voidforceSave(String userId, String key, boolean download, boolean coEdit, boolean forcesaved, String comment)Forces saving a document on document server.DocumentContentgetContent(String userId, String fileKey)Get file content.javax.jcr.NodegetDocument(String workspace, String path)Gets the document node by its path and optionally a repository workspace.javax.jcr.NodegetDocumentById(String workspace, String uuid)Gets the document node by its id and optionally a repository workspace.StringgetDocumentId(javax.jcr.Node node)Gets the document ID for given node.StringgetDocumentServiceSecret()ConfiggetEditor(String userId, String workspace, String path)Return existing editor configuration for given user and node.ConfiggetEditorByKey(String userId, String key)Return existing editor for given temporal key.StringgetEditorLink(javax.jcr.Node node, String scheme, String host, int port)Gets the editor page URL for opening at Platform server.Config.Editor.UsergetLastModifier(String key)Gets the last modifier userId.ChangeStategetState(String userId, String fileKey)Local state of editing document.org.exoplatform.services.organization.UsergetUser(String username)Gets the user.Config.Editor.UsergetUser(String key, String userId)Gets a user.List<Version>getVersions(String workspace, String docId, int itemParPage, int pageNum)get the list of versions of the document with the given id.StringinitDocument(String workspace, String path)Inits the document and returns an ID for use within editors.StringinitDocument(javax.jcr.Node node)Inits the document and returns an ID for use within editors.booleanisDocumentMimeSupported(javax.jcr.Node node)Checks if the node has compatible mime-types.voidremoveListener(OnlyofficeEditorListener listener)Remove listener from the service.voidsetLastModifier(String key, String userId)Sets the last modifier userId.voidupdateDocument(DocumentStatus status)Update a configuration associated with given DocumentStatus instance.voidupdateTitle(String workspace, String docId, String title, String userId)Updates title of a document.booleanvalidateToken(String token, String key)Validates the JWT token received from the document server.
-
-
-
Field Detail
-
EDIT_MODE
static final String EDIT_MODE
The edit mode.- See Also:
- Constant Field Values
-
VIEW_MODE
static final String VIEW_MODE
The view mode.- See Also:
- Constant Field Values
-
EDITOR_OPENED_EVENT
static final String EDITOR_OPENED_EVENT
The editor opened event.- See Also:
- Constant Field Values
-
EDITOR_CLOSED_EVENT
static final String EDITOR_CLOSED_EVENT
The editor closed event.- See Also:
- Constant Field Values
-
EDITOR_SAVED_EVENT
static final String EDITOR_SAVED_EVENT
The editor saved event.- See Also:
- Constant Field Values
-
EDITOR_VERSION_EVENT
static final String EDITOR_VERSION_EVENT
The editor version event.- See Also:
- Constant Field Values
-
EDITOR_ERROR_EVENT
static final String EDITOR_ERROR_EVENT
The editor error event.- See Also:
- Constant Field Values
-
-
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 thennullwill be returned. If user not valid then OnlyofficeEditorException will be thrown.- Parameters:
userId-Stringworkspace-Stringpath-String- Returns:
Configornull- Throws:
OnlyofficeEditorException- the onlyoffice editor exceptionjavax.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 thennullwill be returned. If user not valid then OnlyofficeEditorException will be thrown.- Parameters:
userId- the user idkey- the key, seegetEditor(String, String, String)- Returns:
- the editor by key
- Throws:
OnlyofficeEditorException- the onlyoffice editor exceptionjavax.jcr.RepositoryException- the repository exception
-
createEditor
Config createEditor(String userSchema, String userHost, int userPost, String userId, String workspace, String docId) throws OnlyofficeEditorException, javax.jcr.RepositoryException
Create an editor configuration for given user and node.- Parameters:
userSchema- the schemauserHost- the hostuserPost- the user postuserId-Stringworkspace-StringdocId-Stringa document reference in the workspace, seeinitDocument(String, String)- Returns:
Configinstance in case of successful creation ornullif local file type not supported.- Throws:
OnlyofficeEditorException- if editor exception happenedjavax.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 schemauserHost- the user hostuserPost- the user postuserId- the user idworkspace- the workspacedocId- the doc id- Returns:
- the config
- Throws:
OnlyofficeEditorException- the onlyoffice editor exceptionjavax.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 happenedjavax.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 workspacepath- the path- Returns:
- the string
- Throws:
OnlyofficeEditorException- the onlyoffice editor exceptionjavax.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 nodescheme- the schemehost- the hostport- the port- Returns:
- the editor link
- Throws:
EditorLinkNotFoundException- the editor link not found exceptionsjavax.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 benull, then a default one will be usedpath- the path of a document- Returns:
- the document or
nullif nothing found - Throws:
javax.jcr.RepositoryException- the repository exceptionBadParameterException- the bad parameter exeption
-
getContent
DocumentContent getContent(String userId, String fileKey) throws OnlyofficeEditorException, javax.jcr.RepositoryException
Get file content.- Parameters:
userId-StringfileKey-String- Returns:
DocumentContent- Throws:
OnlyofficeEditorException- the onlyoffice editor exceptionjavax.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:
trueif client host with given name can download document content,falseotherwise.
-
getState
ChangeState getState(String userId, String fileKey) throws OnlyofficeEditorException
Local state of editing document.- Parameters:
userId-StringfileKey-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 workspacedocId- the document iditemParPage- the versions par pagepageNum- 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.RepositoryExceptionChecks 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, otherwisenullwill be returned.- Parameters:
node- the node- Returns:
- the document ID or
null - Throws:
DocumentNotFoundException- the document not found exceptionjavax.jcr.RepositoryException- the repository exception- See Also:
initDocument(String, String),canEditDocument(Node)
-
isDocumentMimeSupported
boolean isDocumentMimeSupported(javax.jcr.Node node) throws javax.jcr.RepositoryExceptionChecks 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 benull, then a default one will be useduuid- the id of a document- Returns:
- the document or
nullif nothing found - Throws:
DocumentNotFoundException- the document not found exceptionjavax.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 userIdkey- the keycoEdited- the coEditedforcesaved- the forceSavedcomment- the commentcontentUrl- 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 keyuserId- 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 userIdkey- the keydownload- the downloadcoEdit- the coeditforcesaved- the forcesavedcomment- the comment
-
getUser
Config.Editor.User getUser(String key, String userId)
Gets a user.- Parameters:
key- the keyuserId- the userId- Returns:
- the user
-
validateToken
boolean validateToken(String token, String key)
Validates the JWT token received from the document server.- Parameters:
token- the tokenkey- 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 workspacedocId- the docIdtitle- the titleuserId- 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.RepositoryExceptionAdds file preferences (path to symlink)- Parameters:
node- the nodeuserId- the userIdpath- the path- Throws:
javax.jcr.RepositoryException- the repository exception
-
getDocumentServiceSecret
String getDocumentServiceSecret()
-
-