Interface ProductImport

All Superinterfaces:
ImportResource

public interface ProductImport extends ImportResource

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

This is the minimal representation required for creating a Product in commercetools.


Example to create an instance using the builder pattern

     ProductImport productImport = ProductImport.builder()
             .key("{key}")
             .name(nameBuilder -> nameBuilder)
             .productType(productTypeBuilder -> productTypeBuilder)
             .slug(slugBuilder -> slugBuilder)
             .build()
 
  • Method Details

    • getKey

      @NotNull @NotNull String getKey()

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

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

      @NotNull @Valid @NotNull @Valid LocalizedString getName()

      Maps to Product.name.

      Returns:
      name
    • getProductType

      @NotNull @Valid @NotNull @Valid ProductTypeKeyReference getProductType()

      The productType of a Product. Maps to Product.productType. The Reference to the ProductType with which the Product is associated. If referenced ProductType does not exist, the state of the ImportOperation will be set to unresolved until the necessary ProductType is created.

      Returns:
      productType
    • getSlug

      @NotNull @Valid @NotNull @Valid LocalizedString getSlug()

      Human-readable identifiers usually used as deep-link URL to the related product. Each slug must be unique across a Project, but a product can have the same slug for different languages. Allowed are alphabetic, numeric, underscore (_) and hyphen (-) characters.

      Returns:
      slug
    • getDescription

      @Valid @Valid LocalizedString getDescription()

      Maps to Product.description.

      Returns:
      description
    • getCategories

      @Valid @Valid List<CategoryKeyReference> getCategories()

      Maps to Product.categories. The References to the Categories with which the Product is associated. If referenced Categories do not exist, the state of the ImportOperation will be set to unresolved until the necessary Categories are created.

      Returns:
      categories
    • getMetaTitle

      @Valid @Valid LocalizedString getMetaTitle()

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Returns:
      metaTitle
    • getMetaDescription

      @Valid @Valid LocalizedString getMetaDescription()

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Returns:
      metaDescription
    • getMetaKeywords

      @Valid @Valid LocalizedString getMetaKeywords()

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Returns:
      metaKeywords
    • getTaxCategory

      @Valid @Valid TaxCategoryKeyReference getTaxCategory()

      The Reference to the TaxCategory with which the Product is associated. If referenced TaxCategory does not exist, the state of the ImportOperation will be set to unresolved until the necessary TaxCategory is created.

      Returns:
      taxCategory
    • getSearchKeywords

      @Valid @Valid SearchKeywords getSearchKeywords()

      Search keywords are primarily used by the suggester but are also considered for the full-text search. SearchKeywords is a JSON object where the keys are of IETF language tag. The value to a language tag key is an array of SearchKeyword for the specific language.

      {
          "en": [
            { "text": "Multi tool" },
            { "text": "Swiss Army Knife", "suggestTokenizer": { "type": "whitespace" } }
          ],
          "de": [
            {
              "text": "Schweizer Messer",
              "suggestTokenizer": {
                "type": "custom",
                "inputs": ["schweizer messer", "offiziersmesser", "sackmesser"]
              }
            }
          ]
        }
        
      Returns:
      searchKeywords
    • getState

      @Valid @Valid StateKeyReference getState()

      The Reference to the State with which the Product is associated. If referenced State does not exist, the state of the ImportOperation will be set to unresolved until the necessary State is created.

      Returns:
      state
    • getPublish

      Boolean getPublish()

      If publish is set to either true or false, both staged and current projections are set to the same value provided by the import data. If publish is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether publish is set or not.

      Returns:
      publish
    • getPriceMode

      ProductPriceModeEnum getPriceMode()

      Determines the type of Prices the API uses. See ProductPriceMode for more details. If not provided, the existing Product.priceMode is not changed.

      Returns:
      priceMode
    • setKey

      void setKey(String key)

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

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

      void setName(LocalizedString name)

      Maps to Product.name.

      Parameters:
      name - value to be set
    • setProductType

      void setProductType(ProductTypeKeyReference productType)

      The productType of a Product. Maps to Product.productType. The Reference to the ProductType with which the Product is associated. If referenced ProductType does not exist, the state of the ImportOperation will be set to unresolved until the necessary ProductType is created.

      Parameters:
      productType - value to be set
    • setSlug

      void setSlug(LocalizedString slug)

      Human-readable identifiers usually used as deep-link URL to the related product. Each slug must be unique across a Project, but a product can have the same slug for different languages. Allowed are alphabetic, numeric, underscore (_) and hyphen (-) characters.

      Parameters:
      slug - value to be set
    • setDescription

      void setDescription(LocalizedString description)

      Maps to Product.description.

      Parameters:
      description - value to be set
    • setCategories

      void setCategories(CategoryKeyReference... categories)

      Maps to Product.categories. The References to the Categories with which the Product is associated. If referenced Categories do not exist, the state of the ImportOperation will be set to unresolved until the necessary Categories are created.

      Parameters:
      categories - values to be set
    • setCategories

      void setCategories(List<CategoryKeyReference> categories)

      Maps to Product.categories. The References to the Categories with which the Product is associated. If referenced Categories do not exist, the state of the ImportOperation will be set to unresolved until the necessary Categories are created.

      Parameters:
      categories - values to be set
    • setMetaTitle

      void setMetaTitle(LocalizedString metaTitle)

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Parameters:
      metaTitle - value to be set
    • setMetaDescription

      void setMetaDescription(LocalizedString metaDescription)

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Parameters:
      metaDescription - value to be set
    • setMetaKeywords

      void setMetaKeywords(LocalizedString metaKeywords)

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Parameters:
      metaKeywords - value to be set
    • setTaxCategory

      void setTaxCategory(TaxCategoryKeyReference taxCategory)

      The Reference to the TaxCategory with which the Product is associated. If referenced TaxCategory does not exist, the state of the ImportOperation will be set to unresolved until the necessary TaxCategory is created.

      Parameters:
      taxCategory - value to be set
    • setSearchKeywords

      void setSearchKeywords(SearchKeywords searchKeywords)

      Search keywords are primarily used by the suggester but are also considered for the full-text search. SearchKeywords is a JSON object where the keys are of IETF language tag. The value to a language tag key is an array of SearchKeyword for the specific language.

      {
          "en": [
            { "text": "Multi tool" },
            { "text": "Swiss Army Knife", "suggestTokenizer": { "type": "whitespace" } }
          ],
          "de": [
            {
              "text": "Schweizer Messer",
              "suggestTokenizer": {
                "type": "custom",
                "inputs": ["schweizer messer", "offiziersmesser", "sackmesser"]
              }
            }
          ]
        }
        
      Parameters:
      searchKeywords - value to be set
    • setState

      void setState(StateKeyReference state)

      The Reference to the State with which the Product is associated. If referenced State does not exist, the state of the ImportOperation will be set to unresolved until the necessary State is created.

      Parameters:
      state - value to be set
    • setPublish

      void setPublish(Boolean publish)

      If publish is set to either true or false, both staged and current projections are set to the same value provided by the import data. If publish is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether publish is set or not.

      Parameters:
      publish - value to be set
    • setPriceMode

      void setPriceMode(ProductPriceModeEnum priceMode)

      Determines the type of Prices the API uses. See ProductPriceMode for more details. If not provided, the existing Product.priceMode is not changed.

      Parameters:
      priceMode - value to be set
    • of

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

      static ProductImport of(ProductImport template)
      factory method to create a shallow copy ProductImport
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      @Nullable static ProductImport deepCopy(@Nullable ProductImport template)
      factory method to create a deep copy of ProductImport
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static ProductImportBuilder builder()
      builder factory method for ProductImport
      Returns:
      builder
    • builder

      static ProductImportBuilder builder(ProductImport template)
      create builder for ProductImport instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withProductImport

      default <T> T withProductImport(Function<ProductImport,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<ProductImport> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference