Class GetOnlyOfficeResponse
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.acting.AbstractAction
-
- org.apache.cocoon.acting.ServiceableAction
-
- org.ametys.plugins.workspaces.documents.onlyoffice.GetOnlyOfficeResponse
-
- All Implemented Interfaces:
Component,LogEnabled,Serviceable,Action
public class GetOnlyOfficeResponse extends ServiceableAction
Action to handle OnlyOffice communications
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGetOnlyOfficeResponse.UserStatusEnumeration for user connection status
-
Field Summary
Fields Modifier and Type Field Description protected JSONUtils_jsonUtilsJSON utilsprotected org.slf4j.Logger_loggerThe loggerprotected OnlyOfficeKeyManager_onlyOfficeManagerThe only office managerprotected AmetysObjectResolver_resolverThe Ametys object resolverprotected WorkspaceExplorerResourceDAO_workspaceExplorerResourceDAOWorkspace explorer resource DAO-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description GetOnlyOfficeResponse()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mapact(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)protected booleancallbackHandler(Map<String,Object> response, String resourceId)Analyze the response from document editing service on OnlyOffice Server See https://api.onlyoffice.com/editors/callbackprotected GetOnlyOfficeResponse.UserStatusgetUserConnectionStatus(Map<String,Object> response)Get the status of a user connectionprotected booleanprocessSave(String documentURI, String resourceId)Save the documentprotected booleansaveDocument(Map<String,Object> response, String resourceId)Save the document if neededvoidservice(ServiceManager smanager)-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_logger
protected org.slf4j.Logger _logger
The logger
-
_jsonUtils
protected JSONUtils _jsonUtils
JSON utils
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_workspaceExplorerResourceDAO
protected WorkspaceExplorerResourceDAO _workspaceExplorerResourceDAO
Workspace explorer resource DAO
-
_onlyOfficeManager
protected OnlyOfficeKeyManager _onlyOfficeManager
The only office manager
-
-
Constructor Detail
-
GetOnlyOfficeResponse
public GetOnlyOfficeResponse()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableAction- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
- Throws:
Exception
-
callbackHandler
protected boolean callbackHandler(Map<String,Object> response, String resourceId)
Analyze the response from document editing service on OnlyOffice Server See https://api.onlyoffice.com/editors/callback- Parameters:
response- the response as JSON objectresourceId- id of edited resource- Returns:
- true if the response is ok and the needed process successed.
-
getUserConnectionStatus
protected GetOnlyOfficeResponse.UserStatus getUserConnectionStatus(Map<String,Object> response)
Get the status of a user connection- Parameters:
response- response of OO server as JSON- Returns:
- the user status
-
saveDocument
protected boolean saveDocument(Map<String,Object> response, String resourceId)
Save the document if needed- Parameters:
response- the OO response as JSONresourceId- id of document to edit- Returns:
- true if save success, false otherwise
-
processSave
protected boolean processSave(String documentURI, String resourceId)
Save the document- Parameters:
documentURI- the URI of document to saveresourceId- id of the resource to update- Returns:
- true if success to save document, false otherwise
-
-