Class CartDiscountTransformUtils
- java.lang.Object
-
- com.commercetools.sync.cartdiscounts.utils.CartDiscountTransformUtils
-
public final class CartDiscountTransformUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CartDiscountTransformUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.CompletableFuture<java.util.List<io.sphere.sdk.cartdiscounts.CartDiscountDraft>>
toCartDiscountDrafts(io.sphere.sdk.client.SphereClient client, ReferenceIdToKeyCache referenceIdToKeyCache, java.util.List<io.sphere.sdk.cartdiscounts.CartDiscount> cartDiscounts)
Transforms cartDiscounts by resolving the references and map them to CartDiscountDrafts.
-
-
-
Method Detail
-
toCartDiscountDrafts
@Nonnull public static java.util.concurrent.CompletableFuture<java.util.List<io.sphere.sdk.cartdiscounts.CartDiscountDraft>> toCartDiscountDrafts(@Nonnull io.sphere.sdk.client.SphereClient client, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache, @Nonnull java.util.List<io.sphere.sdk.cartdiscounts.CartDiscount> cartDiscounts)
Transforms cartDiscounts by resolving the references and map them to CartDiscountDrafts.This method resolves(fetch key values for the reference id's) non null and unexpanded references of the cartDiscount
CartDiscount
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 CartDiscount to CartDiscountDraft by performing reference resolution considering idToKey value from the cache.
- Parameters:
client
- commercetools client.referenceIdToKeyCache
- the instance that manages cache.cartDiscounts
- the cartDiscounts to resolve the references.- Returns:
- a new list which contains cartDiscountDrafts which have all their references resolved.
TODO: Move the implementation from service class to this util class.
-
-