various minor fixes (#353)
* Ensure "I" flag in profile table representation is not used for underlying infrastructural constraints that exist everywhere * render multiple values for properties if they exist * fix for npe * fix for use of "current" as version * fix bad package URLs as they are loaded * RELEASE_NOTES.md
This commit is contained in:
parent
5e3b51e286
commit
b8370f7e61
|
@ -0,0 +1,9 @@
|
|||
Validator:
|
||||
* no changes with impact
|
||||
|
||||
Other code changes:
|
||||
* Ensure "I" flag in profile table representation is not used just for infrastructural constraints
|
||||
* Render multiple values for properties in CodeSystems if they exist
|
||||
* Fix for npe rendering resources based on profiles
|
||||
* fix for use of "current" as version
|
||||
* hack for past bad package URLs
|
|
@ -3812,7 +3812,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
if (element != null && element.getIsSummary()) {
|
||||
checkForNoChange(element.getIsSummaryElement(), gc.addStyledText(translate("sd.table", "This element is included in summaries"), "\u03A3", null, null, null, false));
|
||||
}
|
||||
if (element != null && (!element.getConstraint().isEmpty() || !element.getCondition().isEmpty())) {
|
||||
if (element != null && (hasNonBaseConstraints(element.getConstraint()) || hasNonBaseConditions(element.getCondition()))) {
|
||||
gc.addStyledText(translate("sd.table", "This element has or is affected by some invariants ("+listConstraintsAndConditions(element)+")"), "I", null, null, null, false);
|
||||
}
|
||||
|
||||
|
@ -3860,7 +3860,8 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
return res;
|
||||
}
|
||||
|
||||
private Cell addCell(Row row, Cell cell) {
|
||||
|
||||
private Cell addCell(Row row, Cell cell) {
|
||||
row.getCells().add(cell);
|
||||
return (cell);
|
||||
}
|
||||
|
@ -3869,18 +3870,49 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
return app == null ? src : src + app;
|
||||
}
|
||||
|
||||
private boolean hasNonBaseConditions(List<IdType> conditions) {
|
||||
for (IdType c : conditions) {
|
||||
if (!isBaseCondition(c)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private boolean hasNonBaseConstraints(List<ElementDefinitionConstraintComponent> constraints) {
|
||||
for (ElementDefinitionConstraintComponent c : constraints) {
|
||||
if (!isBaseConstraint(c)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String listConstraintsAndConditions(ElementDefinition element) {
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
for (ElementDefinitionConstraintComponent con : element.getConstraint()) {
|
||||
b.append(con.getKey());
|
||||
if (!isBaseConstraint(con)) {
|
||||
b.append(con.getKey());
|
||||
}
|
||||
}
|
||||
for (IdType id : element.getCondition()) {
|
||||
b.append(id.asStringValue());
|
||||
if (!isBaseCondition(id)) {
|
||||
b.append(id.asStringValue());
|
||||
}
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
private boolean isBaseCondition(IdType c) {
|
||||
String key = c.asStringValue();
|
||||
return key.startsWith("ele-") || key.startsWith("res-") || key.startsWith("ext-") || key.startsWith("dom-") || key.startsWith("dr-");
|
||||
}
|
||||
|
||||
private boolean isBaseConstraint(ElementDefinitionConstraintComponent con) {
|
||||
String key = con.getKey();
|
||||
return key.startsWith("ele-") || key.startsWith("res-") || key.startsWith("ext-") || key.startsWith("dom-") || key.startsWith("dr-");
|
||||
}
|
||||
|
||||
private void makeChoiceRows(List<Row> subRows, ElementDefinition element, HierarchicalTableGenerator gen, String corePath, String profileBaseFileName) {
|
||||
// create a child for each choice
|
||||
|
|
|
@ -416,15 +416,17 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
for (PropertyComponent pc : properties) {
|
||||
td = tr.td();
|
||||
boolean first = true;
|
||||
ConceptPropertyComponent pcv = CodeSystemUtilities.getProperty(c, pc.getCode());
|
||||
if (pcv != null && pcv.hasValue()) {
|
||||
if (first) first = false; else td.addText(", ");
|
||||
if (pcv.hasValueCoding()) {
|
||||
td.addText(pcv.getValueCoding().getCode());
|
||||
} else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrl(pcv.getValue().primitiveValue())) {
|
||||
td.ah(pcv.getValue().primitiveValue()).tx(pcv.getValue().primitiveValue());
|
||||
} else {
|
||||
td.addText(pcv.getValue().primitiveValue());
|
||||
List<ConceptPropertyComponent> pcvl = CodeSystemUtilities.getPropertyValues(c, pc.getCode());
|
||||
for (ConceptPropertyComponent pcv : pcvl) {
|
||||
if (pcv.hasValue()) {
|
||||
if (first) first = false; else td.addText(", ");
|
||||
if (pcv.hasValueCoding()) {
|
||||
td.addText(pcv.getValueCoding().getCode());
|
||||
} else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrl(pcv.getValue().primitiveValue())) {
|
||||
td.ah(pcv.getValue().primitiveValue()).tx(pcv.getValue().primitiveValue());
|
||||
} else {
|
||||
td.addText(pcv.getValue().primitiveValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -251,12 +251,12 @@ public class DataRenderer extends Renderer {
|
|||
} else {
|
||||
return "No display for "+b.fhirType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String display(DataType type) {
|
||||
if (type.isEmpty())
|
||||
if (type == null || type.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (type instanceof Coding) {
|
||||
return displayCoding((Coding) type);
|
||||
|
@ -354,7 +354,6 @@ public class DataRenderer extends Renderer {
|
|||
} else {
|
||||
x.tx("No display for "+type.fhirType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void renderReference(XhtmlNode x, Reference ref) {
|
||||
|
@ -368,15 +367,17 @@ public class DataRenderer extends Renderer {
|
|||
}
|
||||
|
||||
public void renderDateTime(XhtmlNode x, Base e) {
|
||||
if (e.hasPrimitiveValue())
|
||||
if (e.hasPrimitiveValue()) {
|
||||
x.addText(((DateTimeType) e).toHumanDisplay());
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderUri(XhtmlNode x, UriType uri) {
|
||||
if (uri.getValue().startsWith("mailto:"))
|
||||
if (uri.getValue().startsWith("mailto:")) {
|
||||
x.ah(uri.getValue()).addText(uri.getValue().substring(7));
|
||||
else
|
||||
} else {
|
||||
x.ah(uri.getValue()).addText(uri.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderUri(XhtmlNode x, UriType uri, String path, String id) {
|
||||
|
@ -782,7 +783,6 @@ public class DataRenderer extends Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected String displayQuantity(Quantity q) {
|
||||
StringBuilder s = new StringBuilder();
|
||||
|
||||
|
|
|
@ -181,6 +181,10 @@ public class VersionUtilities {
|
|||
public static String getMajMin(String version) {
|
||||
if (version == null)
|
||||
return null;
|
||||
|
||||
if ("current".equals(version)) {
|
||||
return CURRENT_VERSION;
|
||||
}
|
||||
|
||||
if (Utilities.charCount(version, '.') == 1) {
|
||||
String[] p = version.split("\\.");
|
||||
|
|
|
@ -814,7 +814,7 @@ public class NpmPackage {
|
|||
|
||||
public String getWebLocation() {
|
||||
if (npm.has("url")) {
|
||||
return npm.get("url").getAsString();
|
||||
return PackageHacker.fixPackageUrl(npm.get("url").getAsString());
|
||||
} else {
|
||||
return JSONUtil.str(npm, "canonical");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue