Class VariantReferenceResolver

    • 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)
        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.
        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.
    • Method Detail

      • resolveReferences

        public java.util.concurrent.CompletionStage<io.sphere.sdk.products.ProductVariantDraft> resolveReferences​(@Nonnull
                                                                                                                  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.

        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 class BaseReferenceResolver<io.sphere.sdk.products.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, a ReferenceResolutionException.