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 java.lang.Object implements StructureTypeModeService, org.springframework.beans.factory.InitializingBean
Default implementation ofStructureTypeModeService
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.LongDEFAULT_EXPIRATION_TIME
-
Constructor Summary
Constructors Constructor Description DefaultStructureTypeModeService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected voidapplyStructureTypeModeData(java.lang.String typeCode, StructureTypeMode mode, ComponentTypeStructure baseTypeStructure, java.util.Set<ComponentTypeAttributeStructure> attributes, java.util.Set<java.lang.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 java.util.Optional<AttributeDescriptorModel>getAttributeDescriptor(java.lang.String typecode, java.lang.String qualifier)protected AttributeModePopulatorsProvidergetAttributeModePopulatorsProvider()ComponentTypeStructuregetComponentTypeByCodeAndMode(java.lang.String typeCode, StructureTypeMode structureTypeMode)Get a single component type structure for a given structure type mode.protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.Map<StructureTypeMode,ComponentTypeStructure>>>getComponentTypeDataSupplierMap()protected java.util.Map<StructureTypeMode,ComponentTypeStructure>getComponentTypesByCodeInternal(java.lang.String typeCode)Internal method to build theMapfor a given type code.protected ComponentTypeStructureServicegetComponentTypeStructureService()protected ConfigurationServicegetConfigurationService()protected StructureTypeModeAttributeFilterProvidergetStructureTypeModeAttributeFilterProvider()protected java.util.Deque<StructureTypeModeAttributeFilter>getStructureTypeModeData(java.lang.String typeCode, StructureTypeMode mode)Get the mode defintion for this type or its super type, if one does not exist.protected voidgetStructureTypeModeData(java.lang.String typeCode, StructureTypeMode mode, java.util.Deque<StructureTypeModeAttributeFilter> structureModeDataList)Recursively collects the the mode definition for its type and for its parent's type.protected TypeServicegetTypeService()protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.Map<StructureTypeMode,ComponentTypeStructure>>>initializeComponentTypeDataSupplier()Internal method to initialize the Map that will serve as a data store for this service.protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.Map<StructureTypeMode,ComponentTypeStructure>>>initializeInternalStructureMap(java.lang.Long expirationTime)voidsetAttributeModePopulatorsProvider(AttributeModePopulatorsProvider attributeModePopulatorsProvider)protected voidsetAttributePosition(ComponentTypeAttributeStructure attribute, java.util.Set<java.lang.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)
-
-
-
Method Detail
-
getComponentTypeByCodeAndMode
public ComponentTypeStructure getComponentTypeByCodeAndMode(java.lang.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<java.util.Map<java.lang.String,java.util.Map<StructureTypeMode,ComponentTypeStructure>>> initializeComponentTypeDataSupplier()
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 java.util.Map<StructureTypeMode,ComponentTypeStructure> getComponentTypesByCodeInternal(java.lang.String typeCode)
Internal method to build theMapfor 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 java.util.Optional<AttributeDescriptorModel> getAttributeDescriptor(java.lang.String typecode, java.lang.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(java.lang.String typeCode, StructureTypeMode mode, ComponentTypeStructure baseTypeStructure, java.util.Set<ComponentTypeAttributeStructure> attributes, java.util.Set<java.lang.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 java.util.Deque<StructureTypeModeAttributeFilter> getStructureTypeModeData(java.lang.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(java.lang.String typeCode, StructureTypeMode mode, java.util.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, java.util.Set<java.lang.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<java.util.Map<java.lang.String,java.util.Map<StructureTypeMode,ComponentTypeStructure>>> getComponentTypeDataSupplierMap()
-
initializeInternalStructureMap
protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.Map<StructureTypeMode,ComponentTypeStructure>>> initializeInternalStructureMap(java.lang.Long expirationTime)
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
getTypeService
protected TypeService getTypeService()
-
setTypeService
public void setTypeService(TypeService typeService)
-
getComponentTypeStructureService
protected ComponentTypeStructureService getComponentTypeStructureService()
-
setComponentTypeStructureService
public void setComponentTypeStructureService(ComponentTypeStructureService componentTypeStructureService)
-
getConfigurationService
protected ConfigurationService getConfigurationService()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getAttributeModePopulatorsProvider
protected AttributeModePopulatorsProvider getAttributeModePopulatorsProvider()
-
setAttributeModePopulatorsProvider
public void setAttributeModePopulatorsProvider(AttributeModePopulatorsProvider attributeModePopulatorsProvider)
-
getStructureTypeModeAttributeFilterProvider
protected StructureTypeModeAttributeFilterProvider getStructureTypeModeAttributeFilterProvider()
-
setStructureTypeModeAttributeFilterProvider
public void setStructureTypeModeAttributeFilterProvider(StructureTypeModeAttributeFilterProvider structureTypeModeAttributeFilterProvider)
-
-