if (StringUtils.isNotBlank(priorityAttribute)) {
rule.setSeverity(RulePriority.valueOf(StringUtils.trim(priorityAttribute)));
}
List<String> tags = Lists.newArrayList();
SMInputCursor cursor = ruleC.childElementCursor();
while (cursor.getNext() != null) {
String nodeName = cursor.getLocalName();
if (StringUtils.equalsIgnoreCase("name", nodeName)) {
rule.setName(StringUtils.trim(cursor.collectDescendantText(false)));
} else if (StringUtils.equalsIgnoreCase("description", nodeName)) {
rule.setDescription(StringUtils.trim(cursor.collectDescendantText(false)));
} else if (StringUtils.equalsIgnoreCase("key", nodeName)) {
rule.setKey(StringUtils.trim(cursor.collectDescendantText(false)));
} else if (StringUtils.equalsIgnoreCase("configKey", nodeName)) {
rule.setConfigKey(StringUtils.trim(cursor.collectDescendantText(false)));
} else if (StringUtils.equalsIgnoreCase("priority", nodeName)) {
rule.setSeverity(RulePriority.valueOf(StringUtils.trim(cursor.collectDescendantText(false))));
} else if (StringUtils.equalsIgnoreCase("cardinality", nodeName)) {
rule.setCardinality(Cardinality.valueOf(StringUtils.trim(cursor.collectDescendantText(false))));
} else if (StringUtils.equalsIgnoreCase("status", nodeName)) {
rule.setStatus(StringUtils.trim(cursor.collectDescendantText(false)));
} else if (StringUtils.equalsIgnoreCase("param", nodeName)) {
processParameter(rule, cursor);
} else if (StringUtils.equalsIgnoreCase("tag", nodeName)) {
tags.add(StringUtils.trim(cursor.collectDescendantText(false)));
}
}
if (Strings.isNullOrEmpty(rule.getKey())) {
throw new SonarException("Node <key> is missing in <rule>");
}