Package org.nuxeo.ecm.core.convert.api
Interface ConversionService
-
- All Known Subinterfaces:
ConversionServiceManager
- All Known Implementing Classes:
ConversionServiceImpl
public interface ConversionService
Interface for the Conversion Service.- Author:
- tiry
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description BlobHolder
convert(String converterName, BlobHolder blobHolder, Map<String,Serializable> parameters)
Converts a Blob given a converter name.Blob
convertBlobToPDF(Blob blob)
Deprecated.since 9.2, useconvertToMimeType(String, BlobHolder, Map)
with the PDF mimetype as destination insteadBlobHolder
convertToMimeType(String destinationMimeType, BlobHolder blobHolder, Map<String,Serializable> parameters)
Converts a Blob given a target destination MimeType.BlobHolder
getConversionResult(String id, boolean cleanTransientStoreEntry)
Returns the conversion result for the givenid
if any,null
otherwise.ConversionStatus
getConversionStatus(String id)
Returns the status of a scheduled conversion given itsid
, ornull
if no conversion scheduled.default String
getConverterName(String sourceMimeType, String destinationMimeType)
Returns the converter name for the givensourceMimeType
anddestinationMimeType
.String
getConverterName(String sourceMimeType, String destinationMimeType, boolean allowWildcard)
Returns the converter name for the givensourceMimeType
anddestinationMimeType
.default List<String>
getConverterNames(String sourceMimeType, String destinationMimeType)
Returns the list of converter names handling the givensourceMimeType
anddestinationMimeType
.List<String>
getConverterNames(String sourceMimeType, String destinationMimeType, boolean allowWildcard)
Returns the list of converter names handling the givensourceMimeType
anddestinationMimeType
.List<String>
getRegistredConverters()
Returns the names of the registered converters.ConverterCheckResult
isConverterAvailable(String converterName)
Checks for converter availability.ConverterCheckResult
isConverterAvailable(String converterName, boolean refresh)
Checks for converter availability.boolean
isSourceMimeTypeSupported(String converterName, String sourceMimeType)
Returns true if the converter supports the givensourceMimeType
, false otherwise.String
scheduleConversion(String converterName, BlobHolder blobHolder, Map<String,Serializable> parameters)
Schedules a conversion given a converter name.String
scheduleConversionToMimeType(String destinationMimeType, BlobHolder blobHolder, Map<String,Serializable> parameters)
Schedules a conversion given a target mime type.
-
-
-
Method Detail
-
getConverterName
default String getConverterName(String sourceMimeType, String destinationMimeType)
Returns the converter name for the givensourceMimeType
anddestinationMimeType
.Follows the algorithm of
getConverterNames(String, String)
.
-
getConverterName
String getConverterName(String sourceMimeType, String destinationMimeType, boolean allowWildcard)
Returns the converter name for the givensourceMimeType
anddestinationMimeType
.Follows the algorithm of
getConverterNames(String, String, boolean)
.- Since:
- 11.1
- See Also:
getConverterNames(String, String, boolean)
-
getConverterNames
default List<String> getConverterNames(String sourceMimeType, String destinationMimeType)
Returns the list of converter names handling the givensourceMimeType
anddestinationMimeType
.
-
getConverterNames
List<String> getConverterNames(String sourceMimeType, String destinationMimeType, boolean allowWildcard)
Returns the list of converter names handling the givensourceMimeType
anddestinationMimeType
.Finds the converter names based on the following algorithm:
- Find the converters exactly matching the given
sourceMimeType
- If no converter found, find the converters matching a wildcard subtype based on the
sourceMimeType
, such has "image/*" - If no converter found and
allowWildcard
istrue
, find the converters matching a wildcard source mime type "*" - Then, filter only the converters matching the given
destinationMimeType
- Parameters:
allowWildcard
-true
to allow returning converters with '*' as source mime type.- Since:
- 11.1
- Find the converters exactly matching the given
-
convert
BlobHolder convert(String converterName, BlobHolder blobHolder, Map<String,Serializable> parameters) throws ConversionException
Converts a Blob given a converter name.- Throws:
ConversionException
-
convertToMimeType
BlobHolder convertToMimeType(String destinationMimeType, BlobHolder blobHolder, Map<String,Serializable> parameters) throws ConversionException
Converts a Blob given a target destination MimeType.- Throws:
ConversionException
-
convertBlobToPDF
@Deprecated Blob convertBlobToPDF(Blob blob) throws IOException
Deprecated.since 9.2, useconvertToMimeType(String, BlobHolder, Map)
with the PDF mimetype as destination insteadConverts a Blob to PDF. If the blob has inner blobs such as images, they will be correctly rendered in the PDF.- Throws:
IOException
- Since:
- 9.1
-
getRegistredConverters
List<String> getRegistredConverters()
Returns the names of the registered converters.
-
isConverterAvailable
ConverterCheckResult isConverterAvailable(String converterName, boolean refresh) throws ConverterNotRegistered
Checks for converter availability.Result can be:
ConverterNotRegistered
if converter is not registered.- Error Message / Installation message if converter dependencies are not available an successful check.
- Throws:
ConverterNotRegistered
-
isConverterAvailable
ConverterCheckResult isConverterAvailable(String converterName) throws ConversionException
Checks for converter availability.Result can be:
ConverterNotRegistered
if converter is not registered.- Error Message / Installation message if converter dependencies are not available an successful check.
Result can be taken from an internal cache.
- Throws:
ConversionException
-
isSourceMimeTypeSupported
boolean isSourceMimeTypeSupported(String converterName, String sourceMimeType)
Returns true if the converter supports the givensourceMimeType
, false otherwise.- Since:
- 5.8
-
scheduleConversion
String scheduleConversion(String converterName, BlobHolder blobHolder, Map<String,Serializable> parameters)
Schedules a conversion given a converter name.Returns a conversion id to be used by
getConversionResult(String, boolean)
.- Since:
- 7.4
-
scheduleConversionToMimeType
String scheduleConversionToMimeType(String destinationMimeType, BlobHolder blobHolder, Map<String,Serializable> parameters)
Schedules a conversion given a target mime type.Returns a conversion id to be used by
getConversionResult(String, boolean)
.- Since:
- 7.10
-
getConversionStatus
ConversionStatus getConversionStatus(String id)
Returns the status of a scheduled conversion given itsid
, ornull
if no conversion scheduled.- Since:
- 7.4
-
getConversionResult
BlobHolder getConversionResult(String id, boolean cleanTransientStoreEntry)
Returns the conversion result for the givenid
if any,null
otherwise.- Since:
- 7.4
-
-