Package org.exoplatform.onlyoffice
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe edit mode.static final StringThe editor closed event.static final StringThe editor error event.static final StringThe editor opened event.static final StringThe editor saved event.static final StringThe editor version event.static final Stringstatic final StringThe view mode. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFilePreferences(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) byte[]convertNodeContent(javax.jcr.Node node, String format, String originalFileType, String userId) Convert the provided node to requested formatbyte[]convertNodeContentToPdf(javax.jcr.Node node, String userId) Convert the provided node to PDF filecreateEditor(String userSchema, String userHost, int userPost, String userId, String workspace, String docId, String mode) Create an editor configuration for given user and node.createViewer(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.getContent(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.getDocumentId(javax.jcr.Node node) Gets the document ID for given node.Return existing editor configuration for given user and node.getEditorByKey(String userId, String key) Return existing editor for given temporal key.getEditorLink(javax.jcr.Node node, String scheme, String host, int port) Gets the editor page URL for opening at Platform server.getLastModifier(String key) Gets the last modifier userId.Local state of editing document.org.exoplatform.services.organization.UserGets the user.Gets a user.getVersions(String workspace, String docId, int itemParPage, int pageNum) get the list of versions of the document with the given id.initDocument(String workspace, String path) Inits the document and returns an ID for use within editors.initDocument(javax.jcr.Node node) Inits the document and returns an ID for use within editors.booleanisDocumentCoedited(String key) Checks if the document is opened for edition by multiple usersbooleanisDocumentMimeSupported(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 Details
-
EDIT_MODE
The edit mode.- See Also:
-
VIEW_MODE
The view mode.- See Also:
-
FILLFORM_MODE
- See Also:
-
EDITOR_OPENED_EVENT
The editor opened event.- See Also:
-
EDITOR_CLOSED_EVENT
The editor closed event.- See Also:
-
EDITOR_SAVED_EVENT
The editor saved event.- See Also:
-
EDITOR_VERSION_EVENT
The editor version event.- See Also:
-
EDITOR_ERROR_EVENT
The editor error event.- See Also:
-
-
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 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, String mode) 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
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
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
Local state of editing document.- Parameters:
userId-StringfileKey-String- Returns:
ChangeState- Throws:
OnlyofficeEditorException- the onlyoffice editor exception
-
addListener
Add listener to the service.- Parameters:
listener- the listener
-
removeListener
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.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, 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:
-
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 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
Gets the last modifier userId.- Parameters:
key- the key- Returns:
- the editor user
-
setLastModifier
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
Gets a user.- Parameters:
key- the keyuserId- the userId- Returns:
- the user
-
validateToken
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
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.RepositoryException Adds file preferences (path to symlink)- Parameters:
node- the nodeuserId- the userIdpath- the path- Throws:
javax.jcr.RepositoryException- the repository exception
-
getDocumentServiceSecret
String getDocumentServiceSecret() -
closeWithoutModification
-
isDocumentCoedited
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) throws javax.jcr.RepositoryException Convert the provided node to PDF file- Parameters:
node- Document nodeuserId- user name- Returns:
- binary content of the PDF
- Throws:
javax.jcr.RepositoryException
-
convertNodeContent
byte[] convertNodeContent(javax.jcr.Node node, String format, String originalFileType, String userId) Convert the provided node to requested format- Parameters:
node- Document nodeformat- output content formatoriginalFileType- input content formatuserId- user name- Returns:
- binary content of the PDF
-