@SuppressWarnings("unchecked")
private static List<Trigger> convertTriggers(List<YamlTrigger> triggers) {
if (triggers == null || triggers.isEmpty()) {
return null;
}
List<Trigger> result = new ArrayList<>();
for (YamlTrigger t : triggers) {
String name = t.getName();
Map<String, Object> opts = (Map<String, Object>) StepConverter.deepConvert(t.getOptions());
List<String> activeProfiles = (List<String>) opts.remove(Constants.Request.ACTIVE_PROFILES_KEY);
Map<String, Object> arguments = (Map<String, Object>) opts.remove(Constants.Request.ARGUMENTS_KEY);
Map<String, Object> cfg = new HashMap<>();
for (String key : TRIGGER_CONFIG_KEYS) {
cfg.put(key, opts.remove(key));
}
JsonLocation l = t.getLocation();
SourceMap sourceMap = new SourceMap(SourceMap.Significance.HIGH,
String.valueOf(l.getSourceRef()),
l.getLineNr(),
l.getColumnNr(),
"Trigger: " + name);
result.add(new Trigger(name, activeProfiles, arguments, opts, cfg, sourceMap));
}
return result;
}