mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-03-09 14:33:32 +00:00
Merge branch 'master' of github.com:jamesagnew/hapi-fhir
This commit is contained in:
commit
5f63dcfe7d
hapi-fhir-base/src/main/java/ca/uhn/fhir/parser
hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser
pom.xmlsrc/changes
@ -49,6 +49,7 @@ import ca.uhn.fhir.rest.api.EncodingEnum;
|
|||||||
import ca.uhn.fhir.util.ElementUtil;
|
import ca.uhn.fhir.util.ElementUtil;
|
||||||
import static ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum.ID_DATATYPE;
|
import static ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum.ID_DATATYPE;
|
||||||
import static ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum.PRIMITIVE_DATATYPE;
|
import static ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum.PRIMITIVE_DATATYPE;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is the FHIR JSON parser/encoder. Users should not interact with this class directly, but should use
|
* This class is the FHIR JSON parser/encoder. Users should not interact with this class directly, but should use
|
||||||
@ -705,6 +706,21 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
|
|||||||
if (isNotBlank(contentAsBase64)) {
|
if (isNotBlank(contentAsBase64)) {
|
||||||
write(theEventWriter, "content", contentAsBase64);
|
write(theEventWriter, "content", contentAsBase64);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
Method getSC = bin.getClass().getMethod("getSecurityContext");
|
||||||
|
Object securityContext = getSC.invoke(bin);
|
||||||
|
if (securityContext != null) {
|
||||||
|
Method getRef = securityContext.getClass().getMethod("getReference");
|
||||||
|
String securityContextRef = (String) getRef.invoke(securityContext);
|
||||||
|
if (securityContextRef != null) {
|
||||||
|
beginObject(theEventWriter, "securityContext");
|
||||||
|
writeOptionalTagWithTextNode(theEventWriter, "reference", securityContextRef);
|
||||||
|
theEventWriter.endObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource));
|
encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource));
|
||||||
}
|
}
|
||||||
|
@ -576,6 +576,23 @@ public class JsonParserDstu3Test {
|
|||||||
assertEquals("{\"resourceType\":\"Binary\"}", output);
|
assertEquals("{\"resourceType\":\"Binary\"}", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEncodeBinaryWithSecurityContext() {
|
||||||
|
Binary bin = new Binary();
|
||||||
|
bin.setContentType("text/plain");
|
||||||
|
bin.setContent("Now is the time".getBytes());
|
||||||
|
Reference securityContext = new Reference();
|
||||||
|
securityContext.setReference("DiagnosticReport/1");
|
||||||
|
bin.setSecurityContext(securityContext);
|
||||||
|
String encoded = ourCtx.newJsonParser().encodeResourceToString(bin);
|
||||||
|
assertThat(encoded, containsString("Binary"));
|
||||||
|
assertThat(encoded, containsString("contentType"));
|
||||||
|
assertThat(encoded, containsString("text/plain"));
|
||||||
|
assertThat(encoded, containsString("Tm93IGlzIHRoZSB0aW1l"));
|
||||||
|
assertThat(encoded, containsString("securityContext"));
|
||||||
|
assertThat(encoded, containsString("{\"reference\":\"DiagnosticReport/1\"}"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* #158
|
* #158
|
||||||
*/
|
*/
|
||||||
|
4
pom.xml
4
pom.xml
@ -366,6 +366,10 @@
|
|||||||
<id>patrick-werner</id>
|
<id>patrick-werner</id>
|
||||||
<name>Patrick Werner</name>
|
<name>Patrick Werner</name>
|
||||||
</developer>
|
</developer>
|
||||||
|
<developer>
|
||||||
|
<id>malcolmm83</id>
|
||||||
|
<name>Malcolm McRoberts</name>
|
||||||
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
|
@ -170,6 +170,11 @@
|
|||||||
DSTU2-hl7org and DSTU2.1 structures did not copy resource IDs when invoking
|
DSTU2-hl7org and DSTU2.1 structures did not copy resource IDs when invoking
|
||||||
copyValues(). Thanks to Clayton Bodendein for the pull request!
|
copyValues(). Thanks to Clayton Bodendein for the pull request!
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix" issue="734">
|
||||||
|
When encoding a Binary resource, the Binary.securityContext field
|
||||||
|
was not encoded correctly. Thanks to Malcolm McRoberts for the pull
|
||||||
|
request with fix and test case!
|
||||||
|
</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="3.0.0" date="2017-09-27">
|
<release version="3.0.0" date="2017-09-27">
|
||||||
<action type="add">
|
<action type="add">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user