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
Action to handle OnlyOffice communications
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration for user connection status -
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user providerprotected JSONUtils
JSON utilsprotected Logger
The loggerprotected OnlyOfficeKeyManager
The only office managerprotected AmetysObjectResolver
The Ametys object resolverprotected RightManager
The right managerprotected WorkspaceExplorerResourceDAO
Workspace explorer resource DAOFields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionact
(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 Details
-
_logger
The logger -
_jsonUtils
JSON utils -
_resolver
The Ametys object resolver -
_workspaceExplorerResourceDAO
Workspace explorer resource DAO -
_onlyOfficeManager
The only office manager -
_currentUserProvider
The current user provider -
_rightManager
The right manager
-
-
Constructor Details
-
GetOnlyOfficeResponse
public GetOnlyOfficeResponse()
-
-
Method Details
-
service
- 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
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
Get the status of a user connection- Parameters:
response
- response of OO server as JSON- Returns:
- the user status
-
saveDocument
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
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
-