Class DefaultStructureTypeModeService
java.lang.Object
de.hybris.platform.cmsfacades.types.service.impl.DefaultStructureTypeModeService
- All Implemented Interfaces:
StructureTypeModeService,org.springframework.beans.factory.InitializingBean
public class DefaultStructureTypeModeService
extends Object
implements StructureTypeModeService, org.springframework.beans.factory.InitializingBean
Default implementation of
StructureTypeModeService-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidapplyStructureTypeModeData(String typeCode, StructureTypeMode mode, ComponentTypeStructure baseTypeStructure, Set<ComponentTypeAttributeStructure> attributes, Set<String> attributeOrder) Apply the Structure Type Mode defined for this Type.protected voidaugmentAttributePopulators(StructureTypeMode mode, ComponentTypeStructure typeStructure) Augment the attribute's populator list using theAttributeModePopulatorsProvider.protected ComponentTypeStructureconvertTypeStructureData(StructureTypeMode mode, ComponentTypeStructure baseTypeStructure) Convert theComponentTypeStructureintoComponentTypeData.protected Optional<AttributeDescriptorModel>getAttributeDescriptor(String typecode, String qualifier) protected AttributeModePopulatorsProvidergetComponentTypeByCodeAndMode(String typeCode, StructureTypeMode structureTypeMode) Get a single component type structure for a given structure type mode.protected com.google.common.base.Supplier<Map<String,Map<StructureTypeMode, ComponentTypeStructure>>> protected Map<StructureTypeMode,ComponentTypeStructure> getComponentTypesByCodeInternal(String typeCode) Internal method to build theMap<StructureTypeMode, ComponentTypeData>for a given type code.protected ComponentTypeStructureServiceprotected ConfigurationServiceprotected StructureTypeModeAttributeFilterProviderprotected Deque<StructureTypeModeAttributeFilter>getStructureTypeModeData(String typeCode, StructureTypeMode mode) Get the mode defintion for this type or its super type, if one does not exist.protected voidgetStructureTypeModeData(String typeCode, StructureTypeMode mode, Deque<StructureTypeModeAttributeFilter> structureModeDataList) Recursively collects the the mode definition for its type and for its parent's type.protected TypeServiceprotected com.google.common.base.Supplier<Map<String,Map<StructureTypeMode, ComponentTypeStructure>>> Internal method to initialize the Map that will serve as a data store for this service.protected com.google.common.base.Supplier<Map<String,Map<StructureTypeMode, ComponentTypeStructure>>> initializeInternalStructureMap(Long expirationTime) voidsetAttributeModePopulatorsProvider(AttributeModePopulatorsProvider attributeModePopulatorsProvider) protected voidsetAttributePosition(ComponentTypeAttributeStructure attribute, Set<String> attributeOrder) Sets the attribute's position to be equal to the position of the attribute in the ordered list, or to be Integer.MAX_VALUE, if the attribute is not present in the ordered list.voidsetComponentTypeStructureService(ComponentTypeStructureService componentTypeStructureService) voidsetConfigurationService(ConfigurationService configurationService) voidsetStructureTypeModeAttributeFilterProvider(StructureTypeModeAttributeFilterProvider structureTypeModeAttributeFilterProvider) voidsetTypeService(TypeService typeService)
-
Field Details
-
DEFAULT_EXPIRATION_TIME
-
-
Constructor Details
-
DefaultStructureTypeModeService
public DefaultStructureTypeModeService()
-
-
Method Details
-
getComponentTypeByCodeAndMode
public ComponentTypeStructure getComponentTypeByCodeAndMode(String typeCode, StructureTypeMode structureTypeMode) Description copied from interface:StructureTypeModeServiceGet a single component type structure for a given structure type mode.- Specified by:
getComponentTypeByCodeAndModein interfaceStructureTypeModeService- Parameters:
typeCode- - the _TYPECODE of the component type to retrieve from the base modestructureTypeMode- - the mode of the structure type- Returns:
- the component type structure or null when the code and mode provided do not match any existing types
-
initializeComponentTypeDataSupplier
protected com.google.common.base.Supplier<Map<String,Map<StructureTypeMode, initializeComponentTypeDataSupplier()ComponentTypeStructure>>> Internal method to initialize the Map that will serve as a data store for this service.- Returns:
- the supplier method to get the
Map<String, Map<StructureTypeMode, ComponentTypeData>>
-
getComponentTypesByCodeInternal
protected Map<StructureTypeMode,ComponentTypeStructure> getComponentTypesByCodeInternal(String typeCode) Internal method to build theMap<StructureTypeMode, ComponentTypeData>for a given type code.- Parameters:
typeCode- the Item Type Code- Returns:
- a map where the keys are the
StructureTypeModeand the values areComponentTypeData
-
augmentAttributePopulators
protected void augmentAttributePopulators(StructureTypeMode mode, ComponentTypeStructure typeStructure) Augment the attribute's populator list using theAttributeModePopulatorsProvider.- Parameters:
mode- the current mode being inspected.typeStructure- the typeStructure with the attributes to be inspected.
-
getAttributeDescriptor
protected Optional<AttributeDescriptorModel> getAttributeDescriptor(String typecode, String qualifier) -
convertTypeStructureData
protected ComponentTypeStructure convertTypeStructureData(StructureTypeMode mode, ComponentTypeStructure baseTypeStructure) Convert theComponentTypeStructureintoComponentTypeData. It creates a new object as the image of the DEFAULT, if not empty, or the BASE, which is never null.- Parameters:
mode- the mode for this current type structure view.baseTypeStructure- the BASE type structure- Returns:
- the component type structure
-
applyStructureTypeModeData
protected void applyStructureTypeModeData(String typeCode, StructureTypeMode mode, ComponentTypeStructure baseTypeStructure, Set<ComponentTypeAttributeStructure> attributes, Set<String> attributeOrder) Apply the Structure Type Mode defined for this Type.- Parameters:
typeCode- the type code we are want to apply the mode into.mode- the mode definitionbaseTypeStructure- the base type Structure that is mode-agnostic.attributes- the pre-built set of attributes defined by the base.attributeOrder- the final attribute order
-
getStructureTypeModeData
protected Deque<StructureTypeModeAttributeFilter> getStructureTypeModeData(String typeCode, StructureTypeMode mode) Get the mode defintion for this type or its super type, if one does not exist.- Parameters:
typeCode- the type code that defines a mode.mode- the structure mode required for this type- Returns:
- the StructureTypeModeData defined in the configuration, or empty() if none.
-
getStructureTypeModeData
protected void getStructureTypeModeData(String typeCode, StructureTypeMode mode, Deque<StructureTypeModeAttributeFilter> structureModeDataList) Recursively collects the the mode definition for its type and for its parent's type.- Parameters:
typeCode- the current type code possibly owning the mode definitionmode- the mode definitionstructureModeDataList- the final list of modes collected.
-
setAttributePosition
protected void setAttributePosition(ComponentTypeAttributeStructure attribute, Set<String> attributeOrder) Sets the attribute's position to be equal to the position of the attribute in the ordered list, or to be Integer.MAX_VALUE, if the attribute is not present in the ordered list.- Parameters:
attribute- the ComponentTypeAttributeStructure we want to set the positionattributeOrder- the ordered list
-
getComponentTypeDataSupplierMap
protected com.google.common.base.Supplier<Map<String,Map<StructureTypeMode, getComponentTypeDataSupplierMap()ComponentTypeStructure>>> -
initializeInternalStructureMap
protected com.google.common.base.Supplier<Map<String,Map<StructureTypeMode, initializeInternalStructureMapComponentTypeStructure>>> (Long expirationTime) -
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
getTypeService
-
setTypeService
-
getComponentTypeStructureService
-
setComponentTypeStructureService
public void setComponentTypeStructureService(ComponentTypeStructureService componentTypeStructureService) -
getConfigurationService
-
setConfigurationService
-
getAttributeModePopulatorsProvider
-
setAttributeModePopulatorsProvider
public void setAttributeModePopulatorsProvider(AttributeModePopulatorsProvider attributeModePopulatorsProvider) -
getStructureTypeModeAttributeFilterProvider
-
setStructureTypeModeAttributeFilterProvider
public void setStructureTypeModeAttributeFilterProvider(StructureTypeModeAttributeFilterProvider structureTypeModeAttributeFilterProvider)
-