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
,ThreadSafe
,Action
public class GetOnlyOfficeResponse extends ServiceableAction implements ThreadSafe
Action to handle OnlyOffice communications
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GetOnlyOfficeResponse.UserStatus
Enumeration for user connection status
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user providerprotected JSONUtils
_jsonUtils
JSON utilsprotected org.slf4j.Logger
_logger
The loggerprotected OnlyOfficeKeyManager
_onlyOfficeManager
The only office managerprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected RightManager
_rightManager
The right managerprotected WorkspaceExplorerResourceDAO
_workspaceExplorerResourceDAO
Workspace 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 Map
act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
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/callbackprotected GetOnlyOfficeResponse.UserStatus
getUserConnectionStatus(Map<String,Object> response)
Get the status of a user connectionprotected boolean
processSave(String documentURI, String resourceId)
Save the documentprotected boolean
saveDocument(Map<String,Object> response, String resourceId)
Save the document if neededvoid
service(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
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_rightManager
protected RightManager _rightManager
The right manager
-
-
Constructor Detail
-
GetOnlyOfficeResponse
public GetOnlyOfficeResponse()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) 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
-
-