Interface MediaConversionService
-
- All Known Implementing Classes:
DefaultMediaConversionService
public interface MediaConversionServiceService to convert medias and manage conversion formats and converted medias.- Since:
- 4.6
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidconvertMedias(MediaContainerModel container)Converts theMediaContainerModel's master media to all formats which are currently not present in the givenMediaContainerModel.intdeleteConvertedMedias(MediaContainerModel container)Removes all converted medias within the specifiedMediaContainerModel.java.util.Collection<ConversionMediaFormatModel>getAllConversionFormats()Retrieves all configuredConversionMediaFormatModelfrom database.ConversionStatusgetConversionStatus(MediaContainerModel model)Computes the currentConversionStatusfor the givenMediaContainerModel.java.util.Collection<MediaModel>getConvertedMedias(MediaContainerModel container)Retrieves all converted medias in the givenMediaContainerModel, i.e.MediaModelgetMaster(MediaContainerModel model)Retrieves the current 'master'MediaModelof the givenMediaContainerModel.MediaModelgetOrConvert(MediaContainerModel container, MediaFormatModel format)Retrieves theMediaModelin the specifiedMediaFormatModelassociated with the givenMediaContainerModel.
-
-
-
Method Detail
-
deleteConvertedMedias
int deleteConvertedMedias(MediaContainerModel container)
Removes all converted medias within the specifiedMediaContainerModel.- Parameters:
container- theMediaContainerModelto clean up- Returns:
- the number of medias removed
- Throws:
java.lang.IllegalArgumentException- if the specifiedcontainerisnull.
-
convertMedias
void convertMedias(MediaContainerModel container)
Converts theMediaContainerModel's master media to all formats which are currently not present in the givenMediaContainerModel.- Parameters:
container- theMediaContainerModelto 'fill up'.- Throws:
java.lang.IllegalArgumentException- if the specifiedcontainerisnull.
-
getConvertedMedias
java.util.Collection<MediaModel> getConvertedMedias(MediaContainerModel container)
Retrieves all converted medias in the givenMediaContainerModel, i.e. all medias within this container which have a parent and a format set.- Parameters:
container- theMediaContainerModelin question.- Returns:
- A collection of all converted medias in the given
MediaContainerModel. - Throws:
java.lang.IllegalArgumentException- if the specifiedcontainerisnull.
-
getAllConversionFormats
java.util.Collection<ConversionMediaFormatModel> getAllConversionFormats()
Retrieves all configuredConversionMediaFormatModelfrom database.- Returns:
- all currently configured
ConversionMediaFormatModels.
-
getConversionStatus
ConversionStatus getConversionStatus(MediaContainerModel model)
Computes the currentConversionStatusfor the givenMediaContainerModel. The conversion status isConversionStatus.EMPTY, if the container has no master, orConversionStatus.UNCONVERTED, if there are none of the target formats available,ConversionStatus.PARTIALLY_CONVERTED, if there are some of the target formats available, orConversionStatus.CONVERTED, if all of the target formats are available.
- the
supportedFormatof the assignedConversionGroupModelor - all
ConversionMediaFormatModelinstances in the system, if noConversionGroupModelis set on the givenMediaContainerModel
- Parameters:
model- theMediaContainerModelto compute the conversion status for- Returns:
- the current
ConversionStatusfor the givenMediaContainerModel - Throws:
java.lang.IllegalArgumentException- if the specifiedmodelisnull.
-
getMaster
MediaModel getMaster(MediaContainerModel model)
Retrieves the current 'master'MediaModelof the givenMediaContainerModel. The master media is defined as theMediaModelwithin theMediaContainerModelwhich has no original and no original data pk set (attributesMediaModel.ORIGINALandMediaModel.ORIGINALDATAPK).- Parameters:
model- theMediaContainerModelin question- Returns:
- the current master media or
nullif no such media exists. - Throws:
java.lang.IllegalArgumentException- if the specifiedmodelisnull.- See Also:
MediaContainerModel.getMaster(),MediaModel.getOriginal()
-
getOrConvert
MediaModel getOrConvert(MediaContainerModel container, MediaFormatModel format)
Retrieves theMediaModelin the specifiedMediaFormatModelassociated with the givenMediaContainerModel. If no such media exists the service will try to convert the media to that format automatically (synchronous). The conversion will also be performed if the converted media is outdated, i.e. if the binary data of the converted media's original is not the same anymore.- Parameters:
container- theMediaContainerModelto search.format- theMediaFormatModelto retrieve.- Returns:
- the
MediaModelof the givenMediaContainerModelin the givenMediaFormatModel. - Throws:
java.lang.IllegalArgumentException- if any of the specified parameters isnull.ModelNotFoundException- if the media could neither be retrieved nor converted.- Since:
- 4.6
-
-