Class CustomerBatchValidator

    • Field Detail

      • CUSTOMER_DRAFT_IS_NULL

        public static final java.lang.String CUSTOMER_DRAFT_IS_NULL
        See Also:
        Constant Field Values
      • CUSTOMER_DRAFT_KEY_NOT_SET

        public static final java.lang.String CUSTOMER_DRAFT_KEY_NOT_SET
        See Also:
        Constant Field Values
      • CUSTOMER_DRAFT_EMAIL_NOT_SET

        public static final java.lang.String CUSTOMER_DRAFT_EMAIL_NOT_SET
        See Also:
        Constant Field Values
    • Method Detail

      • validateAndCollectReferencedKeys

        public org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<com.commercetools.api.models.customer.CustomerDraft>,​CustomerBatchValidator.ReferencedKeys> validateAndCollectReferencedKeys​(@Nonnull
                                                                                                                                                                                                             java.util.List<com.commercetools.api.models.customer.CustomerDraft> customerDrafts)
        Given the List<CustomerDraft> of drafts this method attempts to validate drafts and return an ImmutablePair<Set<CustomerDraft>, CustomerBatchValidator.ReferencedKeys> which contains the Set of valid drafts and referenced keys within a wrapper.

        A valid customer 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 email which is not blank (null/empty)
        4. Each address in the addresses list satisfies the following conditions:
          1. It is not null
          2. It has a key which is not blank (null/empty)
          3. It has a unique key
        5. Each address index in the 'billing' and 'shipping' addresses list are valid and contained in the addresses list.
        Specified by:
        validateAndCollectReferencedKeys in class BaseBatchValidator<com.commercetools.api.models.customer.CustomerDraft,​CustomerSyncOptions,​CustomerSyncStatistics>
        Parameters:
        customerDrafts - the customer drafts to validate and collect referenced keys.
        Returns:
        ImmutablePair<Set<CustomerDraft>, CustomerBatchValidator.ReferencedKeys> which contains the Set of valid drafts and referenced keys within a wrapper.