Class ShoppingListBatchValidator
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseBatchValidator<io.sphere.sdk.shoppinglists.ShoppingListDraft,ShoppingListSyncOptions,ShoppingListSyncStatistics>
-
- com.commercetools.sync.shoppinglists.helpers.ShoppingListBatchValidator
-
public class ShoppingListBatchValidator extends BaseBatchValidator<io.sphere.sdk.shoppinglists.ShoppingListDraft,ShoppingListSyncOptions,ShoppingListSyncStatistics>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShoppingListBatchValidator.ReferencedKeys
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SHOPPING_LIST_DRAFT_IS_NULL
static java.lang.String
SHOPPING_LIST_DRAFT_KEY_NOT_SET
static java.lang.String
SHOPPING_LIST_DRAFT_NAME_NOT_SET
-
Constructor Summary
Constructors Constructor Description ShoppingListBatchValidator(ShoppingListSyncOptions syncOptions, ShoppingListSyncStatistics 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.shoppinglists.ShoppingListDraft>,ShoppingListBatchValidator.ReferencedKeys>
validateAndCollectReferencedKeys(java.util.List<io.sphere.sdk.shoppinglists.ShoppingListDraft> shoppingListDrafts)
Given theList
<ShoppingListDraft
> of drafts this method attempts to validate drafts and collect referenced type keys from the draft and return anImmutablePair
<Set
<ShoppingListDraft
>,ShoppingListBatchValidator.ReferencedKeys
> which contains theSet
of valid drafts and referenced keys.-
Methods inherited from class com.commercetools.sync.commons.helpers.BaseBatchValidator
collectReferencedKeyFromCustomFieldsDraft, collectReferencedKeyFromReference, collectReferencedKeyFromResourceIdentifier, collectReferencedKeysFromAssetDrafts, handleError, handleError
-
-
-
-
Field Detail
-
SHOPPING_LIST_DRAFT_KEY_NOT_SET
public static final java.lang.String SHOPPING_LIST_DRAFT_KEY_NOT_SET
- See Also:
- Constant Field Values
-
SHOPPING_LIST_DRAFT_IS_NULL
public static final java.lang.String SHOPPING_LIST_DRAFT_IS_NULL
- See Also:
- Constant Field Values
-
SHOPPING_LIST_DRAFT_NAME_NOT_SET
public static final java.lang.String SHOPPING_LIST_DRAFT_NAME_NOT_SET
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ShoppingListBatchValidator
public ShoppingListBatchValidator(@Nonnull ShoppingListSyncOptions syncOptions, @Nonnull ShoppingListSyncStatistics syncStatistics)
-
-
Method Detail
-
validateAndCollectReferencedKeys
public org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<io.sphere.sdk.shoppinglists.ShoppingListDraft>,ShoppingListBatchValidator.ReferencedKeys> validateAndCollectReferencedKeys(@Nonnull java.util.List<io.sphere.sdk.shoppinglists.ShoppingListDraft> shoppingListDrafts)
Given theList
<ShoppingListDraft
> of drafts this method attempts to validate drafts and collect referenced type keys from the draft and return anImmutablePair
<Set
<ShoppingListDraft
>,ShoppingListBatchValidator.ReferencedKeys
> which contains theSet
of valid drafts and referenced keys.A valid shopping list draft is one which satisfies the following conditions:
- It is not null
- It has a key which is not blank (null/empty)
- It has a name which is not null
- It has all lineItems AND textLineItems valid
- A lineItem is valid if it satisfies the following conditions:
- It has a SKU which is not blank (null/empty)
- A textLineItem is valid if it satisfies the following conditions:
- It has a name which is not blank (null/empty)
- Specified by:
validateAndCollectReferencedKeys
in classBaseBatchValidator<io.sphere.sdk.shoppinglists.ShoppingListDraft,ShoppingListSyncOptions,ShoppingListSyncStatistics>
- Parameters:
shoppingListDrafts
- the shopping list drafts to validate and collect referenced keys.- Returns:
ImmutablePair
<Set
<ShoppingListDraft
>,ShoppingListBatchValidator.ReferencedKeys
> which contains theSet
of valid drafts and referenced keys within a wrapper.
-
-