fix rendering bugs (#1671)

* fix rendering bugs

* release notes

---------

Co-authored-by: Grahame Grieve <grahameg@gmail.ccom>
This commit is contained in:
Grahame Grieve 2024-06-28 09:06:42 +10:00 committed by GitHub
parent 66b8e57564
commit 6a66f37898
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 8 deletions

View File

@ -4,4 +4,4 @@
## Other code changes
* no changes
* Rendering fixes

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() {