use of org.graylog2.rest.models.configuration.responses.RequestedConfigurationField in project graylog2-server by Graylog2.
the class AvailableAlarmCallbackSummaryResponse method extractRequestedConfiguration.
public List<RequestedConfigurationField> extractRequestedConfiguration(Map<String, Map<String, Object>> config) {
List<RequestedConfigurationField> result = Lists.newArrayList();
List<RequestedConfigurationField> booleanFields = Lists.newArrayList();
for (Map.Entry<String, Map<String, Object>> entry : config.entrySet()) {
try {
String fieldType = (String) entry.getValue().get("type");
switch(fieldType) {
case "text":
result.add(new TextField(entry));
continue;
case "number":
result.add(new NumberField(entry));
continue;
case "boolean":
booleanFields.add(new BooleanField(entry));
continue;
case "dropdown":
result.add(new DropdownField(entry));
continue;
default:
LOG.info("Unknown field type [{}].", fieldType);
}
} catch (Exception e) {
LOG.error("Skipping invalid configuration field [" + entry.getKey() + "]", e);
}
}
result.addAll(booleanFields);
return result;
}
Aggregations