public abstract class AbstractDocumentContentConverterService extends Object implements DocumentContentConverterService
This class is responsible for document content conversion (usually for *->pdf for preview and pdf download purposes) Service uses cache (memory and disk) to minimize unneeded conversions.
Constructor and Description |
---|
AbstractDocumentContentConverterService(com.edorasware.commons.core.content.ContentManager contentManager,
com.edorasware.api.workobject.WorkObjectService workObjectService,
String cacheTempPath,
String tempFileNamePrefix,
List<DocumentContentConverter> contentConverters,
com.edorasware.commons.core.cache.StatisticsAwareCache statisticsAwareCache) |
Modifier and Type | Method and Description |
---|---|
void |
evictCachedFile(String globalId)
Evict the cached file from the corresponding WorkObject.
|
Set<com.google.common.net.MediaType> |
getAcceptableMediaTypes()
Returns set of supported media types, which is converter able to convert
|
org.springframework.core.io.Resource |
getConvertedContent(String id)
Returns converted content for a given document work object.
|
com.edorasware.commons.core.content.ContentMetadata |
getConvertedContentMetadata(String id)
Returns converted
ContentMetadata for the given document work object reference |
com.edorasware.commons.core.util.fp.Pair<com.edorasware.commons.core.content.ContentMetadata,org.springframework.core.io.Resource> |
getConvertedContentMetadataAndInputStream(String id)
Returns converted content for the given document identifier
|
com.edorasware.commons.core.content.ContentReference |
getConvertedContentReference(String id)
Returns converted
ContentReference for the given document work object reference |
boolean |
isConvertible(com.edorasware.api.workobject.WorkObject workObject)
Is given workObject convertible by this service
|
void |
shutdown()
Clean up the cache and remove all temporary files
|
public AbstractDocumentContentConverterService(com.edorasware.commons.core.content.ContentManager contentManager, com.edorasware.api.workobject.WorkObjectService workObjectService, String cacheTempPath, String tempFileNamePrefix, List<DocumentContentConverter> contentConverters, com.edorasware.commons.core.cache.StatisticsAwareCache statisticsAwareCache)
contentManager
- content manager to use for obtaining contentworkObjectService
- generic workobject service for resolving workobjectscacheTempPath
- directory in which temporary converted content is stored. If null or empty default path (${edoras-one.home}/temp) is used. Directory is always cleaned
up on the spring application context refresh.tempFileNamePrefix
- file name prefix used for cached files (can be empty)contentConverters
- converters to use for content conversionstatisticsAwareCache
- One cache.public org.springframework.core.io.Resource getConvertedContent(String id)
DocumentContentConverterService
Returns converted content for a given document work object.
getConvertedContent
in interface DocumentContentConverterService
id
- the document identifierpublic com.edorasware.commons.core.util.fp.Pair<com.edorasware.commons.core.content.ContentMetadata,org.springframework.core.io.Resource> getConvertedContentMetadataAndInputStream(String id)
DocumentContentConverterService
Returns converted content for the given document identifier
getConvertedContentMetadataAndInputStream
in interface DocumentContentConverterService
id
- document identifierContentMetadata
and converted content InputStream
public com.edorasware.commons.core.content.ContentReference getConvertedContentReference(String id)
DocumentContentConverterService
Returns converted ContentReference
for the given document work object reference
getConvertedContentReference
in interface DocumentContentConverterService
id
- document identifierContentReference
public com.edorasware.commons.core.content.ContentMetadata getConvertedContentMetadata(String id)
DocumentContentConverterService
Returns converted ContentMetadata
for the given document work object reference
getConvertedContentMetadata
in interface DocumentContentConverterService
id
- document identifierContentMetadata
public boolean isConvertible(com.edorasware.api.workobject.WorkObject workObject)
DocumentContentConverterService
Is given workObject convertible by this service
isConvertible
in interface DocumentContentConverterService
workObject
- to convertpublic void shutdown()
Clean up the cache and remove all temporary files
shutdown
in interface DocumentContentConverterService
public void evictCachedFile(String globalId)
Evict the cached file from the corresponding WorkObject.
evictCachedFile
in interface DocumentContentConverterService
globalId
- The global ID to evictpublic Set<com.google.common.net.MediaType> getAcceptableMediaTypes()
DocumentContentConverterService
Returns set of supported media types, which is converter able to convert
getAcceptableMediaTypes
in interface DocumentContentConverterService
MediaType
Copyright © 2010 - 2018 edorasware ag. All Rights Reserved.