Class ProductTypeTransformUtils
- java.lang.Object
-
- com.commercetools.sync.producttypes.utils.ProductTypeTransformUtils
-
public final class ProductTypeTransformUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ProductTypeTransformUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.CompletableFuture<java.util.List<com.commercetools.api.models.product_type.ProductTypeDraft>>
toProductTypeDrafts(com.commercetools.api.client.ProjectApiRoot client, ReferenceIdToKeyCache referenceIdToKeyCache, java.util.List<com.commercetools.api.models.product_type.ProductType> productTypes)
Transforms productTypes by resolving the references and map them to ProductTypeDrafts.
-
-
-
Method Detail
-
toProductTypeDrafts
@Nonnull public static java.util.concurrent.CompletableFuture<java.util.List<com.commercetools.api.models.product_type.ProductTypeDraft>> toProductTypeDrafts(@Nonnull com.commercetools.api.client.ProjectApiRoot client, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache, @Nonnull java.util.List<com.commercetools.api.models.product_type.ProductType> productTypes)
Transforms productTypes by resolving the references and map them to ProductTypeDrafts.This method replaces the ids on attribute references with keys and resolves(fetch key values for the reference id's) non null and unexpanded references of the productType
ProductType
by using cache.If the reference ids are already cached, key values are pulled from the cache, otherwise it executes the query to fetch the key value for the reference id's and store the idToKey value pair in the cache for reuse.
Then maps the ProductType to ProductTypeDraft by performing reference resolution considering idToKey value from the cache.
- Parameters:
client
- commercetools client.referenceIdToKeyCache
- the instance that manages cache.productTypes
- the productTypes to replace the references and attributes id's with keys.- Returns:
- a new list which contains productTypeDrafts which have all their references and attributes references resolved and already replaced with keys.
-
-