Interface MediaConversionService
-
- All Known Implementing Classes:
DefaultMediaConversionService
public interface MediaConversionService
Service 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 void
convertMedias(MediaContainerModel container)
Converts theMediaContainerModel
's master media to all formats which are currently not present in the givenMediaContainerModel
.int
deleteConvertedMedias(MediaContainerModel container)
Removes all converted medias within the specifiedMediaContainerModel
.java.util.Collection<ConversionMediaFormatModel>
getAllConversionFormats()
Retrieves all configuredConversionMediaFormatModel
from database.ConversionStatus
getConversionStatus(MediaContainerModel model)
Computes the currentConversionStatus
for the givenMediaContainerModel
.java.util.Collection<MediaModel>
getConvertedMedias(MediaContainerModel container)
Retrieves all converted medias in the givenMediaContainerModel
, i.e.MediaModel
getMaster(MediaContainerModel model)
Retrieves the current 'master'MediaModel
of the givenMediaContainerModel
.MediaModel
getOrConvert(MediaContainerModel container, MediaFormatModel format)
Retrieves theMediaModel
in the specifiedMediaFormatModel
associated with the givenMediaContainerModel
.
-
-
-
Method Detail
-
deleteConvertedMedias
int deleteConvertedMedias(MediaContainerModel container)
Removes all converted medias within the specifiedMediaContainerModel
.- Parameters:
container
- theMediaContainerModel
to clean up- Returns:
- the number of medias removed
- Throws:
java.lang.IllegalArgumentException
- if the specifiedcontainer
isnull
.
-
convertMedias
void convertMedias(MediaContainerModel container)
Converts theMediaContainerModel
's master media to all formats which are currently not present in the givenMediaContainerModel
.- Parameters:
container
- theMediaContainerModel
to 'fill up'.- Throws:
java.lang.IllegalArgumentException
- if the specifiedcontainer
isnull
.
-
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
- theMediaContainerModel
in question.- Returns:
- A collection of all converted medias in the given
MediaContainerModel
. - Throws:
java.lang.IllegalArgumentException
- if the specifiedcontainer
isnull
.
-
getAllConversionFormats
java.util.Collection<ConversionMediaFormatModel> getAllConversionFormats()
Retrieves all configuredConversionMediaFormatModel
from database.- Returns:
- all currently configured
ConversionMediaFormatModel
s.
-
getConversionStatus
ConversionStatus getConversionStatus(MediaContainerModel model)
Computes the currentConversionStatus
for 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
supportedFormat
of the assignedConversionGroupModel
or - all
ConversionMediaFormatModel
instances in the system, if noConversionGroupModel
is set on the givenMediaContainerModel
- Parameters:
model
- theMediaContainerModel
to compute the conversion status for- Returns:
- the current
ConversionStatus
for the givenMediaContainerModel
- Throws:
java.lang.IllegalArgumentException
- if the specifiedmodel
isnull
.
-
getMaster
MediaModel getMaster(MediaContainerModel model)
Retrieves the current 'master'MediaModel
of the givenMediaContainerModel
. The master media is defined as theMediaModel
within theMediaContainerModel
which has no original and no original data pk set (attributesMediaModel.ORIGINAL
andMediaModel.ORIGINALDATAPK
).- Parameters:
model
- theMediaContainerModel
in question- Returns:
- the current master media or
null
if no such media exists. - Throws:
java.lang.IllegalArgumentException
- if the specifiedmodel
isnull
.- See Also:
MediaContainerModel.getMaster()
,MediaModel.getOriginal()
-
getOrConvert
MediaModel getOrConvert(MediaContainerModel container, MediaFormatModel format)
Retrieves theMediaModel
in the specifiedMediaFormatModel
associated 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
- theMediaContainerModel
to search.format
- theMediaFormatModel
to retrieve.- Returns:
- the
MediaModel
of the givenMediaContainerModel
in 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
-
-