Class CartDiscountReferenceResolver
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseReferenceResolver<D,S>
-
- com.commercetools.sync.commons.helpers.CustomReferenceResolver<io.sphere.sdk.cartdiscounts.CartDiscountDraft,io.sphere.sdk.cartdiscounts.CartDiscountDraftBuilder,CartDiscountSyncOptions>
-
- com.commercetools.sync.cartdiscounts.helpers.CartDiscountReferenceResolver
-
public final class CartDiscountReferenceResolver extends CustomReferenceResolver<io.sphere.sdk.cartdiscounts.CartDiscountDraft,io.sphere.sdk.cartdiscounts.CartDiscountDraftBuilder,CartDiscountSyncOptions>
-
-
Field Summary
-
Fields inherited from class com.commercetools.sync.commons.helpers.CustomReferenceResolver
TYPE_DOES_NOT_EXIST
-
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 CartDiscountReferenceResolver(CartDiscountSyncOptions options, TypeService typeService)
Takes aCartDiscountSyncOptions
instance, aTypeService
to instantiate aCartDiscountReferenceResolver
instance that could be used to resolve the cartDiscount drafts in the CTP project specified in the injectedCartDiscountSyncOptions
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.concurrent.CompletionStage<io.sphere.sdk.cartdiscounts.CartDiscountDraftBuilder>
resolveCustomTypeReference(io.sphere.sdk.cartdiscounts.CartDiscountDraftBuilder draftBuilder)
Given a draft ofD
(e.g.java.util.concurrent.CompletionStage<io.sphere.sdk.cartdiscounts.CartDiscountDraft>
resolveReferences(io.sphere.sdk.cartdiscounts.CartDiscountDraft draft)
Given aCartDiscountDraft
this method attempts to resolve the custom type reference to return aCompletionStage
which contains a new instance of the draft with the resolved reference or, in case an error occurs during reference resolution, aReferenceResolutionException
.-
Methods inherited from class com.commercetools.sync.commons.helpers.CustomReferenceResolver
resolveCustomTypeReference
-
Methods inherited from class com.commercetools.sync.commons.helpers.BaseReferenceResolver
getIdFromReference, getKeyFromResourceIdentifier
-
-
-
-
Constructor Detail
-
CartDiscountReferenceResolver
public CartDiscountReferenceResolver(@Nonnull CartDiscountSyncOptions options, @Nonnull TypeService typeService)
Takes aCartDiscountSyncOptions
instance, aTypeService
to instantiate aCartDiscountReferenceResolver
instance that could be used to resolve the cartDiscount drafts in the CTP project specified in the injectedCartDiscountSyncOptions
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.typeService
- the service to fetch the custom types for reference resolution.
-
-
Method Detail
-
resolveReferences
@Nonnull public java.util.concurrent.CompletionStage<io.sphere.sdk.cartdiscounts.CartDiscountDraft> resolveReferences(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraft draft)
Given aCartDiscountDraft
this method attempts to resolve the custom type reference to return aCompletionStage
which contains a new instance of the draft with the resolved reference or, in case an error occurs during reference resolution, aReferenceResolutionException
.- Specified by:
resolveReferences
in classBaseReferenceResolver<io.sphere.sdk.cartdiscounts.CartDiscountDraft,CartDiscountSyncOptions>
- Parameters:
draft
- the CartDiscountDraft to resolve its references.- Returns:
- a
CompletionStage
that contains as a result a new CartDiscountDraft instance with resolved custom type reference or, in case an error occurs during reference resolution, aReferenceResolutionException
.
-
resolveCustomTypeReference
protected java.util.concurrent.CompletionStage<io.sphere.sdk.cartdiscounts.CartDiscountDraftBuilder> resolveCustomTypeReference(@Nonnull io.sphere.sdk.cartdiscounts.CartDiscountDraftBuilder draftBuilder)
Description copied from class:CustomReferenceResolver
Given a draft ofD
(e.g.CategoryDraft
) this method attempts to resolve it's custom type reference to returnCompletionStage
which contains a new instance of the draft with the resolved custom type reference.The method then tries to fetch the key of the custom type, optimistically from a cache. If the key is is not found, the resultant draft would remain exactly the same as the passed draft (without a custom type reference resolution).
- Specified by:
resolveCustomTypeReference
in classCustomReferenceResolver<io.sphere.sdk.cartdiscounts.CartDiscountDraft,io.sphere.sdk.cartdiscounts.CartDiscountDraftBuilder,CartDiscountSyncOptions>
- Parameters:
draftBuilder
- the draft builder to resolve it's references.- Returns:
- a
CompletionStage
that contains as a result a new draft instance with resolved custom type references or, in case an error occurs during reference resolution, aReferenceResolutionException
.
-
-