public final class VariantReferenceResolver extends BaseReferenceResolver<io.sphere.sdk.products.ProductVariantDraft,ProductSyncOptions>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
REFERENCE_ID_FIELD |
static java.lang.String |
REFERENCE_TYPE_ID_FIELD |
BLANK_ID_VALUE_ON_RESOURCE_IDENTIFIER, options| Constructor and Description |
|---|
VariantReferenceResolver(ProductSyncOptions productSyncOptions,
TypeService typeService,
ChannelService channelService,
CustomerGroupService customerGroupService,
ProductService productService)
Takes a
ProductSyncOptions instance, TypeService, a ChannelService, a
CustomerGroupService and a ProductService to instantiate a VariantReferenceResolver
instance that could be used to resolve the variants of product drafts in the CTP project specified in the
injected ProductSyncOptions instance. |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletionStage<io.sphere.sdk.products.ProductVariantDraft> |
resolveReferences(io.sphere.sdk.products.ProductVariantDraft productVariantDraft)
Given a
ProductVariantDraft this method attempts to resolve the prices and attributes to
return a CompletionStage which contains a new instance of the draft with the resolved
references. |
getKeyFromResourceIdentifierpublic static final java.lang.String REFERENCE_TYPE_ID_FIELD
public static final java.lang.String REFERENCE_ID_FIELD
public VariantReferenceResolver(@Nonnull
ProductSyncOptions productSyncOptions,
@Nonnull
TypeService typeService,
@Nonnull
ChannelService channelService,
@Nonnull
CustomerGroupService customerGroupService,
@Nonnull
ProductService productService)
ProductSyncOptions instance, TypeService, a ChannelService, a
CustomerGroupService and a ProductService to instantiate a VariantReferenceResolver
instance that could be used to resolve the variants of product drafts in the CTP project specified in the
injected ProductSyncOptions instance.productSyncOptions - 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.productService - the service to fetch the products for reference resolution.public java.util.concurrent.CompletionStage<io.sphere.sdk.products.ProductVariantDraft> resolveReferences(@Nonnull
io.sphere.sdk.products.ProductVariantDraft productVariantDraft)
ProductVariantDraft this method attempts to resolve the prices and attributes to
return a CompletionStage which contains a new instance of the draft with the resolved
references. The keys of the references are either taken from the expanded references or
taken from the id field of the references.resolveReferences in class BaseReferenceResolver<io.sphere.sdk.products.ProductVariantDraft,ProductSyncOptions>productVariantDraft - the product variant draft to resolve it's references.CompletionStage that contains as a result a new productDraft instance with resolved references
or, in case an error occurs during reference resolution, a ReferenceResolutionException.