public final class ProductTypeTransformUtils
extends java.lang.Object
| Constructor and Description |
|---|
ProductTypeTransformUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.concurrent.CompletableFuture<java.util.List<io.sphere.sdk.producttypes.ProductTypeDraft>> |
toProductTypeDrafts(io.sphere.sdk.client.SphereClient client,
ReferenceIdToKeyCache referenceIdToKeyCache,
java.util.List<io.sphere.sdk.producttypes.ProductType> productTypes)
Transforms productTypes by resolving the references and map them to ProductTypeDrafts.
|
@Nonnull
public static java.util.concurrent.CompletableFuture<java.util.List<io.sphere.sdk.producttypes.ProductTypeDraft>> toProductTypeDrafts(@Nonnull
io.sphere.sdk.client.SphereClient client,
@Nonnull
ReferenceIdToKeyCache referenceIdToKeyCache,
@Nonnull
java.util.List<io.sphere.sdk.producttypes.ProductType> productTypes)
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 productTypeProductType 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.
client - commercetools client.referenceIdToKeyCache - the instance that manages cache.productTypes - the productTypes to replace the references and attributes id's with keys.TODO: Move the implementation from ProductTransformServiceImplProductTypeTransformServiceImpl class to this util class and remove the Service.