Interface ProductVariantImport

All Superinterfaces:
ImportResource

public interface ProductVariantImport extends ImportResource

The data representation for a ProductVariant to be imported that is persisted as a ProductVariant in the Project.


Example to create an instance using the builder pattern

     ProductVariantImport productVariantImport = ProductVariantImport.builder()
             .key("{key}")
             .isMasterVariant(true)
             .product(productBuilder -> productBuilder)
             .build()
 
  • Method Details

    • getKey

      @NotNull @NotNull String getKey()

      User-defined unique identifier. If a ProductVariant with this key exists on the specified product, it will be updated with the imported data.

      Specified by:
      getKey in interface ImportResource
      Returns:
      key
    • getSku

      String getSku()

      Maps to ProductVariant.sku.

      Returns:
      sku
    • getIsMasterVariant

      @NotNull @NotNull Boolean getIsMasterVariant()
      • When creating a new ProductVariant, set to false; otherwise, the import operation will fail with a NewMasterVariantAdditionNotAllowed error.
      • Set to true if the ProductVariant exists and you want to set this ProductVariant as the Master Variant.
      Returns:
      isMasterVariant
    • getAttributes

      @Valid @Valid List<Attribute> getAttributes()

      Maps to ProductVariant.attributes. The referenced attribute must be defined in an already existing ProductType in the project, or the state of the ImportOperation will be unresolved.

      Returns:
      attributes
    • getImages

      @Valid @Valid List<Image> getImages()

      Maps to ProductVariant.images.

      Returns:
      images
    • getAssets

      @Valid @Valid List<Asset> getAssets()

      Maps to ProductVariant.assets.

      Returns:
      assets
    • getStaged

      Boolean getStaged()
      • Set to false to update both the current and staged projections of the Product with the new Product Variant data.
      • Leave empty or set to true to only update the staged projection.
      Returns:
      staged
    • getProduct

      @NotNull @Valid @NotNull @Valid ProductKeyReference getProduct()

      The Product to which this Product Variant belongs. Maps to ProductVariant.product. The Reference to the Product with which the ProductVariant is associated. If referenced Product does not exist, the state of the ImportOperation will be set to unresolved until the necessary Product is created.

      Returns:
      product
    • setKey

      void setKey(String key)

      User-defined unique identifier. If a ProductVariant with this key exists on the specified product, it will be updated with the imported data.

      Specified by:
      setKey in interface ImportResource
      Parameters:
      key - value to be set
    • setSku

      void setSku(String sku)

      Maps to ProductVariant.sku.

      Parameters:
      sku - value to be set
    • setIsMasterVariant

      void setIsMasterVariant(Boolean isMasterVariant)
      • When creating a new ProductVariant, set to false; otherwise, the import operation will fail with a NewMasterVariantAdditionNotAllowed error.
      • Set to true if the ProductVariant exists and you want to set this ProductVariant as the Master Variant.
      Parameters:
      isMasterVariant - value to be set
    • setAttributes

      void setAttributes(Attribute... attributes)

      Maps to ProductVariant.attributes. The referenced attribute must be defined in an already existing ProductType in the project, or the state of the ImportOperation will be unresolved.

      Parameters:
      attributes - values to be set
    • setAttributes

      void setAttributes(List<Attribute> attributes)

      Maps to ProductVariant.attributes. The referenced attribute must be defined in an already existing ProductType in the project, or the state of the ImportOperation will be unresolved.

      Parameters:
      attributes - values to be set
    • setImages

      void setImages(Image... images)

      Maps to ProductVariant.images.

      Parameters:
      images - values to be set
    • setImages

      void setImages(List<Image> images)

      Maps to ProductVariant.images.

      Parameters:
      images - values to be set
    • setAssets

      void setAssets(Asset... assets)

      Maps to ProductVariant.assets.

      Parameters:
      assets - values to be set
    • setAssets

      void setAssets(List<Asset> assets)

      Maps to ProductVariant.assets.

      Parameters:
      assets - values to be set
    • setStaged

      void setStaged(Boolean staged)
      • Set to false to update both the current and staged projections of the Product with the new Product Variant data.
      • Leave empty or set to true to only update the staged projection.
      Parameters:
      staged - value to be set
    • setProduct

      void setProduct(ProductKeyReference product)

      The Product to which this Product Variant belongs. Maps to ProductVariant.product. The Reference to the Product with which the ProductVariant is associated. If referenced Product does not exist, the state of the ImportOperation will be set to unresolved until the necessary Product is created.

      Parameters:
      product - value to be set
    • of

      static ProductVariantImport of()
      factory method
      Returns:
      instance of ProductVariantImport
    • of

      factory method to create a shallow copy ProductVariantImport
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      factory method to create a deep copy of ProductVariantImport
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static ProductVariantImportBuilder builder()
      builder factory method for ProductVariantImport
      Returns:
      builder
    • builder

      create builder for ProductVariantImport instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withProductVariantImport

      default <T> T withProductVariantImport(Function<ProductVariantImport,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<ProductVariantImport> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference