Merge pull request #800 from hapifhir/gg-202204-xver

fix problem with non-new data types on xver extensions
This commit is contained in:
Grahame Grieve 2022-04-28 10:35:30 +10:00 committed by GitHub
commit f8d869172c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 15 deletions

View File

@ -146,25 +146,27 @@ public class XVerExtensionManager {
public void populateTypes(JsonObject path, ElementDefinition val, String verSource, String verTarget) {
for (JsonElement i : path.getAsJsonArray("types")) {
String s = i.getAsString();
if (s.contains("(")) {
String t = s.substring(0, s.indexOf("("));
TypeRefComponent tr = val.addType().setCode(translateDataType(verTarget, t));
if (hasTargets(tr.getCode()) ) {
s = s.substring(t.length()+1);
for (String p : s.substring(0, s.length()-1).split("\\|")) {
if ("Any".equals(p)) {
tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/Resource");
} else if (p.contains(",")) {
for (String pp : p.split("\\,")) {
tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+pp);
if (!s.startsWith("!")) {
if (s.contains("(")) {
String t = s.substring(0, s.indexOf("("));
TypeRefComponent tr = val.addType().setCode(translateDataType(verTarget, t));
if (hasTargets(tr.getCode()) ) {
s = s.substring(t.length()+1);
for (String p : s.substring(0, s.length()-1).split("\\|")) {
if ("Any".equals(p)) {
tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/Resource");
} else if (p.contains(",")) {
for (String pp : p.split("\\,")) {
tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+pp);
}
} else {
tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+p);
}
} else {
tr.addTargetProfile("http://hl7.org/fhir/StructureDefinition/"+p);
}
}
} else {
val.addType().setCode(translateDataType(verTarget, s));
}
} else {
val.addType().setCode(translateDataType(verTarget, s));
}
}
}