Skip to content

Commit

Permalink
Fix validation for DRGElements (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
opatrascoiu authored Feb 15, 2024
1 parent 1d0c4ae commit 629c692
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private void checkInputDataHasTypeRef(File dmnFile) throws Exception {
}
}

// DRGElement.name == DRGElement.variable.name and DRGElement.typeRef == DRGElement.variable.typeRef
// DRGElement.name == DRGElement.variable.name
private void checkDRGElementVariable(File dmnFile) throws Exception {
Document xmlDocument = builder.parse(dmnFile);
List<String> problems = new ArrayList<>();
Expand All @@ -228,10 +228,8 @@ private List<String> checkDRGElementVariable(File dmnFile, Document xmlDocument,
Node drgElementNode = xPathVariables.item(i);
// Extract and compare values
String name = extractStringAttribute(drgElementNode, "name");
String typeRef = extractStringAttribute(drgElementNode, "typeRef");
Node variableNode = extractChild(drgElementNode, "variable");
String variableName = extractStringAttribute(variableNode, "name");
String variableTypeRef = extractStringAttribute(variableNode, "typeRef");
// Check name
if (name != null && variableName != null) {
if (!name.equals(variableName)) {
Expand All @@ -244,18 +242,6 @@ private List<String> checkDRGElementVariable(File dmnFile, Document xmlDocument,
problems.add(problem);
}
}
// Check typeRef
if (typeRef != null && variableTypeRef != null) {
if (!typeRef.equals(variableTypeRef)) {
String problem = String.format("%s: DRGElement node %s typeRef '%s' is the same with the variable typeRef '%s'",
dmnFile.getName(),
elementName,
name,
variableName);
System.err.println(problem);
problems.add(problem);
}
}
}
}
return problems;
Expand Down

0 comments on commit 629c692

Please sign in to comment.