Class StateReferenceResolver

    • Constructor Detail

      • StateReferenceResolver

        public StateReferenceResolver​(@Nonnull
                                      StateSyncOptions options,
                                      @Nonnull
                                      StateService stateService)
        Takes a StateSyncOptions instance, a StateService to instantiate a StateReferenceResolver instance that could be used to resolve the category drafts in the CTP project specified in the injected StateSyncOptions 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 a StateDraft this method attempts to resolve the transition state references to return a CompletionStage 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 class BaseReferenceResolver<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, a ReferenceResolutionException.