Class VariantProductModelConverter

  • All Implemented Interfaces:
    TypeSystemAwareModelConverter, UpdateableModelConverter, ModelConverter, java.lang.Cloneable

    public class VariantProductModelConverter
    extends ItemModelConverter
    VariantProduct - specific ModelConverter. It's required for VariantProducts to provide the correct type (via getType). Using the default ItemModelConverter the returned type is recognized as abstract by VariantType, which is used during the save - action.
    • Method Detail

      • getType

        public java.lang.String getType​(java.lang.Object model)
        Returns the exact type of the given model. This method is overridden because it requires some specific handling for VariantProduct. The returned Type would be typically "VariantProduct" (itemType), which is recognized as abstract in the variantType, which will be used later before persisting the object. In such case - ModelServiceException is thrown. The proper solution for VariantProduct is to return variant type of the base product type.
        Specified by:
        getType in interface ModelConverter
        Overrides:
        getType in class ItemModelConverter
      • getTypeFromBaseProduct

        protected java.lang.String getTypeFromBaseProduct​(VariantProductModel model)