fix renderers - don't make nonvalid URLs into html links + fix NPE +
This commit is contained in:
parent
d427295ee6
commit
a75ac22c91
|
@ -634,7 +634,14 @@ public class Element extends Base {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name+"="+fhirType() + "["+(children == null || hasValue() ? value : Integer.toString(children.size())+" children")+"]";
|
||||
if (name.equals(fhirType()) && isResource()) {
|
||||
return fhirType()+"/"+getIdBase() + "["+(children == null || hasValue() ? value : Integer.toString(children.size())+" children")+"]";
|
||||
|
||||
} else if (isResource()) {
|
||||
return name+"="+fhirType()+"/"+getIdBase()+ "["+(children == null || hasValue() ? value : Integer.toString(children.size())+" children")+"]";
|
||||
} else {
|
||||
return name+"="+fhirType() + "["+(children == null || hasValue() ? value : Integer.toString(children.size())+" children")+"]";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -62,6 +62,8 @@ public class Manager {
|
|||
return "txt";
|
||||
case VBAR:
|
||||
return "hl7";
|
||||
case SHC:
|
||||
return "shc";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -422,7 +422,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
|
|||
if (first) first = false; else td.addText(", ");
|
||||
if (pcv.hasValueCoding()) {
|
||||
td.addText(pcv.getValueCoding().getCode());
|
||||
} else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrl(pcv.getValue().primitiveValue())) {
|
||||
} else if (pcv.hasValueStringType() && Utilities.isAbsoluteUrlLinkable(pcv.getValue().primitiveValue())) {
|
||||
td.ah(pcv.getValue().primitiveValue()).tx(pcv.getValue().primitiveValue());
|
||||
} else {
|
||||
td.addText(pcv.getValue().primitiveValue());
|
||||
|
|
|
@ -450,8 +450,10 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
|
|||
x.addText(((Enumeration<?>) e).getValue().toString()); // todo: look up a display name if there is one
|
||||
return true;
|
||||
} else if (e instanceof BooleanType) {
|
||||
if (((BooleanType) e).getValue()) {
|
||||
if (((BooleanType) e).hasValue()) {
|
||||
x.addText(name);
|
||||
x.addText(": ");
|
||||
x.addText(((BooleanType) e).getValueAsString());
|
||||
return true;
|
||||
}
|
||||
} else if (e instanceof CodeableReference) {
|
||||
|
|
|
@ -1013,7 +1013,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
private void defn(XhtmlNode tbl, String name, String url, Resource res) throws UnsupportedEncodingException, IOException {
|
||||
if (res != null && res.hasUserData("path")) {
|
||||
defn(tbl, "Definition", RendererFactory.factory(res, context).display(res), res.getUserString("path"));
|
||||
} else if (Utilities.isAbsoluteUrl(url)) {
|
||||
} else if (Utilities.isAbsoluteUrlLinkable(url)) {
|
||||
defn(tbl, "Definition", url, url);
|
||||
} {
|
||||
defn(tbl, "Definition", url);
|
||||
|
|
|
@ -1098,7 +1098,17 @@ public class Utilities {
|
|||
if (ref != null && ref.contains(":")) {
|
||||
String scheme = ref.substring(0, ref.indexOf(":"));
|
||||
String details = ref.substring(ref.indexOf(":")+1);
|
||||
return (existsInList(scheme, "http", "https", "urn") || isToken(scheme) || Utilities.startsWithInList(ref, "urn:iso:", "urn:iso-iec:", "urn:iso-cie:", "urn:iso-astm:", "urn:iso-ieee:", "urn:iec:"))
|
||||
return (existsInList(scheme, "http", "https", "urn") || (isToken(scheme) && scheme.equals(scheme.toLowerCase())) || Utilities.startsWithInList(ref, "urn:iso:", "urn:iso-iec:", "urn:iso-cie:", "urn:iso-astm:", "urn:iso-ieee:", "urn:iec:"))
|
||||
&& details != null && details.length() > 0 && !details.contains(" "); // rfc5141
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isAbsoluteUrlLinkable(String ref) {
|
||||
if (ref != null && ref.contains(":")) {
|
||||
String scheme = ref.substring(0, ref.indexOf(":"));
|
||||
String details = ref.substring(ref.indexOf(":")+1);
|
||||
return (existsInList(scheme, "http", "https", "ftp"))
|
||||
&& details != null && details.length() > 0 && !details.contains(" "); // rfc5141
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -135,7 +135,7 @@ public class VersionUtilities {
|
|||
}
|
||||
|
||||
public static boolean isR5Ver(String ver) {
|
||||
return ver != null && ver.startsWith(CURRENT_VERSION);
|
||||
return ver != null && (ver.startsWith(CURRENT_VERSION) || ver.equals("current"));
|
||||
}
|
||||
|
||||
public static boolean isR4BVer(String ver) {
|
||||
|
|
Loading…
Reference in New Issue