Class 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<com.commercetools.api.models.product.ProductVariantDraft> mapToProductVariantDrafts​(java.util.List<com.commercetools.api.models.product.ProductVariant> productVariants, ReferenceIdToKeyCache referenceIdToKeyCache)
      Returns an List<ProductVariantDraft> consisting of the results of applying the mapping from ProductVariant to ProductVariantDraft with considering reference resolution.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • mapToProductVariantDrafts

        @Nonnull
        public static java.util.List<com.commercetools.api.models.product.ProductVariantDraft> mapToProductVariantDrafts​(@Nonnull
                                                                                                                         java.util.List<com.commercetools.api.models.product.ProductVariant> productVariants,
                                                                                                                         @Nonnull
                                                                                                                         ReferenceIdToKeyCache referenceIdToKeyCache)
        Returns an List<ProductVariantDraft> consisting of the results of applying the mapping from ProductVariant to ProductVariantDraft with considering reference resolution.

        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 of ProductVariantDraft built from the supplied List of ProductVariant.