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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidcollectExtraAttributesFromTypeAndAncestorsInRegistry(ComposedTypeModel composedType, Set<ComponentTypeAttributeStructure> attributes) Recursively collects extra attributes that are not in the Data Model, but it is present on the the registryprotected voidcollectTypePopulatorsFromTypeAndAncestorsInRegistry(ComposedTypeModel composedType, List<Populator<ComposedTypeModel, ComponentTypeData>> populators) Recursively collects type populators from the registry until it reaches the root type (CMSItem)getComponentTypeStructure(String typeCode) Get aComponentTypeStructureby its typecode.protected ComponentTypeStructuregetComponentTypeStructureInternal(String typeCode) Internal method to get the component type structure for a given typeCodeprotected ComponentTypeStructureRegistryGet all elements in the registry.protected Converter<ComposedTypeModel,ComponentTypeStructure> protected ConfigurationServiceprotected com.google.common.base.Supplier<Map<String,ComponentTypeStructure>> protected TypeServiceprotected com.google.common.base.Supplier<Map<String,ComponentTypeStructure>> Supplier function to initialize the ComponentTypeStructure map.protected com.google.common.base.Supplier<Map<String,ComponentTypeStructure>> initializeInternalStructureMap(Long expirationTime) Predicate to test if the composed type represented by the typeCode is valid and is abstract.voidsetComponentTypeStructureRegistry(ComponentTypeStructureRegistry componentTypeStructureRegistry) voidsetComposedTypeToStructureConverter(Converter<ComposedTypeModel, ComponentTypeStructure> composedTypeToStructureConverter) voidsetConfigurationService(ConfigurationService configurationService) voidsetTypeBlacklistSet(Set<String> typeBlacklistSet) voidsetTypeService(TypeService typeService)
-
Field Details
-
DEFAULT_EXPIRATION_TIME
-
-
Constructor Details
-
GenericComponentTypeStructureService
public GenericComponentTypeStructureService()
-
-
Method Details
-
getComponentTypeStructure
Description copied from interface:ComponentTypeStructureServiceGet aComponentTypeStructureby its typecode.- Specified by:
getComponentTypeStructurein interfaceComponentTypeStructureService- Parameters:
typeCode- - the typeCode of the element to retrieve.- Returns:
- the element matching the typeCode
- Throws:
UnknownIdentifierException- when the typeCode does not existConversionException- when the type requested does not extend CMSItem
-
getComponentTypeStructures
Description copied from interface:ComponentTypeStructureServiceGet all elements in the registry.- Specified by:
getComponentTypeStructuresin interfaceComponentTypeStructureService- 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
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
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
ComponentTypeStructurerepresented 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 populatorspopulators- 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 populatorsattributes-
-
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
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
getTypeService
-
setTypeService
-
getTypeBlacklistSet
-
setTypeBlacklistSet
-
getConfigurationService
-
setConfigurationService
-
getComposedTypeToStructureConverter
-
setComposedTypeToStructureConverter
public void setComposedTypeToStructureConverter(Converter<ComposedTypeModel, ComponentTypeStructure> composedTypeToStructureConverter) -
getComponentTypeStructureRegistry
-
setComponentTypeStructureRegistry
public void setComponentTypeStructureRegistry(ComponentTypeStructureRegistry componentTypeStructureRegistry)
-