Class BaseBatchValidator<ResourceDraftT,SyncOptionsT extends BaseSyncOptions,SyncStatisticsT extends BaseSyncStatistics>
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseBatchValidator<ResourceDraftT,SyncOptionsT,SyncStatisticsT>
-
- Direct Known Subclasses:
CartDiscountBatchValidator
,CategoryBatchValidator
,CustomerBatchValidator
,CustomObjectBatchValidator
,InventoryBatchValidator
,ProductBatchValidator
,ProductTypeBatchValidator
,ShoppingListBatchValidator
,StateBatchValidator
,TaxCategoryBatchValidator
,TypeBatchValidator
public abstract class BaseBatchValidator<ResourceDraftT,SyncOptionsT extends BaseSyncOptions,SyncStatisticsT extends BaseSyncStatistics> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description BaseBatchValidator(SyncOptionsT syncOptions, SyncStatisticsT syncStatistics)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
collectReferencedKeyFromCustomFieldsDraft(com.commercetools.api.models.type.CustomFieldsDraft customFieldsDraft, java.util.function.Consumer<java.lang.String> keyConsumer)
protected <T> void
collectReferencedKeyFromResourceIdentifier(com.commercetools.api.models.common.ResourceIdentifier resourceIdentifier, java.util.function.Consumer<java.lang.String> keyConsumer)
protected void
collectReferencedKeysFromAssetDrafts(java.util.List<com.commercetools.api.models.common.AssetDraft> assetDrafts, java.util.function.Consumer<java.lang.String> keyConsumer)
protected void
handleError(SyncException syncException)
protected void
handleError(java.lang.String errorMessage)
abstract org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<ResourceDraftT>,?>
validateAndCollectReferencedKeys(java.util.List<ResourceDraftT> drafts)
Given theList
<D
> (e.g.CustomerDraft
) of drafts this method attempts to validate drafts and collect referenced keys from the draft and return anImmutablePair
<Set
<D
>, ?> which contains theSet
of valid drafts and referenced keys.
-
-
-
Constructor Detail
-
BaseBatchValidator
public BaseBatchValidator(@Nonnull SyncOptionsT syncOptions, @Nonnull SyncStatisticsT syncStatistics)
-
-
Method Detail
-
validateAndCollectReferencedKeys
public abstract org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<ResourceDraftT>,?> validateAndCollectReferencedKeys(@Nonnull java.util.List<ResourceDraftT> drafts)
Given theList
<D
> (e.g.CustomerDraft
) of drafts this method attempts to validate drafts and collect referenced keys from the draft and return anImmutablePair
<Set
<D
>, ?> which contains theSet
of valid drafts and referenced keys.- Parameters:
drafts
- the drafts to validate.- Returns:
ImmutablePair
<Set
<D
>, ?> which contains theSet
of valid drafts and referenced keys.
-
collectReferencedKeyFromResourceIdentifier
protected <T> void collectReferencedKeyFromResourceIdentifier(@Nullable com.commercetools.api.models.common.ResourceIdentifier resourceIdentifier, @Nonnull java.util.function.Consumer<java.lang.String> keyConsumer)
-
collectReferencedKeyFromCustomFieldsDraft
protected void collectReferencedKeyFromCustomFieldsDraft(@Nullable com.commercetools.api.models.type.CustomFieldsDraft customFieldsDraft, @Nonnull java.util.function.Consumer<java.lang.String> keyConsumer)
-
collectReferencedKeysFromAssetDrafts
protected void collectReferencedKeysFromAssetDrafts(@Nullable java.util.List<com.commercetools.api.models.common.AssetDraft> assetDrafts, @Nonnull java.util.function.Consumer<java.lang.String> keyConsumer)
-
handleError
protected void handleError(@Nonnull SyncException syncException)
-
handleError
protected void handleError(@Nonnull java.lang.String errorMessage)
-
-