fix rendering bugs

This commit is contained in:
Grahame Grieve 2024-06-28 08:06:25 +10:00
parent 66b8e57564
commit 8bf07711f1
4 changed files with 10 additions and 7 deletions

View File

@ -685,10 +685,10 @@ public class PatientRenderer extends ResourceRenderer {
private boolean hasRenderablePhoto(ResourceWrapper r) throws UnsupportedEncodingException, FHIRException, IOException {
if (r.has("photo")) {
List<ResourceWrapper> a = r.children("photo");
for (ResourceWrapper v : a) {
Attachment att = (Attachment) v.getBase();
if (att.hasContentType() && att.getContentType().startsWith("image/") &&
att.getData() != null && (!context.isInlineGraphics() || (att.getData().length > 0 && att.getData().length < MAX_IMAGE_LENGTH))) {
for (ResourceWrapper att : a) {
if (att.has("contentType") && att.primitiveValue("contentType").startsWith("image/") &&
att.has("data") && (!context.isInlineGraphics() || (att.primitiveValue("data").length() > 0 &&
att.primitiveValue("data").length() < MAX_IMAGE_LENGTH))) {
return true;
}
}

View File

@ -169,8 +169,8 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
} else if (ew.fhirType().equals("ElementDefinition")) {
x.tx("todo-bundle");
} else if (!renderDataType(status, parent, x, ew)) {
if (Utilities.existsInList(ew.fhirType(), "Attachment", "Narrative", "Meta", "ProductShelfLife", "RelatedArtifact")) {
throw new NotImplementedException("type "+ew.fhirType()+" not handled. This may be due to unresolved inter-version compatibility issues");
if (!Utilities.existsInList(ew.fhirType(), "Narrative", "Meta", "ProductShelfLife", "RelatedArtifact")) {
throw new NotImplementedException("type "+ew.fhirType()+" not handled by the rendering framework");
}
}
}

View File

@ -341,6 +341,9 @@ public abstract class ResourceRenderer extends DataRenderer {
if (rr == null) {
String disp = display != null && display.hasPrimitiveValue() ? displayDataType(display) : actual.primitiveValue();
x.ah(context.prefixLocalHref(actual.primitiveValue())).tx(disp);
} else if (rr.getResource() == null) {
String disp = display != null && display.hasPrimitiveValue() ? displayDataType(display) : "??";
x.ah(context.prefixLocalHref(rr.getWebPath())).tx(disp);
} else {
String disp = display != null && display.hasPrimitiveValue() ? displayDataType(display) : RendererFactory.factory(rr.getResource(), context.forContained()).buildSummary(rr.getResource());
x.ah(context.prefixLocalHref(rr.getWebPath())).tx(disp);

View File

@ -195,7 +195,7 @@ public class ResourceWrapperNative extends ResourceWrapper {
public Resource getResourceNative() {
ResourceWrapper focus = getResourceWrapper();
return (Resource) ((ResourceWrapperNative) focus).element;
return focus == null ? null : (Resource) ((ResourceWrapperNative) focus).element;
}
public boolean hasFormatComment() {