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 Details

    • DEFAULT_EXPIRATION_TIME

      protected static final Long DEFAULT_EXPIRATION_TIME
  • Constructor Details

    • DefaultStructureTypeModeService

      public DefaultStructureTypeModeService()
  • Method Details

    • getComponentTypeByCodeAndMode

      public ComponentTypeStructure getComponentTypeByCodeAndMode(String typeCode, StructureTypeMode structureTypeMode)
      Description copied from interface: StructureTypeModeService
      Get a single component type structure for a given structure type mode.
      Specified by:
      getComponentTypeByCodeAndMode in interface StructureTypeModeService
      Parameters:
      typeCode - - the _TYPECODE of the component type to retrieve from the base mode
      structureTypeMode - - 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,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 Map<StructureTypeMode,ComponentTypeStructure> getComponentTypesByCodeInternal(String typeCode)
      Internal method to build the Map<StructureTypeMode, ComponentTypeData> for a given type code.
      Parameters:
      typeCode - the Item Type Code
      Returns:
      a map where the keys are the StructureTypeMode and the values are ComponentTypeData
    • augmentAttributePopulators

      protected void augmentAttributePopulators(StructureTypeMode mode, ComponentTypeStructure typeStructure)
      Augment the attribute's populator list using the AttributeModePopulatorsProvider.
      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 the ComponentTypeStructure into ComponentTypeData. 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 definition
      baseTypeStructure - 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 definition
      mode - the mode definition
      structureModeDataList - 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 position
      attributeOrder - the ordered list
    • getComponentTypeDataSupplierMap

      protected com.google.common.base.Supplier<Map<String,Map<StructureTypeMode,ComponentTypeStructure>>> getComponentTypeDataSupplierMap()
    • initializeInternalStructureMap

      protected com.google.common.base.Supplier<Map<String,Map<StructureTypeMode,ComponentTypeStructure>>> initializeInternalStructureMap(Long expirationTime)
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      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)