public interface MediaService
| Modifier and Type | Method and Description |
|---|---|
void |
addVersionStreamForMedia(MediaModel media,
java.lang.String versionId,
java.io.InputStream data)
Adds the additional version of data as stream for given base media.
|
void |
addVersionStreamForMedia(MediaModel media,
java.lang.String mimeType,
java.lang.String versionId,
java.io.InputStream data)
Adds the additional version of data as stream for given base media
|
void |
copyData(MediaModel fromMedia,
MediaModel toMedia)
Copies data from a media to another media by linking the data (both medias will point to same data file).
|
void |
duplicateData(MediaModel fromMedia,
MediaModel toMedia)
Copies data from a media to another media by duplicating the data (both medias will point to different data file).
|
byte[] |
getDataFromMedia(MediaModel media)
Returns the stored file of given media as raw data array.
|
java.io.DataInputStream |
getDataStreamFromMedia(MediaModel media)
Deprecated.
since ages - please use
getStreamFromMedia(MediaModel) instead |
java.util.Collection<java.io.File> |
getFiles(MediaModel mediaModel)
Deprecated.
since ages - Operating on files is no more supported. Use InputStream related methods.
|
MediaFolderModel |
getFolder(java.lang.String qualifier)
Gets the folder identified unique by given qualifier.
|
MediaFormatModel |
getFormat(java.lang.String qualifier)
Gets the format identified unique by given qualifier.
|
MediaModel |
getMedia(CatalogVersionModel catalogVersion,
java.lang.String code)
Gets the media identified unique by given code and catalog version.
|
MediaModel |
getMedia(java.lang.String code)
Gets the media identified unique by given code.
|
MediaModel |
getMediaByContext(MediaModel media,
MediaContextModel context)
Gets related media for given media determined by target format of given context.
|
MediaModel |
getMediaByFormat(MediaContainerModel container,
MediaFormatModel format)
Gets media in specified format related to given media container.
|
MediaModel |
getMediaByFormat(MediaModel media,
MediaFormatModel format)
Gets media in specified format related to given media.
|
java.util.Collection<MediaModel> |
getMediaWithSameDataReference(MediaModel media)
Returns a collection of MediaModel objects that point to the same physical file.
|
MediaFolderModel |
getRootFolder()
Gets the root media folder.
|
java.io.InputStream |
getStreamForMediaVersion(MediaModel media,
java.lang.String versionId)
Gets the stream for media version.
|
java.io.InputStream |
getStreamFromMedia(MediaModel media)
Returns the stored file of given media as stream.
|
java.lang.String |
getUrlForMedia(MediaModel media)
Returns URL for to given media.
|
java.lang.String |
getUrlForMediaVersion(MediaModel media,
java.lang.String versionId)
Gets the URL for media version rendered by configured URL strategy.
|
boolean |
hasData(MediaModel media)
Returns information whether given media has binary data.
|
void |
moveData(MediaModel fromMedia,
MediaModel toMedia)
Moves a media data to another media.
|
void |
moveMediaToFolder(MediaModel media,
MediaFolderModel targetFolder)
Changes the folder of media to given new folder and move the related media data to this folder.
|
void |
removeDataFromMedia(MediaModel media)
Removes binary data from provided media.
|
boolean |
removeDataFromMediaQuietly(MediaModel media)
Removes binary data from provided media without throwing exception.
|
void |
removeVersionForMedia(MediaModel media,
java.lang.String versionId)
Removes the version of data for media.
|
void |
setDataForMedia(MediaModel media,
byte[] data)
Sets given raw data to media by writing content of given stream to a new data file.
|
void |
setDataStreamForMedia(MediaModel media,
java.io.DataInputStream data)
Deprecated.
since ages - please use
setStreamForMedia(MediaModel, InputStream) instead |
void |
setFolderForMedia(MediaModel media,
MediaFolderModel targetFolder)
Deprecated.
|
void |
setStreamForMedia(MediaModel media,
java.io.InputStream data)
Sets given data to media by writing content of given stream to a new data file.
|
void |
setStreamForMedia(MediaModel media,
java.io.InputStream data,
java.lang.String originalName,
java.lang.String mimeType)
Sets given data to media by writing content of given stream to a new data file.
|
void |
setStreamForMedia(MediaModel media,
java.io.InputStream data,
java.lang.String originalName,
java.lang.String mimeType,
MediaFolderModel folder)
Sets given data to media by writing content of given stream to a new data file.
|
void |
setUrlForMedia(MediaModel media,
java.lang.String url)
Sets the external URL for the media.
|
boolean hasData(MediaModel media)
media - media to examine@Deprecated java.io.DataInputStream getDataStreamFromMedia(MediaModel media) throws NoDataAvailableException
getStreamFromMedia(MediaModel) insteadmedia - media for which data is requestedNoDataAvailableException - if no data was set beforejava.io.InputStream getStreamFromMedia(MediaModel media) throws NoDataAvailableException, java.lang.IllegalArgumentException
media - media for which data is requestedNoDataAvailableException - if no data was set before or if underlying data is corruptedjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullbyte[] getDataFromMedia(MediaModel media) throws NoDataAvailableException
media - media for which data is requestedNoDataAvailableException - if no data was set before or if underlying data is corruptedvoid setDataForMedia(MediaModel media, byte[] data) throws MediaIOException, java.lang.IllegalArgumentException
media - media for which data will be setdata - raw data to setMediaIOException - if IO problems has occurredjava.lang.IllegalArgumentException - the illegal argument exception if any argument is null@Deprecated void setDataStreamForMedia(MediaModel media, java.io.DataInputStream data)
setStreamForMedia(MediaModel, InputStream) insteadmedia - media for which data will be setdata - data to setMediaIOException - if IO problems has occurredvoid setStreamForMedia(MediaModel media, java.io.InputStream data) throws MediaIOException, java.lang.IllegalArgumentException
media - media for which data will be setdata - data to setMediaIOException - if IO problems has occurredjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullboolean removeDataFromMediaQuietly(MediaModel media)
media - void removeDataFromMedia(MediaModel media)
media - media from which data will be removedMediaRemovalExceptionvoid addVersionStreamForMedia(MediaModel media, java.lang.String versionId, java.io.InputStream data)
media - the base mediaversionId - the unique version id of data (like format name)data - the data streamvoid addVersionStreamForMedia(MediaModel media, java.lang.String mimeType, java.lang.String versionId, java.io.InputStream data)
media - the base mediamimeType - the custom mime typeversionId - the unique version id of data (like format name)data - the data streamvoid removeVersionForMedia(MediaModel media, java.lang.String versionId)
media - the base mediaversionId - the unique version id of data (like format name)java.lang.String getUrlForMediaVersion(MediaModel media, java.lang.String versionId)
media - the base mediaversionId - the unique version id of data (like format name)java.io.InputStream getStreamForMediaVersion(MediaModel media, java.lang.String versionId)
media - the base mediaversionId - the unique version id of data (like format name)void setStreamForMedia(MediaModel media, java.io.InputStream data, java.lang.String originalName, java.lang.String mimeType) throws MediaIOException, java.lang.IllegalArgumentException
media - media for which data will be setdata - data to setoriginalName - The file name that will be set to the media modelmimeType - MIME type of the media that will be set to the media modelMediaIOException - if IO problems has occurredjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullvoid setStreamForMedia(MediaModel media, java.io.InputStream data, java.lang.String originalName, java.lang.String mimeType, MediaFolderModel folder) throws MediaIOException, java.lang.IllegalArgumentException
media - media for which data will be setdata - data to setoriginalName - The file name that will be set to the media modelmimeType - MIME type of the media that will be set to the media modelfolder - The folder where media will be storedjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullMediaStoreException - if any media store problems occursjava.lang.IllegalStateException - if media model is newMediaIOExceptionvoid setUrlForMedia(MediaModel media, java.lang.String url)
media - media for which the url will be seturl - the urljava.lang.String getUrlForMedia(MediaModel media)
media - media for which the url will be obtained@Deprecated void setFolderForMedia(MediaModel media, MediaFolderModel targetFolder) throws MediaIOException, java.lang.IllegalArgumentException
moveMediaToFolder(de.hybris.platform.core.model.media.MediaModel, de.hybris.platform.core.model.media.MediaFolderModel) insteadmedia - media for which the folder will be changedtargetFolder - folder where the data has to be moved toMediaIOException - if IO problems has occurredjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullvoid moveMediaToFolder(MediaModel media, MediaFolderModel targetFolder) throws MediaIOException, java.lang.IllegalArgumentException
ModelService.save(Object) method.media - media for which the folder will be changedtargetFolder - folder where the data has to be moved toMediaIOException - if IO problems has occurredjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullvoid moveData(MediaModel fromMedia, MediaModel toMedia) throws MediaIOException, java.lang.IllegalArgumentException
ModelService.save(Object) method.fromMedia - source media to move data fromtoMedia - target media to move data toMediaIOException - in case of unexpected errors while move operationjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullvoid copyData(MediaModel fromMedia, MediaModel toMedia) throws MediaIOException, java.lang.IllegalArgumentException
duplicateData(MediaModel, MediaModel) which copies by duplicating the data file. In case the source media
does not hold own data but points to a URL this media simply takes the URL - no real data is copied.
This method calls ModelService.save(Object) method.fromMedia - source media to copy data fromtoMedia - target media to copy data toMediaIOException - in case of unexpected errors while move operationjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullvoid duplicateData(MediaModel fromMedia, MediaModel toMedia) throws MediaIOException, java.lang.IllegalArgumentException
copyData(MediaModel, MediaModel) which only creates a link. In case the source media does not
hold own data but points to a URL this media simply takes the URL - no real data is copied.
This method calls ModelService.save(Object) method.fromMedia - source media to copy data fromtoMedia - target media to copy data toMediaIOException - in case of unexpected errors while move operationjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullMediaModel getMediaByContext(MediaModel media, MediaContextModel context) throws ModelNotFoundException, java.lang.IllegalArgumentException
media - media for which the related media in specific format is neededcontext - context which defines the target formatModelNotFoundException - if no container is assigned ( MediaModel.getMediaContainer() returns
null) or the
assigned MediaContainerModel does not provide a media in given format.java.lang.IllegalArgumentException - the illegal argument exception if any argument is nullMediaModel getMediaByFormat(MediaModel media, MediaFormatModel format) throws ModelNotFoundException, java.lang.IllegalArgumentException
media - media for which the related media in specific format is neededformat - format the desired media has to havenull if no corresponding media in specified format is availableModelNotFoundException - if no container is assigned ( MediaModel.getMediaContainer() returns
null) or the
assigned MediaContainerModel does not provide a media in given format.java.lang.IllegalArgumentException - the illegal argument exception if any argument is nullMediaModel getMediaByFormat(MediaContainerModel container, MediaFormatModel format) throws ModelNotFoundException, java.lang.IllegalArgumentException
container - container for which the related media in specific format is neededformat - format the desired media has to havenull if no corresponding media in specified format is
availableModelNotFoundException - if container is null or the assigned MediaContainerModel does not
provide a media
in given format.java.lang.IllegalArgumentException - the illegal argument exception if any argument is nullMediaModel getMedia(CatalogVersionModel catalogVersion, java.lang.String code) throws UnknownIdentifierException, AmbiguousIdentifierException
catalogVersion - version used for searchingcode - code used for searchingUnknownIdentifierException - in case no media can be foundAmbiguousIdentifierException - in case more than one media was found (code and version are not unique)java.lang.IllegalArgumentException - if any of the given qualifier or catalogVersion are nullMediaModel getMedia(java.lang.String code) throws UnknownIdentifierException, AmbiguousIdentifierException
code - code used for searchingUnknownIdentifierException - in case no media can be foundAmbiguousIdentifierException - in case more than one media was found (code is not unique)java.lang.IllegalArgumentException - if given qualifier is null@Deprecated java.util.Collection<java.io.File> getFiles(MediaModel mediaModel) throws java.lang.IllegalArgumentException, NoDataAvailableException
File's.mediaModel - mediaModel used for searchingjava.lang.IllegalArgumentException - the illegal argument exception if any argument is nullNoDataAvailableException - if no file was foundMediaFolderModel getFolder(java.lang.String qualifier) throws UnknownIdentifierException, AmbiguousIdentifierException
qualifier - qualifier used for searching the folderUnknownIdentifierException - in case no folder can be foundAmbiguousIdentifierException - in case more than one folder is foundjava.lang.IllegalArgumentException - if given qualifier is nullMediaFormatModel getFormat(java.lang.String qualifier) throws UnknownIdentifierException, AmbiguousIdentifierException
qualifier - qualifier used for searching the formatUnknownIdentifierException - in case no format can be foundAmbiguousIdentifierException - in case more than one format is foundjava.lang.IllegalArgumentException - if given qualifier is nullMediaFolderModel getRootFolder() throws ModelNotFoundException
ModelNotFoundException is thrown. The root folder is the default folder for a
media.ModelNotFoundException - in case no root folder is availablejava.util.Collection<MediaModel> getMediaWithSameDataReference(MediaModel media)
media - media used for searchCopyright © 2018 SAP SE. All Rights Reserved.