Class VariantReferenceResolutionUtils
- java.lang.Object
-
- com.commercetools.sync.products.utils.VariantReferenceResolutionUtils
-
public final class VariantReferenceResolutionUtils extends java.lang.Object
Util class which provides utilities that can be used when syncing resources from a source commercetools project to a target one.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<io.sphere.sdk.products.ProductVariantDraft>
mapToProductVariantDrafts(java.util.List<io.sphere.sdk.products.ProductVariant> productVariants, ReferenceIdToKeyCache referenceIdToKeyCache)
Returns anList
<ProductVariantDraft
> consisting of the results of applying the mapping fromProductVariant
toProductVariantDraft
with considering reference resolution.
-
-
-
Method Detail
-
mapToProductVariantDrafts
@Nonnull public static java.util.List<io.sphere.sdk.products.ProductVariantDraft> mapToProductVariantDrafts(@Nonnull java.util.List<io.sphere.sdk.products.ProductVariant> productVariants, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache)
Returns anList
<ProductVariantDraft
> consisting of the results of applying the mapping fromProductVariant
toProductVariantDraft
with considering reference resolution.Mapping of Reference fields for the reference resolution Reference field from to variants.prices.channel Reference
<Channel
>ResourceIdentifier
<Channel
>variants.prices.customerGroup * Reference
<CustomerGroup
>ResourceIdentifier
<CustomerGroup
>variants.prices.custom.type Reference
<Type
>ResourceIdentifier
<Type
>variants.assets.custom.type Reference
<Type
>ResourceIdentifier
<Type
>variants.attributes on List
<Attribute
*Reference
<ProductType
> (example for ProductType)Reference
<ProductType
> (with key replaced with id field)Note: The aforementioned references should be cached(idToKey value fetched and stored in a map). Any reference that is not cached will have its id in place and not replaced by the key will be considered as existing resources on the target commercetools project and the library will issues an update/create API request without reference resolution.
- Parameters:
productVariants
- the product variants without expansion of references.referenceIdToKeyCache
- the instance that manages cache.- Returns:
- a
List
ofProductVariantDraft
built from the suppliedList
ofProductVariant
.
-
-