Class ComponentTypeStructureConverter
- java.lang.Object
-
- de.hybris.platform.cmsfacades.types.converter.ComponentTypeStructureConverter
-
- All Implemented Interfaces:
Converter<ComponentTypeStructure,ComponentTypeData>,org.springframework.core.convert.converter.Converter<ComponentTypeStructure,ComponentTypeData>
public class ComponentTypeStructureConverter extends java.lang.Object implements Converter<ComponentTypeStructure,ComponentTypeData>
Converter use to convert aComponentTypeStructureto aComponentTypeData.
-
-
Constructor Summary
Constructors Constructor Description ComponentTypeStructureConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AttributeDescriptorModelbuildAttributeDescriptorModel(ComposedTypeModel composedTypeModel, ComponentTypeAttributeStructure attribute)Creates a newAttributeDescriptorwith basic data copied from the provided attribute.ComponentTypeDataconvert(ComponentTypeStructure source)Converts the source object, creating a new instance of the destination typeComponentTypeDataconvert(ComponentTypeStructure source, ComponentTypeData target)Convert the source object by filling the prototypeprotected ComponentTypeAttributeDataconvertAttribute(ComponentTypeAttributeStructure attribute, AttributeDescriptorModel attributeDescriptor)Convert the attribute descriptor to a POJO using the structure attribute's populators.protected ComponentTypeAttributeDataconvertAttributeAndEvaluatePermissions(ComposedTypeModel composedType, ComponentTypeAttributeStructure attributeStructure)This method converts the attribute attribute descriptor to a POJO using the structure attribute's populators and evaluates its permissions.protected booleanenclosingTypeHasAttribute(ComposedTypeModel enclosingType, java.lang.String qualifier)Checks whether the component type contains the attribute identified by the qualifier provided.protected AttributeDescriptorModelgetAttributeDescriptor(ComposedTypeModel type, ComponentTypeAttributeStructure originalAttribute)GetAttributeDescriptormatching with the qualifier of the attribute for the type provided.protected CMSAdminSiteServicegetCmsAdminSiteService()protected CMSPermissionCheckergetCmsPermissionChecker()protected org.springframework.beans.factory.ObjectFactory<ComponentTypeAttributeData>getComponentTypeAttributeDataFactory()protected PermissionCRUDServicegetPermissionCRUDService()protected StringDecapitalizergetStringDecapitalizer()protected TypeServicegetTypeService()protected booleanhasReadPermissionOnAttribute(AttributeDescriptorModel attributeDescriptorModel)Checks whether the current principal has read permission on the attribute provided.protected booleanisReadOnlyMode()Checks whether the structure api should return fields in read only mode (editable = false)voidsetCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService)voidsetCmsPermissionChecker(CMSPermissionChecker cmsPermissionChecker)voidsetComponentTypeAttributeDataFactory(org.springframework.beans.factory.ObjectFactory<ComponentTypeAttributeData> componentTypeAttributeDataFactory)voidsetPermissionCRUDService(PermissionCRUDService permissionCRUDService)voidsetStringDecapitalizer(StringDecapitalizer stringDecapitalizer)voidsetTypeService(TypeService typeService)protected voidthrowTypePermissionException(java.lang.String permissionName, java.lang.String typeCode)ThrowsTypePermissionException.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.servicelayer.dto.converter.Converter
convertAll, convertAllIgnoreExceptions, getLogger
-
-
-
-
Method Detail
-
convert
public ComponentTypeData convert(ComponentTypeStructure source) throws ConversionException
Description copied from interface:ConverterConverts the source object, creating a new instance of the destination type- Specified by:
convertin interfaceConverter<ComponentTypeStructure,ComponentTypeData>- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<ComponentTypeStructure,ComponentTypeData>- Parameters:
source- the source object- Returns:
- the converted object
- Throws:
ConversionException- if an error occurs
-
convert
public ComponentTypeData convert(ComponentTypeStructure source, ComponentTypeData target) throws ConversionException
Description copied from interface:ConverterConvert the source object by filling the prototype- Specified by:
convertin interfaceConverter<ComponentTypeStructure,ComponentTypeData>- Parameters:
source- the source objecttarget- the prototype to fill- Returns:
- the converted object, identical to the prototype
- Throws:
ConversionException- if an error occurs
-
throwTypePermissionException
protected void throwTypePermissionException(java.lang.String permissionName, java.lang.String typeCode)ThrowsTypePermissionException.- Parameters:
permissionName- permission nametypeCode- type code
-
buildAttributeDescriptorModel
protected AttributeDescriptorModel buildAttributeDescriptorModel(ComposedTypeModel composedTypeModel, ComponentTypeAttributeStructure attribute)
Creates a newAttributeDescriptorwith basic data copied from the provided attribute.- Parameters:
composedTypeModel- - the composed type model containing the provided attributeattribute- - the attribute from where to copy the new descriptor data- Returns:
- the newly created attribute descriptor
-
getAttributeDescriptor
protected AttributeDescriptorModel getAttributeDescriptor(ComposedTypeModel type, ComponentTypeAttributeStructure originalAttribute)
GetAttributeDescriptormatching with the qualifier of the attribute for the type provided.- Parameters:
type- - the composed type model in which to search for the descriptororiginalAttribute- - the attribute whose descriptor to search for.- Returns:
- the attribute descriptor matching the given criteria
-
convertAttribute
protected ComponentTypeAttributeData convertAttribute(ComponentTypeAttributeStructure attribute, AttributeDescriptorModel attributeDescriptor)
Convert the attribute descriptor to a POJO using the structure attribute's populators.- Parameters:
attribute- - the structure type attributeattributeDescriptor- - the attribute descriptor- Returns:
- the component type attribute POJO
-
convertAttributeAndEvaluatePermissions
protected ComponentTypeAttributeData convertAttributeAndEvaluatePermissions(ComposedTypeModel composedType, ComponentTypeAttributeStructure attributeStructure)
This method converts the attribute attribute descriptor to a POJO using the structure attribute's populators and evaluates its permissions.- Parameters:
composedType- - the composed type model containing the attribute to convert.attributeStructure- - the attribute to convert- Returns:
- the component type attribute POJO. Will be null if user has no read-permissions.
-
isReadOnlyMode
protected boolean isReadOnlyMode()
Checks whether the structure api should return fields in read only mode (editable = false)- Returns:
- TRUE if the read only mode is used, FALSE otherwise.
-
hasReadPermissionOnAttribute
protected boolean hasReadPermissionOnAttribute(AttributeDescriptorModel attributeDescriptorModel)
Checks whether the current principal has read permission on the attribute provided.- Parameters:
attributeDescriptorModel- - The descriptor that specifies the attribute whose read permission to check.- Returns:
- true if the current principal has been granted read permission on the attribute; false otherwise.
- Throws:
AttributePermissionException- - When principal does not have read permission for a required attribute.
-
enclosingTypeHasAttribute
protected boolean enclosingTypeHasAttribute(ComposedTypeModel enclosingType, java.lang.String qualifier)
Checks whether the component type contains the attribute identified by the qualifier provided.- Parameters:
enclosingType- - The item where to look for the expected attributequalifier- - The qualifier of the attribute to find- Returns:
- true if the attribute is found; false otherwise.
-
getStringDecapitalizer
protected StringDecapitalizer getStringDecapitalizer()
-
setStringDecapitalizer
public void setStringDecapitalizer(StringDecapitalizer stringDecapitalizer)
-
getComponentTypeAttributeDataFactory
protected org.springframework.beans.factory.ObjectFactory<ComponentTypeAttributeData> getComponentTypeAttributeDataFactory()
-
setComponentTypeAttributeDataFactory
public void setComponentTypeAttributeDataFactory(org.springframework.beans.factory.ObjectFactory<ComponentTypeAttributeData> componentTypeAttributeDataFactory)
-
getTypeService
protected TypeService getTypeService()
-
setTypeService
public void setTypeService(TypeService typeService)
-
getPermissionCRUDService
protected PermissionCRUDService getPermissionCRUDService()
-
setPermissionCRUDService
public void setPermissionCRUDService(PermissionCRUDService permissionCRUDService)
-
getCmsPermissionChecker
protected CMSPermissionChecker getCmsPermissionChecker()
-
setCmsPermissionChecker
public void setCmsPermissionChecker(CMSPermissionChecker cmsPermissionChecker)
-
getCmsAdminSiteService
protected CMSAdminSiteService getCmsAdminSiteService()
-
setCmsAdminSiteService
public void setCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService)
-
-