version notes

This commit is contained in:
Grahame Grieve 2020-11-27 10:39:23 +11:00
commit a6df87b0a4
15 changed files with 61 additions and 67 deletions

View File

@ -1,8 +1,14 @@
Validator Changes: Validator Changes:
* no effective changes * no effective changes
* fix issue for content references in versions before R3
* Add on the fly retrieval of profiles in the validator
* Fix bug where validator reported 'not done yet' for invalid contained references
* Fix for wrong reference to Any in cross version extensions
Other Code Changes: Other Code Changes:
* fix bug converting type mode in Structure Map * fix bug converting type mode in Structure Map
* fix bug converting Timing.when (issue 383) * fix bug converting Timing.when (issue 383)
* fix bug doing date time comparisons with seconds in FHIRPath * fix bug doing date time comparisons with seconds in FHIRPath
* Add support for instance-name and instance-description extensions * Add support for instance-name and instance-description extensions
* Fix for bundle renderer trying to render resources from the wrong version

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -39,6 +39,7 @@ import org.hl7.fhir.r5.utils.client.network.ResourceRequest;
import org.hl7.fhir.utilities.ToolingClientLogger; import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
@ -234,7 +235,7 @@ public class FHIRToolingClient {
try { try {
result = client.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), result = client.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())), ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),"Update " + resource.fhirType() + "/" + id, TIMEOUT_OPERATION); getPreferredResourceFormat(), "Update " + resource.fhirType() + "/" + id, TIMEOUT_OPERATION);
if (result.isUnsuccessfulRequest()) { if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload()); throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
} }
@ -357,10 +358,10 @@ public class FHIRToolingClient {
try { try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"), result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "ValueSet/$expand?url=" + source.getUrl(), TIMEOUT_OPERATION_EXPAND); ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "ValueSet/$expand?url=" + source.getUrl(), TIMEOUT_OPERATION_EXPAND);
if (result.isUnsuccessfulRequest()) { if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload()); throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
} }
} catch (MalformedURLException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return result == null ? null : (ValueSet) result.getPayload(); return result == null ? null : (ValueSet) result.getPayload();
@ -371,7 +372,7 @@ public class FHIRToolingClient {
org.hl7.fhir.r5.utils.client.network.ResourceRequest<Resource> result = null; org.hl7.fhir.r5.utils.client.network.ResourceRequest<Resource> result = null;
try { try {
result = client.issueGetResourceRequest(resourceAddress.resolveOperationUri(CodeSystem.class, "lookup", params), getPreferredResourceFormat(), "CodeSystem/$lookup", TIMEOUT_NORMAL); result = client.issueGetResourceRequest(resourceAddress.resolveOperationUri(CodeSystem.class, "lookup", params), getPreferredResourceFormat(), "CodeSystem/$lookup", TIMEOUT_NORMAL);
} catch (MalformedURLException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
if (result.isUnsuccessfulRequest()) { if (result.isUnsuccessfulRequest()) {
@ -390,10 +391,10 @@ public class FHIRToolingClient {
try { try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params), result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "ValueSet/$expand?url=" + source.getUrl(), TIMEOUT_OPERATION_EXPAND); ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "ValueSet/$expand?url=" + source.getUrl(), TIMEOUT_OPERATION_EXPAND);
if (result.isUnsuccessfulRequest()) { if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload()); throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
} }
} catch (MalformedURLException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return result == null ? null : (ValueSet) result.getPayload(); return result == null ? null : (ValueSet) result.getPayload();
@ -410,10 +411,10 @@ public class FHIRToolingClient {
try { try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()), result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "Closure?name=" + name, TIMEOUT_NORMAL); ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "Closure?name=" + name, TIMEOUT_NORMAL);
if (result.isUnsuccessfulRequest()) { if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload()); throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
} }
} catch (MalformedURLException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return result == null ? null : (ConceptMap) result.getPayload(); return result == null ? null : (ConceptMap) result.getPayload();
@ -427,10 +428,10 @@ public class FHIRToolingClient {
try { try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()), result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "UpdateClosure?name=" + name, TIMEOUT_OPERATION); ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "UpdateClosure?name=" + name, TIMEOUT_OPERATION);
if (result.isUnsuccessfulRequest()) { if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload()); throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
} }
} catch (MalformedURLException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return result == null ? null : (ConceptMap) result.getPayload(); return result == null ? null : (ConceptMap) result.getPayload();

View File

@ -74,7 +74,7 @@ public class Client {
public <T extends Resource> ResourceRequest<T> issueOptionsRequest(URI optionsUri, public <T extends Resource> ResourceRequest<T> issueOptionsRequest(URI optionsUri,
String resourceFormat, String resourceFormat,
String message, String message,
long timeout) throws MalformedURLException { long timeout) throws IOException {
Request.Builder request = new Request.Builder() Request.Builder request = new Request.Builder()
.method("OPTIONS", null) .method("OPTIONS", null)
.url(optionsUri.toURL()); .url(optionsUri.toURL());
@ -85,7 +85,7 @@ public class Client {
public <T extends Resource> ResourceRequest<T> issueGetResourceRequest(URI resourceUri, public <T extends Resource> ResourceRequest<T> issueGetResourceRequest(URI resourceUri,
String resourceFormat, String resourceFormat,
String message, String message,
long timeout) throws MalformedURLException { long timeout) throws IOException {
Request.Builder request = new Request.Builder() Request.Builder request = new Request.Builder()
.url(resourceUri.toURL()); .url(resourceUri.toURL());
@ -96,7 +96,7 @@ public class Client {
byte[] payload, byte[] payload,
String resourceFormat, String resourceFormat,
String message, String message,
long timeout) throws MalformedURLException { long timeout) throws IOException {
return issuePutRequest(resourceUri, payload, resourceFormat, null, message, timeout); return issuePutRequest(resourceUri, payload, resourceFormat, null, message, timeout);
} }
@ -105,7 +105,7 @@ public class Client {
String resourceFormat, String resourceFormat,
Headers headers, Headers headers,
String message, String message,
long timeout) throws MalformedURLException { long timeout) throws IOException {
if (payload == null) throw new EFhirClientException("PUT requests require a non-null payload"); if (payload == null) throw new EFhirClientException("PUT requests require a non-null payload");
RequestBody body = RequestBody.create(payload); RequestBody body = RequestBody.create(payload);
Request.Builder request = new Request.Builder() Request.Builder request = new Request.Builder()
@ -119,7 +119,7 @@ public class Client {
byte[] payload, byte[] payload,
String resourceFormat, String resourceFormat,
String message, String message,
long timeout) throws MalformedURLException { long timeout) throws IOException {
return issuePostRequest(resourceUri, payload, resourceFormat, null, message, timeout); return issuePostRequest(resourceUri, payload, resourceFormat, null, message, timeout);
} }
@ -128,7 +128,7 @@ public class Client {
String resourceFormat, String resourceFormat,
Headers headers, Headers headers,
String message, String message,
long timeout) throws MalformedURLException { long timeout) throws IOException {
if (payload == null) throw new EFhirClientException("POST requests require a non-null payload"); if (payload == null) throw new EFhirClientException("POST requests require a non-null payload");
RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload); RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload);
Request.Builder request = new Request.Builder() Request.Builder request = new Request.Builder()
@ -138,14 +138,14 @@ public class Client {
return executeFhirRequest(request, resourceFormat, headers, message, retryCount, timeout); return executeFhirRequest(request, resourceFormat, headers, message, retryCount, timeout);
} }
public boolean issueDeleteRequest(URI resourceUri) throws MalformedURLException { public boolean issueDeleteRequest(URI resourceUri) throws IOException {
Request.Builder request = new Request.Builder() Request.Builder request = new Request.Builder()
.url(resourceUri.toURL()) .url(resourceUri.toURL())
.delete(); .delete();
return executeFhirRequest(request, null, null, null, retryCount, timeout).isSuccessfulRequest(); return executeFhirRequest(request, null, null, null, retryCount, timeout).isSuccessfulRequest();
} }
public Bundle issueGetFeedRequest(URI resourceUri, String resourceFormat) throws MalformedURLException { public Bundle issueGetFeedRequest(URI resourceUri, String resourceFormat) throws IOException {
Request.Builder request = new Request.Builder() Request.Builder request = new Request.Builder()
.url(resourceUri.toURL()); .url(resourceUri.toURL());
@ -171,7 +171,7 @@ public class Client {
byte[] payload, byte[] payload,
String resourceFormat, String resourceFormat,
String message, String message,
int timeout) throws MalformedURLException { int timeout) throws IOException {
if (payload == null) throw new EFhirClientException("POST requests require a non-null payload"); if (payload == null) throw new EFhirClientException("POST requests require a non-null payload");
RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload); RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload);
Request.Builder request = new Request.Builder() Request.Builder request = new Request.Builder()
@ -186,7 +186,7 @@ public class Client {
Headers headers, Headers headers,
String message, String message,
int retryCount, int retryCount,
long timeout) { long timeout) throws IOException {
return new FhirRequestBuilder(request) return new FhirRequestBuilder(request)
.withLogger(logger) .withLogger(logger)
.withResourceFormat(resourceFormat) .withResourceFormat(resourceFormat)
@ -202,7 +202,7 @@ public class Client {
Headers headers, Headers headers,
String message, String message,
int retryCount, int retryCount,
long timeout) { long timeout) throws IOException {
return new FhirRequestBuilder(request) return new FhirRequestBuilder(request)
.withLogger(logger) .withLogger(logger)
.withResourceFormat(resourceFormat) .withResourceFormat(resourceFormat)

View File

@ -1,9 +1,7 @@
package org.hl7.fhir.r5.utils.client.network; package org.hl7.fhir.r5.utils.client.network;
import kotlin.Pair;
import okhttp3.*; import okhttp3.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.formats.IParser; import org.hl7.fhir.r5.formats.IParser;
import org.hl7.fhir.r5.formats.JsonParser; import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.formats.XmlParser;
@ -16,7 +14,10 @@ import org.hl7.fhir.r5.utils.client.ResourceFormat;
import org.hl7.fhir.utilities.ToolingClientLogger; import org.hl7.fhir.utilities.ToolingClientLogger;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class FhirRequestBuilder { public class FhirRequestBuilder {
@ -201,31 +202,17 @@ public class FhirRequestBuilder {
return httpRequest.build(); return httpRequest.build();
} }
public <T extends Resource> ResourceRequest<T> execute() { public <T extends Resource> ResourceRequest<T> execute() throws IOException {
formatHeaders(httpRequest, resourceFormat, null); formatHeaders(httpRequest, resourceFormat, null);
Response response = getHttpClient().newCall(httpRequest.build()).execute();
try { T resource = unmarshalReference(response, resourceFormat);
Response response = getHttpClient().newCall(httpRequest.build()).execute(); return new ResourceRequest<T>(resource, response.code(), getLocationHeader(response.headers()));
T resource = unmarshalReference(response, resourceFormat);
return new ResourceRequest<T>(resource, response.code(), getLocationHeader(response.headers()));
} catch (IOException e) {
e.printStackTrace();
throw new FHIRException(e);
}
} }
public Bundle executeAsBatch() { public Bundle executeAsBatch() throws IOException {
formatHeaders(httpRequest, resourceFormat, null); formatHeaders(httpRequest, resourceFormat, null);
Response response = getHttpClient().newCall(httpRequest.build()).execute();
try { return unmarshalFeed(response, resourceFormat);
Response response = getHttpClient().newCall(httpRequest.build()).execute();
return unmarshalFeed(response, resourceFormat);
} catch (IOException e) {
e.printStackTrace();
}
return null;
} }
/** /**
@ -317,9 +304,9 @@ public class FhirRequestBuilder {
* Logs the given {@link Response}, using the current {@link ToolingClientLogger}. If the current * Logs the given {@link Response}, using the current {@link ToolingClientLogger}. If the current
* {@link FhirRequestBuilder#logger} is null, no action is taken. * {@link FhirRequestBuilder#logger} is null, no action is taken.
* *
* @param responseCode HTTP response code * @param responseCode HTTP response code
* @param responseHeaders {@link Headers} from response * @param responseHeaders {@link Headers} from response
* @param responseBody Byte array response * @param responseBody Byte array response
*/ */
protected void log(int responseCode, Headers responseHeaders, byte[] responseBody) { protected void log(int responseCode, Headers responseHeaders, byte[] responseBody) {
if (logger != null) { if (logger != null) {

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -14,7 +14,7 @@
HAPI FHIR. HAPI FHIR.
--> -->
<artifactId>org.hl7.fhir.core</artifactId> <artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version> <version>5.2.2</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>