Class CloneComponentMediaContainerDataToAttributeContentConverter

  • All Implemented Interfaces:
    Converter<java.util.Map<java.lang.String,​java.lang.String>,​MediaContainerModel>

    public class CloneComponentMediaContainerDataToAttributeContentConverter
    extends java.lang.Object
    implements Converter<java.util.Map<java.lang.String,​java.lang.String>,​MediaContainerModel>
    The Converter is invoked when cloning a component which contain a MediaContainer. This converts a Map representation of a MediaContainerModel 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 Detail

      • CloneComponentMediaContainerDataToAttributeContentConverter

        public CloneComponentMediaContainerDataToAttributeContentConverter()
    • Method Detail

      • convert

        public MediaContainerModel convert​(java.util.Map<java.lang.String,​java.lang.String> source)
        Description copied from interface: Converter
        Uses the source S object and produces an new instance of T.
        Specified by:
        convert in interface Converter<java.util.Map<java.lang.String,​java.lang.String>,​MediaContainerModel>
        Parameters:
        source - the input to be converted.
        Returns:
        an instance of T, converted from the input source.
      • findMediaCodeExistsInSourceAndAttributeMap

        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 languageTag,
                                                                                                                                              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
        Parameters:
        srcAttributeMap - the Map representation of the source attribute (saved in the session)
        languageTag - the current language locale (saved in the session)
        mediaFormat - the media format defined in the source Map
        mediaCode - the media code defined in the source Map
        Returns:
        Optional containing an Map.Entry from the srcAttributeMap which matches the given mediaCode and mediaFormat; otherwise Optional.empty()
      • setUniqueItemIdentifierService

        public void setUniqueItemIdentifierService​(UniqueItemIdentifierService uniqueItemIdentifierService)
      • setMediaFormatService

        public void setMediaFormatService​(CMSMediaFormatService mediaFormatService)
      • setMediaContainerFacade

        public void setMediaContainerFacade​(MediaContainerFacade mediaContainerFacade)
      • setCloneComponentContextProvider

        public void setCloneComponentContextProvider​(CloneComponentContextProvider cloneComponentContextProvider)
      • getModelService

        protected ModelService getModelService()
      • setModelService

        public void setModelService​(ModelService modelService)