Class ProductTypeReferenceResolutionUtils


  • public final class ProductTypeReferenceResolutionUtils
    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_type.ProductTypeDraft> mapToProductTypeDrafts​(java.util.List<com.commercetools.api.models.product_type.ProductType> productTypes, ReferenceIdToKeyCache referenceIdToKeyCache)
      Returns an List<ProductTypeDraft> consisting of the results of applying the mapping from ProductType to ProductTypeDraft with considering reference resolution.
      • Methods inherited from class java.lang.Object

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

      • mapToProductTypeDrafts

        @Nonnull
        public static java.util.List<com.commercetools.api.models.product_type.ProductTypeDraft> mapToProductTypeDrafts​(@Nonnull
                                                                                                                        java.util.List<com.commercetools.api.models.product_type.ProductType> productTypes,
                                                                                                                        @Nonnull
                                                                                                                        ReferenceIdToKeyCache referenceIdToKeyCache)
        Returns an List<ProductTypeDraft> consisting of the results of applying the mapping from ProductType to ProductTypeDraft with considering reference resolution.
        Mapping of Reference fields for the reference resolution
        Reference field from to
        productType references (in case it has NestedType or set of NestedType) Set<ProductTypeReference> Set<ProductTypeReference> (with key replaced with id field)

        Note:If some references are not expanded for an attributeDefinition of a productType, the method will throw a ReferenceReplacementException containing the root causes of the exceptions that occurred in any of the supplied productTypes.

        Parameters:
        productTypes - the product types with expanded references.
        referenceIdToKeyCache - the instance that manages cache.
        Returns:
        a List of ProductTypeDraft built from the supplied List of ProductType.