createTriggerExecutor method
Creates a TriggerExecutor for trigger and caches it.
The cache key is studyDeploymentId and triggerId.
Returns null if no registered TriggerFactory supports the runtime type
of trigger.
Implementation
TriggerExecutor? createTriggerExecutor(String studyDeploymentId, int triggerId, TriggerConfiguration trigger) {
TriggerExecutor? executor;
if (_triggerFactories[trigger.runtimeType] != null) {
executor = _triggerFactories[trigger.runtimeType]!.create(trigger);
}
if (executor == null) {
warning("$runtimeType - Cannot create a TriggerExecutor for trigger type '${trigger.runtimeType}'.");
} else {
_triggerExecutors[studyDeploymentId] ??= {};
_triggerExecutors[studyDeploymentId]?[triggerId] = executor;
}
return _triggerExecutors[studyDeploymentId]?[triggerId];
}