Improve rendering of message about logical target

This commit is contained in:
Grahame Grieve 2023-09-15 10:15:31 -07:00
parent 96ce441f9a
commit 71def00e24
2 changed files with 29 additions and 9 deletions

View File

@ -1505,12 +1505,21 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
addCanonicalListExt(gen, c, profile.getExtensionsByUrl(ToolingExtensions.EXT_SD_COMPLIES_WITH_PROFILE), "This profile also complies with the profile", true);
if (profile.getKind() == StructureDefinitionKind.LOGICAL) {
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
if (ToolingExtensions.readBoolExtension(profile, ToolingExtensions.EXT_LOGICAL_TARGET)) {
c.addPiece(gen.new Piece(null, "This logical model can be the target of a reference", null).addStyle("font-weight:bold"));
Extension lt = ToolingExtensions.getExtension(profile, ToolingExtensions.EXT_LOGICAL_TARGET);
if (lt == null || !lt.hasValueBooleanType()) {
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
c.addPiece(gen.new Piece(null, "Instances of this logical model are not marked to be the target of a Reference", null).addStyle("font-weight:bold")); ;
} else if (lt.getValue().hasExtension(ToolingExtensions.DAR)) {
} else if (!lt.getValueBooleanType().hasValue()) {
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
c.addPiece(gen.new Piece(null, "Instances of this logical model are not marked to be the target of a Reference", null).addStyle("font-weight:bold")); ;
} else if (lt.getValueBooleanType().booleanValue()) {
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
c.addPiece(gen.new Piece(null, "Instances of this logical model can be the target of a Reference", null).addStyle("font-weight:bold"));
} else {
c.addPiece(gen.new Piece(null, "This logical model cannot be the target of a reference", null).addStyle("font-weight:bold"));
}
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
c.addPiece(gen.new Piece(null, "Instances of this logical model cannot be the target of a Reference", null).addStyle("font-weight:bold"));
}
}
}
if (definition != null) {
@ -3538,7 +3547,17 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
}
}
if (root && sd.getKind() == StructureDefinitionKind.LOGICAL) {
tableRow(tbl, "Logical Model", null, strikethrough, ToolingExtensions.readBoolExtension(sd, ToolingExtensions.EXT_LOGICAL_TARGET) ? "This logical model can be the target of a reference" : "This logical model cannot be the target of a reference");
Extension lt = ToolingExtensions.getExtension(sd, ToolingExtensions.EXT_LOGICAL_TARGET);
if (lt == null || !lt.hasValue()) {
tableRow(tbl, "Logical Model", null, strikethrough, "Instances of this logical model are not marked to be the target of a Reference");
} else if (lt.getValue().hasExtension(ToolingExtensions.DAR)) {
} else if (lt.getValueBooleanType().hasValue()) {
tableRow(tbl, "Logical Model", null, strikethrough, "Instances of this logical model are not marked to be the target of a Reference");
} else if (lt.getValueBooleanType().booleanValue()) {
tableRow(tbl, "Logical Model", null, strikethrough, "Instances of this logical model can be the target of a Reference");
} else {
tableRow(tbl, "Logical Model", null, strikethrough, "Instances of this logical model cannot be the target of a Reference");
}
}
if (root && sd.hasExtension(ToolingExtensions.EXT_SD_IMPOSE_PROFILE)) {

View File

@ -143,6 +143,10 @@ public class ToolingExtensions {
public static final String EXT_PROFILE_MAPPING = "http://hl7.org/fhir/tools/StructureDefinition/profile-mapping";
public static final String EXT_CS_ALTERNATE_USE = "http://hl7.org/fhir/StructureDefinition/alternate-code-use";
public static final String EXT_CS_ALTERNATE_STATUS = "http://hl7.org/fhir/StructureDefinition/alternate-code-status";
public static final String EXT_OBLIGATION_PROFILE_FLAG = "http://hl7.org/fhir/tools/StructureDefinition/obligation-profile";
public static final String EXT_OBLIGATION_INHERITS = "http://hl7.org/fhir/tools/StructureDefinition/inherit-obligations";
public static final String DAR = "http://hl7.org/fhir/StructureDefinition/data-absent-reason";
// validated
// private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid";
@ -1081,7 +1085,4 @@ public class ToolingExtensions {
return res;
}
public static final String EXT_OBLIGATION_PROFILE_FLAG = "http://hl7.org/fhir/tools/StructureDefinition/obligation-profile";
public static final String EXT_OBLIGATION_INHERITS = "http://hl7.org/fhir/tools/StructureDefinition/inherit-obligations";
}