Merge pull request #1107 from ahdis/oe_choice_without_x

CDA Logical model validation: if choice is only value don't add type
This commit is contained in:
Grahame Grieve 2023-03-06 06:11:21 +11:00 committed by GitHub
commit cbb75520c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -111,11 +111,15 @@ public class NodeStack {
else if (element.getProperty().isChoice()) { else if (element.getProperty().isChoice()) {
String n = res.literalPath.substring(res.literalPath.lastIndexOf(".") + 1); String n = res.literalPath.substring(res.literalPath.lastIndexOf(".") + 1);
String en = element.getProperty().getName(); String en = element.getProperty().getName();
en = en.substring(0, en.length() - 3); if (en.endsWith("[x]")) {
String t = n.substring(en.length()); en = en.substring(0, en.length() - 3);
if (isPrimitiveType(Utilities.uncapitalize(t))) String t = n.substring(en.length());
t = Utilities.uncapitalize(t); if (isPrimitiveType(Utilities.uncapitalize(t)))
res.literalPath = res.literalPath.substring(0, res.literalPath.lastIndexOf(".")) + "." + en + ".ofType(" + t + ")"; t = Utilities.uncapitalize(t);
res.literalPath = res.literalPath.substring(0, res.literalPath.lastIndexOf(".")) + "." + en + ".ofType(" + t + ")";
} else {
res.literalPath = res.literalPath.substring(0, res.literalPath.lastIndexOf(".")) + "." + en;;
}
} }
res.logicalPaths = new ArrayList<String>(); res.logicalPaths = new ArrayList<String>();
if (type != null) { if (type != null) {