Class InventoryBatchValidator
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseBatchValidator<io.sphere.sdk.inventory.InventoryEntryDraft,InventorySyncOptions,InventorySyncStatistics>
-
- com.commercetools.sync.inventories.helpers.InventoryBatchValidator
-
public class InventoryBatchValidator extends BaseBatchValidator<io.sphere.sdk.inventory.InventoryEntryDraft,InventorySyncOptions,InventorySyncStatistics>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InventoryBatchValidator.ReferencedKeys
-
Constructor Summary
Constructors Constructor Description InventoryBatchValidator(InventorySyncOptions syncOptions, InventorySyncStatistics syncStatistics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<io.sphere.sdk.inventory.InventoryEntryDraft>,InventoryBatchValidator.ReferencedKeys>
validateAndCollectReferencedKeys(java.util.List<io.sphere.sdk.inventory.InventoryEntryDraft> inventoryDrafts)
Given theList
<InventoryEntryDraft
> of drafts this method attempts to validate drafts and collect referenced keys from the draft and return anImmutablePair
<Set
<InventoryEntryDraft
>,InventoryBatchValidator.ReferencedKeys
> which contains theSet
of 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
-
InventoryBatchValidator
public InventoryBatchValidator(@Nonnull InventorySyncOptions syncOptions, @Nonnull InventorySyncStatistics syncStatistics)
-
-
Method Detail
-
validateAndCollectReferencedKeys
public org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<io.sphere.sdk.inventory.InventoryEntryDraft>,InventoryBatchValidator.ReferencedKeys> validateAndCollectReferencedKeys(@Nonnull java.util.List<io.sphere.sdk.inventory.InventoryEntryDraft> inventoryDrafts)
Given theList
<InventoryEntryDraft
> of drafts this method attempts to validate drafts and collect referenced keys from the draft and return anImmutablePair
<Set
<InventoryEntryDraft
>,InventoryBatchValidator.ReferencedKeys
> which contains theSet
of valid drafts and referenced keys within a wrapper.A valid inventory draft is one which satisfies the following conditions:
- It is not null
- It has a sku which is not blank (null/empty)
- Specified by:
validateAndCollectReferencedKeys
in classBaseBatchValidator<io.sphere.sdk.inventory.InventoryEntryDraft,InventorySyncOptions,InventorySyncStatistics>
- Parameters:
inventoryDrafts
- the inventory drafts to validate and collect referenced keys.- Returns:
ImmutablePair
<Set
<InventoryEntryDraft
>,InventoryBatchValidator.ReferencedKeys
> which contains theSet
of valid drafts and referenced keys within a wrapper.
-
-