* @return The executable.
*/
private AbstractRule createExecutableFromRule(Rule rule, String cypher) {
RuleParam typeParam = rule.getParam(RuleParameter.Type.getName());
if (typeParam == null) {
throw new SonarException("Cannot determine type of rule for " + rule);
}
AbstractRule executable;
String type = typeParam.getDefaultValue();
RuleType ruleType = RuleType.valueOf(type);
switch (ruleType) {
case Concept:
executable = new Concept();
break;
case Constraint:
executable = new Constraint();
break;
default:
throw new SonarException("Rule type is not supported " + ruleType);
}
createExecutable(executable, rule.getName(), rule.getDescription(), cypher);
return executable;
}