Class ScriptListenerServiceImpl
java.lang.Object
ch.tocco.nice2.scripting.impl.groovy.listener.ScriptListenerServiceImpl
- All Implemented Interfaces:
ScriptListenerService
-
Nested Class Summary
Nested classes/interfaces inherited from interface ScriptListenerService
ScriptListenerService.EntityData -
Constructor Summary
ConstructorsConstructorDescriptionScriptListenerServiceImpl(Context context, QueryBuilderFactory queryBuilderFactory, GroovyEvaluationService groovyEvaluationService, SecurityManager securityManager) -
Method Summary
Modifier and TypeMethodDescription@Nullable GroovyEvaluationService.ScriptResultapplyListener(Entity listener, ScriptListenerService.EntityData target, boolean force) Run the given 'Dynamic_listener' entity with theGroovyEvaluationService.voidapplyListenersToEntities(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
-
Constructor Details
-
ScriptListenerServiceImpl
public ScriptListenerServiceImpl(Context context, QueryBuilderFactory queryBuilderFactory, GroovyEvaluationService groovyEvaluationService, SecurityManager securityManager)
-
-
Method Details
-
applyListenersToEntities
public void applyListenersToEntities(Collection<ScriptListenerService.EntityData> entities, String event, boolean afterCommit) Description copied from interface:ScriptListenerServiceFinds 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.- Specified by:
applyListenersToEntitiesin interfaceScriptListenerService- Parameters:
entities- allScriptListenerService.EntityDatainstances 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 public @Nullable GroovyEvaluationService.ScriptResult applyListener(Entity listener, ScriptListenerService.EntityData target, boolean force) Description copied from interface:ScriptListenerServiceRun the given 'Dynamic_listener' entity with theGroovyEvaluationService. The parameter 'target' is added to the binding of the script (with the name 'entity').- Specified by:
applyListenerin interfaceScriptListenerService- Parameters:
force- force execution (ignoreScriptListenerService.EntityData.getChangedFields()
-
withoutScriptListener
Description copied from interface:ScriptListenerServiceGet an invoker to run code without invoking script listeners- Specified by:
withoutScriptListenerin interfaceScriptListenerService
-