Interface ProductVariantImport
- All Superinterfaces:
ImportResource
Represents the data used to import a ProductVariant. Once imported, this data 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 ProductVariantImportBuilderbuilder()builder factory method for ProductVariantImportstatic ProductVariantImportBuilderbuilder(ProductVariantImport template) create builder for ProductVariantImport instancecopyDeep()static ProductVariantImportdeepCopy(ProductVariantImport template) factory method to create a deep copy of ProductVariantImportMaps toProductVariant.assets.Maps toProductVariant.attributes.Maps toProductVariant.images.@NotNull BooleanWhen creating a new ProductVariant, set tofalse; otherwise, the import operation will fail with a NewMasterVariantAdditionNotAllowed error. Set totrueif the ProductVariant exists and you want to set this ProductVariant as the Master Variant.@NotNull StringgetKey()User-defined unique identifier.@NotNull @Valid ProductKeyReferenceThe Product containing this ProductVariant.getSku()Maps toProductVariant.sku.Set tofalseto update both the current and staged projections of the Product with the new Product Variant data. Leave empty or set totrueto only update the staged projection.static ProductVariantImportof()factory methodstatic ProductVariantImportof(ProductVariantImport template) factory method to create a shallow copy ProductVariantImportvoidMaps toProductVariant.assets.voidMaps toProductVariant.assets.voidsetAttributes(Attribute... attributes) Maps toProductVariant.attributes.voidsetAttributes(List<Attribute> attributes) Maps toProductVariant.attributes.voidMaps toProductVariant.images.voidMaps toProductVariant.images.voidsetIsMasterVariant(Boolean isMasterVariant) When creating a new ProductVariant, set tofalse; otherwise, the import operation will fail with a NewMasterVariantAdditionNotAllowed error. Set totrueif the ProductVariant exists and you want to set this ProductVariant as the Master Variant.voidUser-defined unique identifier.voidsetProduct(ProductKeyReference product) The Product containing this ProductVariant.voidMaps toProductVariant.sku.voidSet tofalseto update both the current and staged projections of the Product with the new Product Variant data. Leave empty or set totrueto only update the staged projection.static com.fasterxml.jackson.core.type.TypeReference<ProductVariantImport>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithProductVariantImport(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
keyexists on the specifiedproduct, it is updated with the imported data.- Specified by:
getKeyin 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
trueif 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 thestateof 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
falseto update both the current and staged projections of the Product with the new Product Variant data. - Leave empty or set to
trueto only update the staged projection.
- Returns:
- staged
- Set to
-
getProduct
The Product containing this ProductVariant. If the referenced Product does not exist, the
stateof the ImportOperation will be set tounresolveduntil the referenced Product is created.- Returns:
- product
-
setKey
User-defined unique identifier. If a ProductVariant with this
keyexists on the specifiedproduct, it is updated with the imported data.- Specified by:
setKeyin 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
trueif 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 thestateof 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 thestateof 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
falseto update both the current and staged projections of the Product with the new Product Variant data. - Leave empty or set to
trueto only update the staged projection.
- Parameters:
staged- value to be set
- Set to
-
setProduct
The Product containing this ProductVariant. If the referenced Product does not exist, the
stateof the ImportOperation will be set tounresolveduntil the referenced 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
-
copyDeep
ProductVariantImport copyDeep()- Specified by:
copyDeepin interfaceImportResource
-
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
-