fix rendering of logical models, + fix bugs in FHIRPath type resolution

This commit is contained in:
Grahame Grieve 2019-12-17 13:46:47 +11:00
parent 6948ef61eb
commit 0ae1ade035
2 changed files with 14 additions and 4 deletions

View File

@ -2533,8 +2533,11 @@ public class ProfileUtilities extends TranslatingUtilities {
r.setIcon(deep ? "icon_"+m+"extension_complex.png" : "icon_extension_simple.png", deep ? HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX : HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE); r.setIcon(deep ? "icon_"+m+"extension_complex.png" : "icon_extension_simple.png", deep ? HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX : HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
List<ElementDefinition> children = getChildren(ed.getSnapshot().getElement(), ed.getSnapshot().getElement().get(0)); List<ElementDefinition> children = getChildren(ed.getSnapshot().getElement(), ed.getSnapshot().getElement().get(0));
for (ElementDefinition child : children) for (ElementDefinition child : children)
if (!child.getPath().endsWith(".id")) if (!child.getPath().endsWith(".id")) {
genElement(defFile == null ? "" : defFile+"-definitions.html#extension.", gen, r.getSubRows(), child, ed.getSnapshot().getElement(), null, true, defFile, true, full, corePath, imagePath, true, false, false, false, null); List<StructureDefinition> sdl = new ArrayList<>();
sdl.add(ed);
genElement(defFile == null ? "" : defFile+"-definitions.html#extension.", gen, r.getSubRows(), child, ed.getSnapshot().getElement(), sdl, true, defFile, true, full, corePath, imagePath, true, false, false, false, null);
}
} else if (deep) { } else if (deep) {
List<ElementDefinition> children = new ArrayList<ElementDefinition>(); List<ElementDefinition> children = new ArrayList<ElementDefinition>();
for (ElementDefinition ted : ed.getSnapshot().getElement()) { for (ElementDefinition ted : ed.getSnapshot().getElement()) {
@ -2704,7 +2707,14 @@ public class ProfileUtilities extends TranslatingUtilities {
c.addPiece(checkForNoChange(t, gen.new Piece((t.getProfile().get(0).getValue().startsWith(corePath)? corePath: "")+ref, t.getWorkingCode(), null))); c.addPiece(checkForNoChange(t, gen.new Piece((t.getProfile().get(0).getValue().startsWith(corePath)? corePath: "")+ref, t.getWorkingCode(), null)));
} else { } else {
String tc = t.getWorkingCode(); String tc = t.getWorkingCode();
if (pkp != null && pkp.hasLinkFor(tc)) { if (Utilities.isAbsoluteUrl(tc)) {
StructureDefinition sd = context.fetchTypeDefinition(tc);
if (sd == null) {
c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, tc), tc, null)));
} else {
c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, tc), sd.getName(), null)));
}
} else if (pkp != null && pkp.hasLinkFor(tc)) {
c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, tc), tc, null))); c.addPiece(checkForNoChange(t, gen.new Piece(pkp.getLinkFor(corePath, tc), tc, null)));
} else } else
c.addPiece(checkForNoChange(t, gen.new Piece(null, tc, null))); c.addPiece(checkForNoChange(t, gen.new Piece(null, tc, null)));

View File

@ -397,7 +397,7 @@ public class FHIRPathEngine {
if (context == null) { if (context == null) {
types = null; // this is a special case; the first path reference will have to resolve to something in the context types = null; // this is a special case; the first path reference will have to resolve to something in the context
} else if (!context.contains(".")) { } else if (!context.contains(".")) {
StructureDefinition sd = worker.fetchResource(StructureDefinition.class, context); StructureDefinition sd = worker.fetchTypeDefinition(context);
types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl()); types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl());
} else { } else {
String ctxt = context.substring(0, context.indexOf('.')); String ctxt = context.substring(0, context.indexOf('.'));