Class CustomerBatchValidator
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseBatchValidator<com.commercetools.api.models.customer.CustomerDraft,CustomerSyncOptions,CustomerSyncStatistics>
-
- com.commercetools.sync.customers.helpers.CustomerBatchValidator
-
public class CustomerBatchValidator extends BaseBatchValidator<com.commercetools.api.models.customer.CustomerDraft,CustomerSyncOptions,CustomerSyncStatistics>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CustomerBatchValidator.ReferencedKeys
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CUSTOMER_DRAFT_EMAIL_NOT_SET
static java.lang.String
CUSTOMER_DRAFT_IS_NULL
static java.lang.String
CUSTOMER_DRAFT_KEY_NOT_SET
-
Constructor Summary
Constructors Constructor Description CustomerBatchValidator(CustomerSyncOptions syncOptions, CustomerSyncStatistics syncStatistics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<com.commercetools.api.models.customer.CustomerDraft>,CustomerBatchValidator.ReferencedKeys>
validateAndCollectReferencedKeys(java.util.List<com.commercetools.api.models.customer.CustomerDraft> customerDrafts)
Given theList
<CustomerDraft
> of drafts this method attempts to validate drafts and return anImmutablePair
<Set
<CustomerDraft
>,CustomerBatchValidator.ReferencedKeys
> which contains theSet
of valid drafts and referenced keys within a wrapper.-
Methods inherited from class com.commercetools.sync.commons.helpers.BaseBatchValidator
collectReferencedKeyFromCustomFieldsDraft, collectReferencedKeyFromResourceIdentifier, collectReferencedKeysFromAssetDrafts, handleError, handleError
-
-
-
-
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
-
-
Constructor Detail
-
CustomerBatchValidator
public CustomerBatchValidator(@Nonnull CustomerSyncOptions syncOptions, @Nonnull CustomerSyncStatistics syncStatistics)
-
-
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 theList
<CustomerDraft
> of drafts this method attempts to validate drafts and return anImmutablePair
<Set
<CustomerDraft
>,CustomerBatchValidator.ReferencedKeys
> which contains theSet
of valid drafts and referenced keys within a wrapper.A valid customer 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 email which is not blank (null/empty)
- Each address in the addresses list satisfies the following conditions:
- It is not null
- It has a key which is not blank (null/empty)
- It has a unique key
- Each address index in the 'billing' and 'shipping' addresses list are valid and contained in the addresses list.
- Specified by:
validateAndCollectReferencedKeys
in classBaseBatchValidator<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 theSet
of valid drafts and referenced keys within a wrapper.
-
-