Group group = Group.builder().id(id).severity(null /* todo */) .ruleSource(context.getSource()) .concepts(includedConcepts).constraints(includedConstraints) .groups(includedGroups) .build();
public GroupBuilder concept(String id, Severity severity) { rule.concepts.put(id, severity); return getThis(); }
public static Group.GroupBuilder builder() { return new GroupBuilder(new Group()); }
public GroupBuilder groups(Map<String, Severity> groups) { rule.groups.putAll(groups); return getThis(); }
public GroupBuilder constraint(String id, Severity severity) { rule.constraints.put(id, severity); return getThis(); }
public GroupBuilder concepts(Map<String, Severity> concepts) { rule.concepts.putAll(concepts); return getThis(); }
public GroupBuilder group(String id, Severity severity) { rule.groups.put(id, severity); return getThis(); } }
public GroupBuilder constraints(Map<String, Severity> constraints) { rule.constraints.putAll(constraints); return getThis(); }
private void extractGroup(RuleSource ruleSource, AbstractBlock groupBlock, RuleSetBuilder ruleSetBuilder) throws RuleException { Attributes attributes = new Attributes(groupBlock.getAttributes()); Map<String, Severity> constraints = getGroupElements(attributes, INCLUDES_CONSTRAINTS); Map<String, Severity> concepts = getGroupElements(attributes, INCLUDES_CONCEPTS); Map<String, Severity> groups = getGroupElements(attributes, INCLUDES_GROUPS); Severity severity = getSeverity(attributes, getRuleConfiguration().getDefaultGroupSeverity()); Group group = Group.builder().id(groupBlock.id()).description(groupBlock.getTitle()).severity(severity).ruleSource(ruleSource).concepts(concepts) .constraints(constraints).groups(groups).build(); ruleSetBuilder.addGroup(group); }
private Group createGroup(String id, RuleSource ruleSource, GroupType referenceableType) throws RuleException { SeverityEnumType severityType = referenceableType.getSeverity(); Severity severity = getSeverity(severityType, getRuleConfiguration().getDefaultGroupSeverity()); Map<String, Severity> includeConcepts = getIncludedReferences(referenceableType.getIncludeConcept()); Map<String, Severity> includeConstraints = getIncludedReferences(referenceableType.getIncludeConstraint()); Map<String, Severity> includeGroups = getIncludedReferences(referenceableType.getIncludeGroup()); return Group.builder().id(id).severity(severity).ruleSource(ruleSource).concepts(includeConcepts).constraints(includeConstraints) .groups(includeGroups).build(); }