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:
* 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:
* fix bug converting type mode in Structure Map
* fix bug converting Timing.when (issue 383)
* 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>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version>
<version>5.2.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.2.2-SNAPSHOT</version>
<version>5.2.2</version>
<relativePath>../pom.xml</relativePath>
</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.Utilities;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
@ -234,7 +235,7 @@ public class FHIRToolingClient {
try {
result = client.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),
ByteUtils.resourceToByteArray(resource, false, isJson(getPreferredResourceFormat())),
getPreferredResourceFormat(),"Update " + resource.fhirType() + "/" + id, TIMEOUT_OPERATION);
getPreferredResourceFormat(), "Update " + resource.fhirType() + "/" + id, TIMEOUT_OPERATION);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
}
@ -357,10 +358,10 @@ public class FHIRToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
ByteUtils.resourceToByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "ValueSet/$expand?url=" + source.getUrl(), TIMEOUT_OPERATION_EXPAND);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
}
} catch (MalformedURLException e) {
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
}
} catch (IOException e) {
e.printStackTrace();
}
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;
try {
result = client.issueGetResourceRequest(resourceAddress.resolveOperationUri(CodeSystem.class, "lookup", params), getPreferredResourceFormat(), "CodeSystem/$lookup", TIMEOUT_NORMAL);
} catch (MalformedURLException e) {
} catch (IOException e) {
e.printStackTrace();
}
if (result.isUnsuccessfulRequest()) {
@ -390,10 +391,10 @@ public class FHIRToolingClient {
try {
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);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
}
} catch (MalformedURLException e) {
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
}
} catch (IOException e) {
e.printStackTrace();
}
return result == null ? null : (ValueSet) result.getPayload();
@ -410,10 +411,10 @@ public class FHIRToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "Closure?name=" + name, TIMEOUT_NORMAL);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
}
} catch (MalformedURLException e) {
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
}
} catch (IOException e) {
e.printStackTrace();
}
return result == null ? null : (ConceptMap) result.getPayload();
@ -427,10 +428,10 @@ public class FHIRToolingClient {
try {
result = client.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, "UpdateClosure?name=" + name, TIMEOUT_OPERATION);
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
}
} catch (MalformedURLException e) {
if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
}
} catch (IOException e) {
e.printStackTrace();
}
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,
String resourceFormat,
String message,
long timeout) throws MalformedURLException {
long timeout) throws IOException {
Request.Builder request = new Request.Builder()
.method("OPTIONS", null)
.url(optionsUri.toURL());
@ -85,7 +85,7 @@ public class Client {
public <T extends Resource> ResourceRequest<T> issueGetResourceRequest(URI resourceUri,
String resourceFormat,
String message,
long timeout) throws MalformedURLException {
long timeout) throws IOException {
Request.Builder request = new Request.Builder()
.url(resourceUri.toURL());
@ -96,7 +96,7 @@ public class Client {
byte[] payload,
String resourceFormat,
String message,
long timeout) throws MalformedURLException {
long timeout) throws IOException {
return issuePutRequest(resourceUri, payload, resourceFormat, null, message, timeout);
}
@ -105,7 +105,7 @@ public class Client {
String resourceFormat,
Headers headers,
String message,
long timeout) throws MalformedURLException {
long timeout) throws IOException {
if (payload == null) throw new EFhirClientException("PUT requests require a non-null payload");
RequestBody body = RequestBody.create(payload);
Request.Builder request = new Request.Builder()
@ -119,7 +119,7 @@ public class Client {
byte[] payload,
String resourceFormat,
String message,
long timeout) throws MalformedURLException {
long timeout) throws IOException {
return issuePostRequest(resourceUri, payload, resourceFormat, null, message, timeout);
}
@ -128,7 +128,7 @@ public class Client {
String resourceFormat,
Headers headers,
String message,
long timeout) throws MalformedURLException {
long timeout) throws IOException {
if (payload == null) throw new EFhirClientException("POST requests require a non-null payload");
RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload);
Request.Builder request = new Request.Builder()
@ -138,14 +138,14 @@ public class Client {
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()
.url(resourceUri.toURL())
.delete();
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()
.url(resourceUri.toURL());
@ -171,7 +171,7 @@ public class Client {
byte[] payload,
String resourceFormat,
String message,
int timeout) throws MalformedURLException {
int timeout) throws IOException {
if (payload == null) throw new EFhirClientException("POST requests require a non-null payload");
RequestBody body = RequestBody.create(MediaType.parse(resourceFormat + ";charset=" + DEFAULT_CHARSET), payload);
Request.Builder request = new Request.Builder()
@ -186,7 +186,7 @@ public class Client {
Headers headers,
String message,
int retryCount,
long timeout) {
long timeout) throws IOException {
return new FhirRequestBuilder(request)
.withLogger(logger)
.withResourceFormat(resourceFormat)
@ -202,7 +202,7 @@ public class Client {
Headers headers,
String message,
int retryCount,
long timeout) {
long timeout) throws IOException {
return new FhirRequestBuilder(request)
.withLogger(logger)
.withResourceFormat(resourceFormat)

View File

@ -1,9 +1,7 @@
package org.hl7.fhir.r5.utils.client.network;
import kotlin.Pair;
import okhttp3.*;
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.JsonParser;
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 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;
public class FhirRequestBuilder {
@ -201,31 +202,17 @@ public class FhirRequestBuilder {
return httpRequest.build();
}
public <T extends Resource> ResourceRequest<T> execute() {
public <T extends Resource> ResourceRequest<T> execute() throws IOException {
formatHeaders(httpRequest, resourceFormat, null);
try {
Response response = getHttpClient().newCall(httpRequest.build()).execute();
T resource = unmarshalReference(response, resourceFormat);
return new ResourceRequest<T>(resource, response.code(), getLocationHeader(response.headers()));
} catch (IOException e) {
e.printStackTrace();
throw new FHIRException(e);
}
Response response = getHttpClient().newCall(httpRequest.build()).execute();
T resource = unmarshalReference(response, resourceFormat);
return new ResourceRequest<T>(resource, response.code(), getLocationHeader(response.headers()));
}
public Bundle executeAsBatch() {
public Bundle executeAsBatch() throws IOException {
formatHeaders(httpRequest, resourceFormat, null);
try {
Response response = getHttpClient().newCall(httpRequest.build()).execute();
return unmarshalFeed(response, resourceFormat);
} catch (IOException e) {
e.printStackTrace();
}
return null;
Response response = getHttpClient().newCall(httpRequest.build()).execute();
return unmarshalFeed(response, resourceFormat);
}
/**
@ -317,9 +304,9 @@ public class FhirRequestBuilder {
* Logs the given {@link Response}, using the current {@link ToolingClientLogger}. If the current
* {@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 responseBody Byte array response
* @param responseBody Byte array response
*/
protected void log(int responseCode, Headers responseHeaders, byte[] responseBody) {
if (logger != null) {

View File

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

View File

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

View File

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

View File

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

View File

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