Class StateTransformUtils
- java.lang.Object
-
- com.commercetools.sync.states.utils.StateTransformUtils
-
public final class StateTransformUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description StateTransformUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.CompletableFuture<java.util.List<com.commercetools.api.models.state.StateDraft>>
toStateDrafts(com.commercetools.api.client.ProjectApiRoot client, ReferenceIdToKeyCache referenceIdToKeyCache, java.util.List<com.commercetools.api.models.state.State> states)
Transforms States by resolving the references and map them to StateDrafts.
-
-
-
Method Detail
-
toStateDrafts
@Nonnull public static java.util.concurrent.CompletableFuture<java.util.List<com.commercetools.api.models.state.StateDraft>> toStateDrafts(@Nonnull com.commercetools.api.client.ProjectApiRoot client, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache, @Nonnull java.util.List<com.commercetools.api.models.state.State> states)
Transforms States by resolving the references and map them to StateDrafts.This method resolves(fetch key values for the reference id's) non null and unexpanded references of the State
State
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 State to StateDraft by performing reference resolution considering idToKey value from the cache.
- Parameters:
client
- commercetools client.referenceIdToKeyCache
- the instance that manages cache.states
- the states to resolve the references.- Returns:
- a new list which contains StateDrafts which have all their references resolved.
-
-