Interface ProductVariantImport
- All Superinterfaces:
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 Summary
Modifier and TypeMethodDescriptionstatic ProductVariantImportBuilder
builder()
builder factory method for ProductVariantImportstatic ProductVariantImportBuilder
builder
(ProductVariantImport template) create builder for ProductVariantImport instancestatic ProductVariantImport
deepCopy
(ProductVariantImport template) factory method to create a deep copy of ProductVariantImportMaps toProductVariant.assets
.Maps toProductVariant.attributes
.Maps toProductVariant.images
.@NotNull Boolean
When creating a new ProductVariant, set tofalse
; otherwise, the import operation will fail with a NewMasterVariantAdditionNotAllowed error. Set totrue
if the ProductVariant exists and you want to set this ProductVariant as the Master Variant.@NotNull String
getKey()
User-defined unique identifier.@NotNull @Valid ProductKeyReference
The Product to which this Product Variant belongs.getSku()
Maps toProductVariant.sku
.Set tofalse
to update both the current and staged projections of the Product with the new Product Variant data. Leave empty or set totrue
to only update the staged projection.static ProductVariantImport
of()
factory methodstatic ProductVariantImport
of
(ProductVariantImport template) factory method to create a shallow copy ProductVariantImportvoid
Maps toProductVariant.assets
.void
Maps toProductVariant.assets
.void
setAttributes
(Attribute... attributes) Maps toProductVariant.attributes
.void
setAttributes
(List<Attribute> attributes) Maps toProductVariant.attributes
.void
Maps toProductVariant.images
.void
Maps toProductVariant.images
.void
setIsMasterVariant
(Boolean isMasterVariant) When creating a new ProductVariant, set tofalse
; otherwise, the import operation will fail with a NewMasterVariantAdditionNotAllowed error. Set totrue
if the ProductVariant exists and you want to set this ProductVariant as the Master Variant.void
User-defined unique identifier.void
setProduct
(ProductKeyReference product) The Product to which this Product Variant belongs.void
Maps toProductVariant.sku
.void
Set tofalse
to update both the current and staged projections of the Product with the new Product Variant data. Leave empty or set totrue
to only update the staged projection.static com.fasterxml.jackson.core.type.TypeReference<ProductVariantImport>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withProductVariantImport
(Function<ProductVariantImport, T> helper) accessor map functionMethods inherited from interface com.commercetools.importapi.models.common.ImportResource
withImportResource
-
Method Details
-
getKey
User-defined unique identifier. If a ProductVariant with this
key
exists on the specifiedproduct
, it will be updated with the imported data.- Specified by:
getKey
in interfaceImportResource
- Returns:
- key
-
getSku
String getSku()Maps to
ProductVariant.sku
.- Returns:
- sku
-
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
- When creating a new ProductVariant, set to
-
getAttributes
Maps to
ProductVariant.attributes
. The referenced attribute must be defined in an already existing ProductType in the project, or thestate
of the ImportOperation will beunresolved
.- Returns:
- attributes
-
getImages
Maps to
ProductVariant.images
.- Returns:
- images
-
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
- Set to
-
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, thestate
of the ImportOperation will be set tounresolved
until the necessary Product is created.- Returns:
- product
-
setKey
User-defined unique identifier. If a ProductVariant with this
key
exists on the specifiedproduct
, it will be updated with the imported data.- Specified by:
setKey
in interfaceImportResource
- Parameters:
key
- value to be set
-
setSku
Maps to
ProductVariant.sku
.- Parameters:
sku
- value to be set
-
setIsMasterVariant
- 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
- When creating a new ProductVariant, set to
-
setAttributes
Maps to
ProductVariant.attributes
. The referenced attribute must be defined in an already existing ProductType in the project, or thestate
of the ImportOperation will beunresolved
.- Parameters:
attributes
- values to be set
-
setAttributes
Maps to
ProductVariant.attributes
. The referenced attribute must be defined in an already existing ProductType in the project, or thestate
of the ImportOperation will beunresolved
.- Parameters:
attributes
- values to be set
-
setImages
Maps to
ProductVariant.images
.- Parameters:
images
- values to be set
-
setImages
Maps to
ProductVariant.images
.- Parameters:
images
- values to be set
-
setAssets
Maps to
ProductVariant.assets
.- Parameters:
assets
- values to be set
-
setAssets
Maps to
ProductVariant.assets
.- Parameters:
assets
- values to be set
-
setStaged
- 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
- Set to
-
setProduct
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, thestate
of the ImportOperation will be set tounresolved
until the necessary Product is created.- Parameters:
product
- value to be set
-
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
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
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-