use of org.drools.verifier.components.Restriction in project drools by kiegroup.
the class ComponentsReportVisitor method visitField.
public static String visitField(String sourceFolder, Field field, VerifierReport result) {
VerifierData data = result.getVerifierData();
ObjectType objectType = data.getVerifierObject(VerifierComponentType.OBJECT_TYPE, field.getObjectTypePath());
Collection<VerifierRule> rules = data.getRulesByFieldPath(field.getPath());
Map<String, Object> map = new HashMap<String, Object>();
map.put("sourceFolder", sourceFolder);
map.put("ruleFolder", UrlFactory.RULE_FOLDER);
map.put("objectTypeFolder", UrlFactory.OBJECT_TYPE_FOLDER);
map.put("fieldFolder", UrlFactory.FIELD_FOLDER);
map.put("field", field);
map.put("objectType", objectType);
map.put("rules", rules);
if (field.getFieldType() == Field.DOUBLE || field.getFieldType() == Field.DATE || field.getFieldType() == Field.INT) {
Collection<MissingRange> causes = result.getRangeCheckCausesByFieldPath(field.getPath());
Collection<Restriction> restrictions = data.getRestrictionsByFieldPath(field.getPath());
map.put("ranges", "Ranges:" + MissingRangesReportVisitor.visitRanges(UrlFactory.PREVIOUS_FOLDER, restrictions, causes));
} else {
map.put("ranges", "");
}
String myTemplate = readFile("field.htm");
return String.valueOf(TemplateRuntime.eval(myTemplate, map));
}
Aggregations