Class StateReferenceResolver
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseReferenceResolver<io.sphere.sdk.states.StateDraft,StateSyncOptions>
-
- com.commercetools.sync.states.helpers.StateReferenceResolver
-
public final class StateReferenceResolver extends BaseReferenceResolver<io.sphere.sdk.states.StateDraft,StateSyncOptions>
-
-
Field Summary
-
Fields inherited from class com.commercetools.sync.commons.helpers.BaseReferenceResolver
BLANK_ID_VALUE_ON_REFERENCE, BLANK_KEY_VALUE_ON_RESOURCE_IDENTIFIER, options
-
-
Constructor Summary
Constructors Constructor Description StateReferenceResolver(StateSyncOptions options, StateService stateService)
Takes aStateSyncOptions
instance, aStateService
to instantiate aStateReferenceResolver
instance that could be used to resolve the category drafts in the CTP project specified in the injectedStateSyncOptions
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletionStage<io.sphere.sdk.states.StateDraft>
resolveReferences(io.sphere.sdk.states.StateDraft stateDraft)
Given aStateDraft
this method attempts to resolve the transition state references to return aCompletionStage
which contains a new instance of the draft with the resolved references.-
Methods inherited from class com.commercetools.sync.commons.helpers.BaseReferenceResolver
getIdFromReference, getKeyFromResourceIdentifier
-
-
-
-
Constructor Detail
-
StateReferenceResolver
public StateReferenceResolver(@Nonnull StateSyncOptions options, @Nonnull StateService stateService)
Takes aStateSyncOptions
instance, aStateService
to instantiate aStateReferenceResolver
instance that could be used to resolve the category drafts in the CTP project specified in the injectedStateSyncOptions
instance.- Parameters:
options
- the container of all the options of the sync process including the CTP project client and/or configuration and other sync-specific options.stateService
- the service to fetch the states for reference resolution.
-
-
Method Detail
-
resolveReferences
@Nonnull public java.util.concurrent.CompletionStage<io.sphere.sdk.states.StateDraft> resolveReferences(@Nonnull io.sphere.sdk.states.StateDraft stateDraft)
Given aStateDraft
this method attempts to resolve the transition state references to return aCompletionStage
which contains a new instance of the draft with the resolved references. The keys of the references are taken from the id field of the references.- Specified by:
resolveReferences
in classBaseReferenceResolver<io.sphere.sdk.states.StateDraft,StateSyncOptions>
- Parameters:
stateDraft
- the stateDraft to resolve its references.- Returns:
- a
CompletionStage
that contains as a result a new Statedraft instance with resolved category references or, in case an error occurs during reference resolution, aReferenceResolutionException
.
-
-