Package com.kenshoo.pl.entity.spi
Interface PostFetchCommandEnricher<E extends EntityType<E>>
-
- Type Parameters:
E-
- All Superinterfaces:
CurrentStateConsumer<E>
- All Known Implementing Classes:
CopyFieldsOnCreateEnricher,CopyFieldsOnUpdateEnricher,CreationDateEnricher,DefaultFieldValueEnricher,ExistingFieldModifier,FalseUpdatesPurger,MissingFieldEnricher,SingleFieldEnricher
public interface PostFetchCommandEnricher<E extends EntityType<E>> extends CurrentStateConsumer<E>
As opposed toFieldValueSupplierwhich is implemented by the end-user flow, this interface is implemented by operations that are considered inherent part of the persistence layer. For example, if every newly generated entity should get a unique affcode, this logic is implemented with an enricher (by implementing this interface). The enrichers are called after the current state is fetched and user-specified suppliers are resolved but before the changes are validated.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidenrich(java.util.Collection<? extends ChangeEntityCommand<E>> commands, ChangeOperation changeOperation, ChangeContext changeContext)"Enriches" the commands with system-imposed changes.default java.util.stream.Stream<EntityField<E,?>>fieldsToEnrich()return stream of enriched fields according to input commands.default booleanshouldRun(java.util.Collection<? extends EntityChange<E>> entityChanges)-
Methods inherited from interface com.kenshoo.pl.entity.spi.CurrentStateConsumer
getSupportedChangeOperation, requiredFields
-
-
-
-
Method Detail
-
enrich
void enrich(java.util.Collection<? extends ChangeEntityCommand<E>> commands, ChangeOperation changeOperation, ChangeContext changeContext)
"Enriches" the commands with system-imposed changes.- Parameters:
commands- commands to enrichchangeOperation- operationchangeContext- the context of the operation
-
fieldsToEnrich
default java.util.stream.Stream<EntityField<E,?>> fieldsToEnrich()
return stream of enriched fields according to input commands.- Returns:
- the fields should be enriched
-
shouldRun
default boolean shouldRun(java.util.Collection<? extends EntityChange<E>> entityChanges)
- Parameters:
entityChanges- to enrich- Returns:
- indicator that enricher should be run
-
-