public class CloneComponentMediaContainerDataToAttributeContentConverter extends java.lang.Object implements Converter<java.util.Map<java.lang.String,java.lang.String>,MediaContainerModel>
Converter is invoked when cloning a component which contain a MediaContainer. This converts a
MapMediaContainerModel into an actual MediaContainerModel
When cloning a component, the "source" Map contains the values as inputed by the request payload. The
"cloneComponentModel" is the component model created by cloning from the source component uuid specified in the
request payload.
When editing a MediaContainer, if at least one media was modified in the "source" Map for any given MediaFormat, the
resulting "cloneComponentModel" should update the reference to the updated "source" Map value. Otherwise, a reference
to the cloned media model is used instead.| Constructor and Description |
|---|
CloneComponentMediaContainerDataToAttributeContentConverter() |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Map<java.lang.String,MediaModel> |
buildMediaModelMapForAllMediaFormats(java.util.Map<java.lang.String,MediaFormatModel> mediaFormatModelMap,
MediaContainerModel mediaContainerModel)
Builds a
Map of all media format qualifiers defined in the platform and all MediaModel defined in
the cloned component model. |
MediaContainerModel |
convert(java.util.Map<java.lang.String,java.lang.String> source)
Uses the source
S object and produces an new instance of T. |
protected java.util.Optional<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
findMediaCodeExistsInSourceAndAttributeMap(java.util.Map<java.lang.String,java.lang.Object> srcAttributeMap,
java.lang.String languagueTag,
java.lang.String mediaFormat,
java.lang.String mediaCode)
Compare the mediaCode in the "source" Map and in the "source attribute" Map to determine if it was modified for a
given MediaFormat when the mediaCode is different, add the updated value to the map
|
protected CloneComponentContextProvider |
getCloneComponentContextProvider() |
protected MediaContainerFacade |
getMediaContainerFacade() |
protected CMSMediaFormatService |
getMediaFormatService() |
protected ModelService |
getModelService() |
protected UniqueItemIdentifierService |
getUniqueItemIdentifierService() |
void |
setCloneComponentContextProvider(CloneComponentContextProvider cloneComponentContextProvider) |
void |
setMediaContainerFacade(MediaContainerFacade mediaContainerFacade) |
void |
setMediaFormatService(CMSMediaFormatService mediaFormatService) |
void |
setModelService(ModelService modelService) |
void |
setUniqueItemIdentifierService(UniqueItemIdentifierService uniqueItemIdentifierService) |
public CloneComponentMediaContainerDataToAttributeContentConverter()
public MediaContainerModel convert(java.util.Map<java.lang.String,java.lang.String> source)
ConverterS object and produces an new instance of T.convert in interface Converter<java.util.Map<java.lang.String,java.lang.String>,MediaContainerModel>source - the input to be converted.T, converted from the input source.protected java.util.Map<java.lang.String,MediaModel> buildMediaModelMapForAllMediaFormats(java.util.Map<java.lang.String,MediaFormatModel> mediaFormatModelMap, MediaContainerModel mediaContainerModel)
Map of all media format qualifiers defined in the platform and all MediaModel defined in
the cloned component model. If a MediaModel is not found for a given media format, the value is set to
NULL
Map of key-value pairs of <MediaFormatModel.getQualifier() and MediaModel>mediaFormatModelMap - map containing key-value pairs of <MediaFormatModel.getQualifier() and MediaFormatModel>mediaContainerModel - the media container model defined on the cloned component modelMediaFormatModel.getQualifier() and MediaModel>. If a
MediaModel is not found for a given media format, the entry value is NULL.protected java.util.Optional<java.util.Map.Entry<java.lang.String,java.lang.Object>> findMediaCodeExistsInSourceAndAttributeMap(java.util.Map<java.lang.String,java.lang.Object> srcAttributeMap,
java.lang.String languagueTag,
java.lang.String mediaFormat,
java.lang.String mediaCode)
srcAttributeMap - the Map representation of the source attribute (saved in the session)languagueTag - the current language locale (saved in the session)mediaFormat - the media format defined in the source MapmediaCode - the media code defined in the source MapOptional containing an Map.Entry from the srcAttributeMap which matches the given
mediaCode and mediaFormat; otherwise Optional.empty()protected UniqueItemIdentifierService getUniqueItemIdentifierService()
public void setUniqueItemIdentifierService(UniqueItemIdentifierService uniqueItemIdentifierService)
protected CMSMediaFormatService getMediaFormatService()
public void setMediaFormatService(CMSMediaFormatService mediaFormatService)
protected MediaContainerFacade getMediaContainerFacade()
public void setMediaContainerFacade(MediaContainerFacade mediaContainerFacade)
protected CloneComponentContextProvider getCloneComponentContextProvider()
public void setCloneComponentContextProvider(CloneComponentContextProvider cloneComponentContextProvider)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
Copyright © 2018 SAP SE. All Rights Reserved.