diff --git a/hapi-fhir-base/examples/src/main/java/example/ResourceRefs.java b/hapi-fhir-base/examples/src/main/java/example/ResourceRefs.java new file mode 100644 index 00000000000..28729139d16 --- /dev/null +++ b/hapi-fhir-base/examples/src/main/java/example/ResourceRefs.java @@ -0,0 +1,36 @@ +package example; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.dstu.resource.Organization; +import ca.uhn.fhir.model.dstu.resource.Patient; + +public class ResourceRefs { + + private static FhirContext ourCtx = new FhirContext(); + + public static void main(String[] args) { + manualContained(); + } + + public static void manualContained() { + // START SNIPPET: manualContained + // Create an organization, and give it a local ID + Organization org = new Organization(); + org.setId("#localOrganization"); + org.getName().setValue("Contained Test Organization"); + + // Create a patient + Patient patient = new Patient(); + patient.setId("Patient/1333"); + patient.addIdentifier("urn:mrns", "253345"); + + // Set the reference, and manually add the contained resource + patient.getManagingOrganization().setReference("#localOrganization"); + patient.getContained().getContainedResources().add(org); + + String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); + System.out.println(encoded); + // END SNIPPET: manualContained + } + +} diff --git a/hapi-fhir-base/src/changes/changes.xml b/hapi-fhir-base/src/changes/changes.xml index 8c3c247e64f..70c5632bc81 100644 --- a/hapi-fhir-base/src/changes/changes.xml +++ b/hapi-fhir-base/src/changes/changes.xml @@ -6,7 +6,7 @@
+ Note that you may also "contain" resources manually in your own code if you + prefer. The following example show how to do this: +
+- Oct 22, 2014 - HAPI FHIR 0.7 Released - A new build has been uploaded, - containing a number of new features and bug fixes. See the changelog - for a complete list of what has changed. Of particular note, the way - that contained resources are automatically serialized has been adjusted. This was - technically a bugfix, as the previous version was often repeating encoded - resources as top-level resources in returned bundles, but it is possible that - implementations have been relying on this b - the TagList - class has been switched from a List to a Set based on discussion + Oct 23, 2014 - HAPI FHIR 0.7 Released - HAPI 0.7 has been released! + This release contains a number of contributions and bugfixes from all over + the FHIR community. Thanks to everyone who contributed! +
++ In particular, note that this release corrects an issue where contained resources + sometimes got encoded as both contained and top-level resources, and top level + resources sometimes got encoded as contained resources. It is possible that some + existing applications depended on the buggy behaviour, so please do a bit of extra + testing on your server applications if you use contained resources at all. See + the resource references + documentation for a bit more information on how these work, and please feel free to + post to the google group + if things aren't working as expected. +
++ This release also introduces a fascinating Vagrant + based development environment contributed by Preston Lee which should allow you + to try out a fully functional, database backed HAPI server in a virtual server + on your own development box. +
+
+ See the changelog
+ for a complete list of what's new!
- James Agnew