Class CategoryTransformServiceImpl
- java.lang.Object
-
- com.commercetools.sync.services.impl.BaseTransformServiceImpl
-
- com.commercetools.sync.categories.service.impl.CategoryTransformServiceImpl
-
- All Implemented Interfaces:
CategoryTransformService
public class CategoryTransformServiceImpl extends BaseTransformServiceImpl implements CategoryTransformService
-
-
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 CategoryTransformServiceImpl(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.categories.CategoryDraft>>
toCategoryDrafts(java.util.List<io.sphere.sdk.categories.Category> categories)
Transforms categories by resolving the references and map them to CategoryDrafts.-
Methods inherited from class com.commercetools.sync.services.impl.BaseTransformServiceImpl
cacheResourceReferenceKeys, cacheResourceReferenceKeys, createResourceIdsGraphQlRequests, fetchAndFillReferenceIdToKeyCache, getCtpClient, getNonCachedReferenceIds
-
-
-
-
Constructor Detail
-
CategoryTransformServiceImpl
public CategoryTransformServiceImpl(@Nonnull io.sphere.sdk.client.SphereClient ctpClient, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache)
-
-
Method Detail
-
toCategoryDrafts
@Nonnull public java.util.concurrent.CompletableFuture<java.util.List<io.sphere.sdk.categories.CategoryDraft>> toCategoryDrafts(@Nonnull java.util.List<io.sphere.sdk.categories.Category> categories)
Description copied from interface:CategoryTransformService
Transforms categories by resolving the references and map them to CategoryDrafts.This method replaces the ids on unexpanded references of the category
Category
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 Category to CategoryDraft by performing reference resolution considering idToKey value from the cache.
- Specified by:
toCategoryDrafts
in interfaceCategoryTransformService
- Parameters:
categories
- the categories to replace the references id's with keys.- Returns:
- a new list which contains categoryDrafts which have all their references resolved and already replaced with keys.
-
-