Class GenericComponentTypeStructureService

java.lang.Object
de.hybris.platform.cmsfacades.types.service.impl.GenericComponentTypeStructureService
All Implemented Interfaces:
ComponentTypeStructureService, org.springframework.beans.factory.InitializingBean

public class GenericComponentTypeStructureService extends Object implements ComponentTypeStructureService, org.springframework.beans.factory.InitializingBean
Implementation of the ComponentTypeStructureService that first attempts to get type using the registered structure type ComponentTypeStructureRegistry.getComponentTypeStructure(String).

As a fallback strategy, it creates an instance of the ComponentTypeStructure by introspecting the Type and its attributes. This service will be first lookup for the ComposedTypeModel and check if one of its super type is CMSItemModel.

If it passes this verification, then it will convert an instance of ComposedTypeModel into a new instance of ComponentTypeStructure.

  • Field Details

    • DEFAULT_EXPIRATION_TIME

      protected static final Long DEFAULT_EXPIRATION_TIME
  • Constructor Details

    • GenericComponentTypeStructureService

      public GenericComponentTypeStructureService()
  • Method Details

    • getComponentTypeStructure

      public ComponentTypeStructure getComponentTypeStructure(String typeCode)
      Description copied from interface: ComponentTypeStructureService
      Get a ComponentTypeStructure by its typecode.
      Specified by:
      getComponentTypeStructure in interface ComponentTypeStructureService
      Parameters:
      typeCode - - the typeCode of the element to retrieve.
      Returns:
      the element matching the typeCode
      Throws:
      UnknownIdentifierException - when the typeCode does not exist
      ConversionException - when the type requested does not extend CMSItem
    • getComponentTypeStructures

      public Collection<ComponentTypeStructure> getComponentTypeStructures()
      Description copied from interface: ComponentTypeStructureService
      Get all elements in the registry.
      Specified by:
      getComponentTypeStructures in interface ComponentTypeStructureService
      Returns:
      all items in the registry or an empty collection if no elements are found.
    • initializeComponentTypeStructureMap

      protected com.google.common.base.Supplier<Map<String,ComponentTypeStructure>> initializeComponentTypeStructureMap()
      Supplier function to initialize the ComponentTypeStructure map.
    • isAbstractType

      protected Predicate<String> isAbstractType()
      Predicate to test if the composed type represented by the typeCode is valid and is abstract.

      Returns TRUE if the composed type is a valid type and is abstract.

    • getComponentTypeStructureInternal

      protected ComponentTypeStructure getComponentTypeStructureInternal(String typeCode)
      Internal method to get the component type structure for a given typeCode
      Parameters:
      typeCode - the type code that represents the component type structure
      Returns:
      the ComponentTypeStructure represented by this typeCode.
    • collectTypePopulatorsFromTypeAndAncestorsInRegistry

      protected void collectTypePopulatorsFromTypeAndAncestorsInRegistry(ComposedTypeModel composedType, List<Populator<ComposedTypeModel,ComponentTypeData>> populators)
      Recursively collects type populators from the registry until it reaches the root type (CMSItem)
      Parameters:
      composedType - the type being used to look for populators
      populators - the list of populators that has to be modified
    • collectExtraAttributesFromTypeAndAncestorsInRegistry

      protected void collectExtraAttributesFromTypeAndAncestorsInRegistry(ComposedTypeModel composedType, Set<ComponentTypeAttributeStructure> attributes)
      Recursively collects extra attributes that are not in the Data Model, but it is present on the the registry
      Parameters:
      composedType - the type being used to look for populators
      attributes -
    • getInternalComponentTypeStructureMap

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

      protected com.google.common.base.Supplier<Map<String,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)
    • getTypeBlacklistSet

      protected Set<String> getTypeBlacklistSet()
    • setTypeBlacklistSet

      public void setTypeBlacklistSet(Set<String> typeBlacklistSet)
    • getConfigurationService

      protected ConfigurationService getConfigurationService()
    • setConfigurationService

      public void setConfigurationService(ConfigurationService configurationService)
    • getComposedTypeToStructureConverter

      protected Converter<ComposedTypeModel,ComponentTypeStructure> getComposedTypeToStructureConverter()
    • setComposedTypeToStructureConverter

      public void setComposedTypeToStructureConverter(Converter<ComposedTypeModel,ComponentTypeStructure> composedTypeToStructureConverter)
    • getComponentTypeStructureRegistry

      protected ComponentTypeStructureRegistry getComponentTypeStructureRegistry()
    • setComponentTypeStructureRegistry

      public void setComponentTypeStructureRegistry(ComponentTypeStructureRegistry componentTypeStructureRegistry)