Package org.nuxeo.ecm.core.convert.api
Interface ConversionService
-
- All Known Subinterfaces:
ConversionServiceManager
- All Known Implementing Classes:
ConversionServiceImpl
public interface ConversionServiceInterface for the Conversion Service.- Author:
- tiry
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description BlobHolderconvert(String converterName, BlobHolder blobHolder, Map<String,Serializable> parameters)Converts a Blob given a converter name.BlobconvertBlobToPDF(Blob blob)Deprecated.since 9.2, useconvertToMimeType(String, BlobHolder, Map)with the PDF mimetype as destination insteadBlobHolderconvertToMimeType(String destinationMimeType, BlobHolder blobHolder, Map<String,Serializable> parameters)Converts a Blob given a target destination MimeType.BlobHoldergetConversionResult(String id, boolean cleanTransientStoreEntry)Returns the conversion result for the givenidif any,nullotherwise.ConversionStatusgetConversionStatus(String id)Returns the status of a scheduled conversion given itsid, ornullif no conversion scheduled.default StringgetConverterName(String sourceMimeType, String destinationMimeType)Returns the converter name for the givensourceMimeTypeanddestinationMimeType.StringgetConverterName(String sourceMimeType, String destinationMimeType, boolean allowWildcard)Returns the converter name for the givensourceMimeTypeanddestinationMimeType.default List<String>getConverterNames(String sourceMimeType, String destinationMimeType)Returns the list of converter names handling the givensourceMimeTypeanddestinationMimeType.List<String>getConverterNames(String sourceMimeType, String destinationMimeType, boolean allowWildcard)Returns the list of converter names handling the givensourceMimeTypeanddestinationMimeType.List<String>getRegistredConverters()Returns the names of the registered converters.ConverterCheckResultisConverterAvailable(String converterName)Checks for converter availability.ConverterCheckResultisConverterAvailable(String converterName, boolean refresh)Checks for converter availability.booleanisSourceMimeTypeSupported(String converterName, String sourceMimeType)Returns true if the converter supports the givensourceMimeType, false otherwise.StringscheduleConversion(String converterName, BlobHolder blobHolder, Map<String,Serializable> parameters)Schedules a conversion given a converter name.StringscheduleConversionToMimeType(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 givensourceMimeTypeanddestinationMimeType.Follows the algorithm of
getConverterNames(String, String).
-
getConverterName
String getConverterName(String sourceMimeType, String destinationMimeType, boolean allowWildcard)
Returns the converter name for the givensourceMimeTypeanddestinationMimeType.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 givensourceMimeTypeanddestinationMimeType.
-
getConverterNames
List<String> getConverterNames(String sourceMimeType, String destinationMimeType, boolean allowWildcard)
Returns the list of converter names handling the givensourceMimeTypeanddestinationMimeType.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
allowWildcardistrue, find the converters matching a wildcard source mime type "*" - Then, filter only the converters matching the given
destinationMimeType
- Parameters:
allowWildcard-trueto 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:
ConverterNotRegisteredif 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:
ConverterNotRegisteredif 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, ornullif no conversion scheduled.- Since:
- 7.4
-
getConversionResult
BlobHolder getConversionResult(String id, boolean cleanTransientStoreEntry)
Returns the conversion result for the givenidif any,nullotherwise.- Since:
- 7.4
-
-