Class PriceReferenceResolver
- java.lang.Object
 - 
- com.commercetools.sync.commons.helpers.BaseReferenceResolver<D,S>
 - 
- com.commercetools.sync.commons.helpers.CustomReferenceResolver<io.sphere.sdk.products.PriceDraft,io.sphere.sdk.products.PriceDraftBuilder,ProductSyncOptions>
 - 
- com.commercetools.sync.products.helpers.PriceReferenceResolver
 
 
 
 
- 
public final class PriceReferenceResolver extends CustomReferenceResolver<io.sphere.sdk.products.PriceDraft,io.sphere.sdk.products.PriceDraftBuilder,ProductSyncOptions>
 
- 
- 
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 PriceReferenceResolver(ProductSyncOptions options, TypeService typeService, ChannelService channelService, CustomerGroupService customerGroupService)Takes aProductSyncOptionsinstance,TypeService, aChannelServiceand aCustomerGroupServiceto instantiate aPriceReferenceResolverinstance that could be used to resolve the prices of variant drafts in the CTP project specified in the injectedProductSyncOptionsinstance. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.concurrent.CompletionStage<io.sphere.sdk.products.PriceDraftBuilder>resolveCustomTypeReference(io.sphere.sdk.products.PriceDraftBuilder draftBuilder)Given a draft ofD(e.g.java.util.concurrent.CompletionStage<io.sphere.sdk.products.PriceDraft>resolveReferences(io.sphere.sdk.products.PriceDraft priceDraft)Given aPriceDraftthis method attempts to resolve the custom type and channel references to return aCompletionStagewhich contains a new instance of the draft with the resolved references.- 
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
- 
PriceReferenceResolver
public PriceReferenceResolver(@Nonnull ProductSyncOptions options, @Nonnull TypeService typeService, @Nonnull ChannelService channelService, @Nonnull CustomerGroupService customerGroupService)Takes aProductSyncOptionsinstance,TypeService, aChannelServiceand aCustomerGroupServiceto instantiate aPriceReferenceResolverinstance that could be used to resolve the prices of variant drafts in the CTP project specified in the injectedProductSyncOptionsinstance.- 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.channelService- the service to fetch the channels for reference resolution.customerGroupService- the service to fetch the customer groups for reference resolution.
 
 - 
 
- 
Method Detail
- 
resolveReferences
public java.util.concurrent.CompletionStage<io.sphere.sdk.products.PriceDraft> resolveReferences(@Nonnull io.sphere.sdk.products.PriceDraft priceDraft)Given aPriceDraftthis method attempts to resolve the custom type and channel references to return aCompletionStagewhich contains a new instance of the draft with the resolved references.The method then tries to fetch the key of the customer group, optimistically from a cache. If the id is not found in cache nor the CTP project the
ReferenceResolutionExceptionwill be thrown.- Specified by:
 resolveReferencesin classBaseReferenceResolver<io.sphere.sdk.products.PriceDraft,ProductSyncOptions>- Parameters:
 priceDraft- the priceDraft to resolve it's references.- Returns:
 - a 
CompletionStagethat contains as a result a new inventoryEntryDraft instance with resolved references or, in case an error occurs during reference resolution aReferenceResolutionException. 
 
- 
resolveCustomTypeReference
@Nonnull protected java.util.concurrent.CompletionStage<io.sphere.sdk.products.PriceDraftBuilder> resolveCustomTypeReference(@Nonnull io.sphere.sdk.products.PriceDraftBuilder draftBuilder)Description copied from class:CustomReferenceResolverGiven a draft ofD(e.g.CategoryDraft) this method attempts to resolve it's custom type reference to returnCompletionStagewhich 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:
 resolveCustomTypeReferencein classCustomReferenceResolver<io.sphere.sdk.products.PriceDraft,io.sphere.sdk.products.PriceDraftBuilder,ProductSyncOptions>- Parameters:
 draftBuilder- the draft builder to resolve it's references.- Returns:
 - a 
CompletionStagethat contains as a result a new draft instance with resolved custom type references or, in case an error occurs during reference resolution, aReferenceResolutionException. 
 
 - 
 
 -