Class ProductTypeTransformServiceImpl
- java.lang.Object
-
- com.commercetools.sync.services.impl.BaseTransformServiceImpl
-
- com.commercetools.sync.producttypes.service.impl.ProductTypeTransformServiceImpl
-
- All Implemented Interfaces:
ProductTypeTransformService
public class ProductTypeTransformServiceImpl extends BaseTransformServiceImpl implements ProductTypeTransformService
-
-
Field Summary
-
Fields inherited from class com.commercetools.sync.services.impl.BaseTransformServiceImpl
CHUNK_SIZE, KEY_IS_NOT_SET_PLACE_HOLDER, referenceIdToKeyCache
-
-
Constructor Summary
Constructors Constructor Description ProductTypeTransformServiceImpl(io.sphere.sdk.client.SphereClient ctpClient, ReferenceIdToKeyCache referenceIdToKeyCache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.util.List<io.sphere.sdk.producttypes.ProductTypeDraft>>
toProductTypeDrafts(java.util.List<io.sphere.sdk.producttypes.ProductType> productTypes)
Transforms productTypes by resolving the references and map them to ProductTypeDrafts.-
Methods inherited from class com.commercetools.sync.services.impl.BaseTransformServiceImpl
cacheResourceReferenceKeys, cacheResourceReferenceKeys, createResourceIdsGraphQlRequests, fetchAndFillReferenceIdToKeyCache, getCtpClient, getNonCachedReferenceIds
-
-
-
-
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 productType
ProductType
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 interfaceProductTypeTransformService
- 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
-
-