Class StateReferenceResolutionUtils
- java.lang.Object
-
- com.commercetools.sync.states.utils.StateReferenceResolutionUtils
-
public final class StateReferenceResolutionUtils extends java.lang.Object
Util class which provides utilities that can be used when syncing resources from a source commercetools project to a target one.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<com.commercetools.api.models.state.StateDraft>
mapToStateDrafts(java.util.List<com.commercetools.api.models.state.State> states, ReferenceIdToKeyCache referenceIdToKeyCache)
Returns anList
<StateDraft
> consisting of the results of applying the mapping fromState
toStateDraft
with considering reference resolution.
-
-
-
Method Detail
-
mapToStateDrafts
@Nonnull public static java.util.List<com.commercetools.api.models.state.StateDraft> mapToStateDrafts(@Nonnull java.util.List<com.commercetools.api.models.state.State> states, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache)
Returns anList
<StateDraft
> consisting of the results of applying the mapping fromState
toStateDraft
with considering reference resolution.Mapping of Reference fields for the reference resolution Reference field from to transitions List
<StateReference
>List
<StateResourceIdentifier
>Note: The transition references should be cached(idToKey value fetched and stored in a map). Any reference, which have its id in place and not replaced by the key, it would not be found in the map. In this case, this reference will be considered as existing resources on the target commercetools project and the library will issues an update/create API request without reference resolution..
- Parameters:
states
- the states without expansion of references.referenceIdToKeyCache
- the instance that manages cache.- Returns:
- a
List
ofStateDraft
built from the suppliedList
ofState
.
-
-