public class DefaultConvertedMediaCreationStrategy extends java.lang.Object implements ConvertedMediaCreationStrategy
ConvertedMediaCreationStrategy.| Constructor and Description |
|---|
DefaultConvertedMediaCreationStrategy() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
createCode(MediaModel parent,
MediaFormatModel format)
Assembles the code to use for the newly created media.
|
protected java.lang.String |
createFileName(MediaModel parent,
ConversionMediaFormatModel format)
Assembles a file name for the newly created media.
|
protected java.lang.String |
createMime(MediaModel parent,
ConversionMediaFormatModel format)
Assembles the mime type to be set on the newly created media.
|
protected MediaModel |
createModel()
Creates the
MediaModel of which all relevant attributes will be set. |
MediaModel |
createOrUpdate(MediaModel parent,
ConversionMediaFormatModel format,
java.io.InputStream content)
Creates a new media which was converted from the given
parent by successful conversion to the given
format or updates the corresponding media if it already exists. |
MediaService |
getMediaService() |
ModelService |
getModelService()
Accesses the
ModelService to use. |
protected void |
loadContents(MediaModel dmm,
MediaModel parent,
ConversionMediaFormatModel format,
java.io.InputStream inputStream)
Load the data from the given
InputStream and stores them to the MediaModel. |
void |
setMediaService(MediaService mediaService) |
void |
setModelService(ModelService modelService)
Sets the
ModelService to use (for Spring IoC). |
public DefaultConvertedMediaCreationStrategy()
public MediaModel createOrUpdate(MediaModel parent, ConversionMediaFormatModel format, java.io.InputStream content) throws MediaIOException
parent by successful conversion to the given
format or updates the corresponding media if it already exists. The passed InputStream
content must be used to load the media's data.
The MediaService is passed to avoid circular dependencies.createOrUpdate in interface ConvertedMediaCreationStrategyparent - the media the to-be-created media was converted from. This model should be set as the newly created
media's parent.format - the format of the to-be-created media. This object should be set as the newly created media's format.content - InputStream holding the converted content.MediaModelMediaIOException - on any technical error when loading the contentsConvertedMediaCreationStrategy.createOrUpdate(MediaModel, ConversionMediaFormatModel, InputStream)protected MediaModel createModel()
MediaModel of which all relevant attributes will be set. This is a good method to override if
you what
MediaModel.protected void loadContents(MediaModel dmm, MediaModel parent, ConversionMediaFormatModel format, java.io.InputStream inputStream)
InputStream and stores them to the MediaModel.dmm - the MediaModel to store the data to.parent - the parent MediaModelformat - the format of the new MediaModelin - the InputStream containing the new medias data.MediaService.setStreamForMedia(MediaModel, InputStream)protected java.lang.String createMime(MediaModel parent, ConversionMediaFormatModel format)
parent - the parent MediaModelformat - the format of the new MediaModelprotected java.lang.String createFileName(MediaModel parent, ConversionMediaFormatModel format)
parent - the parent MediaModelformat - the format of the new MediaModelcreateCode(MediaModel, MediaFormatModel),
AbstractMediaModel.getRealFileName()protected java.lang.String createCode(MediaModel parent, MediaFormatModel format)
parent - the parent MediaModelformat - the format of the new MediaModelpublic ModelService getModelService()
ModelService to use.ModelServicepublic void setModelService(ModelService modelService)
ModelService to use (for Spring IoC).modelService - a nice ModelService to use.public MediaService getMediaService()
public void setMediaService(MediaService mediaService)
Copyright © 2018 SAP SE. All Rights Reserved.