private void extractExecutableRule(RuleSource ruleSource, AbstractBlock executableRuleBlock, RuleSetBuilder builder) throws RuleException {
Attributes attributes = new Attributes(executableRuleBlock.getAttributes());
String id = executableRuleBlock.id();
if (id == null) {
throw new RuleException("An id attribute is required for the rule '" + executableRuleBlock + "' (i.e. '[[rule:id]]' is required.");
}
String description = attributes.getString(TITLE, "");
if (description == null) {
LOGGER.info("Description of rule is missing: Using empty text for description (source='{}', id='{}').", ruleSource.getId(), id);
}
Map<String, Boolean> required = getRequiresConcepts(ruleSource, id, attributes);
Map<String, Parameter> parameters = getParameters(attributes.getString(REQUIRES_PARAMETERS));
Executable<?> executable = getExecutable(executableRuleBlock, attributes);
if (executable != null) {
Verification verification = getVerification(attributes);
Report report = getReport(executableRuleBlock);
if (CONCEPT.equals(executableRuleBlock.getRole())) {
Severity severity = getSeverity(attributes, getRuleConfiguration().getDefaultConceptSeverity());
Concept concept = Concept.builder().id(id).description(description).severity(severity).executable(executable).requiresConcepts(required)
.parameters(parameters).verification(verification).report(report).ruleSource(ruleSource).build();
builder.addConcept(concept);
} else if (CONSTRAINT.equals(executableRuleBlock.getRole())) {
Severity severity = getSeverity(attributes, getRuleConfiguration().getDefaultConstraintSeverity());
Constraint constraint = Constraint.builder().id(id).description(description).severity(severity).executable(executable)
.requiresConcepts(required).parameters(parameters).verification(verification).report(report).ruleSource(ruleSource).build();
builder.addConstraint(constraint);
}
}
}