Class VariantReferenceResolver
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseReferenceResolver<com.commercetools.api.models.product.ProductVariantDraft,ProductSyncOptions>
-
- com.commercetools.sync.products.helpers.VariantReferenceResolver
-
public final class VariantReferenceResolver extends BaseReferenceResolver<com.commercetools.api.models.product.ProductVariantDraft,ProductSyncOptions>
-
-
Field Summary
-
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 VariantReferenceResolver(ProductSyncOptions productSyncOptions, TypeService typeService, ChannelService channelService, CustomerGroupService customerGroupService, ProductService productService, ProductTypeService productTypeService, CategoryService categoryService, CustomObjectService customObjectService, StateService stateService, CustomerService customerService)
Instantiates aVariantReferenceResolver
instance that could be used to resolve the variants of product drafts in the CTP project specified in the injectedProductSyncOptions
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletionStage<com.commercetools.api.models.product.ProductVariantDraft>
resolveReferences(com.commercetools.api.models.product.ProductVariantDraft productVariantDraft)
Given aProductVariantDraft
this method attempts to resolve the prices, assets and attributes to return aCompletionStage
which contains a new instance of the draft with the resolved references.-
Methods inherited from class com.commercetools.sync.commons.helpers.BaseReferenceResolver
getIdFromReference, getKeyFromResourceIdentifier
-
-
-
-
Constructor Detail
-
VariantReferenceResolver
public VariantReferenceResolver(@Nonnull ProductSyncOptions productSyncOptions, @Nonnull TypeService typeService, @Nonnull ChannelService channelService, @Nonnull CustomerGroupService customerGroupService, @Nonnull ProductService productService, @Nonnull ProductTypeService productTypeService, @Nonnull CategoryService categoryService, @Nonnull CustomObjectService customObjectService, @Nonnull StateService stateService, @Nonnull CustomerService customerService)
Instantiates aVariantReferenceResolver
instance that could be used to resolve the variants of product drafts in the CTP project specified in the injectedProductSyncOptions
instance.- Parameters:
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.customObjectService
- the service to fetch the custom objects for reference resolution.stateService
- the service to fetch the states for reference resolution.customerService
- the service to fetch the customers for reference resolution.
-
-
Method Detail
-
resolveReferences
public java.util.concurrent.CompletionStage<com.commercetools.api.models.product.ProductVariantDraft> resolveReferences(@Nonnull com.commercetools.api.models.product.ProductVariantDraft productVariantDraft)
Given aProductVariantDraft
this method attempts to resolve the prices, assets and attributes to return aCompletionStage
which contains a new instance of the draft with the resolved references.Note: this method will filter out any null sub resources (e.g. prices, attributes or assets) under the returned resolved variant.
- Specified by:
resolveReferences
in classBaseReferenceResolver<com.commercetools.api.models.product.ProductVariantDraft,ProductSyncOptions>
- Parameters:
productVariantDraft
- the product variant draft to resolve it's references.- Returns:
- a
CompletionStage
that contains as a result a new productDraft instance with resolved references or, in case an error occurs during reference resolution, aReferenceResolutionException
.
-
-