Class StateBatchValidator
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseBatchValidator<com.commercetools.api.models.state.StateDraft,StateSyncOptions,StateSyncStatistics>
-
- com.commercetools.sync.states.helpers.StateBatchValidator
-
public class StateBatchValidator extends BaseBatchValidator<com.commercetools.api.models.state.StateDraft,StateSyncOptions,StateSyncStatistics>
-
-
Constructor Summary
Constructors Constructor Description StateBatchValidator(StateSyncOptions syncOptions, StateSyncStatistics 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.state.StateDraft>,java.util.Set<java.lang.String>>
validateAndCollectReferencedKeys(java.util.List<com.commercetools.api.models.state.StateDraft> stateDrafts)
Given theList
<StateDraft
> of drafts this method attempts to validate drafts and collect referenced keys from the draft and return anImmutablePair
<Set
<StateDraft
> ,Set
<String
>> which contains theSet
of valid drafts and referenced state transition keys.-
Methods inherited from class com.commercetools.sync.commons.helpers.BaseBatchValidator
collectReferencedKeyFromCustomFieldsDraft, collectReferencedKeyFromResourceIdentifier, collectReferencedKeysFromAssetDrafts, handleError, handleError
-
-
-
-
Constructor Detail
-
StateBatchValidator
public StateBatchValidator(@Nonnull StateSyncOptions syncOptions, @Nonnull StateSyncStatistics syncStatistics)
-
-
Method Detail
-
validateAndCollectReferencedKeys
public org.apache.commons.lang3.tuple.ImmutablePair<java.util.Set<com.commercetools.api.models.state.StateDraft>,java.util.Set<java.lang.String>> validateAndCollectReferencedKeys(@Nonnull java.util.List<com.commercetools.api.models.state.StateDraft> stateDrafts)
Given theList
<StateDraft
> of drafts this method attempts to validate drafts and collect referenced keys from the draft and return anImmutablePair
<Set
<StateDraft
> ,Set
<String
>> which contains theSet
of valid drafts and referenced state transition keys.A valid state draft is one which satisfies the following conditions:
- It is not null
- It has a key which is not blank (null/empty)
- It has no invalid state reference on an transition A valid reference is simply one which has its id field's value not blank (null/empty)
- Specified by:
validateAndCollectReferencedKeys
in classBaseBatchValidator<com.commercetools.api.models.state.StateDraft,StateSyncOptions,StateSyncStatistics>
- Parameters:
stateDrafts
- the state drafts to validate and collect referenced state transition keys.- Returns:
ImmutablePair
<Set
<StateDraft
>,Set
<String
>> which contains theSet
of valid drafts and referenced product type keys.
-
-