Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/master' into livebundle-…
Browse files Browse the repository at this point in the history
…support
  • Loading branch information
fil512 committed May 31, 2019
2 parents 9f87b97 + f6c7ff1 commit 3685b37
Show file tree
Hide file tree
Showing 85 changed files with 504 additions and 163 deletions.
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example-projects/hapi-fhir-jpaserver-cds-example/pom.xml
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example-projects/hapi-fhir-jpaserver-dynamic/pom.xml
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-standalone-overlay-example</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion hapi-deployable-pom/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-android/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-base/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

Expand Down
Expand Up @@ -378,7 +378,7 @@ private void encodeCompositeElementChildrenToStreamWriter(RuntimeResourceDefinit
}

List<? extends IBase> values = nextChild.getAccessor().getValues(theElement);
values = super.preProcessValues(nextChild, theResource, values, nextChildElem, theEncodeContext);
values = preProcessValues(nextChild, theResource, values, nextChildElem, theEncodeContext);

if (values == null || values.isEmpty()) {
continue;
Expand Down Expand Up @@ -1457,7 +1457,7 @@ private void writeUndeclaredExtension(RuntimeResourceDefinition theResDef, IBase
* Pre-process value - This is called in case the value is a reference
* since we might modify the text
*/
value = JsonParser.super.preProcessValues(myDef, theResource, Collections.singletonList(value), myChildElem, theEncodeContext).get(0);
value = preProcessValues(myDef, theResource, Collections.singletonList(value), myChildElem, theEncodeContext).get(0);

RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition();
String childName = extDef.getChildNameByDatatype(value.getClass());
Expand Down
Expand Up @@ -387,7 +387,7 @@ private void encodeCompositeElementToStreamWriter(IBaseResource theResource, IBa
} else {

List<? extends IBase> values = nextChild.getAccessor().getValues(theElement);
values = super.preProcessValues(nextChild, theResource, values, nextChildElem, theEncodeContext);
values = preProcessValues(nextChild, theResource, values, nextChildElem, theEncodeContext);

if (values == null || values.isEmpty()) {
continue;
Expand Down
Expand Up @@ -88,6 +88,21 @@ public interface IClientExecutable<T extends IClientExecutable<?, Y>, Y> {
*/
T encodedXml();

/**
* Set a HTTP header not explicitly defined in FHIR but commonly used in real-world scenarios. One
* important example is to set the Authorization header (e.g. Basic Auth or OAuth2-based Bearer auth),
* which tends to be cumbersome using {@link ca.uhn.fhir.rest.client.api.IClientInterceptor IClientInterceptors},
* particularly when REST clients shall be reused and are thus supposed to remain stateless.
* <p>It is the responsibility of the caller to care for proper encoding of the header value, e.g.
* using Base64.</p>
* <p>This is a short-cut alternative to using a corresponding client interceptor</p>
*
* @param theHeaderName header name
* @param theHeaderValue header value
* @return
*/
T withAdditionalHeader(String theHeaderName, String theHeaderValue);

/**
* Actually execute the client operation
*/
Expand Down
Expand Up @@ -21,12 +21,16 @@
*/

public enum VersionEnum {

V2_5_0,
V3_0_0,
V3_1_0,
V3_2_0,
V3_3_0,
V3_4_0,
V3_5_0,
V3_6_0,
V3_7_0,
V3_8_0
V3_8_0,
V4_0_0

}
2 changes: 1 addition & 1 deletion hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

Expand Down
Expand Up @@ -33,7 +33,7 @@ public class ExportConceptMapToCsvCommandR4Test {
private static final String CS_URL_1 = "http://example.com/codesystem/1";
private static final String CS_URL_2 = "http://example.com/codesystem/2";
private static final String CS_URL_3 = "http://example.com/codesystem/3";
private static final String FILE = "./target/output.csv";
private static final String FILE = new File("./target/output.csv").getAbsolutePath();

private static String ourBase;
private static IGenericClient ourClient;
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-client-okhttp/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-client/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

Expand Down
Expand Up @@ -138,7 +138,7 @@ protected Map<String, List<String>> createExtraParams(String theCustomAcceptHead
public <T extends IBaseResource> T fetchResourceFromUrl(Class<T> theResourceType, String theUrl) {
BaseHttpClientInvocation clientInvocation = new HttpGetClientInvocation(getFhirContext(), theUrl);
ResourceResponseHandler<T> binding = new ResourceResponseHandler<T>(theResourceType);
return invokeClient(getFhirContext(), binding, clientInvocation, null, false, false, null, null, null, null);
return invokeClient(getFhirContext(), binding, clientInvocation, null, false, false, null, null, null, null, null);
}

void forceConformanceCheck() {
Expand Down Expand Up @@ -215,11 +215,12 @@ <T> T invokeClient(FhirContext theContext, IClientResponseHandler<T> binding, Ba
}

<T> T invokeClient(FhirContext theContext, IClientResponseHandler<T> binding, BaseHttpClientInvocation clientInvocation, boolean theLogRequestAndResponse) {
return invokeClient(theContext, binding, clientInvocation, null, null, theLogRequestAndResponse, null, null, null, null);
return invokeClient(theContext, binding, clientInvocation, null, null, theLogRequestAndResponse, null, null, null, null, null);
}

<T> T invokeClient(FhirContext theContext, IClientResponseHandler<T> binding, BaseHttpClientInvocation clientInvocation, EncodingEnum theEncoding, Boolean thePrettyPrint,
boolean theLogRequestAndResponse, SummaryEnum theSummaryMode, Set<String> theSubsetElements, CacheControlDirective theCacheControlDirective, String theCustomAcceptHeader) {
boolean theLogRequestAndResponse, SummaryEnum theSummaryMode, Set<String> theSubsetElements, CacheControlDirective theCacheControlDirective, String theCustomAcceptHeader,
Map<String, List<String>> theCustomHeaders) {

if (!myDontValidateConformance) {
myFactory.validateServerBaseIfConfiguredToDoSo(myUrlBase, myClient, this);
Expand Down Expand Up @@ -280,6 +281,14 @@ <T> T invokeClient(FhirContext theContext, IClientResponseHandler<T> binding, Ba
}
}

if (theCustomHeaders != null) {
for (Map.Entry<String, List<String>> customHeader: theCustomHeaders.entrySet()) {
for (String value: customHeader.getValue()) {
httpRequest.addHeader(customHeader.getKey(), value);
}
}
}

if (theLogRequestAndResponse) {
ourLog.info("Client invoking: {}", httpRequest);
String body = httpRequest.getRequestBodyFromStream();
Expand Down

0 comments on commit 3685b37

Please sign in to comment.