public final class VariantReferenceResolver extends BaseReferenceResolver<io.sphere.sdk.products.ProductVariantDraft,ProductSyncOptions>
BLANK_ID_VALUE_ON_RESOURCE_IDENTIFIER, options| Constructor and Description |
|---|
VariantReferenceResolver(ProductSyncOptions productSyncOptions,
TypeService typeService,
ChannelService channelService,
CustomerGroupService customerGroupService,
ProductService productService,
ProductTypeService productTypeService,
CategoryService categoryService)
Instantiates 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, assets and attributes to
return a CompletionStage which contains a new instance of the draft with the resolved
references. |
getKeyFromResourceIdentifierpublic VariantReferenceResolver(@Nonnull
ProductSyncOptions productSyncOptions,
@Nonnull
TypeService typeService,
@Nonnull
ChannelService channelService,
@Nonnull
CustomerGroupService customerGroupService,
@Nonnull
ProductService productService,
@Nonnull
ProductTypeService productTypeService,
@Nonnull
CategoryService categoryService)
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.productTypeService - the service to fetch the productTypes for reference resolution.categoryService - the service to fetch the categories 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, assets 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.
Note: this method will filter out any null sub resources (e.g. prices, attributes or assets) under the returned resolved variant.
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.