Class ProductBatchValidator
- java.lang.Object
 - 
- com.commercetools.sync.commons.helpers.BaseBatchValidator<io.sphere.sdk.products.ProductDraft,ProductSyncOptions,ProductSyncStatistics>
 - 
- com.commercetools.sync.products.helpers.ProductBatchValidator
 
 
 
- 
public class ProductBatchValidator extends BaseBatchValidator<io.sphere.sdk.products.ProductDraft,ProductSyncOptions,ProductSyncStatistics>
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProductBatchValidator.ReferencedKeys 
- 
Constructor Summary
Constructors Constructor Description ProductBatchValidator(ProductSyncOptions syncOptions, ProductSyncStatistics syncStatistics) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Set<java.lang.String>getReferencedProductKeys(io.sphere.sdk.products.ProductVariantDraft variantDraft)Get a set of referenced product keys on all attribute drafts on the supplied Product Variant Draft.org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<io.sphere.sdk.products.ProductDraft>,ProductBatchValidator.ReferencedKeys>validateAndCollectReferencedKeys(java.util.List<io.sphere.sdk.products.ProductDraft> productDrafts)Given theList<ProductDraft> of drafts this method attempts to validate drafts and collect referenced keys from the draft and return anImmutablePair<Set<ProductDraft>,ProductBatchValidator.ReferencedKeys> which contains theSetof valid drafts and referenced keys within a wrapper.- 
Methods inherited from class com.commercetools.sync.commons.helpers.BaseBatchValidator
collectReferencedKeyFromCustomFieldsDraft, collectReferencedKeyFromReference, collectReferencedKeyFromResourceIdentifier, collectReferencedKeysFromAssetDrafts, handleError, handleError 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
ProductBatchValidator
public ProductBatchValidator(@Nonnull ProductSyncOptions syncOptions, @Nonnull ProductSyncStatistics syncStatistics) 
 - 
 
- 
Method Detail
- 
validateAndCollectReferencedKeys
public org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<io.sphere.sdk.products.ProductDraft>,ProductBatchValidator.ReferencedKeys> validateAndCollectReferencedKeys(@Nonnull java.util.List<io.sphere.sdk.products.ProductDraft> productDrafts)
Given theList<ProductDraft> of drafts this method attempts to validate drafts and collect referenced keys from the draft and return anImmutablePair<Set<ProductDraft>,ProductBatchValidator.ReferencedKeys> which contains theSetof valid drafts and referenced keys within a wrapper.A valid product draft is one which satisfies the following conditions:
- It is not null
 - It has a key which is not blank (null/empty)
 - It has all variants AND master variant valid
 - A variant is valid if it satisfies the following conditions:
       
- It has a key which is not blank (null/empty)
 - It has a SKU which is not blank (null/empty)
 
 
- Specified by:
 validateAndCollectReferencedKeysin classBaseBatchValidator<io.sphere.sdk.products.ProductDraft,ProductSyncOptions,ProductSyncStatistics>- Parameters:
 productDrafts- the product drafts to validate and collect referenced keys.- Returns:
 ImmutablePair<Set<ProductDraft>,ProductBatchValidator.ReferencedKeys> which contains theSetof valid drafts and referenced keys within a wrapper.
 
- 
getReferencedProductKeys
@Nonnull public static java.util.Set<java.lang.String> getReferencedProductKeys(@Nonnull io.sphere.sdk.products.ProductVariantDraft variantDraft)Get a set of referenced product keys on all attribute drafts on the supplied Product Variant Draft.Note: Null attributes are skipped since they are validated at a later stage in (
ProductVariantUpdateActionUtils)- Parameters:
 variantDraft- the variant draft to get the referenced product keys from.- Returns:
 - the set of referenced product keys.
 
 
 - 
 
 -