| Constructor and Description |
|---|
DefaultCMSVersionToDataConverter() |
| Modifier and Type | Method and Description |
|---|---|
protected VersionAttributeDescriptor |
buildVersionAttributeDescriptor(TypeModel typeModel,
AttributeDescriptorModel attribute) |
java.lang.String |
convert(ItemModel itemModel)
Uses the source
S object and produces an new instance of T. |
protected java.lang.Object |
convertAttributeValue(VersionAttributeDescriptor attribute,
java.lang.Object attributeValue)
Converts an attribute value to a format supported by
PayloadSerializer. |
protected java.util.Collection<java.lang.Object> |
convertCollection(VersionAttributeDescriptor versionAttributeDescriptor,
java.util.Collection<java.lang.Object> collection)
Converts collection of
Object elements. |
protected java.util.Map<LanguageModel,java.lang.Object> |
convertLocalizedValue(ItemModel itemModel,
AttributeDescriptorModel attribute,
java.util.function.Function<java.lang.Object,java.lang.Object> converter)
Converts the localized attribute value.
|
protected java.util.function.Function<AttributeDescriptorModel,java.util.Optional<java.lang.Object>> |
getAttributeRelatedData(java.util.function.Supplier<java.lang.Object> localizedCollectionGetter,
java.util.function.Supplier<java.lang.Object> localizedGetter,
java.util.function.Supplier<java.lang.Object> collectionGetter,
java.util.function.Supplier<java.lang.Object> simpleGetter)
Returns a
Function aimed at converting any value described by a AttributeDescriptorModel. |
protected java.util.Optional<java.lang.Object> |
getAttributeValueFromItem(ItemModel itemModel,
AttributeDescriptorModel attribute)
Extracts the value from itemModel based on attribute qualifier.
|
protected java.util.Optional<java.lang.Object> |
getAttributeValueFromItem(ItemModel itemModel,
AttributeDescriptorModel attribute,
java.util.Locale locale)
Extracts the value from itemModel based on attribute qualifier and locale.
|
protected java.util.function.Function<AttributeDescriptorModel,java.util.Optional<java.lang.Object>> |
getAttributeValueMapperForItem(ItemModel itemModel)
Returns a function that accepts
AttributeDescriptorModel and converts attribute value to a format
supported by PayloadSerializer. |
protected CMSVersionHelper |
getCmsVersionHelper() |
protected CollectionHelper |
getCollectionHelper() |
protected CommonI18NService |
getCommonI18NService() |
protected java.util.Map<java.lang.String,java.lang.Object> |
getConvertedAttributeValues(ItemModel itemModel)
Returns converted values for
ItemModel attributes. |
protected AttributeStrategyConverterProvider<VersionAttributeDescriptor> |
getConverterProvider() |
protected java.util.Map<java.lang.String,java.lang.Object> |
getCustomConvertedAttributeValues(ItemModel itemModel)
Returns converted values for custom attributes.
|
protected CustomAttributeStrategyConverterProvider |
getCustomConverterProvider() |
protected java.util.function.Predicate<AttributeDescriptorModel> |
getIsCollectionPredicate() |
protected java.util.Map<LanguageModel,java.lang.Object> |
getMapOfLanguages(ItemModel itemModel,
AttributeDescriptorModel attribute)
Method generates the
Map of the LanguageModel and the Object that represents the value for
the language. |
protected ModelService |
getModelService() |
protected PayloadSerializer |
getPayloadSerializer() |
protected VersionAttributeDescriptor |
getVersionAttribute(AttributeDescriptorModel attribute)
Returns
VersionAttributeDescriptor based on AttributeDescriptorModel. |
protected LocalizedAttributesList |
prepareLocalizedValueForSerialization(AttributeDescriptorModel attribute,
java.util.Map<LanguageModel,java.lang.Object> localizedValues)
Packs the converted localized value inside a class supported by
PayloadSerializer. |
protected SLDDataContainer.AttributeValue |
prepareSimpleValueForSerialization(AttributeDescriptorModel attribute,
java.lang.Object convertedValue)
Packs the converted value inside a class supported by
PayloadSerializer. |
void |
setCmsVersionHelper(CMSVersionHelper cmsVersionHelper) |
void |
setCollectionHelper(CollectionHelper collectionHelper) |
void |
setCommonI18NService(CommonI18NService commonI18NService) |
void |
setConverterProvider(AttributeStrategyConverterProvider<VersionAttributeDescriptor> converterProvider) |
void |
setCustomConverterProvider(CustomAttributeStrategyConverterProvider customConverterProvider) |
void |
setIsCollectionPredicate(java.util.function.Predicate<AttributeDescriptorModel> isCollectionPredicate) |
void |
setModelService(ModelService modelService) |
void |
setPayloadSerializer(PayloadSerializer payloadSerializer) |
public java.lang.String convert(ItemModel itemModel)
ConverterS object and produces an new instance of T.protected java.util.Map<java.lang.String,java.lang.Object> getConvertedAttributeValues(ItemModel itemModel)
ItemModel attributes.itemModel - the ItemModel to get the list of attributes and values from.Map of qualifier and a converted value.protected java.util.Map<java.lang.String,java.lang.Object> getCustomConvertedAttributeValues(ItemModel itemModel)
itemModel - the ItemModel to get the custom attribute from.Map of qualifier and a converted value.protected java.util.function.Function<AttributeDescriptorModel,java.util.Optional<java.lang.Object>> getAttributeRelatedData(java.util.function.Supplier<java.lang.Object> localizedCollectionGetter, java.util.function.Supplier<java.lang.Object> localizedGetter, java.util.function.Supplier<java.lang.Object> collectionGetter, java.util.function.Supplier<java.lang.Object> simpleGetter)
Function aimed at converting any value described by a AttributeDescriptorModel. This
function will execute one of the provided suppliers depending on whether the attribute is localized and/or a
collectionlocalizedCollectionGetter - a Supplier invoked if the attribute is both localized and a collectionlocalizedGetter - a Supplier invoked if the attribute is localized and not a collectioncollectionGetter - a Supplier invoked if the attribute is a collection and not localizedsimpleGetter - a Supplier invoked if the attribute is neither localized nor a collectionFunction to convert a valueprotected java.util.function.Function<AttributeDescriptorModel,java.util.Optional<java.lang.Object>> getAttributeValueMapperForItem(ItemModel itemModel)
AttributeDescriptorModel and converts attribute value to a format
supported by PayloadSerializer.itemModel - the ItemModel that contains the value for an attribute.Function that accepts AttributeDescriptorModel as a parameter and returns converted
value wrapped inside a class supported by PayloadSerializer. Can be null.protected LocalizedAttributesList prepareLocalizedValueForSerialization(AttributeDescriptorModel attribute, java.util.Map<LanguageModel,java.lang.Object> localizedValues)
PayloadSerializer.attribute - the AttributeDescriptorModel describing the metadata of the property.localizedValues - the Map that contains converted localized value.LocalizedAttributesList.protected SLDDataContainer.AttributeValue prepareSimpleValueForSerialization(AttributeDescriptorModel attribute, java.lang.Object convertedValue)
PayloadSerializer.attribute - the AttributeDescriptorModel describing the metadata of the property.convertedValue - the converted valueSLDDataContainer.AttributeValue.protected VersionAttributeDescriptor getVersionAttribute(AttributeDescriptorModel attribute)
VersionAttributeDescriptor based on AttributeDescriptorModel. The
VersionAttributeDescriptor contains the type of an element that have to be converted. If the
AttributeDescriptorModel represents localized collection then the VersionAttributeDescriptor
contains the metadata of the localized collection element.
If the AttributeDescriptorModel represents localized value then the VersionAttributeDescriptor
contains the metadata of the localized value.
If the AttributeDescriptorModel represents collection then the VersionAttributeDescriptor contains
the metadata of the collection element.
If the AttributeDescriptorModel represents simple value then the VersionAttributeDescriptor
contains the metadata of the simple value.attribute - the AttributeDescriptorModel describing the metadata of the property.VersionAttributeDescriptor describing the metadata of the element represented by
AttributeDescriptorModel. Can be null.protected VersionAttributeDescriptor buildVersionAttributeDescriptor(TypeModel typeModel, AttributeDescriptorModel attribute)
protected java.util.Map<LanguageModel,java.lang.Object> getMapOfLanguages(ItemModel itemModel, AttributeDescriptorModel attribute)
Map of the LanguageModel and the Object that represents the value for
the language.itemModel - the ItemModel to retrieve the localized value from.attribute - the AttributeDescriptorModel describing the metadata of the property.Map of the LanguageModel and the Object.protected java.util.Optional<java.lang.Object> getAttributeValueFromItem(ItemModel itemModel, AttributeDescriptorModel attribute, java.util.Locale locale)
itemModel - the ItemModel to retrieve the value from.attribute - the AttributeDescriptorModel describing the metadata of the property.locale - the LocaleOptional valueprotected java.util.Optional<java.lang.Object> getAttributeValueFromItem(ItemModel itemModel, AttributeDescriptorModel attribute)
itemModel - the ItemModel to retrieve the value from.attribute - the AttributeDescriptorModel describing the metadata of the property.Optional valueprotected java.util.Map<LanguageModel,java.lang.Object> convertLocalizedValue(ItemModel itemModel, AttributeDescriptorModel attribute, java.util.function.Function<java.lang.Object,java.lang.Object> converter)
itemModel - the ItemModel to retrieve the localized value from.attribute - the AttributeDescriptorModel describing the metadata of the property.converter - the conversion Function that will be applied on each element of the localized value.Map of LanguageModel and Object where the Object represents the value.protected java.util.Collection<java.lang.Object> convertCollection(VersionAttributeDescriptor versionAttributeDescriptor, java.util.Collection<java.lang.Object> collection)
Object elements.versionAttributeDescriptor - the VersionAttributeDescriptor describing the metadata of the collection element.collection - the Collection that will be converted.Collection of converted elements.protected java.lang.Object convertAttributeValue(VersionAttributeDescriptor attribute, java.lang.Object attributeValue)
PayloadSerializer.attribute - attribute the AttributeDescriptorModel describing the metadata of the property.attributeValue - the Object representing the valuePayloadSerializer.protected PayloadSerializer getPayloadSerializer()
public void setPayloadSerializer(PayloadSerializer payloadSerializer)
protected CommonI18NService getCommonI18NService()
public void setCommonI18NService(CommonI18NService commonI18NService)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected AttributeStrategyConverterProvider<VersionAttributeDescriptor> getConverterProvider()
public void setConverterProvider(AttributeStrategyConverterProvider<VersionAttributeDescriptor> converterProvider)
protected CustomAttributeStrategyConverterProvider getCustomConverterProvider()
public void setCustomConverterProvider(CustomAttributeStrategyConverterProvider customConverterProvider)
protected CollectionHelper getCollectionHelper()
public void setCollectionHelper(CollectionHelper collectionHelper)
protected CMSVersionHelper getCmsVersionHelper()
public void setCmsVersionHelper(CMSVersionHelper cmsVersionHelper)
protected java.util.function.Predicate<AttributeDescriptorModel> getIsCollectionPredicate()
public void setIsCollectionPredicate(java.util.function.Predicate<AttributeDescriptorModel> isCollectionPredicate)
Copyright © 2018 SAP SE. All Rights Reserved.