fix loading issue for content references in versions before R3

This commit is contained in:
Grahame Grieve 2020-11-27 10:35:25 +11:00
parent 624ce59c83
commit ec7d280b6f
1 changed files with 13 additions and 3 deletions

View File

@ -4141,11 +4141,13 @@ public class ProfileUtilities extends TranslatingUtilities {
first = false; first = false;
} }
} }
if (first) if (first) {
c.getPieces().add(gen.new Piece(null, "Any", null)); c.getPieces().add(gen.new Piece(null, "Any", null));
}
if (ADD_REFERENCE_TO_TABLE) if (ADD_REFERENCE_TO_TABLE) {
c.getPieces().add(gen.new Piece(null, ")", null)); c.getPieces().add(gen.new Piece(null, ")", null));
}
} else { } else {
StructureDefinition sd = context.fetchTypeDefinition(t); StructureDefinition sd = context.fetchTypeDefinition(t);
@ -5617,6 +5619,7 @@ public class ProfileUtilities extends TranslatingUtilities {
return; return;
Map<String, String> idList = new HashMap<String, String>(); Map<String, String> idList = new HashMap<String, String>();
Map<String, String> replacedIds = new HashMap<String, String>();
SliceList sliceInfo = new SliceList(); SliceList sliceInfo = new SliceList();
// first pass, update the element ids // first pass, update the element ids
@ -5643,6 +5646,9 @@ public class ProfileUtilities extends TranslatingUtilities {
} }
} }
String bs = b.toString(); String bs = b.toString();
if (ed.hasId()) {
replacedIds.put(ed.getId(), bs);
}
ed.setId(bs); ed.setId(bs);
if (idList.containsKey(bs)) { if (idList.containsKey(bs)) {
if (exception || messages == null) { if (exception || messages == null) {
@ -5653,7 +5659,11 @@ public class ProfileUtilities extends TranslatingUtilities {
idList.put(bs, ed.getPath()); idList.put(bs, ed.getPath());
if (ed.hasContentReference() && ed.getContentReference().startsWith("#")) { if (ed.hasContentReference() && ed.getContentReference().startsWith("#")) {
String s = ed.getContentReference(); String s = ed.getContentReference();
ed.setContentReference("http://hl7.org/fhir/StructureDefinition/"+type+s); if (replacedIds.containsKey(s.substring(1))) {
ed.setContentReference("http://hl7.org/fhir/StructureDefinition/"+type+"#"+replacedIds.get(s.substring(1)));
} else {
ed.setContentReference("http://hl7.org/fhir/StructureDefinition/"+type+s);
}
} }
} }
// second path - fix up any broken path based id references // second path - fix up any broken path based id references