Class CustomerBatchValidator
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseBatchValidator<io.sphere.sdk.customers.CustomerDraft,CustomerSyncOptions,CustomerSyncStatistics>
-
- com.commercetools.sync.customers.helpers.CustomerBatchValidator
-
public class CustomerBatchValidator extends BaseBatchValidator<io.sphere.sdk.customers.CustomerDraft,CustomerSyncOptions,CustomerSyncStatistics>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCustomerBatchValidator.ReferencedKeys
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCUSTOMER_DRAFT_EMAIL_NOT_SETstatic java.lang.StringCUSTOMER_DRAFT_IS_NULLstatic java.lang.StringCUSTOMER_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<io.sphere.sdk.customers.CustomerDraft>,CustomerBatchValidator.ReferencedKeys>validateAndCollectReferencedKeys(java.util.List<io.sphere.sdk.customers.CustomerDraft> customerDrafts)Given theList<CustomerDraft> of drafts this method attempts to validate drafts and return anImmutablePair<Set<CustomerDraft>,CustomerBatchValidator.ReferencedKeys> which contains theSetof valid drafts and referenced keys within a wrapper.-
Methods inherited from class com.commercetools.sync.commons.helpers.BaseBatchValidator
collectReferencedKeyFromCustomFieldsDraft, collectReferencedKeyFromReference, 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<io.sphere.sdk.customers.CustomerDraft>,CustomerBatchValidator.ReferencedKeys> validateAndCollectReferencedKeys(@Nonnull java.util.List<io.sphere.sdk.customers.CustomerDraft> customerDrafts)
Given theList<CustomerDraft> of drafts this method attempts to validate drafts and return anImmutablePair<Set<CustomerDraft>,CustomerBatchValidator.ReferencedKeys> which contains theSetof 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:
validateAndCollectReferencedKeysin classBaseBatchValidator<io.sphere.sdk.customers.CustomerDraft,CustomerSyncOptions,CustomerSyncStatistics>- Parameters:
customerDrafts- the customer drafts to validate and collect referenced keys.- Returns:
ImmutablePair<Set<CustomerDraft>,CustomerBatchValidator.ReferencedKeys> which contains theSetof valid drafts and referenced keys within a wrapper.
-
-