createTriggerExecutor method
Create a TriggerExecutor based on the studyDeploymentId and triggerId.
Returns null if trigger is not supported by any registered TriggerFactory
factories.
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];
}