Class OnlyOfficeManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.workspaces.documents.onlyoffice.OnlyOfficeManager
- All Implemented Interfaces:
LogEnabled,Component,Serviceable
Main helper for OnlyOffice edition
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user providerprotected JSONUtilsThe JSON utilsprotected OnlyOfficeKeyManagerThe Only Office key managerprotected AmetysObjectResolverThe Ametys object resolverprotected SourceResolverThe source resolverprotected AuthenticationTokenManagerThe token managerstatic final StringThe Avalon rolestatic final StringThe path for thumbnail filestatic final StringThe path for workspace cache -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_generatePNGFileInCache(String projectName, String uri, String fileId) Generate a png file from the uribooleancanBePreviewed(String resourceId) Determines if the resource file can have a preview of thumbnail from only officevoiddeleteProjectThumbnailsInCache(String projectName) Delete project thumbnails in cachevoiddeleteThumbnailInCache(String projectName, String resourceId) Delete thumbnail in cachebooleangenerateThumbnailInCache(String projectName, String resourceId, UserIdentity user) Generate thumbnail of the resource as pnggenerateToken(String fileId) Generate a token for OnlyOffice usegetOnlyOfficeInfo(String resourceId) Get the needed information for Only Office editiongetThumbnailFile(String projectName, String resourceId) Get thumbnail filebooleanDetermines if OnlyOffice edition is availablevoidservice(ServiceManager manager) signConfiguration(String toSign) Sign a json configuration for OnlyOffice using a secret parametrized keyMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role -
WORKSPACE_PATH_CACHE
The path for workspace cache- See Also:
-
THUMBNAIL_FILE_PATH
The path for thumbnail file- See Also:
-
_tokenManager
The token manager -
_currentUserProvider
The current user provider -
_resolver
The Ametys object resolver -
_onlyOfficeKeyManager
The Only Office key manager -
_jsonUtils
The JSON utils -
_sourceResolver
The source resolver
-
-
Constructor Details
-
OnlyOfficeManager
public OnlyOfficeManager()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
isOnlyOfficeAvailable
Determines if OnlyOffice edition is available- Returns:
- true if OnlyOffice edition is available
-
getOnlyOfficeInfo
Get the needed information for Only Office edition- Parameters:
resourceId- the id of resource to edit- Returns:
- the only office informations
-
generateToken
Generate a token for OnlyOffice use- Parameters:
fileId- id of the resource that will be used by OnlyOffice- Returns:
- the token
-
signConfiguration
Sign a json configuration for OnlyOffice using a secret parametrized key- Parameters:
toSign- The json to sign- Returns:
- The signed json
-
canBePreviewed
Determines if the resource file can have a preview of thumbnail from only office- Parameters:
resourceId- the resource id- Returns:
trueif resource file can have a preview of thumbnail from only office
-
generateThumbnailInCache
Generate thumbnail of the resource as png- Parameters:
projectName- the project nameresourceId- the resource iduser- the user generating the thumbnail- Returns:
trueis the thumbnail is generated
-
deleteThumbnailInCache
Delete thumbnail in cache- Parameters:
projectName- the project nameresourceId- the resourceId id
-
deleteProjectThumbnailsInCache
Delete project thumbnails in cache- Parameters:
projectName- the project name
-
_generatePNGFileInCache
protected void _generatePNGFileInCache(String projectName, String uri, String fileId) throws IOException Generate a png file from the uri- Parameters:
projectName- the project nameuri- the urifileId- the id of the file- Throws:
IOException- if an error occurred
-
getThumbnailFile
Get thumbnail file- Parameters:
projectName- the project nameresourceId- the resource id- Returns:
- the thumbnail file. Can be
nullif doesn't exist.
-