Class AbstractCMSComponentModelVisitor<CMSCOMPONENTTYPE extends AbstractCMSComponentModel>

java.lang.Object
de.hybris.platform.cmsfacades.synchronization.itemvisitors.AbstractCMSComponentModelVisitor<CMSCOMPONENTTYPE>
Type Parameters:
CMSCOMPONENTTYPE - the component type that extends AbstractCMSComponentModel
All Implemented Interfaces:
ItemVisitor<CMSCOMPONENTTYPE>, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
AbstractCMSComponentContainerModelVisitor, AbstractMediaContainerComponentModelVisitor, CMSLinkComponentModelVisitor, DefaultAbstractCMSComponentModelVisitor, NavigationBarCollectionComponentModelVisitor, NavigationBarComponentModelVisitor, NavigationComponentModelVisitor, VideoComponentModelVisitor

public abstract class AbstractCMSComponentModelVisitor<CMSCOMPONENTTYPE extends AbstractCMSComponentModel> extends Object implements ItemVisitor<CMSCOMPONENTTYPE>, org.springframework.beans.factory.InitializingBean
Abstract class for visiting AbstractCMSComponentModel models for the cms synchronization service to work properly. In this implementation, it will collect all component's child (collection or not) extending or being CMSItemModel
  • Field Details

    • SYNCHRONIZATION_COMPONENT_ATTRIBUTE_CACHE_EXPIRATION_TIME

      public static final String SYNCHRONIZATION_COMPONENT_ATTRIBUTE_CACHE_EXPIRATION_TIME
      See Also:
  • Constructor Details

    • AbstractCMSComponentModelVisitor

      public AbstractCMSComponentModelVisitor()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • visit

      public List<ItemModel> visit(CMSCOMPONENTTYPE source, List<ItemModel> path, Map<String,Object> ctx)
      Description copied from interface: ItemVisitor
      Returns visited items for a given theSource item within given contest ctx
      Specified by:
      visit in interface ItemVisitor<CMSCOMPONENTTYPE extends AbstractCMSComponentModel>
      Parameters:
      source - given item
      path - path to given item
      ctx - visitor context
      Returns:
      relevant items for a given theSource item
    • getAttributesFromCacheOrRetrieve

      protected List<AttributeDescriptorModel> getAttributesFromCacheOrRetrieve(CMSCOMPONENTTYPE source)
      Returns the list of attributes for component type. It retrieves them from the cache if available, or generated if cache is empty.
      Parameters:
      source - the source component type
      Returns:
      the list of attributes.
    • isAttributeAllowed

      protected boolean isAttributeAllowed(CMSCOMPONENTTYPE componentType, AttributeDescriptorModel attribute)
      Verifies whether the attribute is allowed for future visiting.
      Parameters:
      componentType - the type for which to retrieve the list of ignored attribute types from config.
      attribute - the attribute to verify
      Returns:
      true if the attribute must be visited earlier, false otherwise.
    • getIgnoreAttributeTypeClasses

      protected List<Class<?>> getIgnoreAttributeTypeClasses(CMSCOMPONENTTYPE componentType)
      Returns all type classes that must be ignored during iteration over component attributes.
      Parameters:
      componentType - the type for which to retrieve the list of ignored attribute types from config.
      Returns:
      the list of classes.
    • collectChildItems

      protected void collectChildItems(CMSCOMPONENTTYPE source, List<ItemModel> toVisit, AttributeDescriptorModel attributeDescriptorModel)
      Collects all child items of type CMSItemModel for the provided source component.
      Parameters:
      source - - the component which attributes is inspected to collect child items
      toVisit - - the list of items collected which will be used by the synchronization service
      attributeDescriptorModel - - the attribute descriptor object containing the information about the attribute of interest
    • getAttributeValue

      protected Object getAttributeValue(CMSCOMPONENTTYPE source, AttributeDescriptorModel attributeDescriptorModel)
      Gets the value by calling the getter for the attribute defined by the provided attribute descriptor.

      When the attribute is not readable (due to configurations in *items.xml), the ModelService will return an AttributeNotSupportedException and the attribute will not be added to the list of items to visit by the synchronization service.

      Parameters:
      source - - the source object which the getter method will be called
      attributeDescriptorModel - - the attribute descriptor object containing the information about the attribute of interest
      Returns:
      the result of the getter; can be NULL
    • isClassAssignableFrom

      protected boolean isClassAssignableFrom(Class clazz, AttributeDescriptorModel attributeDescriptor)
    • getAllIgnoredAttributeTypesInConfigHierarchy

      protected List<String> getAllIgnoredAttributeTypesInConfigHierarchy(List<String> allSuperTypeCodes)
      Returns all type codes that must be ignored during iteration over component attributes.
      Parameters:
      allSuperTypeCodes - the list of type codes for which the configuration must be retrieved.
      Returns:
      the list of type codes that must be ignored.
    • getAllSuperTypeCodes

      protected List<String> getAllSuperTypeCodes(CMSCOMPONENTTYPE componentType)
      Get the list of all the super typeCodes given a composedType, including the composedType typeCode.
      Parameters:
      componentType - the component type
      Returns:
      the List of String representation of all the super typeCodes given a composedType, including the composedType typeCode.
    • getIgnoreAttributeConfigurationByTypeCode

      protected Optional<List<String>> getIgnoreAttributeConfigurationByTypeCode(String typeCode)
      Returns the configuration for the type code.
      Parameters:
      typeCode - the type code for which return the configuration.
      Returns:
      the Optional configuration that contains a list of type codes that must be ignored.
    • getTypeService

      protected TypeService getTypeService()
    • setTypeService

      public void setTypeService(TypeService typeService)
    • getModelService

      protected ModelService getModelService()
    • setModelService

      public void setModelService(ModelService modelService)
    • getAttributeDescriptorModelHelperService

      protected AttributeDescriptorModelHelperService getAttributeDescriptorModelHelperService()
    • setAttributeDescriptorModelHelperService

      public void setAttributeDescriptorModelHelperService(AttributeDescriptorModelHelperService attributeDescriptorModelHelperService)
    • getIgnoreAttributeTypeCodeConfigs

      public Map<String,List<String>> getIgnoreAttributeTypeCodeConfigs()
    • setIgnoreAttributeTypeCodeConfigs

      public void setIgnoreAttributeTypeCodeConfigs(Map<String,List<String>> ignoreAttributeTypeCodeConfigs)
    • getConfigurationService

      public ConfigurationService getConfigurationService()
    • setConfigurationService

      public void setConfigurationService(ConfigurationService configurationService)