Class CartDiscountBatchValidator

    • Method Detail

      • validateAndCollectReferencedKeys

        public org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<com.commercetools.api.models.cart_discount.CartDiscountDraft>,​java.util.Set<java.lang.String>> validateAndCollectReferencedKeys​(@Nonnull
                                                                                                                                                                                                                java.util.List<com.commercetools.api.models.cart_discount.CartDiscountDraft> cartDiscountDrafts)
        Given the List<CartDiscountDraft> of drafts this method attempts to validate drafts and collect referenced type keys from the draft and return an ImmutablePair<Set<CartDiscountDraft> ,Set<String>> which contains the Set of valid drafts and referenced type keys.

        A valid cart discount draft is one which satisfies the following conditions:

        1. It is not null
        2. It has a key which is not blank (null/empty)
        Specified by:
        validateAndCollectReferencedKeys in class BaseBatchValidator<com.commercetools.api.models.cart_discount.CartDiscountDraft,​CartDiscountSyncOptions,​CartDiscountSyncStatistics>
        Parameters:
        cartDiscountDrafts - the cart discount drafts to validate and collect referenced type keys.
        Returns:
        ImmutablePair<Set<CartDiscountDraft>, Set<String>> which contains the Set of valid drafts and referenced type keys.