theWriter.writeEnd();
break;
}
case RESOURCE_REF: {
ResourceReferenceDt referenceDt = (ResourceReferenceDt) theValue;
IdDt value = referenceDt.getReference();
if (theChildName != null) {
theWriter.writeStartObject(theChildName);
} else {
theWriter.writeStartObject();
}
String reference = value.getValue();
if (StringUtils.isBlank(reference)) {
if (value.getResourceType() != null && StringUtils.isNotBlank(value.getIdPart())) {
reference = myContext.getResourceDefinition(value.getResourceType()).getName() + '/' + value.getIdPart();
}
}
if (StringUtils.isNotBlank(reference)) {
theWriter.write(XmlParser.RESREF_REFERENCE, reference);
}
if (referenceDt.getDisplay().isEmpty() == false) {
theWriter.write(XmlParser.RESREF_DISPLAY, referenceDt.getDisplay().getValueAsString());
}
theWriter.writeEnd();
break;
}
case CONTAINED_RESOURCES: {
theWriter.writeStartArray(theChildName);
ContainedDt value = (ContainedDt) theValue;
for (IResource next : value.getContainedResources()) {
encodeResourceToJsonStreamWriter(theResDef, next, theWriter, null, true);
}
theWriter.writeEnd();
break;
}