Class AbstractCMSComponentModelVisitor<CMSCOMPONENTTYPE extends AbstractCMSComponentModel>
- java.lang.Object
-
- de.hybris.platform.cmsfacades.synchronization.itemvisitors.AbstractCMSComponentModelVisitor<CMSCOMPONENTTYPE>
-
- Type Parameters:
CMSCOMPONENTTYPE- the component type that extendsAbstractCMSComponentModel
- All Implemented Interfaces:
ItemVisitor<CMSCOMPONENTTYPE>,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
AbstractCMSComponentContainerModelVisitor,AbstractMediaContainerComponentModelVisitor,CMSLinkComponentModelVisitor,DefaultAbstractCMSComponentModelVisitor,NavigationBarCollectionComponentModelVisitor,NavigationBarComponentModelVisitor,NavigationComponentModelVisitor
public abstract class AbstractCMSComponentModelVisitor<CMSCOMPONENTTYPE extends AbstractCMSComponentModel> extends java.lang.Object implements ItemVisitor<CMSCOMPONENTTYPE>, org.springframework.beans.factory.InitializingBean
Abstract class for visitingAbstractCMSComponentModelmodels for the cms synchronization service to work properly. In this implementation, it will collect all component's child (collection or not) extending or beingCMSItemModel
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSYNCHRONIZATION_COMPONENT_ATTRIBUTE_CACHE_EXPIRATION_TIME
-
Constructor Summary
Constructors Constructor Description AbstractCMSComponentModelVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected voidcollectChildItems(CMSCOMPONENTTYPE source, java.util.List<ItemModel> toVisit, AttributeDescriptorModel attributeDescriptorModel)Collects all child items of typeCMSItemModelfor the provided source component.protected java.util.List<java.lang.String>getAllIgnoredAttributeTypesInConfigHierarchy(java.util.List<java.lang.String> allSuperTypeCodes)Returns all type codes that must be ignored during iteration over component attributes.protected java.util.List<java.lang.String>getAllSuperTypeCodes(CMSCOMPONENTTYPE componentType)Get the list of all the super typeCodes given a composedType, including the composedType typeCode.protected AttributeDescriptorModelHelperServicegetAttributeDescriptorModelHelperService()protected java.util.List<AttributeDescriptorModel>getAttributesFromCacheOrRetrieve(CMSCOMPONENTTYPE source)Returns the list of attributes for component type.protected java.lang.ObjectgetAttributeValue(CMSCOMPONENTTYPE source, AttributeDescriptorModel attributeDescriptorModel)Gets the value by calling the getter for the attribute defined by the provided attribute descriptor.ConfigurationServicegetConfigurationService()protected java.util.Optional<java.util.List<java.lang.String>>getIgnoreAttributeConfigurationByTypeCode(java.lang.String typeCode)Returns the configuration for the type code.protected java.util.List<java.lang.Class<?>>getIgnoreAttributeTypeClasses(CMSCOMPONENTTYPE componentType)Returns all type classes that must be ignored during iteration over component attributes.java.util.Map<java.lang.String,java.util.List<java.lang.String>>getIgnoreAttributeTypeCodeConfigs()protected ModelServicegetModelService()protected TypeServicegetTypeService()protected booleanisAttributeAllowed(CMSCOMPONENTTYPE componentType, AttributeDescriptorModel attribute)Verifies whether the attribute is allowed for future visiting.protected booleanisClassAssignableFrom(java.lang.Class clazz, AttributeDescriptorModel attributeDescriptor)voidsetAttributeDescriptorModelHelperService(AttributeDescriptorModelHelperService attributeDescriptorModelHelperService)voidsetConfigurationService(ConfigurationService configurationService)voidsetIgnoreAttributeTypeCodeConfigs(java.util.Map<java.lang.String,java.util.List<java.lang.String>> ignoreAttributeTypeCodeConfigs)voidsetModelService(ModelService modelService)voidsetTypeService(TypeService typeService)java.util.List<ItemModel>visit(CMSCOMPONENTTYPE source, java.util.List<ItemModel> path, java.util.Map<java.lang.String,java.lang.Object> ctx)Returns visited items for a giventheSourceitem within given contestctx
-
-
-
Field Detail
-
SYNCHRONIZATION_COMPONENT_ATTRIBUTE_CACHE_EXPIRATION_TIME
public static final java.lang.String SYNCHRONIZATION_COMPONENT_ATTRIBUTE_CACHE_EXPIRATION_TIME
- See Also:
- Constant Field Values
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
visit
public java.util.List<ItemModel> visit(CMSCOMPONENTTYPE source, java.util.List<ItemModel> path, java.util.Map<java.lang.String,java.lang.Object> ctx)
Description copied from interface:ItemVisitorReturns visited items for a giventheSourceitem within given contestctx- Specified by:
visitin interfaceItemVisitor<CMSCOMPONENTTYPE extends AbstractCMSComponentModel>- Parameters:
source- given itempath- path to given itemctx- visitor context- Returns:
- relevant items for a given
theSourceitem
-
getAttributesFromCacheOrRetrieve
protected java.util.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 java.util.List<java.lang.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, java.util.List<ItemModel> toVisit, AttributeDescriptorModel attributeDescriptorModel)
Collects all child items of typeCMSItemModelfor the provided source component.- Parameters:
source- - the component which attributes is inspected to collect child itemstoVisit- - the list of items collected which will be used by the synchronization serviceattributeDescriptorModel- - the attribute descriptor object containing the information about the attribute of interest
-
getAttributeValue
protected java.lang.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
AttributeNotSupportedExceptionand 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 calledattributeDescriptorModel- - 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(java.lang.Class clazz, AttributeDescriptorModel attributeDescriptor)
-
getAllIgnoredAttributeTypesInConfigHierarchy
protected java.util.List<java.lang.String> getAllIgnoredAttributeTypesInConfigHierarchy(java.util.List<java.lang.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 java.util.List<java.lang.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
ListofStringrepresentation of all the super typeCodes given a composedType, including the composedType typeCode.
-
getIgnoreAttributeConfigurationByTypeCode
protected java.util.Optional<java.util.List<java.lang.String>> getIgnoreAttributeConfigurationByTypeCode(java.lang.String typeCode)
Returns the configuration for the type code.- Parameters:
typeCode- the type code for which return the configuration.- Returns:
- the
Optionalconfiguration 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 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getIgnoreAttributeTypeCodeConfigs()
-
setIgnoreAttributeTypeCodeConfigs
public void setIgnoreAttributeTypeCodeConfigs(java.util.Map<java.lang.String,java.util.List<java.lang.String>> ignoreAttributeTypeCodeConfigs)
-
getConfigurationService
public ConfigurationService getConfigurationService()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
-