Class ClassificationSystemCPQAttributesProviderImpl
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.facades.impl.ClassificationSystemCPQAttributesProviderImpl
-
- All Implemented Interfaces:
ClassificationSystemCPQAttributesProvider
public class ClassificationSystemCPQAttributesProviderImpl extends java.lang.Object implements ClassificationSystemCPQAttributesProvider
Default implementation of theClassificationSystemCPQAttributesProvider.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCLASSIFICATION
-
Constructor Summary
Constructors Constructor Description ClassificationSystemCPQAttributesProviderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,java.util.Collection<MediaModel>>addMediaEntries(java.util.Collection<ClassificationAttributeValueModel> attrValues)protected java.util.List<ImageData>convertMediaToImages(java.util.Collection<MediaModel> media, java.util.Map<java.lang.String,CPQImageType> cpqMediaFormatQualifiers)protected voiddetermineAvailableClassificationSystems(java.util.List<CatalogModel> catalogs, java.util.List<ClassificationSystemModel> availableClassificationSystems, java.util.List<ClassificationSystemModel> availableClassificationSystemsMatchingPattern)protected java.util.Collection<MediaModel>extractCsticMediaFromAttributeModel(ClassificationAttributeModel attr)protected java.util.Map<java.lang.String,java.util.Collection<MediaModel>>extractCsticValueMediaFromAttributeModel(java.util.Collection<ClassificationAttributeValueModel> attrValues)protected java.util.Map<java.lang.String,java.lang.String>extractValueDescriptionsFromAttributeModel(java.util.Collection<ClassificationAttributeValueModel> attrValues)protected java.util.Map<java.lang.String,java.lang.String>extractValueNamesFromAttributeModel(java.util.Collection<ClassificationAttributeValueModel> attrValues)protected java.util.Collection<ClassificationAttributeModel>findClassificationAttributesByCode(ClassificationSystemVersionModel systemVersion, java.lang.String code)protected java.util.Collection<ClassificationAttributeValueModel>findClassificationAttributeValuesByCodePrefix(ClassificationSystemVersionModel systemVersion, java.lang.String code)protected BaseStoreModelgetBaseStore()protected ClassificationAttributeModelgetClassificationAttribute(java.lang.String name, ClassificationSystemVersionModel systemVersion)Retrieves the hybris classification attribute for a characteristic name (which is part of a CPQ configuraton model).protected java.lang.StringgetClassificationSystemSubString()Returns substring we search for in the available classification systems.ClassificationSystemCPQAttributesContainergetCPQAttributes(java.lang.String name, java.util.Map<java.lang.String,ClassificationSystemCPQAttributesContainer> nameMap)Get CPQ related attributes for the given cstic from the hybris classification system.protected CPQImageFormatMappinggetCpqCsticImageFormatMapping()protected CPQImageFormatMappinggetCpqCsticValueImageFormatMapping()java.util.List<ImageData>getCsticMedia(ClassificationSystemCPQAttributesContainer cpqAttributes)extracts all media assigned to this cstic from the CPQ hybris attribute container.java.util.List<ImageData>getCsticValueMedia(java.lang.String csticValueKey, ClassificationSystemCPQAttributesContainer cpqAttributes)extracts all media assigned to this cstic value from the CPQ hybris attribute container.java.lang.StringgetDisplayName(CsticModel csticModel, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)returns the display name for the cstic.java.lang.StringgetDisplayValueName(CsticValueModel valueModel, CsticModel csticModel, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)returns the display name for the cstic value.protected FlexibleSearchServicegetFlexibleSearchService()protected ImagePopulatorgetImagePopulator()java.lang.StringgetLongText(CsticModel model, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)returns the long text for the cstic.protected ClassificationSystemCPQAttributesContainergetNameFromAttribute(ClassificationAttributeModel attr, ClassificationSystemVersionModel systemVersion)java.lang.StringgetOverviewValueName(CsticValueModel valueModel, CsticModel csticModel, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)returns the display name for the cstic value in context of the overview page.protected ClassificationSystemVersionModelgetSystemVersion()Determines the classification system we use for retrieving the hybris classification attributes for CPQ characteristics.protected UiTypeFindergetUiTypeFinder()protected ValueFormatTranslatorgetValueFormatTranslator()protected java.lang.StringgetValueKey(CsticValueModel valueModel, CsticModel csticModel)java.lang.StringgetValueLongText(CsticValueModel valueModel, CsticModel csticModel, ClassificationSystemCPQAttributesContainer hybrisNames, boolean isDebugEnabled)returns the long text for a cstic value.protected java.lang.StringgetValueName(CsticValueModel valueModel, CsticModel csticModel, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)booleanisDebugEnabled()protected voidlogValue(java.lang.String className, java.lang.String nameType, java.lang.String name, java.lang.String targetType, java.lang.String sourceType, java.lang.String value, boolean isDebugEnabled)voidsetBaseStoreService(BaseStoreService baseStoreService)voidsetClassificationService(ClassificationSystemService classificationService)voidsetCpqCsticImageFormatMapping(CPQImageFormatMapping cpqCsticImageFormatMapping)voidsetCpqCsticValueImageFormatMapping(CPQImageFormatMapping cpqCsticValueImageFormatMapping)voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService)voidsetImagePopulator(ImagePopulator imagePopulator)voidsetUiTypeFinder(UiTypeFinder uiTypeFinder)voidsetValueFormatTranslator(ValueFormatTranslator valueFormatTranslator)
-
-
-
Field Detail
-
CLASSIFICATION
public static final java.lang.String CLASSIFICATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCPQAttributes
public ClassificationSystemCPQAttributesContainer getCPQAttributes(java.lang.String name, java.util.Map<java.lang.String,ClassificationSystemCPQAttributesContainer> nameMap)
Description copied from interface:ClassificationSystemCPQAttributesProviderGet CPQ related attributes for the given cstic from the hybris classification system. It is recommended to provide a nameMap, which should be cached at least on session level, so that the results can be cached in the map and so that there is no need to query CPQ attributes on each invocation.- Specified by:
getCPQAttributesin interfaceClassificationSystemCPQAttributesProvider- Parameters:
name- cstic namenameMap- to cache results- Returns:
- CPQ attribute container
-
getNameFromAttribute
protected ClassificationSystemCPQAttributesContainer getNameFromAttribute(ClassificationAttributeModel attr, ClassificationSystemVersionModel systemVersion)
-
extractValueDescriptionsFromAttributeModel
protected java.util.Map<java.lang.String,java.lang.String> extractValueDescriptionsFromAttributeModel(java.util.Collection<ClassificationAttributeValueModel> attrValues)
-
extractCsticValueMediaFromAttributeModel
protected java.util.Map<java.lang.String,java.util.Collection<MediaModel>> extractCsticValueMediaFromAttributeModel(java.util.Collection<ClassificationAttributeValueModel> attrValues)
-
addMediaEntries
protected final java.util.Map<java.lang.String,java.util.Collection<MediaModel>> addMediaEntries(java.util.Collection<ClassificationAttributeValueModel> attrValues)
-
extractCsticMediaFromAttributeModel
protected java.util.Collection<MediaModel> extractCsticMediaFromAttributeModel(ClassificationAttributeModel attr)
-
extractValueNamesFromAttributeModel
protected java.util.Map<java.lang.String,java.lang.String> extractValueNamesFromAttributeModel(java.util.Collection<ClassificationAttributeValueModel> attrValues)
-
getCsticMedia
public java.util.List<ImageData> getCsticMedia(ClassificationSystemCPQAttributesContainer cpqAttributes)
Description copied from interface:ClassificationSystemCPQAttributesProviderextracts all media assigned to this cstic from the CPQ hybris attribute container. The configuration engine model does not contain any media mappings, so this can only be maintained in hybris.- Specified by:
getCsticMediain interfaceClassificationSystemCPQAttributesProvider- Parameters:
cpqAttributes- CPQ attribute container with hybris media- Returns:
- list of medias
-
getCsticValueMedia
public java.util.List<ImageData> getCsticValueMedia(java.lang.String csticValueKey, ClassificationSystemCPQAttributesContainer cpqAttributes)
Description copied from interface:ClassificationSystemCPQAttributesProviderextracts all media assigned to this cstic value from the CPQ hybris attribute container. The configuration engine model does not contain any media mappings, so this can only be maintained in hybris.- Specified by:
getCsticValueMediain interfaceClassificationSystemCPQAttributesProvider- Parameters:
csticValueKey- key of the cstic valuecpqAttributes- CPQ attribute container with hybris media- Returns:
- list of medias
-
convertMediaToImages
protected java.util.List<ImageData> convertMediaToImages(java.util.Collection<MediaModel> media, java.util.Map<java.lang.String,CPQImageType> cpqMediaFormatQualifiers)
-
getLongText
public java.lang.String getLongText(CsticModel model, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)
Description copied from interface:ClassificationSystemCPQAttributesProviderreturns the long text for the cstic. In case a long text is present in the CPQ attribute container it will be returned, otherwise the long text is extracted from the cstic model.- Specified by:
getLongTextin interfaceClassificationSystemCPQAttributesProvider- Parameters:
model- model of the csticcpqAttributes- CPQ attribute container with hybris long textisDebugEnabled- only iftrue, debug logs will be written- Returns:
- cstic name to be displayed
-
logValue
protected void logValue(java.lang.String className, java.lang.String nameType, java.lang.String name, java.lang.String targetType, java.lang.String sourceType, java.lang.String value, boolean isDebugEnabled)
-
getDisplayName
public java.lang.String getDisplayName(CsticModel csticModel, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)
Description copied from interface:ClassificationSystemCPQAttributesProviderreturns the display name for the cstic. In case a display name is present in the CPQ attribute container it will be returned, otherwise the display name is extracted from the cstic model.- Specified by:
getDisplayNamein interfaceClassificationSystemCPQAttributesProvider- Parameters:
csticModel- model of the csticcpqAttributes- CPQ attribute container with hybris cstic nameisDebugEnabled- only iftrue, debug logs will be written- Returns:
- cstic name to be displayed
-
getClassificationAttribute
protected ClassificationAttributeModel getClassificationAttribute(java.lang.String name, ClassificationSystemVersionModel systemVersion)
Retrieves the hybris classification attribute for a characteristic name (which is part of a CPQ configuraton model).- Parameters:
name- Language independent name of characteristicsystemVersion-- Returns:
- Classification attribute
-
getDisplayValueName
public java.lang.String getDisplayValueName(CsticValueModel valueModel, CsticModel csticModel, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)
Description copied from interface:ClassificationSystemCPQAttributesProviderreturns the display name for the cstic value. In case a display name is present in the CPQ attribute container it will be returned, otherwise the display name is extracted from the cstic value model.- Specified by:
getDisplayValueNamein interfaceClassificationSystemCPQAttributesProvider- Parameters:
valueModel- value model of the cstic valuecsticModel- model of the csticcpqAttributes- CPQ attribute container with hybris cstic value nameisDebugEnabled- only iftrue, debug logs will be written- Returns:
- cstic name to be displayed
-
getOverviewValueName
public java.lang.String getOverviewValueName(CsticValueModel valueModel, CsticModel csticModel, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)
Description copied from interface:ClassificationSystemCPQAttributesProviderreturns the display name for the cstic value in context of the overview page. In case a display name is present in the CPQ attribute container it will be returned, otherwise the display name is extracted from the cstic value model.- Specified by:
getOverviewValueNamein interfaceClassificationSystemCPQAttributesProvider- Parameters:
valueModel- value model of the cstic valuecsticModel- model of the csticcpqAttributes- CPQ attribute container with hybris cstic value nameisDebugEnabled- only iftrue, debug logs will be written- Returns:
- cstic name to be displayed on the overview page
-
getValueName
protected java.lang.String getValueName(CsticValueModel valueModel, CsticModel csticModel, ClassificationSystemCPQAttributesContainer cpqAttributes, boolean isDebugEnabled)
-
getValueKey
protected java.lang.String getValueKey(CsticValueModel valueModel, CsticModel csticModel)
-
getSystemVersion
protected ClassificationSystemVersionModel getSystemVersion()
Determines the classification system we use for retrieving the hybris classification attributes for CPQ characteristics. Checks the classification systems that are attached to a base store.
If no system is available, null is returned.
If at least one system is available: Returns the first one which contains '300' as part of its name, as this matches the customizing proposal for SAP Integration. '300' stands for class type 300 in ERP, which is typically used for product configuration.
If no system contains '300', the first one found is returned.
NOTE The pattern '300' can also be replaced, in this case override method getClassificationSystemPattern- Returns:
- classification system Version model
-
determineAvailableClassificationSystems
protected void determineAvailableClassificationSystems(java.util.List<CatalogModel> catalogs, java.util.List<ClassificationSystemModel> availableClassificationSystems, java.util.List<ClassificationSystemModel> availableClassificationSystemsMatchingPattern)
-
getClassificationSystemSubString
protected java.lang.String getClassificationSystemSubString()
Returns substring we search for in the available classification systems. The first system which contains this substring will be used to determine hybris attributes for CPQ characteristics names- Returns:
- "300"
-
getBaseStore
protected BaseStoreModel getBaseStore()
-
isDebugEnabled
public boolean isDebugEnabled()
- Specified by:
isDebugEnabledin interfaceClassificationSystemCPQAttributesProvider- Returns:
trueonly if debug log is enabled for the attribute container
-
setClassificationService
public void setClassificationService(ClassificationSystemService classificationService)
- Parameters:
classificationService- injects the classification service, required to access the hybris classification system
-
setBaseStoreService
public void setBaseStoreService(BaseStoreService baseStoreService)
- Parameters:
baseStoreService- injects the base store service, required to access the hybris classification system
-
getUiTypeFinder
protected UiTypeFinder getUiTypeFinder()
-
setUiTypeFinder
public void setUiTypeFinder(UiTypeFinder uiTypeFinder)
- Parameters:
uiTypeFinder- characteristic UI type finder
-
getValueFormatTranslator
protected ValueFormatTranslator getValueFormatTranslator()
-
setValueFormatTranslator
public void setValueFormatTranslator(ValueFormatTranslator valueFormatTranslator)
- Parameters:
valueFormatTranslator- value format translator
-
getCpqCsticImageFormatMapping
protected CPQImageFormatMapping getCpqCsticImageFormatMapping()
-
setCpqCsticImageFormatMapping
public void setCpqCsticImageFormatMapping(CPQImageFormatMapping cpqCsticImageFormatMapping)
- Parameters:
cpqCsticImageFormatMapping- the cpqCsticImageFormatMapping to set
-
getCpqCsticValueImageFormatMapping
protected CPQImageFormatMapping getCpqCsticValueImageFormatMapping()
-
setCpqCsticValueImageFormatMapping
public void setCpqCsticValueImageFormatMapping(CPQImageFormatMapping cpqCsticValueImageFormatMapping)
- Parameters:
cpqCsticValueImageFormatMapping- the cpqCsticValueImageFormatMapping to set
-
getImagePopulator
protected ImagePopulator getImagePopulator()
-
setImagePopulator
public void setImagePopulator(ImagePopulator imagePopulator)
- Parameters:
imagePopulator- the imagePopulator to set
-
getFlexibleSearchService
protected FlexibleSearchService getFlexibleSearchService()
-
setFlexibleSearchService
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
- Parameters:
flexibleSearchService- the flexibleSearchService to set
-
findClassificationAttributesByCode
protected java.util.Collection<ClassificationAttributeModel> findClassificationAttributesByCode(ClassificationSystemVersionModel systemVersion, java.lang.String code)
-
findClassificationAttributeValuesByCodePrefix
protected java.util.Collection<ClassificationAttributeValueModel> findClassificationAttributeValuesByCodePrefix(ClassificationSystemVersionModel systemVersion, java.lang.String code)
-
getValueLongText
public java.lang.String getValueLongText(CsticValueModel valueModel, CsticModel csticModel, ClassificationSystemCPQAttributesContainer hybrisNames, boolean isDebugEnabled)
Description copied from interface:ClassificationSystemCPQAttributesProviderreturns the long text for a cstic value. In case a long text is present in the CPQ attribute container it will be returned, otherwise the long text is extracted from the cstic value model.- Specified by:
getValueLongTextin interfaceClassificationSystemCPQAttributesProvider- Parameters:
valueModel- value model of the csticcsticModel- model of the cstichybrisNames- CPQ attribute container with hybris long text- Returns:
- cstic name to be displayed
-
-