Class ProductTypeTransformServiceImpl

    • Constructor Detail

      • ProductTypeTransformServiceImpl

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

      • toProductTypeDrafts

        @Nonnull
        public java.util.concurrent.CompletableFuture<java.util.List<io.sphere.sdk.producttypes.ProductTypeDraft>> toProductTypeDrafts​(@Nonnull
                                                                                                                                       java.util.List<io.sphere.sdk.producttypes.ProductType> productTypes)
                                                                                                                                throws ReferenceReplacementException
        Description copied from interface: ProductTypeTransformService
        Transforms productTypes by resolving the references and map them to ProductTypeDrafts.

        This method replaces the ids on attribute references with keys. It resolves(fetch key value for the reference id) the non-null unexpanded references in the productTypeProductType by using a 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 and store in the cache.

        Then maps the ProductType to ProductTypeDraft by performing reference resolution considering idToKey value from the cache.

        Specified by:
        toProductTypeDrafts in interface ProductTypeTransformService
        Parameters:
        productTypes - the productTypes to replace the references and attributes ids with keys.
        Returns:
        a new list which contains productTypeDrafts which have all their references and attributes references resolved and already replaced with keys.
        Throws:
        ReferenceReplacementException