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 Object
implements Converter<ComponentTypeStructure,ComponentTypeData>
Converter use to convert a
ComponentTypeStructure to a ComponentTypeData.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected AttributeDescriptorModelbuildAttributeDescriptorModel(ComposedTypeModel composedTypeModel, ComponentTypeAttributeStructure attribute) Creates a newAttributeDescriptorwith basic data copied from the provided attribute.convert(ComponentTypeStructure source) Converts the source object, creating a new instance of the destination typeconvert(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, 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 CMSAdminSiteServiceprotected CMSPermissionCheckerprotected org.springframework.beans.factory.ObjectFactory<ComponentTypeAttributeData>protected PermissionCRUDServiceGets the name of the fields that must be returned in the final component type structure.protected StringDecapitalizerprotected TypeServiceprotected booleanhasReadPermissionOnAttribute(AttributeDescriptorModel attributeDescriptorModel) Checks whether the current principal has read permission on the attribute provided.protected booleanisFieldRequired(String fieldToCheck) Checks whether the field is required to be calculated and returned in the final component type structure.protected booleanChecks 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(String permissionName, String typeCode) ThrowsTypePermissionException.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.servicelayer.dto.converter.Converter
convertAll, convertAllIgnoreExceptions, getLoggerMethods inherited from interface org.springframework.core.convert.converter.Converter
andThen
-
Constructor Details
-
ComponentTypeStructureConverter
public ComponentTypeStructureConverter()
-
-
Method Details
-
convert
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
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.
-
isFieldRequired
Checks whether the field is required to be calculated and returned in the final component type structure.- Parameters:
fieldToCheck- Name of the field to check whether it has to be included in the final structure.- Returns:
- TRUE if the field must be included in the final structure, FALSE otherwise.
-
getRequiredFields
Gets the name of the fields that must be returned in the final component type structure.- Returns:
- The list of fields that must be returned. The list will be empty if all fields must be included.
-
hasReadPermissionOnAttribute
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
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
-
setStringDecapitalizer
-
getComponentTypeAttributeDataFactory
protected org.springframework.beans.factory.ObjectFactory<ComponentTypeAttributeData> getComponentTypeAttributeDataFactory() -
setComponentTypeAttributeDataFactory
public void setComponentTypeAttributeDataFactory(org.springframework.beans.factory.ObjectFactory<ComponentTypeAttributeData> componentTypeAttributeDataFactory) -
getTypeService
-
setTypeService
-
getPermissionCRUDService
-
setPermissionCRUDService
-
getCmsPermissionChecker
-
setCmsPermissionChecker
-
getCmsAdminSiteService
-
setCmsAdminSiteService
-