Class ProductReferenceResolutionUtils
- java.lang.Object
 - 
- com.commercetools.sync.products.utils.ProductReferenceResolutionUtils
 
 
- 
public final class ProductReferenceResolutionUtils extends java.lang.ObjectUtil class which provides utilities that can be used when syncing resources from a source commercetools project to a target one. 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.sphere.sdk.products.ProductDraftBuildergetDraftBuilderFromStagedProduct(io.sphere.sdk.products.ProductProjection product)Given aProductthis method creates aProductDraftBuilderbased on the staged projection values of the supplied product.static java.util.List<io.sphere.sdk.products.ProductDraft>mapToProductDrafts(java.util.List<io.sphere.sdk.products.ProductProjection> products, ReferenceIdToKeyCache referenceIdToKeyCache)Returns anList<ProductDraft> consisting of the results of applying the mapping from the staged version of aProductProjectiontoProductDraftwith considering reference resolution. 
 - 
 
- 
- 
Method Detail
- 
mapToProductDrafts
@Nonnull public static java.util.List<io.sphere.sdk.products.ProductDraft> mapToProductDrafts(@Nonnull java.util.List<io.sphere.sdk.products.ProductProjection> products, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache)Returns anList<ProductDraft> consisting of the results of applying the mapping from the staged version of aProductProjectiontoProductDraftwith considering reference resolution.Mapping of Reference fields for the reference resolution Reference field from to productType Reference<ProductType>ResourceIdentifier<ProductType>categories Set<Reference<Category>>Set<ResourceIdentifier<Category>>variants.prices.channel Reference<Channel>ResourceIdentifier<Channel>variants.prices.customerGroup * Reference<CustomerGroup>ResourceIdentifier<CustomerGroup>variants.prices.custom.type Reference<Type>ResourceIdentifier<Type>variants.assets.custom.type Reference<Type>ResourceIdentifier<Type>variants.attributes on List<Attribute*Reference<ProductType> (example for ProductType)Reference<ProductType> (with key replaced with id field)taxCategory Reference<TaxCategory>ResourceIdentifier<TaxCategory>state * Reference<State>ResourceIdentifier<State>Note: The aforementioned references should contain Id in the map(cache) with a key value. Any reference that is not available in the map will have its id in place and not replaced by the key. This reference will be considered as existing resources on the target commercetools project and the library will issues an update/create API request without reference resolution.
- Parameters:
 products- the productprojection (staged) without expansion of references.referenceIdToKeyCache- the instance that manages cache.- Returns:
 - a 
ListofProductDraftbuilt from the suppliedListofProduct. 
 
- 
getDraftBuilderFromStagedProduct
@Nonnull public static io.sphere.sdk.products.ProductDraftBuilder getDraftBuilderFromStagedProduct(@Nonnull io.sphere.sdk.products.ProductProjection product)Given aProductthis method creates aProductDraftBuilderbased on the staged projection values of the supplied product.- Parameters:
 product- the product to create aProductDraftBuilderbased on it's staged data.- Returns:
 - a 
ProductDraftBuilderbased on the staged projection values of the supplied product. 
 
 - 
 
 -