Fix rendering of Logical Models for polymorphic elements, and rendering target profiles with versions

This commit is contained in:
Grahame Grieve 2024-10-30 21:06:58 +10:30
parent 8a9039f08f
commit 6533f2bd36
1 changed files with 27 additions and 12 deletions

View File

@ -2076,7 +2076,12 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
v = "("+sd.getVersion()+")";
}
String disp = sd.present()+v;
String ref = context.getPkp().getLinkForProfile(null, sd.getUrl());
String ref;
if (u.contains("|")) {
ref = sd.getWebPath();
} else {
ref = context.getPkp().getLinkForProfile(null, sd.getUrl());
}
if (ref != null && ref.contains("|"))
ref = ref.substring(0, ref.indexOf("|"));
c.addPiece(checkForNoChange(t, gen.new Piece(ref, disp, null)));
@ -2762,10 +2767,20 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
boolean used = false;
Row choicerow = gen.new Row();
choicerow.setId(element.getPath());
String t = tr.getWorkingCode();
if (isReference(t)) {
String ts = tr.getWorkingCode();
String tu = tr.getWorkingCode();
if (Utilities.isAbsoluteUrl(ts)) {
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, ts);
if (sd != null) {
ts = sd.getType();
}
}
if (Utilities.isAbsoluteUrl(ts)) {
ts = utail(ts);
}
if (isReference(tu)) {
used = true;
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), null, null));
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(ts)), null, null));
choicerow.getCells().add(gen.new Cell());
choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
choicerow.setIcon("icon_reference.png", context.formatPhrase(RenderingContext.TEXT_ICON_REFERENCE));
@ -2804,19 +2819,19 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
}
} else {
StructureDefinition sd = context.getWorker().fetchTypeDefinition(t);
StructureDefinition sd = context.getWorker().fetchTypeDefinition(tu);
if (sd == null) {
if (DEBUG) {
System.out.println("Unable to find "+t);
System.out.println("Unable to find "+tu);
}
sd = context.getWorker().fetchTypeDefinition(t);
sd = context.getWorker().fetchTypeDefinition(tu);
} else if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
used = true;
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null));
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(ts)), sd.getDescription(), null));
choicerow.getCells().add(gen.new Cell());
choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
choicerow.setIcon("icon_primitive.png", context.formatPhrase(RenderingContext.TEXT_ICON_PRIMITIVE));
Cell c = gen.new Cell(null, corePath+"datatypes.html#"+t, sd.getTypeName(), null, null);
Cell c = gen.new Cell(null, corePath+"datatypes.html#"+tu, sd.getTypeName(), null, null);
choicerow.getCells().add(c);
if (!mustSupportMode && isMustSupport(tr) && element.getMustSupport()) {
c.addPiece(gen.new Piece(null, " ", null));
@ -2824,11 +2839,11 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
}
} else {
used = true;
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null));
choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(ts)), sd.getDescription(), null));
choicerow.getCells().add(gen.new Cell());
choicerow.getCells().add(gen.new Cell(null, null, "", null, null));
choicerow.setIcon("icon_datatype.gif", context.formatPhrase(RenderingContext.TEXT_ICON_DATATYPE));
Cell c = gen.new Cell(null, context.getPkp().getLinkFor(corePath, t), sd.getTypeName(), null, null);
Cell c = gen.new Cell(null, context.getPkp().getLinkFor(corePath, tu), sd.getTypeName(), null, null);
choicerow.getCells().add(c);
if (!mustSupportMode && isMustSupport(tr) && element.getMustSupport()) {
c.addPiece(gen.new Piece(null, " ", null));