Class ShoppingListBatchValidator

    • 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
    • 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 the List<ShoppingListDraft> of drafts this method attempts to validate drafts and collect referenced type keys from the draft and return an ImmutablePair<Set< ShoppingListDraft>,ShoppingListBatchValidator.ReferencedKeys> which contains the Set of valid drafts and referenced keys.

        A valid shopping list draft is one which satisfies the following conditions:

        1. It is not null
        2. It has a key which is not blank (null/empty)
        3. It has a name which is not null
        4. It has all lineItems AND textLineItems valid
        5. A lineItem is valid if it satisfies the following conditions:
          1. It has a SKU which is not blank (null/empty)
        6. A textLineItem is valid if it satisfies the following conditions:
          1. It has a name which is not blank (null/empty)
        Specified by:
        validateAndCollectReferencedKeys in class BaseBatchValidator<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 the Set of valid drafts and referenced keys within a wrapper.