String priorityAttribute = ruleC.getAttrValue("priority");
if (StringUtils.isNotBlank(priorityAttribute)) {
severity = StringUtils.trim(priorityAttribute);
}
SMInputCursor cursor = ruleC.childElementCursor();
while (cursor.getNext() != null) {
String nodeName = cursor.getLocalName();
if (StringUtils.equalsIgnoreCase("name", nodeName)) {
name = StringUtils.trim(cursor.collectDescendantText(false));
} else if (StringUtils.equalsIgnoreCase("description", nodeName)) {
description = StringUtils.trim(cursor.collectDescendantText(false));
} else if (StringUtils.equalsIgnoreCase("key", nodeName)) {
key = StringUtils.trim(cursor.collectDescendantText(false));
} else if (StringUtils.equalsIgnoreCase("configKey", nodeName)) {
// deprecated field, replaced by internalKey
internalKey = StringUtils.trim(cursor.collectDescendantText(false));
} else if (StringUtils.equalsIgnoreCase("internalKey", nodeName)) {
internalKey = StringUtils.trim(cursor.collectDescendantText(false));
} else if (StringUtils.equalsIgnoreCase("priority", nodeName)) {
// deprecated field, replaced by severity
severity = StringUtils.trim(cursor.collectDescendantText(false));
} else if (StringUtils.equalsIgnoreCase("severity", nodeName)) {
severity = StringUtils.trim(cursor.collectDescendantText(false));
} else if (StringUtils.equalsIgnoreCase("cardinality", nodeName)) {
cardinality = Cardinality.valueOf(StringUtils.trim(cursor.collectDescendantText(false)));
} else if (StringUtils.equalsIgnoreCase("status", nodeName)) {
status = StringUtils.trim(cursor.collectDescendantText(false));
} else if (StringUtils.equalsIgnoreCase("param", nodeName)) {
params.add(processParameter(cursor));
} else if (StringUtils.equalsIgnoreCase("tag", nodeName)) {
tags.add(StringUtils.trim(cursor.collectDescendantText(false)));
}
}
RulesDefinition.NewRule rule = repo.createRule(key)
.setHtmlDescription(description)
.setSeverity(severity)