Interface ScriptListenerService
- All Known Implementing Classes:
ScriptListenerServiceImpl
public interface ScriptListenerService
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Container for anEntity
and its changed fields. -
Method Summary
Modifier and TypeMethodDescription@Nullable GroovyEvaluationService.ScriptResult
applyListener
(Entity listener, ScriptListenerService.EntityData target, boolean force) Run the given 'Dynamic_listener' entity with theGroovyEvaluationService
.void
applyListenersToEntities
(Collection<ScriptListenerService.EntityData> entities, String event, boolean afterCommit) Finds all Dynamic_listener entities that are registered on any of the given entity models for the specified event and applies the relevant listeners to each provided entity.Get an invoker to run code without invoking script listeners
-
Method Details
-
applyListenersToEntities
void applyListenersToEntities(Collection<ScriptListenerService.EntityData> entities, String event, boolean afterCommit) Finds all Dynamic_listener entities that are registered on any of the given entity models for the specified event and applies the relevant listeners to each provided entity. This fires one query per distinct entity model.- Parameters:
entities
- allScriptListenerService.EntityData
instances for which the given event has occurredevent
- the occurred event to search registered listeners for (create, update or delete)afterCommit
- whether or not to search for after commit listeners
-
applyListener
@Nullable @Nullable GroovyEvaluationService.ScriptResult applyListener(Entity listener, ScriptListenerService.EntityData target, boolean force) Run the given 'Dynamic_listener' entity with theGroovyEvaluationService
. The parameter 'target' is added to the binding of the script (with the name 'entity').- Parameters:
force
- force execution (ignoreScriptListenerService.EntityData.getChangedFields()
-
withoutScriptListener
Invoker withoutScriptListener()Get an invoker to run code without invoking script listeners
-