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 java.lang.Object implements ComponentTypeStructureService, org.springframework.beans.factory.InitializingBean
Implementation of theComponentTypeStructureServicethat first attempts to get type using the registered structure typeComponentTypeStructureRegistry.getComponentTypeStructure(String). As a fallback strategy, it creates an instance of theComponentTypeStructureby introspecting the Type and its attributes. This service will be first lookup for theComposedTypeModeland check if one of its super type isCMSItemModel. If it passes this verification, then it will convert an instance ofComposedTypeModelinto a new instance ofComponentTypeStructure.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.LongDEFAULT_EXPIRATION_TIME
-
Constructor Summary
Constructors Constructor Description GenericComponentTypeStructureService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected voidcollectExtraAttributesFromTypeAndAncestorsInRegistry(ComposedTypeModel composedType, java.util.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, java.util.List<Populator<ComposedTypeModel,ComponentTypeData>> populators)Recursively collects type populators from the registry until it reaches the root type (CMSItem)ComponentTypeStructuregetComponentTypeStructure(java.lang.String typeCode)Get aComponentTypeStructureby its typecode.protected ComponentTypeStructuregetComponentTypeStructureInternal(java.lang.String typeCode)Internal method to get the component type structure for a given typeCodeprotected ComponentTypeStructureRegistrygetComponentTypeStructureRegistry()java.util.Collection<ComponentTypeStructure>getComponentTypeStructures()Get all elements in the registry.protected Converter<ComposedTypeModel,ComponentTypeStructure>getComposedTypeToStructureConverter()protected ConfigurationServicegetConfigurationService()protected com.google.common.base.Supplier<java.util.Map<java.lang.String,ComponentTypeStructure>>getInternalComponentTypeStructureMap()protected java.util.Set<java.lang.String>getTypeBlacklistSet()protected TypeServicegetTypeService()protected com.google.common.base.Supplier<java.util.Map<java.lang.String,ComponentTypeStructure>>initializeComponentTypeStructureMap()Supplier function to initialize the ComponentTypeStructure map.protected com.google.common.base.Supplier<java.util.Map<java.lang.String,ComponentTypeStructure>>initializeInternalStructureMap(java.lang.Long expirationTime)protected java.util.function.Predicate<java.lang.String>isAbstractType()Predicate to test if the composed type represented by the typeCode is abstract.voidsetComponentTypeStructureRegistry(ComponentTypeStructureRegistry componentTypeStructureRegistry)voidsetComposedTypeToStructureConverter(Converter<ComposedTypeModel,ComponentTypeStructure> composedTypeToStructureConverter)voidsetConfigurationService(ConfigurationService configurationService)voidsetTypeBlacklistSet(java.util.Set<java.lang.String> typeBlacklistSet)voidsetTypeService(TypeService typeService)
-
-
-
Method Detail
-
getComponentTypeStructure
public ComponentTypeStructure getComponentTypeStructure(java.lang.String typeCode)
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
public java.util.Collection<ComponentTypeStructure> 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<java.util.Map<java.lang.String,ComponentTypeStructure>> initializeComponentTypeStructureMap()
Supplier function to initialize the ComponentTypeStructure map.
-
isAbstractType
protected java.util.function.Predicate<java.lang.String> isAbstractType()
Predicate to test if the composed type represented by the typeCode is abstract.Returns TRUE if the composed type is abstract.
-
getComponentTypeStructureInternal
protected ComponentTypeStructure getComponentTypeStructureInternal(java.lang.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
ComponentTypeStructurerepresented by this typeCode.
-
collectTypePopulatorsFromTypeAndAncestorsInRegistry
protected void collectTypePopulatorsFromTypeAndAncestorsInRegistry(ComposedTypeModel composedType, java.util.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, java.util.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<java.util.Map<java.lang.String,ComponentTypeStructure>> getInternalComponentTypeStructureMap()
-
initializeInternalStructureMap
protected com.google.common.base.Supplier<java.util.Map<java.lang.String,ComponentTypeStructure>> initializeInternalStructureMap(java.lang.Long expirationTime)
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
getTypeService
protected TypeService getTypeService()
-
setTypeService
public void setTypeService(TypeService typeService)
-
getTypeBlacklistSet
protected java.util.Set<java.lang.String> getTypeBlacklistSet()
-
setTypeBlacklistSet
public void setTypeBlacklistSet(java.util.Set<java.lang.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)
-
-