Class CartDiscountTransformServiceImpl

    • Constructor Detail

      • CartDiscountTransformServiceImpl

        public CartDiscountTransformServiceImpl​(@Nonnull
                                                io.sphere.sdk.client.SphereClient ctpClient,
                                                @Nonnull
                                                ReferenceIdToKeyCache referenceIdToKeyCache)
    • Method Detail

      • toCartDiscountDrafts

        @Nonnull
        public java.util.concurrent.CompletableFuture<java.util.List<io.sphere.sdk.cartdiscounts.CartDiscountDraft>> toCartDiscountDrafts​(@Nonnull
                                                                                                                                          java.util.List<io.sphere.sdk.cartdiscounts.CartDiscount> cartDiscounts)
        Description copied from interface: CartDiscountTransformService
        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 cartDiscountCartDiscount 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.

        Specified by:
        toCartDiscountDrafts in interface CartDiscountTransformService
        Parameters:
        cartDiscounts - the cartDiscounts to resolve the references.
        Returns:
        a new list which contains cartDiscountDrafts which have all their references resolved.