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 Details

    • ComponentTypeStructureConverter

      public ComponentTypeStructureConverter()
  • Method Details

    • convert

      Description copied from interface: Converter
      Converts the source object, creating a new instance of the destination type
      Specified by:
      convert in interface Converter<ComponentTypeStructure,ComponentTypeData>
      Specified by:
      convert in interface org.springframework.core.convert.converter.Converter<ComponentTypeStructure,ComponentTypeData>
      Parameters:
      source - the source object
      Returns:
      the converted object
      Throws:
      ConversionException - if an error occurs
    • convert

      Description copied from interface: Converter
      Convert the source object by filling the prototype
      Specified by:
      convert in interface Converter<ComponentTypeStructure,ComponentTypeData>
      Parameters:
      source - the source object
      target - the prototype to fill
      Returns:
      the converted object, identical to the prototype
      Throws:
      ConversionException - if an error occurs
    • throwTypePermissionException

      protected void throwTypePermissionException(String permissionName, String typeCode)
      Parameters:
      permissionName - permission name
      typeCode - type code
    • buildAttributeDescriptorModel

      protected AttributeDescriptorModel buildAttributeDescriptorModel(ComposedTypeModel composedTypeModel, ComponentTypeAttributeStructure attribute)
      Creates a new AttributeDescriptor with basic data copied from the provided attribute.
      Parameters:
      composedTypeModel - - the composed type model containing the provided attribute
      attribute - - the attribute from where to copy the new descriptor data
      Returns:
      the newly created attribute descriptor
    • getAttributeDescriptor

      protected AttributeDescriptorModel getAttributeDescriptor(ComposedTypeModel type, ComponentTypeAttributeStructure originalAttribute)
      Get AttributeDescriptor matching with the qualifier of the attribute for the type provided.
      Parameters:
      type - - the composed type model in which to search for the descriptor
      originalAttribute - - 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 attribute
      attributeDescriptor - - 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

      protected boolean isFieldRequired(String fieldToCheck)
      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

      protected List<String> 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

      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, 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 attribute
      qualifier - - 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)