Merge branch 'master' into ja_20200609_converter_issues

This commit is contained in:
jamesagnew 2020-06-09 05:39:54 -04:00
commit 48373bc442
103 changed files with 2937 additions and 2074 deletions

View File

@ -1,26 +1,97 @@
HAPI FHIR - HL7 FHIR Core Artifacts
===================================
# HAPI FHIR - HL7 FHIR Core Artifacts
[![Build Status](https://travis-ci.org/hapifhir/org.hl7.fhir.core.svg?branch=master)](https://travis-ci.org/hapifhir/org.hl7.fhir.core)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/hapifhir/org.hl7.fhir.core/badge.svg)](http://search.maven.org/#search|ga|1|hapifhir/org.hl7.fhir.core)
### CI/CD
| master Branch CI | SNAPSHOT Publisher |
| :---: | :---: |
| [![Build Status][Badge-BuildPipeline]][Link-BuildPipeline] | [![Build Status][Badge-SnapshotPipeline]][Link-SnapshotPipeline] |
All intergration and delivery done on Azure pipelines. Every successful merge to master branch will result in a new SNAPSHOT build being published to Sonatype. Azure project can be viewed [here][Link-AzureProject].
# Building this Project
### Current Versions
| Project | Latest SNAPSHOT | Current Release |
| :---: | :---: | :---: |
| org.hl7.fhir.validation.cli | [![Snapshot Artifact][Badge-cliSonatypeSnapshot]][Link-cliSonatypeSnapshot] | [![Release Artifacts][Badge-cliSonatypeRelease]][Link-cliSonatypeRelease] |
| org.hl7.fhir.r4 | [![Snapshot Artifact][Badge-r4SonatypeSnapshot]][Link-r4SonatypeSnapshot] | [![Release Artifacts][Badge-r4SonatypeRelease]][Link-r4SonatypeRelease] |
| org.hl7.fhir.r5 | [![Snapshot Artifact][Badge-r5SonatypeSnapshot]][Link-r5SonatypeSnapshot] | [![Release Artifacts][Badge-r5SonatypeRelease]][Link-r5SonatypeRelease] |
### Building this Project
This project uses [Apache Maven](http://maven.apache.org) to build. To build:
```
mvn install
```
Note that unit tests will run, but are currently not set to fail the build as they do not all pass. This is being worked on.
To skip unit tests:
```
mvn -Dmaven.test.skip install
```
== Maintenance
### Download
##### org.hl7.fhir.validation.cli
###### Maven
```xml
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.validation.cli</artifactId>
<version>(latest version)</version>
</dependency>
```
This project is maintained by Grahame Grieve and James Agnew on behalf of the FHIR community.
###### Gradle
```groovy
compile group: 'ca.uhn.hapi.fhir', name: 'org.hl7.fhir.validation.cli', version: '(latest version)'
```
##### org.hl7.fhir.r4
###### Maven
```xml
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>(latest version)</version>
</dependency>
```
###### Gradle
```groovy
compile group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-structures-r4', version: '(latest version)'
```
##### org.hl7.fhir.r5
###### Maven
```xml
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r5</artifactId>
<version>(latest version)</version>
</dependency>
```
###### Gradle
```groovy
compile group: 'ca.uhn.hapi.fhir', name: 'hapi-fhir-structures-r5', version: '(latest version)'
```
### Maintenance
This project is maintained by [Grahame Grieve][Link-grahameGithub] and [James Agnew][Link-jamesGithub] on behalf of the FHIR community.
[Link-AzureProject]: https://dev.azure.com/fhir-pipelines/fhir-core-library
[Link-BuildPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_build/latest?definitionId=16&branchName=master
[Link-SnapshotPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_build/latest?definitionId=17&branchName=master
[Link-r4SonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r4&v=LATEST "Sonatype Snapshot"
[Link-r4SonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r4&v=LATEST "Sonatype Release"
[Link-r5SonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r5&v=LATEST "Sonatype Snapshot"
[Link-r5SonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.r5&v=LATEST "Sonatype Release"
[Link-cliSonatypeSnapshot]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.validation.cli&v=LATEST "Sonatype Snapshot"
[Link-cliSonatypeRelease]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=ca.uhn.hapi.fhir&a=org.hl7.fhir.validation.cli&v=LATEST "Sonatype Release"
[Link-grahameGithub]: https://github.com/grahamegrieve
[Link-jamesGithub]: https://github.com/jamesagnew
[Badge-BuildPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_apis/build/status/Build%20%26%20Test?branchName=master
[Badge-SnapshotPipeline]: https://dev.azure.com/fhir-pipelines/fhir-core-library/_apis/build/status/Module%20SNAPSHOT%20Publisher?branchName=master
[Badge-r4SonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r4.svg "Sonatype Releases"
[Badge-r4SonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r4.svg "Sonatype Snapshots"
[Badge-r5SonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r5.svg "Sonatype Releases"
[Badge-r5SonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.r5.svg "Sonatype Snapshots"
[Badge-cliSonatypeRelease]: https://img.shields.io/nexus/r/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.cli.svg "Sonatype Releases"
[Badge-cliSonatypeSnapshot]: https://img.shields.io/nexus/s/https/oss.sonatype.org/ca.uhn.hapi.fhir/org.hl7.fhir.validation.cli.svg "Sonatype Snapshots"

View File

@ -1 +0,0 @@

View File

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

View File

@ -42,6 +42,10 @@ import java.util.Locale;
import java.util.Set;
import java.util.TimeZone;
import org.hl7.fhir.convertors.loaders.R2016MayToR4Loader;
import org.hl7.fhir.convertors.loaders.R2ToR4Loader;
import org.hl7.fhir.convertors.loaders.R3ToR4Loader;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.conformance.ProfileUtilities;

View File

@ -48,6 +48,7 @@ import java.util.UUID;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.hl7.fhir.convertors.loaders.R2ToR3Loader;
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
import org.hl7.fhir.dstu3.elementmodel.Manager;
import org.hl7.fhir.dstu3.elementmodel.Manager.FhirFormat;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
public abstract class BaseLoader {

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
/*
Copyright (c) 2011+, HL7, Inc.
@ -37,6 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_14_40;
import org.hl7.fhir.dstu2016may.formats.JsonParser;
import org.hl7.fhir.dstu2016may.formats.XmlParser;
import org.hl7.fhir.dstu2016may.model.Resource;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
/*
Copyright (c) 2011+, HL7, Inc.
@ -37,6 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_14_50;
import org.hl7.fhir.dstu2016may.formats.JsonParser;
import org.hl7.fhir.dstu2016may.formats.XmlParser;
import org.hl7.fhir.dstu2016may.model.Resource;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
/*
Copyright (c) 2011+, HL7, Inc.
@ -37,6 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.dstu2.formats.JsonParser;
import org.hl7.fhir.dstu2.formats.XmlParser;
import org.hl7.fhir.dstu2.model.Resource;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
/*
Copyright (c) 2011+, HL7, Inc.
@ -37,6 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.dstu2.formats.JsonParser;
import org.hl7.fhir.dstu2.formats.XmlParser;
import org.hl7.fhir.dstu2.model.Resource;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
/*
Copyright (c) 2011+, HL7, Inc.
@ -37,6 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.dstu2.formats.JsonParser;
import org.hl7.fhir.dstu2.formats.XmlParser;
import org.hl7.fhir.dstu2.model.Resource;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
/*
Copyright (c) 2011+, HL7, Inc.
@ -37,6 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_30_40;
import org.hl7.fhir.dstu3.formats.JsonParser;
import org.hl7.fhir.dstu3.formats.XmlParser;
import org.hl7.fhir.dstu3.model.Resource;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
/*
Copyright (c) 2011+, HL7, Inc.
@ -37,6 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.dstu3.formats.JsonParser;
import org.hl7.fhir.dstu3.formats.XmlParser;
import org.hl7.fhir.dstu3.model.Resource;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
/*
Copyright (c) 2011+, HL7, Inc.
@ -37,6 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.formats.JsonParser;
import org.hl7.fhir.r4.formats.XmlParser;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.loaders;
/*
Copyright (c) 2011+, HL7, Inc.
@ -37,6 +37,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.formats.XmlParser;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.misc;
/*
Copyright (c) 2011+, HL7, Inc.
@ -38,6 +38,8 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
import org.hl7.fhir.convertors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu3.model.Bundle;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.misc;
/*
Copyright (c) 2011+, HL7, Inc.
@ -35,6 +35,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.hl7.fhir.convertors.VersionConvertor_14_30;
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
public class IGPackConverter140 {

View File

@ -1,4 +1,6 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.misc;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
/*
Copyright (c) 2011+, HL7, Inc.

View File

@ -1,4 +1,6 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.misc;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
/*
Copyright (c) 2011+, HL7, Inc.

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.misc;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
@ -17,6 +17,16 @@ import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
import org.hl7.fhir.dstu2.model.ClaimResponse.ErrorsComponent;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.VersionConvertor_14_30;
import org.hl7.fhir.convertors.VersionConvertor_14_40;
import org.hl7.fhir.convertors.VersionConvertor_14_50;
import org.hl7.fhir.convertors.VersionConvertor_30_40;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.txClient;
/*
Copyright (c) 2011+, HL7, Inc.
@ -35,7 +35,6 @@ import java.net.URISyntaxException;
import org.hl7.fhir.r5.model.FhirPublication;
import org.hl7.fhir.r5.terminologies.TerminologyClient;
import org.hl7.fhir.r5.terminologies.TerminologyClientR5;
import org.hl7.fhir.utilities.Utilities;
public class TerminologyClientFactory {

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.txClient;
/*
Copyright (c) 2011+, HL7, Inc.
@ -34,6 +34,7 @@ package org.hl7.fhir.convertors;
import java.net.URISyntaxException;
import java.util.Map;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.dstu2.utils.client.FHIRToolingClient;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CapabilityStatement;
@ -41,7 +42,7 @@ import org.hl7.fhir.r5.model.Parameters;
import org.hl7.fhir.r5.model.TerminologyCapabilities;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.terminologies.TerminologyClient;
import org.hl7.fhir.r5.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.ToolingClientLogger;
public class TerminologyClientR2 implements TerminologyClient {
@ -84,13 +85,21 @@ public class TerminologyClientR2 implements TerminologyClient {
}
@Override
public void setTimeout(int i) {
// ignored in this version - need to roll R4 internal changes back to R2 if desired
public TerminologyClient setTimeout(int i) {
client.setTimeout(i);
return this;
}
@Override
public void setLogger(ToolingClientLogger txLog) {
// ignored in this version - need to roll R4 internal changes back to R2 if desired
public TerminologyClient setLogger(ToolingClientLogger txLog) {
client.setLogger(txLog);
return this;
}
@Override
public TerminologyClient setRetryCount(int retryCount) throws FHIRException {
client.setRetryCount(retryCount);
return this;
}
@Override
@ -102,4 +111,6 @@ public class TerminologyClientR2 implements TerminologyClient {
public Parameters lookupCode(Map<String, String> params) throws FHIRException {
return (Parameters) VersionConvertor_10_50.convertResource(client.lookupCode(params));
}
}

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.txClient;
/*
Copyright (c) 2011+, HL7, Inc.
@ -34,6 +34,7 @@ package org.hl7.fhir.convertors;
import java.net.URISyntaxException;
import java.util.Map;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.dstu3.utils.client.FHIRToolingClient;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CapabilityStatement;
@ -41,7 +42,7 @@ import org.hl7.fhir.r5.model.Parameters;
import org.hl7.fhir.r5.model.TerminologyCapabilities;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.terminologies.TerminologyClient;
import org.hl7.fhir.r5.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.ToolingClientLogger;
public class TerminologyClientR3 implements TerminologyClient {
@ -84,13 +85,21 @@ public class TerminologyClientR3 implements TerminologyClient {
}
@Override
public void setTimeout(int i) {
// ignored in this version - need to roll R4 internal changes back to R2 if desired
public TerminologyClient setTimeout(int i) {
client.setTimeout(i);
return this;
}
@Override
public void setLogger(ToolingClientLogger txLog) {
// ignored in this version - need to roll R4 internal changes back to R2 if desired
public TerminologyClient setLogger(ToolingClientLogger txLog) {
client.setLogger(txLog);
return this;
}
@Override
public TerminologyClient setRetryCount(int retryCount) throws FHIRException {
client.setRetryCount(retryCount);
return this;
}
@Override

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.convertors;
package org.hl7.fhir.convertors.txClient;
/*
Copyright (c) 2011+, HL7, Inc.
@ -34,6 +34,7 @@ package org.hl7.fhir.convertors;
import java.net.URISyntaxException;
import java.util.Map;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.convertors.conv40_50.TerminologyCapabilities40_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.utils.client.FHIRToolingClient;
@ -42,7 +43,7 @@ import org.hl7.fhir.r5.model.Parameters;
import org.hl7.fhir.r5.model.TerminologyCapabilities;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.terminologies.TerminologyClient;
import org.hl7.fhir.r5.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.ToolingClientLogger;
public class TerminologyClientR4 implements TerminologyClient {
@ -85,13 +86,21 @@ public class TerminologyClientR4 implements TerminologyClient {
}
@Override
public void setTimeout(int i) {
// ignored in this version - need to roll R4 internal changes back to R2 if desired
public TerminologyClient setTimeout(int i) {
client.setTimeout(i);
return this;
}
@Override
public void setLogger(ToolingClientLogger txLog) {
// ignored in this version - need to roll R4 internal changes back to R2 if desired
public TerminologyClient setLogger(ToolingClientLogger txLog) {
client.setLogger(txLog);
return this;
}
@Override
public TerminologyClient setRetryCount(int retryCount) throws FHIRException {
client.setRetryCount(retryCount);
return this;
}
@Override

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.r5.terminologies;
package org.hl7.fhir.convertors.txClient;
/*
Copyright (c) 2011+, HL7, Inc.
@ -34,13 +34,15 @@ package org.hl7.fhir.r5.terminologies;
import java.net.URISyntaxException;
import java.util.Map;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CapabilityStatement;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.Parameters;
import org.hl7.fhir.r5.model.TerminologyCapabilities;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.terminologies.TerminologyClient;
import org.hl7.fhir.r5.utils.client.FHIRToolingClient;
import org.hl7.fhir.r5.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.ToolingClientLogger;
public class TerminologyClientR5 implements TerminologyClient {
@ -76,13 +78,15 @@ public class TerminologyClientR5 implements TerminologyClient {
}
@Override
public void setTimeout(int i) {
public TerminologyClient setTimeout(int i) {
client.setTimeout(i);
return this;
}
@Override
public void setLogger(ToolingClientLogger txLog) {
public TerminologyClient setLogger(ToolingClientLogger txLog) {
client.setLogger(txLog);
return this;
}
@Override
@ -95,4 +99,10 @@ public class TerminologyClientR5 implements TerminologyClient {
return client.lookupCode(params);
}
@Override
public TerminologyClient setRetryCount(int retryCount) throws FHIRException {
client.setRetryCount(retryCount);
return this;
}
}

View File

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

View File

@ -7,19 +7,19 @@ package org.hl7.fhir.dstu2.utils.client;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@ -30,29 +30,33 @@ package org.hl7.fhir.dstu2.utils.client;
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
*/
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@ -68,6 +72,8 @@ import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.hl7.fhir.dstu2.formats.IParser;
import org.hl7.fhir.dstu2.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu2.formats.JsonParser;
@ -79,6 +85,7 @@ import org.hl7.fhir.dstu2.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.dstu2.model.ResourceType;
import org.hl7.fhir.dstu2.utils.ResourceUtilities;
import org.hl7.fhir.utilities.ToolingClientLogger;
/**
* Helper class handling lower level HTTP transport concerns.
@ -86,393 +93,429 @@ import org.hl7.fhir.dstu2.utils.ResourceUtilities;
* @author Claude Nanjo
*/
public class ClientUtils {
public static String DEFAULT_CHARSET = "UTF-8";
public static final String HEADER_LOCATION = "location";
public static <T extends Resource> ResourceRequest<T> issueOptionsRequest(URI optionsUri, String resourceFormat, HttpHost proxy) {
HttpOptions options = new HttpOptions(optionsUri);
return issueResourceRequest(resourceFormat, options, proxy);
}
public static <T extends Resource> ResourceRequest<T> issueGetResourceRequest(URI resourceUri, String resourceFormat, HttpHost proxy) {
HttpGet httpget = new HttpGet(resourceUri);
return issueResourceRequest(resourceFormat, httpget, proxy);
}
public static <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers, HttpHost proxy) {
HttpPut httpPut = new HttpPut(resourceUri);
return issueResourceRequest(resourceFormat, httpPut, payload, headers, proxy);
}
public static <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat, HttpHost proxy) {
HttpPut httpPut = new HttpPut(resourceUri);
return issueResourceRequest(resourceFormat, httpPut, payload, null, proxy);
}
public static <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers, HttpHost proxy) {
HttpPost httpPost = new HttpPost(resourceUri);
return issueResourceRequest(resourceFormat, httpPost, payload, headers, proxy);
}
public static <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat, HttpHost proxy) {
return issuePostRequest(resourceUri, payload, resourceFormat, null, proxy);
}
public static Bundle issueGetFeedRequest(URI resourceUri, String resourceFormat, HttpHost proxy) {
HttpGet httpget = new HttpGet(resourceUri);
configureFhirRequest(httpget, resourceFormat);
HttpResponse response = sendRequest(httpget, proxy);
return unmarshalReference(response, resourceFormat);
}
public static Bundle postBatchRequest(URI resourceUri, byte[] payload, String resourceFormat, HttpHost proxy) {
HttpPost httpPost = new HttpPost(resourceUri);
configureFhirRequest(httpPost, resourceFormat);
HttpResponse response = sendPayload(httpPost, payload, proxy);
return unmarshalFeed(response, resourceFormat);
}
public static boolean issueDeleteRequest(URI resourceUri, HttpHost proxy) {
HttpDelete deleteRequest = new HttpDelete(resourceUri);
HttpResponse response = sendRequest(deleteRequest, proxy);
int responseStatusCode = response.getStatusLine().getStatusCode();
boolean deletionSuccessful = false;
if(responseStatusCode == 204) {
deletionSuccessful = true;
}
return deletionSuccessful;
}
/***********************************************************
* Request/Response Helper methods
***********************************************************/
protected static <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, HttpHost proxy) {
return issueResourceRequest(resourceFormat, request, null, proxy);
}
/**
* @param resourceFormat
* @param options
* @return
*/
protected static <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload, HttpHost proxy) {
return issueResourceRequest(resourceFormat, request, payload, null, proxy);
}
/**
* @param resourceFormat
* @param options
* @return
*/
protected static <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload, List<Header> headers, HttpHost proxy) {
configureFhirRequest(request, resourceFormat, headers);
HttpResponse response = null;
if(request instanceof HttpEntityEnclosingRequest && payload != null) {
response = sendPayload((HttpEntityEnclosingRequestBase)request, payload, proxy);
} else if (request instanceof HttpEntityEnclosingRequest && payload == null){
throw new EFhirClientException("PUT and POST requests require a non-null payload");
} else {
response = sendRequest(request, proxy);
}
T resource = unmarshalReference(response, resourceFormat);
return new ResourceRequest<T>(resource, response.getStatusLine().getStatusCode(), ClientUtils.getLocationHeader(response));
}
/**
* Method adds required request headers.
* TODO handle JSON request as well.
*
* @param request
*/
protected static void configureFhirRequest(HttpRequest request, String format) {
configureFhirRequest(request, format, null);
}
/**
* Method adds required request headers.
* TODO handle JSON request as well.
*
* @param request
*/
protected static void configureFhirRequest(HttpRequest request, String format, List<Header> headers) {
request.addHeader("User-Agent", "Java FHIR Client for FHIR");
if (format != null) {
request.addHeader("Accept",format);
request.addHeader("Content-Type", format + ";charset=" + DEFAULT_CHARSET);
}
request.addHeader("Accept-Charset", DEFAULT_CHARSET);
if(headers != null) {
for(Header header : headers) {
request.addHeader(header);
}
}
}
/**
* Method posts request payload
*
* @param request
* @param payload
* @return
*/
protected static HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload, HttpHost proxy) {
HttpResponse response = null;
try {
HttpClient httpclient = new DefaultHttpClient();
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
request.setEntity(new ByteArrayEntity(payload));
response = httpclient.execute(request);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending HTTP Post/Put Payload", ioe);
}
return response;
}
/**
*
* @param request
* @param payload
* @return
*/
protected static HttpResponse sendRequest(HttpUriRequest request, HttpHost proxy) {
HttpResponse response = null;
try {
HttpClient httpclient = new DefaultHttpClient();
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
response = httpclient.execute(request);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending Http Request", ioe);
}
return response;
}
/**
* Unmarshals a resource from the response stream.
*
* @param response
* @return
*/
@SuppressWarnings("unchecked")
protected static <T extends Resource> T unmarshalReference(HttpResponse response, String format) {
T resource = null;
OperationOutcome error = null;
InputStream instream = null;
HttpEntity entity = response.getEntity();
if (entity != null && entity.getContentLength() > 0) {
try {
instream = entity.getContent();
// System.out.println(writeInputStreamAsString(instream));
resource = (T)getParser(format).parse(instream);
if (resource instanceof OperationOutcome && hasError((OperationOutcome)resource)) {
error = (OperationOutcome) resource;
}
} catch(IOException ioe) {
throw new EFhirClientException("Error unmarshalling entity from Http Response", ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message", e);
} finally {
try{instream.close();}catch(IOException ioe){/* TODO log error */}
}
}
if(error != null) {
throw new EFhirClientException("Error unmarshalling resource: "+ResourceUtilities.getErrorDescription(error), error);
}
return resource;
}
/**
* Unmarshals Bundle from response stream.
*
* @param response
* @return
*/
protected static Bundle unmarshalFeed(HttpResponse response, String format) {
Bundle feed = null;
InputStream instream = null;
HttpEntity entity = response.getEntity();
String contentType = response.getHeaders("Content-Type")[0].getValue();
OperationOutcome error = null;
try {
if (entity != null) {
instream = entity.getContent();
if(contentType.contains(ResourceFormat.RESOURCE_XML.getHeader()) || contentType.contains("text/xml+fhir")) {
// error = (OperationOutcome)getParser(ResourceFormat.RESOURCE_XML.getHeader()).parse(instream);
// } else {
Resource rf = getParser(format).parse(instream);
if (rf instanceof Bundle)
feed = (Bundle) rf;
else if (rf instanceof OperationOutcome && hasError((OperationOutcome) rf)) {
error = (OperationOutcome) rf;
} else {
throw new EFhirClientException("Error unmarshalling feed from Http Response: a resource was returned instead");
}
}
instream.close();
}
} catch(IOException ioe) {
throw new EFhirClientException("Error unmarshalling feed from Http Response", ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message", e);
} finally {
try{instream.close();}catch(IOException ioe){/* TODO log error */}
}
if(error != null) {
throw new EFhirClientException("Error unmarshalling feed: "+ResourceUtilities.getErrorDescription(error), error);
}
return feed;
}
private static boolean hasError(OperationOutcome oo) {
for (OperationOutcomeIssueComponent t : oo.getIssue())
if (t.getSeverity() == IssueSeverity.ERROR || t.getSeverity() == IssueSeverity.FATAL)
return true;
return false;
public static final String DEFAULT_CHARSET = "UTF-8";
public static final String HEADER_LOCATION = "location";
private HttpHost proxy;
private int timeout = 5000;
private String username;
private String password;
private ToolingClientLogger logger;
private int retryCount;
public HttpHost getProxy() {
return proxy;
}
protected static String getLocationHeader(HttpResponse response) {
String location = null;
if(response.getHeaders("location").length > 0) {//TODO Distinguish between both cases if necessary
location = response.getHeaders("location")[0].getValue();
} else if(response.getHeaders("content-location").length > 0) {
location = response.getHeaders("content-location")[0].getValue();
}
return location;
}
/*****************************************************************
* Client connection methods
* ***************************************************************/
public static HttpURLConnection buildConnection(URI baseServiceUri, String tail) {
try {
HttpURLConnection client = (HttpURLConnection) baseServiceUri.resolve(tail).toURL().openConnection();
return client;
} catch(MalformedURLException mue) {
throw new EFhirClientException("Invalid Service URL", mue);
} catch(IOException ioe) {
throw new EFhirClientException("Unable to establish connection to server: " + baseServiceUri.toString() + tail, ioe);
}
}
public static HttpURLConnection buildConnection(URI baseServiceUri, ResourceType resourceType, String id) {
return buildConnection(baseServiceUri, ResourceAddress.buildRelativePathFromResourceType(resourceType, id));
}
/******************************************************************
* Other general helper methods
* ****************************************************************/
public static <T extends Resource> byte[] getResourceAsByteArray(T resource, boolean pretty, boolean isJson) {
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
baos = new ByteArrayOutputStream();
IParser parser = null;
if(isJson) {
parser = new JsonParser();
} else {
parser = new XmlParser();
}
public void setProxy(HttpHost proxy) {
this.proxy = proxy;
}
public int getTimeout() {
return timeout;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public <T extends Resource> ResourceRequest<T> issueOptionsRequest(URI optionsUri, String resourceFormat) {
HttpOptions options = new HttpOptions(optionsUri);
return issueResourceRequest(resourceFormat, options);
}
public <T extends Resource> ResourceRequest<T> issueGetResourceRequest(URI resourceUri, String resourceFormat) {
HttpGet httpget = new HttpGet(resourceUri);
return issueResourceRequest(resourceFormat, httpget);
}
public <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers) {
HttpPut httpPut = new HttpPut(resourceUri);
return issueResourceRequest(resourceFormat, httpPut, payload, headers);
}
public <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat) {
HttpPut httpPut = new HttpPut(resourceUri);
return issueResourceRequest(resourceFormat, httpPut, payload, null);
}
public <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers) {
HttpPost httpPost = new HttpPost(resourceUri);
return issueResourceRequest(resourceFormat, httpPost, payload, headers);
}
public <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat) {
return issuePostRequest(resourceUri, payload, resourceFormat, null);
}
public Bundle issueGetFeedRequest(URI resourceUri, String resourceFormat) {
HttpGet httpget = new HttpGet(resourceUri);
configureFhirRequest(httpget, resourceFormat);
HttpResponse response = sendRequest(httpget);
return unmarshalReference(response, resourceFormat);
}
private void setAuth(HttpRequest httpget) {
if (password != null) {
try {
byte[] b = Base64.encodeBase64((username+":"+password).getBytes("ASCII"));
String b64 = new String(b, StandardCharsets.US_ASCII);
httpget.setHeader("Authorization", "Basic " + b64);
} catch (UnsupportedEncodingException e) {
}
}
}
public Bundle postBatchRequest(URI resourceUri, byte[] payload, String resourceFormat) {
HttpPost httpPost = new HttpPost(resourceUri);
configureFhirRequest(httpPost, resourceFormat);
HttpResponse response = sendPayload(httpPost, payload, proxy);
return unmarshalFeed(response, resourceFormat);
}
public boolean issueDeleteRequest(URI resourceUri) {
HttpDelete deleteRequest = new HttpDelete(resourceUri);
HttpResponse response = sendRequest(deleteRequest);
int responseStatusCode = response.getStatusLine().getStatusCode();
boolean deletionSuccessful = false;
if(responseStatusCode == 204) {
deletionSuccessful = true;
}
return deletionSuccessful;
}
/***********************************************************
* Request/Response Helper methods
***********************************************************/
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request) {
return issueResourceRequest(resourceFormat, request, null);
}
/**
* @param resourceFormat
* @param options
* @return
*/
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload) {
return issueResourceRequest(resourceFormat, request, payload, null);
}
/**
* @param resourceFormat
* @param options
* @return
*/
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload, List<Header> headers) {
configureFhirRequest(request, resourceFormat, headers);
HttpResponse response = null;
if(request instanceof HttpEntityEnclosingRequest && payload != null) {
response = sendPayload((HttpEntityEnclosingRequestBase)request, payload, proxy);
} else if (request instanceof HttpEntityEnclosingRequest && payload == null){
throw new EFhirClientException("PUT and POST requests require a non-null payload");
} else {
response = sendRequest(request);
}
T resource = unmarshalReference(response, resourceFormat);
return new ResourceRequest<T>(resource, response.getStatusLine().getStatusCode(), getLocationHeader(response));
}
/**
* Method adds required request headers.
* TODO handle JSON request as well.
*
* @param request
*/
protected void configureFhirRequest(HttpRequest request, String format) {
configureFhirRequest(request, format, null);
}
/**
* Method adds required request headers.
* TODO handle JSON request as well.
*
* @param request
*/
protected void configureFhirRequest(HttpRequest request, String format, List<Header> headers) {
request.addHeader("User-Agent", "Java FHIR Client for FHIR");
if (format != null) {
request.addHeader("Accept",format);
request.addHeader("Content-Type", format + ";charset=" + DEFAULT_CHARSET);
}
request.addHeader("Accept-Charset", DEFAULT_CHARSET);
if(headers != null) {
for(Header header : headers) {
request.addHeader(header);
}
}
setAuth(request);
}
/**
* Method posts request payload
*
* @param request
* @param payload
* @return
*/
protected HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload, HttpHost proxy) {
HttpResponse response = null;
boolean ok = false;
int tryCount = 0;
while (!ok) {
try {
tryCount++;
HttpClient httpclient = new DefaultHttpClient();
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
request.setEntity(new ByteArrayEntity(payload));
log(request);
response = httpclient.execute(request);
ok = true;
} catch(IOException ioe) {
if (tryCount <= retryCount) {
ok = false;
} else {
throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe);
}
}
}
return response;
}
/**
*
* @param request
* @param payload
* @return
*/
protected HttpResponse sendRequest(HttpUriRequest request) {
HttpResponse response = null;
try {
HttpClient httpclient = new DefaultHttpClient();
log(request);
HttpParams params = httpclient.getParams();
HttpConnectionParams.setConnectionTimeout(params, timeout);
HttpConnectionParams.setSoTimeout(params, timeout);
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
response = httpclient.execute(request);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending Http Request: "+ioe.getMessage(), ioe);
}
return response;
}
/**
* Unmarshals a resource from the response stream.
*
* @param response
* @return
*/
@SuppressWarnings("unchecked")
protected <T extends Resource> T unmarshalReference(HttpResponse response, String format) {
T resource = null;
OperationOutcome error = null;
byte[] cnt = log(response);
if (cnt != null) {
try {
resource = (T)getParser(format).parse(cnt);
if (resource instanceof OperationOutcome && hasError((OperationOutcome)resource)) {
error = (OperationOutcome) resource;
}
} catch(IOException ioe) {
throw new EFhirClientException("Error reading Http Response: "+ioe.getMessage(), ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message: "+e.getMessage(), e);
}
}
if(error != null) {
throw new EFhirClientException("Error from server: "+ResourceUtilities.getErrorDescription(error), error);
}
return resource;
}
/**
* Unmarshals Bundle from response stream.
*
* @param response
* @return
*/
protected Bundle unmarshalFeed(HttpResponse response, String format) {
Bundle feed = null;
byte[] cnt = log(response);
String contentType = response.getHeaders("Content-Type")[0].getValue();
OperationOutcome error = null;
try {
if (cnt != null) {
if(contentType.contains(ResourceFormat.RESOURCE_XML.getHeader()) || contentType.contains("text/xml+fhir")) {
Resource rf = getParser(format).parse(cnt);
if (rf instanceof Bundle)
feed = (Bundle) rf;
else if (rf instanceof OperationOutcome && hasError((OperationOutcome) rf)) {
error = (OperationOutcome) rf;
} else {
throw new EFhirClientException("Error reading server response: a resource was returned instead");
}
}
}
} catch(IOException ioe) {
throw new EFhirClientException("Error reading Http Response", ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message", e);
}
if(error != null) {
throw new EFhirClientException("Error from server: "+ResourceUtilities.getErrorDescription(error), error);
}
return feed;
}
private boolean hasError(OperationOutcome oo) {
for (OperationOutcomeIssueComponent t : oo.getIssue())
if (t.getSeverity() == IssueSeverity.ERROR || t.getSeverity() == IssueSeverity.FATAL)
return true;
return false;
}
protected String getLocationHeader(HttpResponse response) {
String location = null;
if(response.getHeaders("location").length > 0) {//TODO Distinguish between both cases if necessary
location = response.getHeaders("location")[0].getValue();
} else if(response.getHeaders("content-location").length > 0) {
location = response.getHeaders("content-location")[0].getValue();
}
return location;
}
/*****************************************************************
* Client connection methods
* ***************************************************************/
public HttpURLConnection buildConnection(URI baseServiceUri, String tail) {
try {
HttpURLConnection client = (HttpURLConnection) baseServiceUri.resolve(tail).toURL().openConnection();
return client;
} catch(MalformedURLException mue) {
throw new EFhirClientException("Invalid Service URL", mue);
} catch(IOException ioe) {
throw new EFhirClientException("Unable to establish connection to server: " + baseServiceUri.toString() + tail, ioe);
}
}
public HttpURLConnection buildConnection(URI baseServiceUri, ResourceType resourceType, String id) {
return buildConnection(baseServiceUri, ResourceAddress.buildRelativePathFromResourceType(resourceType, id));
}
/******************************************************************
* Other general helper methods
* ****************************************************************/
public <T extends Resource> byte[] getResourceAsByteArray(T resource, boolean pretty, boolean isJson) {
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
baos = new ByteArrayOutputStream();
IParser parser = null;
if(isJson) {
parser = new JsonParser();
} else {
parser = new XmlParser();
}
parser.setOutputStyle(pretty ? OutputStyle.PRETTY : OutputStyle.NORMAL);
parser.compose(baos, resource);
baos.close();
byteArray = baos.toByteArray();
baos.close();
} catch (Exception e) {
try{
baos.close();
}catch(Exception ex) {
throw new EFhirClientException("Error closing output stream", ex);
}
throw new EFhirClientException("Error converting output stream to byte array", e);
}
return byteArray;
}
public static byte[] getFeedAsByteArray(Bundle feed, boolean pretty, boolean isJson) {
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
baos = new ByteArrayOutputStream();
IParser parser = null;
if(isJson) {
parser = new JsonParser();
} else {
parser = new XmlParser();
}
parser.compose(baos, resource);
baos.close();
byteArray = baos.toByteArray();
baos.close();
} catch (Exception e) {
try{
baos.close();
}catch(Exception ex) {
throw new EFhirClientException("Error closing output stream", ex);
}
throw new EFhirClientException("Error converting output stream to byte array", e);
}
return byteArray;
}
public byte[] getFeedAsByteArray(Bundle feed, boolean pretty, boolean isJson) {
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
baos = new ByteArrayOutputStream();
IParser parser = null;
if(isJson) {
parser = new JsonParser();
} else {
parser = new XmlParser();
}
parser.setOutputStyle(pretty ? OutputStyle.PRETTY : OutputStyle.NORMAL);
parser.compose(baos, feed);
baos.close();
byteArray = baos.toByteArray();
baos.close();
} catch (Exception e) {
try{
baos.close();
}catch(Exception ex) {
throw new EFhirClientException("Error closing output stream", ex);
}
throw new EFhirClientException("Error converting output stream to byte array", e);
}
return byteArray;
}
public static Calendar getLastModifiedResponseHeaderAsCalendarObject(URLConnection serverConnection) {
String dateTime = null;
try {
dateTime = serverConnection.getHeaderField("Last-Modified");
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
Date lastModifiedTimestamp = format.parse(dateTime);
Calendar calendar=Calendar.getInstance();
calendar.setTime(lastModifiedTimestamp);
return calendar;
} catch(ParseException pe) {
throw new EFhirClientException("Error parsing Last-Modified response header " + dateTime, pe);
}
}
protected static IParser getParser(String format) {
if(StringUtils.isBlank(format)) {
format = ResourceFormat.RESOURCE_XML.getHeader();
}
if(format.equalsIgnoreCase("json") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader()) || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
return new JsonParser();
} else if(format.equalsIgnoreCase("xml") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader()) || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
return new XmlParser();
} else {
throw new EFhirClientException("Invalid format: " + format);
}
}
/**
* Used for debugging
*
* @param instream
* @return
*/
protected static String writeInputStreamAsString(InputStream instream) {
String value = null;
try {
value = IOUtils.toString(instream, "UTF-8");
System.out.println(value);
} catch(IOException ioe) {
//Do nothing
}
return value;
}
public static Bundle issuePostFeedRequest(URI resourceUri, Map<String, String> parameters, String resourceName, Resource resource, String resourceFormat) throws IOException {
parser.compose(baos, feed);
baos.close();
byteArray = baos.toByteArray();
baos.close();
} catch (Exception e) {
try{
baos.close();
}catch(Exception ex) {
throw new EFhirClientException("Error closing output stream", ex);
}
throw new EFhirClientException("Error converting output stream to byte array", e);
}
return byteArray;
}
public Calendar getLastModifiedResponseHeaderAsCalendarObject(URLConnection serverConnection) {
String dateTime = null;
try {
dateTime = serverConnection.getHeaderField("Last-Modified");
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", new Locale("en", "US"));
Date lastModifiedTimestamp = format.parse(dateTime);
Calendar calendar=Calendar.getInstance();
calendar.setTime(lastModifiedTimestamp);
return calendar;
} catch(ParseException pe) {
throw new EFhirClientException("Error parsing Last-Modified response header " + dateTime, pe);
}
}
protected IParser getParser(String format) {
if(StringUtils.isBlank(format)) {
format = ResourceFormat.RESOURCE_XML.getHeader();
}
if(format.equalsIgnoreCase("json") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader()) || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
return new JsonParser();
} else if(format.equalsIgnoreCase("xml") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader()) || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
return new XmlParser();
} else {
throw new EFhirClientException("Invalid format: " + format);
}
}
public Bundle issuePostFeedRequest(URI resourceUri, Map<String, String> parameters, String resourceName, Resource resource, String resourceFormat) throws IOException {
HttpPost httppost = new HttpPost(resourceUri);
String boundary = "----WebKitFormBoundarykbMUo6H8QaUnYtRy";
httppost.addHeader("Content-Type", "multipart/form-data; boundary="+boundary);
@ -481,8 +524,8 @@ public class ClientUtils {
HttpResponse response = sendPayload(httppost, encodeFormSubmission(parameters, resourceName, resource, boundary));
return unmarshalFeed(response, resourceFormat);
}
private static byte[] encodeFormSubmission(Map<String, String> parameters, String resourceName, Resource resource, String boundary) throws IOException {
private byte[] encodeFormSubmission(Map<String, String> parameters, String resourceName, Resource resource, String boundary) throws IOException {
ByteArrayOutputStream b = new ByteArrayOutputStream();
OutputStreamWriter w = new OutputStreamWriter(b, "UTF-8");
for (String name : parameters.keySet()) {
@ -514,17 +557,99 @@ public class ClientUtils {
* @param payload
* @return
*/
protected static HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload) {
protected HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload) {
HttpResponse response = null;
try {
log(request);
HttpClient httpclient = new DefaultHttpClient();
request.setEntity(new ByteArrayEntity(payload));
response = httpclient.execute(request);
log(response);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe);
}
return response;
}
private void log(HttpUriRequest request) {
if (logger != null) {
List<String> headers = new ArrayList<>();
for (Header h : request.getAllHeaders()) {
headers.add(h.toString());
}
logger.logRequest(request.getMethod(), request.getURI().toString(), headers, null);
}
}
private void log(HttpEntityEnclosingRequestBase request) {
if (logger != null) {
List<String> headers = new ArrayList<>();
for (Header h : request.getAllHeaders()) {
headers.add(h.toString());
}
byte[] cnt = null;
InputStream s;
try {
s = request.getEntity().getContent();
cnt = IOUtils.toByteArray(s);
s.close();
} catch (Exception e) {
}
logger.logRequest(request.getMethod(), request.getURI().toString(), headers, cnt);
}
}
private byte[] log(HttpResponse response) {
byte[] cnt = null;
try {
InputStream s = response.getEntity().getContent();
cnt = IOUtils.toByteArray(s);
s.close();
} catch (Exception e) {
}
if (logger != null) {
List<String> headers = new ArrayList<>();
for (Header h : response.getAllHeaders()) {
headers.add(h.toString());
}
logger.logResponse(response.getStatusLine().toString(), headers, cnt);
}
return cnt;
}
public ToolingClientLogger getLogger() {
return logger;
}
public void setLogger(ToolingClientLogger logger) {
this.logger = logger;
}
/**
* Used for debugging
*
* @param instream
* @return
*/
protected String writeInputStreamAsString(InputStream instream) {
String value = null;
try {
value = IOUtils.toString(instream, "UTF-8");
System.out.println(value);
} catch(IOException ioe) {
//Do nothing
}
return value;
}
public int getRetryCount() {
return retryCount;
}
public void setRetryCount(int retryCount) {
this.retryCount = retryCount;
}
}

View File

@ -52,6 +52,7 @@ import org.hl7.fhir.dstu2.model.PrimitiveType;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.dstu2.model.StringType;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities;
/**
@ -84,6 +85,8 @@ public class FHIRToolingClient {
public static final String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ssK";
public static final String DATE_FORMAT = "yyyy-MM-dd";
public static final String hostKey = "http.proxyHost";
public static final String portKey = "http.proxyPort";
private String base;
private ResourceAddress resourceAddress;
@ -91,15 +94,42 @@ public class FHIRToolingClient {
private HttpHost proxy;
private int maxResultSetSize = -1;//_count
private Conformance conf;
private ClientUtils utils = new ClientUtils();
//Pass enpoint for client - URI
public FHIRToolingClient(String baseServiceUrl) throws URISyntaxException {
preferredResourceFormat = ResourceFormat.RESOURCE_XML;
detectProxy();
initialize(baseServiceUrl);
}
public FHIRToolingClient(String baseServiceUrl, String username, String password) throws URISyntaxException {
preferredResourceFormat = ResourceFormat.RESOURCE_XML;
utils.setUsername(username);
utils.setPassword(password);
detectProxy();
initialize(baseServiceUrl);
}
public void configureProxy(String proxyHost, int proxyPort) {
proxy = new HttpHost(proxyHost, proxyPort);
utils.setProxy(new HttpHost(proxyHost, proxyPort));
}
public void detectProxy() {
String host = System.getenv(hostKey);
String port = System.getenv(portKey);
if(host==null) {
host = System.getProperty(hostKey);
}
if(port==null) {
port = System.getProperty(portKey);
}
if(host!=null && port!=null) {
this.configureProxy(host, Integer.parseInt(port));
}
}
public void initialize(String baseServiceUrl) throws URISyntaxException {
@ -142,9 +172,9 @@ public class FHIRToolingClient {
Conformance conformance = null;
try {
if(useOptionsVerb) {
conformance = (Conformance)ClientUtils.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat(), proxy).getReference();//TODO fix this
conformance = (Conformance)utils.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat()).getReference();//TODO fix this
} else {
conformance = (Conformance)ClientUtils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(false), getPreferredResourceFormat(), proxy).getReference();
conformance = (Conformance)utils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(false), getPreferredResourceFormat()).getReference();
}
} catch(Exception e) {
handleException("An error has occurred while trying to fetch the server's conformance statement", e);
@ -162,9 +192,9 @@ public class FHIRToolingClient {
Conformance conformance = null;
try {
if(useOptionsVerb) {
conformance = (Conformance)ClientUtils.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat(), proxy).getReference();//TODO fix this
conformance = (Conformance)utils.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat()).getReference();//TODO fix this
} else {
conformance = (Conformance)ClientUtils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(true), getPreferredResourceFormat(), proxy).getReference();
conformance = (Conformance)utils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(true), getPreferredResourceFormat()).getReference();
}
} catch(Exception e) {
handleException("An error has occurred while trying to fetch the server's conformance statement", e);
@ -175,7 +205,7 @@ public class FHIRToolingClient {
public <T extends Resource> T read(Class<T> resourceClass, String id) {//TODO Change this to AddressableResource
ResourceRequest<T> result = null;
try {
result = ClientUtils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), getPreferredResourceFormat(), proxy);
result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addSuccessStatus(200);//Only one for now
@ -191,7 +221,7 @@ public class FHIRToolingClient {
public <T extends Resource> T vread(Class<T> resourceClass, String id, String version) {
ResourceRequest<T> result = null;
try {
result = ClientUtils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndIdAndVersion(resourceClass, id, version), getPreferredResourceFormat(), proxy);
result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndIdAndVersion(resourceClass, id, version), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);//unknown
@ -205,40 +235,93 @@ public class FHIRToolingClient {
return result.getPayload();
}
//
// public <T extends Resource> T update(Class<T> resourceClass, T resource, String id) {
// ResourceRequest<T> result = null;
// try {
// List<Header> headers = null;
// result = ClientUtils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),ClientUtils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// result.addErrorStatus(410);//gone
// result.addErrorStatus(404);//unknown
// result.addErrorStatus(405);
// result.addErrorStatus(422);//Unprocessable Entity
// result.addSuccessStatus(200);
// result.addSuccessStatus(201);
// if(result.isUnsuccessfulRequest()) {
// throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
// }
// } catch(Exception e) {
// throw new EFhirClientException("An error has occurred while trying to update this resource", e);
// }
// // TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
// try {
// OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
// ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
// return this.vread(resourceClass, resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
// } catch(ClassCastException e) {
// // if we fall throught we have the correct type already in the create
// }
//
// return result.getPayload();
// }
// GET fhir/ValueSet?url=http://hl7.org/fhir/ValueSet/clinical-findings&version=0.8
public <T extends Resource> T getCanonical(Class<T> resourceClass, String canonicalURL) {
ResourceRequest<T> result = null;
try {
result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndCanonical(resourceClass, canonicalURL), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);//unknown
result.addSuccessStatus(200);//Only one for now
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch (Exception e) {
handleException("An error has occurred while trying to read this version of the resource", e);
}
Bundle bnd = (Bundle) result.getPayload();
if (bnd.getEntry().size() == 0)
throw new EFhirClientException("No matching resource found for canonical URL '"+canonicalURL+"'");
if (bnd.getEntry().size() > 1)
throw new EFhirClientException("Multiple matching resources found for canonical URL '"+canonicalURL+"'");
return (T) bnd.getEntry().get(0).getResource();
}
public Resource update(Resource resource) {
ResourceRequest<Resource> result = null;
try {
List<Header> headers = null;
result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resource.getClass(), resource.getId()),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
result.addErrorStatus(422);//Unprocessable Entity
result.addSuccessStatus(200);
result.addSuccessStatus(201);
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch(Exception e) {
throw new EFhirClientException("An error has occurred while trying to update this resource", e);
}
// TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
try {
OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
return this.vread(resource.getClass(), resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
} catch(ClassCastException e) {
// if we fall throught we have the correct type already in the create
}
return result.getPayload();
}
public <T extends Resource> T update(Class<T> resourceClass, T resource, String id) {
ResourceRequest<T> result = null;
try {
List<Header> headers = null;
result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
result.addErrorStatus(422);//Unprocessable Entity
result.addSuccessStatus(200);
result.addSuccessStatus(201);
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch(Exception e) {
throw new EFhirClientException("An error has occurred while trying to update this resource", e);
}
// TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
try {
OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
return this.vread(resourceClass, resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
} catch(ClassCastException e) {
// if we fall throught we have the correct type already in the create
}
return result.getPayload();
}
//
// public <T extends Resource> boolean delete(Class<T> resourceClass, String id) {
// try {
// return ClientUtils.issueDeleteRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), proxy);
// return utils.issueDeleteRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), proxy);
// } catch(Exception e) {
// throw new EFhirClientException("An error has occurred while trying to delete this resource", e);
// }
@ -250,7 +333,7 @@ public class FHIRToolingClient {
// ResourceRequest<T> resourceRequest = null;
// try {
// List<Header> headers = null;
// resourceRequest = ClientUtils.issuePostRequest(resourceAddress.resolveGetUriFromResourceClass(resourceClass),ClientUtils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// resourceRequest = utils.issuePostRequest(resourceAddress.resolveGetUriFromResourceClass(resourceClass),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// resourceRequest.addSuccessStatus(201);
// if(resourceRequest.isUnsuccessfulRequest()) {
// throw new EFhirClientException("Server responded with HTTP error code " + resourceRequest.getHttpStatus(), (OperationOutcome)resourceRequest.getPayload());
@ -283,7 +366,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Calendar lastUpdate, Class<T> resourceClass, String id) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource", e);
// }
@ -294,7 +377,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Date lastUpdate, Class<T> resourceClass, String id) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource", e);
// }
@ -305,7 +388,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Calendar lastUpdate, Class<T> resourceClass) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource type", e);
// }
@ -316,7 +399,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Date lastUpdate, Class<T> resourceClass) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource type", e);
// }
@ -327,7 +410,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Class<T> resourceClass) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource type", e);
// }
@ -338,7 +421,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Class<T> resourceClass, String id) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource", e);
// }
@ -349,7 +432,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Date lastUpdate) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history since last update",e);
// }
@ -360,7 +443,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Calendar lastUpdate) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history since last update",e);
// }
@ -371,7 +454,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history() {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history since last update",e);
// }
@ -382,7 +465,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle search(Class<T> resourceClass, Map<String, String> parameters) {
// Bundle searchResults = null;
// try {
// searchResults = ClientUtils.issueGetFeedRequest(resourceAddress.resolveSearchUri(resourceClass, parameters), getPreferredResourceFormat(), proxy);
// searchResults = utils.issueGetFeedRequest(resourceAddress.resolveSearchUri(resourceClass, parameters), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("Error performing search with parameters " + parameters, e);
// }
@ -393,7 +476,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle searchPost(Class<T> resourceClass, T resource, Map<String, String> parameters) {
// Bundle searchResults = null;
// try {
// searchResults = ClientUtils.issuePostFeedRequest(resourceAddress.resolveSearchUri(resourceClass, new HashMap<String, String>()), parameters, "src", resource, getPreferredResourceFormat());
// searchResults = utils.issuePostFeedRequest(resourceAddress.resolveSearchUri(resourceClass, new HashMap<String, String>()), parameters, "src", resource, getPreferredResourceFormat());
// } catch (Exception e) {
// handleException("Error performing search with parameters " + parameters, e);
// }
@ -414,9 +497,9 @@ public class FHIRToolingClient {
ps += p.getName() + "=" + Utilities.encodeUri(((PrimitiveType) p.getValue()).asStringValue())+"&";
ResourceRequest<T> result;
if (complex)
result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), ClientUtils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), proxy);
result = utils.issuePostRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat());
else
result = ClientUtils.issueGetResourceRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), getPreferredResourceFormat(), proxy);
result = utils.issueGetResourceRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addSuccessStatus(200);//Only one for now
@ -439,7 +522,7 @@ public class FHIRToolingClient {
public Bundle transaction(Bundle batch) {
Bundle transactionResult = null;
try {
transactionResult = ClientUtils.postBatchRequest(resourceAddress.getBaseServiceUri(), ClientUtils.getFeedAsByteArray(batch, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), proxy);
transactionResult = utils.postBatchRequest(resourceAddress.getBaseServiceUri(), utils.getFeedAsByteArray(batch, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat());
} catch (Exception e) {
handleException("An error occurred trying to process this transaction request", e);
}
@ -451,7 +534,7 @@ public class FHIRToolingClient {
public <T extends Resource> OperationOutcome validate(Class<T> resourceClass, T resource, String id) {
ResourceRequest<T> result = null;
try {
result = ClientUtils.issuePostRequest(resourceAddress.resolveValidateUri(resourceClass, id), ClientUtils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), proxy);
result = utils.issuePostRequest(resourceAddress.resolveValidateUri(resourceClass, id), utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat());
result.addErrorStatus(400);//gone
result.addErrorStatus(422);//Unprocessable Entity
result.addSuccessStatus(200);//OK
@ -469,7 +552,7 @@ public class FHIRToolingClient {
public List<Coding> getAllTags() {
TagListRequest result = null;
try {
result = ClientUtils.issueGetRequestForTagList(resourceAddress.resolveGetAllTags(), getPreferredResourceFormat(), null, proxy);
result = utils.issueGetRequestForTagList(resourceAddress.resolveGetAllTags(), getPreferredResourceFormat(), null, proxy);
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve all tags", e);
}
@ -480,7 +563,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> getAllTagsForResourceType(Class<T> resourceClass) {
TagListRequest result = null;
try {
result = ClientUtils.issueGetRequestForTagList(resourceAddress.resolveGetAllTagsForResourceType(resourceClass), getPreferredResourceFormat(), null, proxy);
result = utils.issueGetRequestForTagList(resourceAddress.resolveGetAllTagsForResourceType(resourceClass), getPreferredResourceFormat(), null, proxy);
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve tags for this resource type", e);
}
@ -491,7 +574,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> getTagsForReference(Class<T> resource, String id) {
TagListRequest result = null;
try {
result = ClientUtils.issueGetRequestForTagList(resourceAddress.resolveGetTagsForReference(resource, id), getPreferredResourceFormat(), null, proxy);
result = utils.issueGetRequestForTagList(resourceAddress.resolveGetTagsForReference(resource, id), getPreferredResourceFormat(), null, proxy);
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve tags for this resource", e);
}
@ -502,7 +585,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> getTagsForResourceVersion(Class<T> resource, String id, String versionId) {
TagListRequest result = null;
try {
result = ClientUtils.issueGetRequestForTagList(resourceAddress.resolveGetTagsForResourceVersion(resource, id, versionId), getPreferredResourceFormat(), null, proxy);
result = utils.issueGetRequestForTagList(resourceAddress.resolveGetTagsForResourceVersion(resource, id, versionId), getPreferredResourceFormat(), null, proxy);
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve tags for this resource version", e);
}
@ -512,7 +595,7 @@ public class FHIRToolingClient {
//
// public <T extends Resource> boolean deleteTagsForReference(Class<T> resourceClass, String id) {
// try {
// return ClientUtils.issueDeleteRequest(resourceAddress.resolveGetTagsForReference(resourceClass, id), proxy);
// return utils.issueDeleteRequest(resourceAddress.resolveGetTagsForReference(resourceClass, id), proxy);
// } catch(Exception e) {
// handleException("An error has occurred while trying to retrieve tags for this resource version", e);
// throw new EFhirClientException("An error has occurred while trying to delete this resource", e);
@ -523,7 +606,7 @@ public class FHIRToolingClient {
//
// public <T extends Resource> boolean deleteTagsForResourceVersion(Class<T> resourceClass, String id, List<Coding> tags, String version) {
// try {
// return ClientUtils.issueDeleteRequest(resourceAddress.resolveGetTagsForResourceVersion(resourceClass, id, version), proxy);
// return utils.issueDeleteRequest(resourceAddress.resolveGetTagsForResourceVersion(resourceClass, id, version), proxy);
// } catch(Exception e) {
// handleException("An error has occurred while trying to retrieve tags for this resource version", e);
// throw new EFhirClientException("An error has occurred while trying to delete this resource", e);
@ -534,7 +617,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> createTags(List<Coding> tags, Class<T> resourceClass, String id) {
TagListRequest request = null;
try {
request = ClientUtils.issuePostRequestForTagList(resourceAddress.resolveGetTagsForReference(resourceClass, id),ClientUtils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request = utils.issuePostRequestForTagList(resourceAddress.resolveGetTagsForReference(resourceClass, id),utils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request.addSuccessStatus(201);
request.addSuccessStatus(200);
if(request.isUnsuccessfulRequest()) {
@ -550,7 +633,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> createTags(List<Coding> tags, Class<T> resourceClass, String id, String version) {
TagListRequest request = null;
try {
request = ClientUtils.issuePostRequestForTagList(resourceAddress.resolveGetTagsForResourceVersion(resourceClass, id, version),ClientUtils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request = utils.issuePostRequestForTagList(resourceAddress.resolveGetTagsForResourceVersion(resourceClass, id, version),utils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request.addSuccessStatus(201);
request.addSuccessStatus(200);
if(request.isUnsuccessfulRequest()) {
@ -566,7 +649,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> deleteTags(List<Coding> tags, Class<T> resourceClass, String id, String version) {
TagListRequest request = null;
try {
request = ClientUtils.issuePostRequestForTagList(resourceAddress.resolveDeleteTagsForResourceVersion(resourceClass, id, version),ClientUtils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request = utils.issuePostRequestForTagList(resourceAddress.resolveDeleteTagsForResourceVersion(resourceClass, id, version),utils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request.addSuccessStatus(201);
request.addSuccessStatus(200);
if(request.isUnsuccessfulRequest()) {
@ -611,7 +694,7 @@ public class FHIRToolingClient {
public Bundle fetchFeed(String url) {
Bundle feed = null;
try {
feed = ClientUtils.issueGetFeedRequest(new URI(url), getPreferredResourceFormat(), proxy);
feed = utils.issueGetFeedRequest(new URI(url), getPreferredResourceFormat());
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve history since last update",e);
}
@ -620,8 +703,8 @@ public class FHIRToolingClient {
public ValueSet expandValueset(ValueSet source) {
List<Header> headers = null;
ResourceRequest<Resource> result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
ClientUtils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
@ -636,7 +719,7 @@ public class FHIRToolingClient {
public Parameters lookupCode(Map<String, String> params) {
ResourceRequest<Resource> result = ClientUtils.issueGetResourceRequest(resourceAddress.resolveOperationUri(ValueSet.class, "lookup", params), getPreferredResourceFormat(), proxy);
ResourceRequest<Resource> result = utils.issueGetResourceRequest(resourceAddress.resolveOperationUri(ValueSet.class, "lookup", params), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
@ -656,8 +739,8 @@ public class FHIRToolingClient {
for (String n : params.keySet())
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
ResourceRequest<Resource> result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
ClientUtils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410); //gone
result.addErrorStatus(404); //unknown
result.addErrorStatus(405);
@ -670,6 +753,22 @@ public class FHIRToolingClient {
return (ValueSet) result.getPayload();
}
// public ValueSet expandValueset(ValueSet source, ExpansionProfile profile, Map<String, String> params) {
// List<Header> headers = null;
// ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
// utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// result.addErrorStatus(410);//gone
// result.addErrorStatus(404);//unknown
// result.addErrorStatus(405);
// result.addErrorStatus(422);//Unprocessable Entity
// result.addSuccessStatus(200);
// result.addSuccessStatus(201);
// if(result.isUnsuccessfulRequest()) {
// throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
// }
// return (ValueSet) result.getPayload();
// }
public String getAddress() {
return base;
@ -679,8 +778,8 @@ public class FHIRToolingClient {
Parameters params = new Parameters();
params.addParameter().setName("name").setValue(new StringType(name));
List<Header> headers = null;
ResourceRequest<Resource> result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ClientUtils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
@ -698,8 +797,8 @@ public class FHIRToolingClient {
params.addParameter().setName("name").setValue(new StringType(name));
params.addParameter().setName("concept").setValue(coding);
List<Header> headers = null;
ResourceRequest<Resource> result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ClientUtils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
@ -712,8 +811,51 @@ public class FHIRToolingClient {
return (ConceptMap) result.getPayload();
}
public Parameters getTerminologyCapabilities() {
return (Parameters) ClientUtils.issueGetResourceRequest(resourceAddress.resolveMetadataTxCaps(), getPreferredResourceFormat(), proxy).getReference();
public int getTimeout() {
return utils.getTimeout();
}
public void setTimeout(int timeout) {
utils.setTimeout(timeout);
}
public String getUsername() {
return utils.getUsername();
}
public void setUsername(String username) {
utils.setUsername(username);
}
public String getPassword() {
return utils.getPassword();
}
public void setPassword(String password) {
utils.setPassword(password);
}
public Parameters getTerminologyCapabilities() {
return (Parameters) utils.issueGetResourceRequest(resourceAddress.resolveMetadataTxCaps(), getPreferredResourceFormat()).getReference();
}
public org.hl7.fhir.utilities.ToolingClientLogger getLogger() {
return utils.getLogger();
}
public void setLogger(ToolingClientLogger logger) {
utils.setLogger(logger);
}
public int getRetryCount() {
return utils.getRetryCount();
}
public void setRetryCount(int retryCount) {
utils.setRetryCount(retryCount);
}
}

View File

@ -40,6 +40,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
@ -78,23 +79,28 @@ public class ResourceAddress {
}
public <T extends Resource> URI resolveOperationURLFromClass(Class<T> resourceClass, String name, String parameters) {
return baseServiceUri.resolve(nameForClass(resourceClass) +"/$"+name+"?"+ parameters);
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$"+name+"?"+ parameters);
}
public <T extends Resource> URI resolveSearchUri(Class<T> resourceClass, Map<String,String> parameters) {
return appendHttpParameters(baseServiceUri.resolve(nameForClass(resourceClass) +"/_search"), parameters);
return appendHttpParameters(baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"_search"), parameters);
}
private <T extends Resource> String nameForClassWithSlash(Class<T> resourceClass) {
String n = nameForClass(resourceClass);
return n == null ? "" : n +"/";
}
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName) {
return baseServiceUri.resolve(nameForClass(resourceClass) +"/$"+opName);
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"/"+opName);
}
public <T extends Resource> URI resolveOperationUri(Class<T> resourceClass, String opName, Map<String,String> parameters) {
return appendHttpParameters(baseServiceUri.resolve(nameForClass(resourceClass) +"/$"+opName), parameters);
return appendHttpParameters(baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$"+opName), parameters);
}
public <T extends Resource> URI resolveValidateUri(Class<T> resourceClass, String id) {
return baseServiceUri.resolve(nameForClass(resourceClass) +"/_validate/"+id);
return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$validate/"+id);
}
public <T extends Resource> URI resolveGetUriFromResourceClass(Class<T> resourceClass) {
@ -109,6 +115,13 @@ public class ResourceAddress {
return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id+"/_history/"+version);
}
public <T extends Resource> URI resolveGetUriFromResourceClassAndCanonical(Class<T> resourceClass, String canonicalUrl) {
if (canonicalUrl.contains("|"))
return baseServiceUri.resolve(nameForClass(resourceClass)+"?url="+canonicalUrl.substring(0, canonicalUrl.indexOf("|"))+"&version="+canonicalUrl.substring(canonicalUrl.indexOf("|")+1));
else
return baseServiceUri.resolve(nameForClass(resourceClass)+"?url="+canonicalUrl);
}
public URI resolveGetHistoryForAllResources(int count) {
if(count > 0) {
return appendHttpParameter(baseServiceUri.resolve("_history"), "_count", ""+count);
@ -195,6 +208,8 @@ public class ResourceAddress {
public <T extends Resource> String nameForClass(Class<T> resourceClass) {
if (resourceClass == null)
return null;
String res = resourceClass.getSimpleName();
if (res.equals("List_"))
return "List";
@ -206,6 +221,11 @@ public class ResourceAddress {
return baseServiceUri.resolve(quick ? "metadata?_summary=true" : "metadata");
}
public URI resolveMetadataTxCaps() {
return baseServiceUri.resolve("metadata?mode=terminology");
}
/**
* For now, assume this type of location header structure.
* Generalize later: http://hl7connect.healthintersections.com.au/svc/fhir/318/_history/1
@ -379,7 +399,7 @@ public class ResourceAddress {
}
public static String getCalendarDateInIsoTimeFormat(Calendar calendar) {
SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd'T'hh:mm:ss");//TODO Move out
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss", new Locale("en", "US"));//TODO Move out
format.setTimeZone(TimeZone.getTimeZone("GMT"));
return format.format(calendar.getTime());
}
@ -410,8 +430,4 @@ public class ResourceAddress {
}
}
public URI resolveMetadataTxCaps() {
return baseServiceUri.resolve("metadata?mode=terminology");
}
}

View File

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

View File

@ -134,7 +134,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
params.put("_limit", "10000");
params.put("_incomplete", "true");
params.put("profile", "http://www.healthintersections.com.au/fhir/expansion/no-details");
ValueSet result = txServer.expandValueset(vs, params);
ValueSet result = txServer.expandValueset(vs, null, params);
return new ValueSetExpansionOutcome(result);
} catch (Exception e) {
return new ValueSetExpansionOutcome("Error expanding ValueSet \""+vs.getUrl()+": "+e.getMessage());

View File

@ -38,21 +38,25 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
@ -81,6 +85,7 @@ import org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComp
import org.hl7.fhir.dstu2016may.model.Resource;
import org.hl7.fhir.dstu2016may.model.ResourceType;
import org.hl7.fhir.dstu2016may.utils.ResourceUtilities;
import org.hl7.fhir.utilities.ToolingClientLogger;
/**
* Helper class handling lower level HTTP transport concerns.
@ -92,53 +97,103 @@ public class ClientUtils {
public static String DEFAULT_CHARSET = "UTF-8";
public static final String HEADER_LOCATION = "location";
public static <T extends Resource> ResourceRequest<T> issueOptionsRequest(URI optionsUri, String resourceFormat, HttpHost proxy) {
private HttpHost proxy;
private int timeout = 5000;
private String username;
private String password;
private ToolingClientLogger logger;
private int retryCount;
public HttpHost getProxy() {
return proxy;
}
public void setProxy(HttpHost proxy) {
this.proxy = proxy;
}
public int getTimeout() {
return timeout;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public <T extends Resource> ResourceRequest<T> issueOptionsRequest(URI optionsUri, String resourceFormat) {
HttpOptions options = new HttpOptions(optionsUri);
return issueResourceRequest(resourceFormat, options, proxy);
return issueResourceRequest(resourceFormat, options);
}
public static <T extends Resource> ResourceRequest<T> issueGetResourceRequest(URI resourceUri, String resourceFormat, HttpHost proxy) {
public <T extends Resource> ResourceRequest<T> issueGetResourceRequest(URI resourceUri, String resourceFormat) {
HttpGet httpget = new HttpGet(resourceUri);
return issueResourceRequest(resourceFormat, httpget, proxy);
return issueResourceRequest(resourceFormat, httpget);
}
public static <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers, HttpHost proxy) {
public <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers) {
HttpPut httpPut = new HttpPut(resourceUri);
return issueResourceRequest(resourceFormat, httpPut, payload, headers, proxy);
return issueResourceRequest(resourceFormat, httpPut, payload, headers);
}
public static <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat, HttpHost proxy) {
public <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat) {
HttpPut httpPut = new HttpPut(resourceUri);
return issueResourceRequest(resourceFormat, httpPut, payload, null, proxy);
return issueResourceRequest(resourceFormat, httpPut, payload, null);
}
public static <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers, HttpHost proxy) {
public <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers) {
HttpPost httpPost = new HttpPost(resourceUri);
return issueResourceRequest(resourceFormat, httpPost, payload, headers, proxy);
return issueResourceRequest(resourceFormat, httpPost, payload, headers);
}
public static <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat, HttpHost proxy) {
return issuePostRequest(resourceUri, payload, resourceFormat, null, proxy);
public <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat) {
return issuePostRequest(resourceUri, payload, resourceFormat, null);
}
public static Bundle issueGetFeedRequest(URI resourceUri, String resourceFormat, HttpHost proxy) {
public Bundle issueGetFeedRequest(URI resourceUri, String resourceFormat) {
HttpGet httpget = new HttpGet(resourceUri);
configureFhirRequest(httpget, resourceFormat);
HttpResponse response = sendRequest(httpget, proxy);
HttpResponse response = sendRequest(httpget);
return unmarshalReference(response, resourceFormat);
}
public static Bundle postBatchRequest(URI resourceUri, byte[] payload, String resourceFormat, HttpHost proxy) {
private void setAuth(HttpRequest httpget) {
if (password != null) {
try {
byte[] b = Base64.encodeBase64((username+":"+password).getBytes("ASCII"));
String b64 = new String(b, StandardCharsets.US_ASCII);
httpget.setHeader("Authorization", "Basic " + b64);
} catch (UnsupportedEncodingException e) {
}
}
}
public Bundle postBatchRequest(URI resourceUri, byte[] payload, String resourceFormat) {
HttpPost httpPost = new HttpPost(resourceUri);
configureFhirRequest(httpPost, resourceFormat);
HttpResponse response = sendPayload(httpPost, payload, proxy);
return unmarshalFeed(response, resourceFormat);
}
public static boolean issueDeleteRequest(URI resourceUri, HttpHost proxy) {
public boolean issueDeleteRequest(URI resourceUri) {
HttpDelete deleteRequest = new HttpDelete(resourceUri);
HttpResponse response = sendRequest(deleteRequest, proxy);
HttpResponse response = sendRequest(deleteRequest);
int responseStatusCode = response.getStatusLine().getStatusCode();
boolean deletionSuccessful = false;
if(responseStatusCode == 204) {
@ -151,8 +206,8 @@ public class ClientUtils {
* Request/Response Helper methods
***********************************************************/
protected static <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, HttpHost proxy) {
return issueResourceRequest(resourceFormat, request, null, proxy);
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request) {
return issueResourceRequest(resourceFormat, request, null);
}
/**
@ -160,8 +215,8 @@ public class ClientUtils {
* @param options
* @return
*/
protected static <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload, HttpHost proxy) {
return issueResourceRequest(resourceFormat, request, payload, null, proxy);
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload) {
return issueResourceRequest(resourceFormat, request, payload, null);
}
/**
@ -169,7 +224,7 @@ public class ClientUtils {
* @param options
* @return
*/
protected static <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload, List<Header> headers, HttpHost proxy) {
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload, List<Header> headers) {
configureFhirRequest(request, resourceFormat, headers);
HttpResponse response = null;
if(request instanceof HttpEntityEnclosingRequest && payload != null) {
@ -177,10 +232,10 @@ public class ClientUtils {
} else if (request instanceof HttpEntityEnclosingRequest && payload == null){
throw new EFhirClientException("PUT and POST requests require a non-null payload");
} else {
response = sendRequest(request, proxy);
response = sendRequest(request);
}
T resource = unmarshalReference(response, resourceFormat);
return new ResourceRequest<T>(resource, response.getStatusLine().getStatusCode(), ClientUtils.getLocationHeader(response));
return new ResourceRequest<T>(resource, response.getStatusLine().getStatusCode(), getLocationHeader(response));
}
@ -190,7 +245,7 @@ public class ClientUtils {
*
* @param request
*/
protected static void configureFhirRequest(HttpRequest request, String format) {
protected void configureFhirRequest(HttpRequest request, String format) {
configureFhirRequest(request, format, null);
}
@ -200,7 +255,7 @@ public class ClientUtils {
*
* @param request
*/
protected static void configureFhirRequest(HttpRequest request, String format, List<Header> headers) {
protected void configureFhirRequest(HttpRequest request, String format, List<Header> headers) {
request.addHeader("User-Agent", "Java FHIR Client for FHIR");
if (format != null) {
@ -213,6 +268,7 @@ public class ClientUtils {
request.addHeader(header);
}
}
setAuth(request);
}
/**
@ -222,17 +278,28 @@ public class ClientUtils {
* @param payload
* @return
*/
protected static HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload, HttpHost proxy) {
protected HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload, HttpHost proxy) {
HttpResponse response = null;
boolean ok = false;
int tryCount = 0;
while (!ok) {
try {
tryCount++;
HttpClient httpclient = new DefaultHttpClient();
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
request.setEntity(new ByteArrayEntity(payload));
log(request);
response = httpclient.execute(request);
ok = true;
} catch(IOException ioe) {
throw new EFhirClientException("Error sending HTTP Post/Put Payload", ioe);
if (tryCount <= retryCount) {
ok = false;
} else {
throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe);
}
}
}
return response;
}
@ -243,20 +310,20 @@ public class ClientUtils {
* @param payload
* @return
*/
protected static HttpResponse sendRequest(HttpUriRequest request, HttpHost proxy) {
protected HttpResponse sendRequest(HttpUriRequest request) {
HttpResponse response = null;
try {
HttpClient httpclient = new DefaultHttpClient();
log(request);
HttpParams params = httpclient.getParams();
HttpConnectionParams.setConnectionTimeout(params, 5000);
HttpConnectionParams.setSoTimeout(params, 5000);
HttpConnectionParams.setConnectionTimeout(params, timeout);
HttpConnectionParams.setSoTimeout(params, timeout);
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
response = httpclient.execute(request);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending Http Request", ioe);
throw new EFhirClientException("Error sending Http Request: "+ioe.getMessage(), ioe);
}
return response;
}
@ -268,29 +335,24 @@ public class ClientUtils {
* @return
*/
@SuppressWarnings("unchecked")
protected static <T extends Resource> T unmarshalReference(HttpResponse response, String format) {
protected <T extends Resource> T unmarshalReference(HttpResponse response, String format) {
T resource = null;
OperationOutcome error = null;
InputStream instream = null;
HttpEntity entity = response.getEntity();
if (entity != null && entity.getContentLength() != 0) {
try {
instream = entity.getContent();
// System.out.println(writeInputStreamAsString(instream));
resource = (T)getParser(format).parse(instream);
byte[] cnt = log(response);
if (cnt != null) {
try {
resource = (T)getParser(format).parse(cnt);
if (resource instanceof OperationOutcome && hasError((OperationOutcome)resource)) {
error = (OperationOutcome) resource;
}
} catch(IOException ioe) {
throw new EFhirClientException("Error unmarshalling entity from Http Response", ioe);
throw new EFhirClientException("Error reading Http Response: "+ioe.getMessage(), ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message", e);
} finally {
try{instream.close();}catch(IOException ioe){/* TODO log error */}
throw new EFhirClientException("Error parsing response message: "+e.getMessage(), e);
}
}
if(error != null) {
throw new EFhirClientException("Error unmarshalling resource: "+ResourceUtilities.getErrorDescription(error), error);
throw new EFhirClientException("Error from server: "+ResourceUtilities.getErrorDescription(error), error);
}
return resource;
}
@ -301,50 +363,43 @@ public class ClientUtils {
* @param response
* @return
*/
protected static Bundle unmarshalFeed(HttpResponse response, String format) {
protected Bundle unmarshalFeed(HttpResponse response, String format) {
Bundle feed = null;
InputStream instream = null;
HttpEntity entity = response.getEntity();
byte[] cnt = log(response);
String contentType = response.getHeaders("Content-Type")[0].getValue();
OperationOutcome error = null;
try {
if (entity != null) {
instream = entity.getContent();
if (cnt != null) {
if(contentType.contains(ResourceFormat.RESOURCE_XML.getHeader()) || contentType.contains("text/xml+fhir")) {
// error = (OperationOutcome)getParser(ResourceFormat.RESOURCE_XML.getHeader()).parse(instream);
// } else {
Resource rf = getParser(format).parse(instream);
Resource rf = getParser(format).parse(cnt);
if (rf instanceof Bundle)
feed = (Bundle) rf;
else if (rf instanceof OperationOutcome && hasError((OperationOutcome) rf)) {
error = (OperationOutcome) rf;
} else {
throw new EFhirClientException("Error unmarshalling feed from Http Response: a resource was returned instead");
throw new EFhirClientException("Error reading server response: a resource was returned instead");
}
}
instream.close();
}
} catch(IOException ioe) {
throw new EFhirClientException("Error unmarshalling feed from Http Response", ioe);
throw new EFhirClientException("Error reading Http Response", ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message", e);
} finally {
try{instream.close();}catch(IOException ioe){/* TODO log error */}
}
if(error != null) {
throw new EFhirClientException("Error unmarshalling feed: "+ResourceUtilities.getErrorDescription(error), error);
throw new EFhirClientException("Error from server: "+ResourceUtilities.getErrorDescription(error), error);
}
return feed;
}
private static boolean hasError(OperationOutcome oo) {
private boolean hasError(OperationOutcome oo) {
for (OperationOutcomeIssueComponent t : oo.getIssue())
if (t.getSeverity() == IssueSeverity.ERROR || t.getSeverity() == IssueSeverity.FATAL)
return true;
return false;
}
protected static String getLocationHeader(HttpResponse response) {
protected String getLocationHeader(HttpResponse response) {
String location = null;
if(response.getHeaders("location").length > 0) {//TODO Distinguish between both cases if necessary
location = response.getHeaders("location")[0].getValue();
@ -359,7 +414,7 @@ public class ClientUtils {
* Client connection methods
* ***************************************************************/
public static HttpURLConnection buildConnection(URI baseServiceUri, String tail) {
public HttpURLConnection buildConnection(URI baseServiceUri, String tail) {
try {
HttpURLConnection client = (HttpURLConnection) baseServiceUri.resolve(tail).toURL().openConnection();
return client;
@ -370,7 +425,7 @@ public class ClientUtils {
}
}
public static HttpURLConnection buildConnection(URI baseServiceUri, ResourceType resourceType, String id) {
public HttpURLConnection buildConnection(URI baseServiceUri, ResourceType resourceType, String id) {
return buildConnection(baseServiceUri, ResourceAddress.buildRelativePathFromResourceType(resourceType, id));
}
@ -379,7 +434,7 @@ public class ClientUtils {
* ****************************************************************/
public static <T extends Resource> byte[] getResourceAsByteArray(T resource, boolean pretty, boolean isJson) {
public <T extends Resource> byte[] getResourceAsByteArray(T resource, boolean pretty, boolean isJson) {
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
@ -406,7 +461,7 @@ public class ClientUtils {
return byteArray;
}
public static byte[] getFeedAsByteArray(Bundle feed, boolean pretty, boolean isJson) {
public byte[] getFeedAsByteArray(Bundle feed, boolean pretty, boolean isJson) {
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
@ -433,11 +488,11 @@ public class ClientUtils {
return byteArray;
}
public static Calendar getLastModifiedResponseHeaderAsCalendarObject(URLConnection serverConnection) {
public Calendar getLastModifiedResponseHeaderAsCalendarObject(URLConnection serverConnection) {
String dateTime = null;
try {
dateTime = serverConnection.getHeaderField("Last-Modified");
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", new Locale("en", "US"));
Date lastModifiedTimestamp = format.parse(dateTime);
Calendar calendar=Calendar.getInstance();
calendar.setTime(lastModifiedTimestamp);
@ -447,7 +502,7 @@ public class ClientUtils {
}
}
protected static IParser getParser(String format) {
protected IParser getParser(String format) {
if(StringUtils.isBlank(format)) {
format = ResourceFormat.RESOURCE_XML.getHeader();
}
@ -460,25 +515,7 @@ public class ClientUtils {
}
}
/**
* Used for debugging
*
* @param instream
* @return
*/
protected static String writeInputStreamAsString(InputStream instream) {
String value = null;
try {
value = IOUtils.toString(instream, "UTF-8");
System.out.println(value);
} catch(IOException ioe) {
//Do nothing
}
return value;
}
public static Bundle issuePostFeedRequest(URI resourceUri, Map<String, String> parameters, String resourceName, Resource resource, String resourceFormat) throws IOException {
public Bundle issuePostFeedRequest(URI resourceUri, Map<String, String> parameters, String resourceName, Resource resource, String resourceFormat) throws IOException {
HttpPost httppost = new HttpPost(resourceUri);
String boundary = "----WebKitFormBoundarykbMUo6H8QaUnYtRy";
httppost.addHeader("Content-Type", "multipart/form-data; boundary="+boundary);
@ -488,7 +525,7 @@ public class ClientUtils {
return unmarshalFeed(response, resourceFormat);
}
private static byte[] encodeFormSubmission(Map<String, String> parameters, String resourceName, Resource resource, String boundary) throws IOException {
private byte[] encodeFormSubmission(Map<String, String> parameters, String resourceName, Resource resource, String boundary) throws IOException {
ByteArrayOutputStream b = new ByteArrayOutputStream();
OutputStreamWriter w = new OutputStreamWriter(b, "UTF-8");
for (String name : parameters.keySet()) {
@ -520,17 +557,99 @@ public class ClientUtils {
* @param payload
* @return
*/
protected static HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload) {
protected HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload) {
HttpResponse response = null;
try {
log(request);
HttpClient httpclient = new DefaultHttpClient();
request.setEntity(new ByteArrayEntity(payload));
response = httpclient.execute(request);
log(response);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe);
}
return response;
}
private void log(HttpUriRequest request) {
if (logger != null) {
List<String> headers = new ArrayList<>();
for (Header h : request.getAllHeaders()) {
headers.add(h.toString());
}
logger.logRequest(request.getMethod(), request.getURI().toString(), headers, null);
}
}
private void log(HttpEntityEnclosingRequestBase request) {
if (logger != null) {
List<String> headers = new ArrayList<>();
for (Header h : request.getAllHeaders()) {
headers.add(h.toString());
}
byte[] cnt = null;
InputStream s;
try {
s = request.getEntity().getContent();
cnt = IOUtils.toByteArray(s);
s.close();
} catch (Exception e) {
}
logger.logRequest(request.getMethod(), request.getURI().toString(), headers, cnt);
}
}
private byte[] log(HttpResponse response) {
byte[] cnt = null;
try {
InputStream s = response.getEntity().getContent();
cnt = IOUtils.toByteArray(s);
s.close();
} catch (Exception e) {
}
if (logger != null) {
List<String> headers = new ArrayList<>();
for (Header h : response.getAllHeaders()) {
headers.add(h.toString());
}
logger.logResponse(response.getStatusLine().toString(), headers, cnt);
}
return cnt;
}
public ToolingClientLogger getLogger() {
return logger;
}
public void setLogger(ToolingClientLogger logger) {
this.logger = logger;
}
/**
* Used for debugging
*
* @param instream
* @return
*/
protected String writeInputStreamAsString(InputStream instream) {
String value = null;
try {
value = IOUtils.toString(instream, "UTF-8");
System.out.println(value);
} catch(IOException ioe) {
//Do nothing
}
return value;
}
public int getRetryCount() {
return retryCount;
}
public void setRetryCount(int retryCount) {
this.retryCount = retryCount;
}
}

View File

@ -52,6 +52,7 @@ import org.hl7.fhir.dstu2016may.model.PrimitiveType;
import org.hl7.fhir.dstu2016may.model.Resource;
import org.hl7.fhir.dstu2016may.model.StringType;
import org.hl7.fhir.dstu2016may.model.ValueSet;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities;
/**
@ -93,6 +94,7 @@ public class FHIRToolingClient {
private HttpHost proxy;
private int maxResultSetSize = -1;//_count
private Conformance conf;
private ClientUtils utils = new ClientUtils();
//Pass enpoint for client - URI
public FHIRToolingClient(String baseServiceUrl) throws URISyntaxException {
@ -101,8 +103,16 @@ public class FHIRToolingClient {
initialize(baseServiceUrl);
}
public FHIRToolingClient(String baseServiceUrl, String username, String password) throws URISyntaxException {
preferredResourceFormat = ResourceFormat.RESOURCE_XML;
utils.setUsername(username);
utils.setPassword(password);
detectProxy();
initialize(baseServiceUrl);
}
public void configureProxy(String proxyHost, int proxyPort) {
proxy = new HttpHost(proxyHost, proxyPort);
utils.setProxy(new HttpHost(proxyHost, proxyPort));
}
public void detectProxy() {
@ -162,9 +172,9 @@ public class FHIRToolingClient {
Conformance conformance = null;
try {
if(useOptionsVerb) {
conformance = (Conformance)ClientUtils.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat(), proxy).getReference();//TODO fix this
conformance = (Conformance)utils.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat()).getReference();//TODO fix this
} else {
conformance = (Conformance)ClientUtils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(false), getPreferredResourceFormat(), proxy).getReference();
conformance = (Conformance)utils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(false), getPreferredResourceFormat()).getReference();
}
} catch(Exception e) {
handleException("An error has occurred while trying to fetch the server's conformance statement", e);
@ -182,9 +192,9 @@ public class FHIRToolingClient {
Conformance conformance = null;
try {
if(useOptionsVerb) {
conformance = (Conformance)ClientUtils.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat(), proxy).getReference();//TODO fix this
conformance = (Conformance)utils.issueOptionsRequest(resourceAddress.getBaseServiceUri(), getPreferredResourceFormat()).getReference();//TODO fix this
} else {
conformance = (Conformance)ClientUtils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(true), getPreferredResourceFormat(), proxy).getReference();
conformance = (Conformance)utils.issueGetResourceRequest(resourceAddress.resolveMetadataUri(true), getPreferredResourceFormat()).getReference();
}
} catch(Exception e) {
handleException("An error has occurred while trying to fetch the server's conformance statement", e);
@ -195,7 +205,7 @@ public class FHIRToolingClient {
public <T extends Resource> T read(Class<T> resourceClass, String id) {//TODO Change this to AddressableResource
ResourceRequest<T> result = null;
try {
result = ClientUtils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), getPreferredResourceFormat(), proxy);
result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addSuccessStatus(200);//Only one for now
@ -211,7 +221,7 @@ public class FHIRToolingClient {
public <T extends Resource> T vread(Class<T> resourceClass, String id, String version) {
ResourceRequest<T> result = null;
try {
result = ClientUtils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndIdAndVersion(resourceClass, id, version), getPreferredResourceFormat(), proxy);
result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndIdAndVersion(resourceClass, id, version), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);//unknown
@ -225,40 +235,93 @@ public class FHIRToolingClient {
return result.getPayload();
}
//
// public <T extends Resource> T update(Class<T> resourceClass, T resource, String id) {
// ResourceRequest<T> result = null;
// try {
// List<Header> headers = null;
// result = ClientUtils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),ClientUtils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// result.addErrorStatus(410);//gone
// result.addErrorStatus(404);//unknown
// result.addErrorStatus(405);
// result.addErrorStatus(422);//Unprocessable Entity
// result.addSuccessStatus(200);
// result.addSuccessStatus(201);
// if(result.isUnsuccessfulRequest()) {
// throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
// }
// } catch(Exception e) {
// throw new EFhirClientException("An error has occurred while trying to update this resource", e);
// }
// // TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
// try {
// OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
// ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
// return this.vread(resourceClass, resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
// } catch(ClassCastException e) {
// // if we fall throught we have the correct type already in the create
// }
//
// return result.getPayload();
// }
// GET fhir/ValueSet?url=http://hl7.org/fhir/ValueSet/clinical-findings&version=0.8
public <T extends Resource> T getCanonical(Class<T> resourceClass, String canonicalURL) {
ResourceRequest<T> result = null;
try {
result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndCanonical(resourceClass, canonicalURL), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);//unknown
result.addSuccessStatus(200);//Only one for now
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch (Exception e) {
handleException("An error has occurred while trying to read this version of the resource", e);
}
Bundle bnd = (Bundle) result.getPayload();
if (bnd.getEntry().size() == 0)
throw new EFhirClientException("No matching resource found for canonical URL '"+canonicalURL+"'");
if (bnd.getEntry().size() > 1)
throw new EFhirClientException("Multiple matching resources found for canonical URL '"+canonicalURL+"'");
return (T) bnd.getEntry().get(0).getResource();
}
public Resource update(Resource resource) {
ResourceRequest<Resource> result = null;
try {
List<Header> headers = null;
result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resource.getClass(), resource.getId()),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
result.addErrorStatus(422);//Unprocessable Entity
result.addSuccessStatus(200);
result.addSuccessStatus(201);
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch(Exception e) {
throw new EFhirClientException("An error has occurred while trying to update this resource", e);
}
// TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
try {
OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
return this.vread(resource.getClass(), resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
} catch(ClassCastException e) {
// if we fall throught we have the correct type already in the create
}
return result.getPayload();
}
public <T extends Resource> T update(Class<T> resourceClass, T resource, String id) {
ResourceRequest<T> result = null;
try {
List<Header> headers = null;
result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
result.addErrorStatus(422);//Unprocessable Entity
result.addSuccessStatus(200);
result.addSuccessStatus(201);
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch(Exception e) {
throw new EFhirClientException("An error has occurred while trying to update this resource", e);
}
// TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
try {
OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
return this.vread(resourceClass, resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
} catch(ClassCastException e) {
// if we fall throught we have the correct type already in the create
}
return result.getPayload();
}
//
// public <T extends Resource> boolean delete(Class<T> resourceClass, String id) {
// try {
// return ClientUtils.issueDeleteRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), proxy);
// return utils.issueDeleteRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), proxy);
// } catch(Exception e) {
// throw new EFhirClientException("An error has occurred while trying to delete this resource", e);
// }
@ -270,7 +333,7 @@ public class FHIRToolingClient {
// ResourceRequest<T> resourceRequest = null;
// try {
// List<Header> headers = null;
// resourceRequest = ClientUtils.issuePostRequest(resourceAddress.resolveGetUriFromResourceClass(resourceClass),ClientUtils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// resourceRequest = utils.issuePostRequest(resourceAddress.resolveGetUriFromResourceClass(resourceClass),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// resourceRequest.addSuccessStatus(201);
// if(resourceRequest.isUnsuccessfulRequest()) {
// throw new EFhirClientException("Server responded with HTTP error code " + resourceRequest.getHttpStatus(), (OperationOutcome)resourceRequest.getPayload());
@ -303,7 +366,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Calendar lastUpdate, Class<T> resourceClass, String id) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource", e);
// }
@ -314,7 +377,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Date lastUpdate, Class<T> resourceClass, String id) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource", e);
// }
@ -325,7 +388,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Calendar lastUpdate, Class<T> resourceClass) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource type", e);
// }
@ -336,7 +399,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Date lastUpdate, Class<T> resourceClass) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource type", e);
// }
@ -347,7 +410,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Class<T> resourceClass) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceType(resourceClass, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource type", e);
// }
@ -358,7 +421,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Class<T> resourceClass, String id) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForResourceId(resourceClass, id, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history information for this resource", e);
// }
@ -369,7 +432,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Date lastUpdate) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history since last update",e);
// }
@ -380,7 +443,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history(Calendar lastUpdate) {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(lastUpdate, maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history since last update",e);
// }
@ -391,7 +454,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle history() {
// Bundle history = null;
// try {
// history = ClientUtils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(maxResultSetSize), getPreferredResourceFormat(), proxy);
// history = utils.issueGetFeedRequest(resourceAddress.resolveGetHistoryForAllResources(maxResultSetSize), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("An error has occurred while trying to retrieve history since last update",e);
// }
@ -402,7 +465,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle search(Class<T> resourceClass, Map<String, String> parameters) {
// Bundle searchResults = null;
// try {
// searchResults = ClientUtils.issueGetFeedRequest(resourceAddress.resolveSearchUri(resourceClass, parameters), getPreferredResourceFormat(), proxy);
// searchResults = utils.issueGetFeedRequest(resourceAddress.resolveSearchUri(resourceClass, parameters), getPreferredResourceFormat(), proxy);
// } catch (Exception e) {
// handleException("Error performing search with parameters " + parameters, e);
// }
@ -413,7 +476,7 @@ public class FHIRToolingClient {
// public <T extends Resource> Bundle searchPost(Class<T> resourceClass, T resource, Map<String, String> parameters) {
// Bundle searchResults = null;
// try {
// searchResults = ClientUtils.issuePostFeedRequest(resourceAddress.resolveSearchUri(resourceClass, new HashMap<String, String>()), parameters, "src", resource, getPreferredResourceFormat());
// searchResults = utils.issuePostFeedRequest(resourceAddress.resolveSearchUri(resourceClass, new HashMap<String, String>()), parameters, "src", resource, getPreferredResourceFormat());
// } catch (Exception e) {
// handleException("Error performing search with parameters " + parameters, e);
// }
@ -434,9 +497,9 @@ public class FHIRToolingClient {
ps += p.getName() + "=" + Utilities.encodeUri(((PrimitiveType) p.getValue()).asStringValue())+"&";
ResourceRequest<T> result;
if (complex)
result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), ClientUtils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), proxy);
result = utils.issuePostRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat());
else
result = ClientUtils.issueGetResourceRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), getPreferredResourceFormat(), proxy);
result = utils.issueGetResourceRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addSuccessStatus(200);//Only one for now
@ -459,7 +522,7 @@ public class FHIRToolingClient {
public Bundle transaction(Bundle batch) {
Bundle transactionResult = null;
try {
transactionResult = ClientUtils.postBatchRequest(resourceAddress.getBaseServiceUri(), ClientUtils.getFeedAsByteArray(batch, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), proxy);
transactionResult = utils.postBatchRequest(resourceAddress.getBaseServiceUri(), utils.getFeedAsByteArray(batch, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat());
} catch (Exception e) {
handleException("An error occurred trying to process this transaction request", e);
}
@ -471,7 +534,7 @@ public class FHIRToolingClient {
public <T extends Resource> OperationOutcome validate(Class<T> resourceClass, T resource, String id) {
ResourceRequest<T> result = null;
try {
result = ClientUtils.issuePostRequest(resourceAddress.resolveValidateUri(resourceClass, id), ClientUtils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), proxy);
result = utils.issuePostRequest(resourceAddress.resolveValidateUri(resourceClass, id), utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat());
result.addErrorStatus(400);//gone
result.addErrorStatus(422);//Unprocessable Entity
result.addSuccessStatus(200);//OK
@ -489,7 +552,7 @@ public class FHIRToolingClient {
public List<Coding> getAllTags() {
TagListRequest result = null;
try {
result = ClientUtils.issueGetRequestForTagList(resourceAddress.resolveGetAllTags(), getPreferredResourceFormat(), null, proxy);
result = utils.issueGetRequestForTagList(resourceAddress.resolveGetAllTags(), getPreferredResourceFormat(), null, proxy);
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve all tags", e);
}
@ -500,7 +563,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> getAllTagsForResourceType(Class<T> resourceClass) {
TagListRequest result = null;
try {
result = ClientUtils.issueGetRequestForTagList(resourceAddress.resolveGetAllTagsForResourceType(resourceClass), getPreferredResourceFormat(), null, proxy);
result = utils.issueGetRequestForTagList(resourceAddress.resolveGetAllTagsForResourceType(resourceClass), getPreferredResourceFormat(), null, proxy);
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve tags for this resource type", e);
}
@ -511,7 +574,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> getTagsForReference(Class<T> resource, String id) {
TagListRequest result = null;
try {
result = ClientUtils.issueGetRequestForTagList(resourceAddress.resolveGetTagsForReference(resource, id), getPreferredResourceFormat(), null, proxy);
result = utils.issueGetRequestForTagList(resourceAddress.resolveGetTagsForReference(resource, id), getPreferredResourceFormat(), null, proxy);
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve tags for this resource", e);
}
@ -522,7 +585,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> getTagsForResourceVersion(Class<T> resource, String id, String versionId) {
TagListRequest result = null;
try {
result = ClientUtils.issueGetRequestForTagList(resourceAddress.resolveGetTagsForResourceVersion(resource, id, versionId), getPreferredResourceFormat(), null, proxy);
result = utils.issueGetRequestForTagList(resourceAddress.resolveGetTagsForResourceVersion(resource, id, versionId), getPreferredResourceFormat(), null, proxy);
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve tags for this resource version", e);
}
@ -532,7 +595,7 @@ public class FHIRToolingClient {
//
// public <T extends Resource> boolean deleteTagsForReference(Class<T> resourceClass, String id) {
// try {
// return ClientUtils.issueDeleteRequest(resourceAddress.resolveGetTagsForReference(resourceClass, id), proxy);
// return utils.issueDeleteRequest(resourceAddress.resolveGetTagsForReference(resourceClass, id), proxy);
// } catch(Exception e) {
// handleException("An error has occurred while trying to retrieve tags for this resource version", e);
// throw new EFhirClientException("An error has occurred while trying to delete this resource", e);
@ -543,7 +606,7 @@ public class FHIRToolingClient {
//
// public <T extends Resource> boolean deleteTagsForResourceVersion(Class<T> resourceClass, String id, List<Coding> tags, String version) {
// try {
// return ClientUtils.issueDeleteRequest(resourceAddress.resolveGetTagsForResourceVersion(resourceClass, id, version), proxy);
// return utils.issueDeleteRequest(resourceAddress.resolveGetTagsForResourceVersion(resourceClass, id, version), proxy);
// } catch(Exception e) {
// handleException("An error has occurred while trying to retrieve tags for this resource version", e);
// throw new EFhirClientException("An error has occurred while trying to delete this resource", e);
@ -554,7 +617,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> createTags(List<Coding> tags, Class<T> resourceClass, String id) {
TagListRequest request = null;
try {
request = ClientUtils.issuePostRequestForTagList(resourceAddress.resolveGetTagsForReference(resourceClass, id),ClientUtils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request = utils.issuePostRequestForTagList(resourceAddress.resolveGetTagsForReference(resourceClass, id),utils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request.addSuccessStatus(201);
request.addSuccessStatus(200);
if(request.isUnsuccessfulRequest()) {
@ -570,7 +633,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> createTags(List<Coding> tags, Class<T> resourceClass, String id, String version) {
TagListRequest request = null;
try {
request = ClientUtils.issuePostRequestForTagList(resourceAddress.resolveGetTagsForResourceVersion(resourceClass, id, version),ClientUtils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request = utils.issuePostRequestForTagList(resourceAddress.resolveGetTagsForResourceVersion(resourceClass, id, version),utils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request.addSuccessStatus(201);
request.addSuccessStatus(200);
if(request.isUnsuccessfulRequest()) {
@ -586,7 +649,7 @@ public class FHIRToolingClient {
public <T extends Resource> List<Coding> deleteTags(List<Coding> tags, Class<T> resourceClass, String id, String version) {
TagListRequest request = null;
try {
request = ClientUtils.issuePostRequestForTagList(resourceAddress.resolveDeleteTagsForResourceVersion(resourceClass, id, version),ClientUtils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request = utils.issuePostRequestForTagList(resourceAddress.resolveDeleteTagsForResourceVersion(resourceClass, id, version),utils.getTagListAsByteArray(tags, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), null, proxy);
request.addSuccessStatus(201);
request.addSuccessStatus(200);
if(request.isUnsuccessfulRequest()) {
@ -631,7 +694,7 @@ public class FHIRToolingClient {
public Bundle fetchFeed(String url) {
Bundle feed = null;
try {
feed = ClientUtils.issueGetFeedRequest(new URI(url), getPreferredResourceFormat(), proxy);
feed = utils.issueGetFeedRequest(new URI(url), getPreferredResourceFormat());
} catch (Exception e) {
handleException("An error has occurred while trying to retrieve history since last update",e);
}
@ -640,8 +703,8 @@ public class FHIRToolingClient {
public ValueSet expandValueset(ValueSet source) {
List<Header> headers = null;
ResourceRequest<Resource> result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
ClientUtils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"),
utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
@ -656,7 +719,7 @@ public class FHIRToolingClient {
public Parameters lookupCode(Map<String, String> params) {
ResourceRequest<Resource> result = ClientUtils.issueGetResourceRequest(resourceAddress.resolveOperationUri(ValueSet.class, "lookup", params), getPreferredResourceFormat(), proxy);
ResourceRequest<Resource> result = utils.issueGetResourceRequest(resourceAddress.resolveOperationUri(ValueSet.class, "lookup", params), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
@ -668,10 +731,16 @@ public class FHIRToolingClient {
}
return (Parameters) result.getPayload();
}
public ValueSet expandValueset(ValueSet source, Map<String, String> params) {
public ValueSet expandValueset(ValueSet source, Parameters expParams,Map<String, String> params) {
List<Header> headers = null;
ResourceRequest<Resource> result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
ClientUtils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
Parameters p = expParams == null ? new Parameters() : expParams.copy();
p.addParameter().setName("valueSet").setResource(source);
for (String n : params.keySet())
p.addParameter().setName(n).setValue(new StringType(params.get(n)));
ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
@ -684,6 +753,22 @@ public class FHIRToolingClient {
return (ValueSet) result.getPayload();
}
// public ValueSet expandValueset(ValueSet source, ExpansionProfile profile, Map<String, String> params) {
// List<Header> headers = null;
// ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand", params),
// utils.getResourceAsByteArray(source, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// result.addErrorStatus(410);//gone
// result.addErrorStatus(404);//unknown
// result.addErrorStatus(405);
// result.addErrorStatus(422);//Unprocessable Entity
// result.addSuccessStatus(200);
// result.addSuccessStatus(201);
// if(result.isUnsuccessfulRequest()) {
// throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
// }
// return (ValueSet) result.getPayload();
// }
public String getAddress() {
return base;
@ -693,8 +778,8 @@ public class FHIRToolingClient {
Parameters params = new Parameters();
params.addParameter().setName("name").setValue(new StringType(name));
List<Header> headers = null;
ResourceRequest<Resource> result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ClientUtils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
@ -712,8 +797,8 @@ public class FHIRToolingClient {
params.addParameter().setName("name").setValue(new StringType(name));
params.addParameter().setName("concept").setValue(coding);
List<Header> headers = null;
ResourceRequest<Resource> result = ClientUtils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
ClientUtils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
@ -726,4 +811,51 @@ public class FHIRToolingClient {
return (ConceptMap) result.getPayload();
}
public int getTimeout() {
return utils.getTimeout();
}
public void setTimeout(int timeout) {
utils.setTimeout(timeout);
}
public String getUsername() {
return utils.getUsername();
}
public void setUsername(String username) {
utils.setUsername(username);
}
public String getPassword() {
return utils.getPassword();
}
public void setPassword(String password) {
utils.setPassword(password);
}
public Parameters getTerminologyCapabilities() {
return (Parameters) utils.issueGetResourceRequest(resourceAddress.resolveMetadataTxCaps(), getPreferredResourceFormat()).getReference();
}
public org.hl7.fhir.utilities.ToolingClientLogger getLogger() {
return utils.getLogger();
}
public void setLogger(ToolingClientLogger logger) {
utils.setLogger(logger);
}
public int getRetryCount() {
return utils.getRetryCount();
}
public void setRetryCount(int retryCount) {
utils.setRetryCount(retryCount);
}
}

View File

@ -40,6 +40,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
@ -114,6 +115,13 @@ public class ResourceAddress {
return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id+"/_history/"+version);
}
public <T extends Resource> URI resolveGetUriFromResourceClassAndCanonical(Class<T> resourceClass, String canonicalUrl) {
if (canonicalUrl.contains("|"))
return baseServiceUri.resolve(nameForClass(resourceClass)+"?url="+canonicalUrl.substring(0, canonicalUrl.indexOf("|"))+"&version="+canonicalUrl.substring(canonicalUrl.indexOf("|")+1));
else
return baseServiceUri.resolve(nameForClass(resourceClass)+"?url="+canonicalUrl);
}
public URI resolveGetHistoryForAllResources(int count) {
if(count > 0) {
return appendHttpParameter(baseServiceUri.resolve("_history"), "_count", ""+count);
@ -213,6 +221,11 @@ public class ResourceAddress {
return baseServiceUri.resolve(quick ? "metadata?_summary=true" : "metadata");
}
public URI resolveMetadataTxCaps() {
return baseServiceUri.resolve("metadata?mode=terminology");
}
/**
* For now, assume this type of location header structure.
* Generalize later: http://hl7connect.healthintersections.com.au/svc/fhir/318/_history/1
@ -386,7 +399,7 @@ public class ResourceAddress {
}
public static String getCalendarDateInIsoTimeFormat(Calendar calendar) {
SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd'T'hh:mm:ss");//TODO Move out
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss", new Locale("en", "US"));//TODO Move out
format.setTimeZone(TimeZone.getTimeZone("GMT"));
return format.format(calendar.getTime());
}

View File

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

View File

@ -7,19 +7,19 @@ package org.hl7.fhir.dstu3.utils.client;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@ -30,7 +30,7 @@ package org.hl7.fhir.dstu3.utils.client;
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
@ -50,6 +50,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
@ -84,6 +85,7 @@ import org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.dstu3.model.Resource;
import org.hl7.fhir.dstu3.model.ResourceType;
import org.hl7.fhir.dstu3.utils.ResourceUtilities;
import org.hl7.fhir.utilities.ToolingClientLogger;
/**
* Helper class handling lower level HTTP transport concerns.
@ -91,15 +93,16 @@ import org.hl7.fhir.dstu3.utils.ResourceUtilities;
* @author Claude Nanjo
*/
public class ClientUtils {
public static final String DEFAULT_CHARSET = "UTF-8";
public static final String HEADER_LOCATION = "location";
public static final String HEADER_LOCATION = "location";
private HttpHost proxy;
private int timeout = 5000;
private String username;
private String password;
private ToolingClientLogger logger;
private int retryCount;
public HttpHost getProxy() {
return proxy;
@ -134,42 +137,42 @@ public class ClientUtils {
}
public <T extends Resource> ResourceRequest<T> issueOptionsRequest(URI optionsUri, String resourceFormat) {
HttpOptions options = new HttpOptions(optionsUri);
HttpOptions options = new HttpOptions(optionsUri);
return issueResourceRequest(resourceFormat, options);
}
}
public <T extends Resource> ResourceRequest<T> issueGetResourceRequest(URI resourceUri, String resourceFormat) {
HttpGet httpget = new HttpGet(resourceUri);
HttpGet httpget = new HttpGet(resourceUri);
return issueResourceRequest(resourceFormat, httpget);
}
}
public <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers) {
HttpPut httpPut = new HttpPut(resourceUri);
HttpPut httpPut = new HttpPut(resourceUri);
return issueResourceRequest(resourceFormat, httpPut, payload, headers);
}
}
public <T extends Resource> ResourceRequest<T> issuePutRequest(URI resourceUri, byte[] payload, String resourceFormat) {
HttpPut httpPut = new HttpPut(resourceUri);
HttpPut httpPut = new HttpPut(resourceUri);
return issueResourceRequest(resourceFormat, httpPut, payload, null);
}
}
public <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat, List<Header> headers) {
HttpPost httpPost = new HttpPost(resourceUri);
HttpPost httpPost = new HttpPost(resourceUri);
return issueResourceRequest(resourceFormat, httpPost, payload, headers);
}
}
public <T extends Resource> ResourceRequest<T> issuePostRequest(URI resourceUri, byte[] payload, String resourceFormat) {
return issuePostRequest(resourceUri, payload, resourceFormat, null);
}
}
public Bundle issueGetFeedRequest(URI resourceUri, String resourceFormat) {
HttpGet httpget = new HttpGet(resourceUri);
configureFhirRequest(httpget, resourceFormat);
HttpGet httpget = new HttpGet(resourceUri);
configureFhirRequest(httpget, resourceFormat);
HttpResponse response = sendRequest(httpget);
return unmarshalReference(response, resourceFormat);
}
return unmarshalReference(response, resourceFormat);
}
private void setAuth(HttpRequest httpget) {
if (password != null) {
try {
@ -182,326 +185,336 @@ public class ClientUtils {
}
public Bundle postBatchRequest(URI resourceUri, byte[] payload, String resourceFormat) {
HttpPost httpPost = new HttpPost(resourceUri);
configureFhirRequest(httpPost, resourceFormat);
HttpResponse response = sendPayload(httpPost, payload, proxy);
return unmarshalFeed(response, resourceFormat);
}
HttpPost httpPost = new HttpPost(resourceUri);
configureFhirRequest(httpPost, resourceFormat);
HttpResponse response = sendPayload(httpPost, payload, proxy);
return unmarshalFeed(response, resourceFormat);
}
public boolean issueDeleteRequest(URI resourceUri) {
HttpDelete deleteRequest = new HttpDelete(resourceUri);
HttpDelete deleteRequest = new HttpDelete(resourceUri);
HttpResponse response = sendRequest(deleteRequest);
int responseStatusCode = response.getStatusLine().getStatusCode();
boolean deletionSuccessful = false;
if(responseStatusCode == 204) {
deletionSuccessful = true;
}
return deletionSuccessful;
}
/***********************************************************
* Request/Response Helper methods
***********************************************************/
int responseStatusCode = response.getStatusLine().getStatusCode();
boolean deletionSuccessful = false;
if(responseStatusCode == 204) {
deletionSuccessful = true;
}
return deletionSuccessful;
}
/***********************************************************
* Request/Response Helper methods
***********************************************************/
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request) {
return issueResourceRequest(resourceFormat, request, null);
}
/**
* @param resourceFormat
* @param options
* @return
*/
}
/**
* @param resourceFormat
* @param options
* @return
*/
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload) {
return issueResourceRequest(resourceFormat, request, payload, null);
}
/**
* @param resourceFormat
* @param options
* @return
*/
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload, List<Header> headers) {
configureFhirRequest(request, resourceFormat, headers);
HttpResponse response = null;
if(request instanceof HttpEntityEnclosingRequest && payload != null) {
response = sendPayload((HttpEntityEnclosingRequestBase)request, payload, proxy);
} else if (request instanceof HttpEntityEnclosingRequest && payload == null){
throw new EFhirClientException("PUT and POST requests require a non-null payload");
} else {
response = sendRequest(request);
}
T resource = unmarshalReference(response, resourceFormat);
return new ResourceRequest<T>(resource, response.getStatusLine().getStatusCode(), getLocationHeader(response));
}
/**
* Method adds required request headers.
* TODO handle JSON request as well.
*
* @param request
*/
protected void configureFhirRequest(HttpRequest request, String format) {
configureFhirRequest(request, format, null);
}
/**
* Method adds required request headers.
* TODO handle JSON request as well.
*
* @param request
*/
protected void configureFhirRequest(HttpRequest request, String format, List<Header> headers) {
request.addHeader("User-Agent", "Java FHIR Client for FHIR");
}
if (format != null) {
request.addHeader("Accept",format);
request.addHeader("Content-Type", format + ";charset=" + DEFAULT_CHARSET);
}
/**
* @param resourceFormat
* @param options
* @return
*/
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload, List<Header> headers) {
configureFhirRequest(request, resourceFormat, headers);
HttpResponse response = null;
if(request instanceof HttpEntityEnclosingRequest && payload != null) {
response = sendPayload((HttpEntityEnclosingRequestBase)request, payload, proxy);
} else if (request instanceof HttpEntityEnclosingRequest && payload == null){
throw new EFhirClientException("PUT and POST requests require a non-null payload");
} else {
response = sendRequest(request);
}
T resource = unmarshalReference(response, resourceFormat);
return new ResourceRequest<T>(resource, response.getStatusLine().getStatusCode(), getLocationHeader(response));
}
/**
* Method adds required request headers.
* TODO handle JSON request as well.
*
* @param request
*/
protected void configureFhirRequest(HttpRequest request, String format) {
configureFhirRequest(request, format, null);
}
/**
* Method adds required request headers.
* TODO handle JSON request as well.
*
* @param request
*/
protected void configureFhirRequest(HttpRequest request, String format, List<Header> headers) {
request.addHeader("User-Agent", "Java FHIR Client for FHIR");
if (format != null) {
request.addHeader("Accept",format);
request.addHeader("Content-Type", format + ";charset=" + DEFAULT_CHARSET);
}
request.addHeader("Accept-Charset", DEFAULT_CHARSET);
if(headers != null) {
for(Header header : headers) {
request.addHeader(header);
}
}
if(headers != null) {
for(Header header : headers) {
request.addHeader(header);
}
}
setAuth(request);
}
/**
* Method posts request payload
*
* @param request
* @param payload
* @return
*/
}
/**
* Method posts request payload
*
* @param request
* @param payload
* @return
*/
protected HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload, HttpHost proxy) {
HttpResponse response = null;
try {
HttpClient httpclient = new DefaultHttpClient();
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
request.setEntity(new ByteArrayEntity(payload));
log(request);
response = httpclient.execute(request);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending HTTP Post/Put Payload", ioe);
}
return response;
}
/**
*
* @param request
* @param payload
* @return
*/
HttpResponse response = null;
boolean ok = false;
int tryCount = 0;
while (!ok) {
try {
tryCount++;
HttpClient httpclient = new DefaultHttpClient();
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
request.setEntity(new ByteArrayEntity(payload));
log(request);
response = httpclient.execute(request);
ok = true;
} catch(IOException ioe) {
if (tryCount <= retryCount) {
ok = false;
} else {
throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe);
}
}
}
return response;
}
/**
*
* @param request
* @param payload
* @return
*/
protected HttpResponse sendRequest(HttpUriRequest request) {
HttpResponse response = null;
try {
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = null;
try {
HttpClient httpclient = new DefaultHttpClient();
log(request);
HttpParams params = httpclient.getParams();
HttpConnectionParams.setConnectionTimeout(params, timeout);
HttpConnectionParams.setSoTimeout(params, timeout);
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
response = httpclient.execute(request);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending Http Request: "+ioe.getMessage(), ioe);
}
return response;
}
/**
* Unmarshals a resource from the response stream.
*
* @param response
* @return
*/
@SuppressWarnings("unchecked")
HttpParams params = httpclient.getParams();
HttpConnectionParams.setConnectionTimeout(params, timeout);
HttpConnectionParams.setSoTimeout(params, timeout);
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
response = httpclient.execute(request);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending Http Request: "+ioe.getMessage(), ioe);
}
return response;
}
/**
* Unmarshals a resource from the response stream.
*
* @param response
* @return
*/
@SuppressWarnings("unchecked")
protected <T extends Resource> T unmarshalReference(HttpResponse response, String format) {
T resource = null;
OperationOutcome error = null;
T resource = null;
OperationOutcome error = null;
byte[] cnt = log(response);
if (cnt != null) {
try {
resource = (T)getParser(format).parse(cnt);
if (resource instanceof OperationOutcome && hasError((OperationOutcome)resource)) {
error = (OperationOutcome) resource;
}
} catch(IOException ioe) {
if (resource instanceof OperationOutcome && hasError((OperationOutcome)resource)) {
error = (OperationOutcome) resource;
}
} catch(IOException ioe) {
throw new EFhirClientException("Error reading Http Response: "+ioe.getMessage(), ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message: "+e.getMessage(), e);
}
}
if(error != null) {
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message: "+e.getMessage(), e);
}
}
if(error != null) {
throw new EFhirClientException("Error from server: "+ResourceUtilities.getErrorDescription(error), error);
}
return resource;
}
/**
* Unmarshals Bundle from response stream.
*
* @param response
* @return
*/
}
return resource;
}
/**
* Unmarshals Bundle from response stream.
*
* @param response
* @return
*/
protected Bundle unmarshalFeed(HttpResponse response, String format) {
Bundle feed = null;
byte[] cnt = log(response);
String contentType = response.getHeaders("Content-Type")[0].getValue();
OperationOutcome error = null;
try {
String contentType = response.getHeaders("Content-Type")[0].getValue();
OperationOutcome error = null;
try {
if (cnt != null) {
if(contentType.contains(ResourceFormat.RESOURCE_XML.getHeader()) || contentType.contains("text/xml+fhir")) {
if(contentType.contains(ResourceFormat.RESOURCE_XML.getHeader()) || contentType.contains("text/xml+fhir")) {
Resource rf = getParser(format).parse(cnt);
if (rf instanceof Bundle)
feed = (Bundle) rf;
else if (rf instanceof OperationOutcome && hasError((OperationOutcome) rf)) {
error = (OperationOutcome) rf;
} else {
if (rf instanceof Bundle)
feed = (Bundle) rf;
else if (rf instanceof OperationOutcome && hasError((OperationOutcome) rf)) {
error = (OperationOutcome) rf;
} else {
throw new EFhirClientException("Error reading server response: a resource was returned instead");
}
}
}
} catch(IOException ioe) {
}
}
}
} catch(IOException ioe) {
throw new EFhirClientException("Error reading Http Response", ioe);
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message", e);
}
if(error != null) {
} catch(Exception e) {
throw new EFhirClientException("Error parsing response message", e);
}
if(error != null) {
throw new EFhirClientException("Error from server: "+ResourceUtilities.getErrorDescription(error), error);
}
return feed;
}
}
return feed;
}
private boolean hasError(OperationOutcome oo) {
for (OperationOutcomeIssueComponent t : oo.getIssue())
if (t.getSeverity() == IssueSeverity.ERROR || t.getSeverity() == IssueSeverity.FATAL)
return true;
return false;
for (OperationOutcomeIssueComponent t : oo.getIssue())
if (t.getSeverity() == IssueSeverity.ERROR || t.getSeverity() == IssueSeverity.FATAL)
return true;
return false;
}
protected String getLocationHeader(HttpResponse response) {
String location = null;
if(response.getHeaders("location").length > 0) {//TODO Distinguish between both cases if necessary
location = response.getHeaders("location")[0].getValue();
} else if(response.getHeaders("content-location").length > 0) {
location = response.getHeaders("content-location")[0].getValue();
}
return location;
}
/*****************************************************************
* Client connection methods
* ***************************************************************/
String location = null;
if(response.getHeaders("location").length > 0) {//TODO Distinguish between both cases if necessary
location = response.getHeaders("location")[0].getValue();
} else if(response.getHeaders("content-location").length > 0) {
location = response.getHeaders("content-location")[0].getValue();
}
return location;
}
/*****************************************************************
* Client connection methods
* ***************************************************************/
public HttpURLConnection buildConnection(URI baseServiceUri, String tail) {
try {
HttpURLConnection client = (HttpURLConnection) baseServiceUri.resolve(tail).toURL().openConnection();
return client;
} catch(MalformedURLException mue) {
throw new EFhirClientException("Invalid Service URL", mue);
} catch(IOException ioe) {
throw new EFhirClientException("Unable to establish connection to server: " + baseServiceUri.toString() + tail, ioe);
}
}
try {
HttpURLConnection client = (HttpURLConnection) baseServiceUri.resolve(tail).toURL().openConnection();
return client;
} catch(MalformedURLException mue) {
throw new EFhirClientException("Invalid Service URL", mue);
} catch(IOException ioe) {
throw new EFhirClientException("Unable to establish connection to server: " + baseServiceUri.toString() + tail, ioe);
}
}
public HttpURLConnection buildConnection(URI baseServiceUri, ResourceType resourceType, String id) {
return buildConnection(baseServiceUri, ResourceAddress.buildRelativePathFromResourceType(resourceType, id));
}
/******************************************************************
* Other general helper methods
* ****************************************************************/
return buildConnection(baseServiceUri, ResourceAddress.buildRelativePathFromResourceType(resourceType, id));
}
/******************************************************************
* Other general helper methods
* ****************************************************************/
public <T extends Resource> byte[] getResourceAsByteArray(T resource, boolean pretty, boolean isJson) {
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
baos = new ByteArrayOutputStream();
IParser parser = null;
if(isJson) {
parser = new JsonParser();
} else {
parser = new XmlParser();
}
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
baos = new ByteArrayOutputStream();
IParser parser = null;
if(isJson) {
parser = new JsonParser();
} else {
parser = new XmlParser();
}
parser.setOutputStyle(pretty ? OutputStyle.PRETTY : OutputStyle.NORMAL);
parser.compose(baos, resource);
baos.close();
byteArray = baos.toByteArray();
baos.close();
} catch (Exception e) {
try{
baos.close();
}catch(Exception ex) {
throw new EFhirClientException("Error closing output stream", ex);
}
throw new EFhirClientException("Error converting output stream to byte array", e);
}
return byteArray;
}
parser.compose(baos, resource);
baos.close();
byteArray = baos.toByteArray();
baos.close();
} catch (Exception e) {
try{
baos.close();
}catch(Exception ex) {
throw new EFhirClientException("Error closing output stream", ex);
}
throw new EFhirClientException("Error converting output stream to byte array", e);
}
return byteArray;
}
public byte[] getFeedAsByteArray(Bundle feed, boolean pretty, boolean isJson) {
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
baos = new ByteArrayOutputStream();
IParser parser = null;
if(isJson) {
parser = new JsonParser();
} else {
parser = new XmlParser();
}
ByteArrayOutputStream baos = null;
byte[] byteArray = null;
try {
baos = new ByteArrayOutputStream();
IParser parser = null;
if(isJson) {
parser = new JsonParser();
} else {
parser = new XmlParser();
}
parser.setOutputStyle(pretty ? OutputStyle.PRETTY : OutputStyle.NORMAL);
parser.compose(baos, feed);
baos.close();
byteArray = baos.toByteArray();
baos.close();
} catch (Exception e) {
try{
baos.close();
}catch(Exception ex) {
throw new EFhirClientException("Error closing output stream", ex);
}
throw new EFhirClientException("Error converting output stream to byte array", e);
}
return byteArray;
}
parser.compose(baos, feed);
baos.close();
byteArray = baos.toByteArray();
baos.close();
} catch (Exception e) {
try{
baos.close();
}catch(Exception ex) {
throw new EFhirClientException("Error closing output stream", ex);
}
throw new EFhirClientException("Error converting output stream to byte array", e);
}
return byteArray;
}
public Calendar getLastModifiedResponseHeaderAsCalendarObject(URLConnection serverConnection) {
String dateTime = null;
try {
dateTime = serverConnection.getHeaderField("Last-Modified");
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
Date lastModifiedTimestamp = format.parse(dateTime);
Calendar calendar=Calendar.getInstance();
calendar.setTime(lastModifiedTimestamp);
return calendar;
} catch(ParseException pe) {
throw new EFhirClientException("Error parsing Last-Modified response header " + dateTime, pe);
}
}
String dateTime = null;
try {
dateTime = serverConnection.getHeaderField("Last-Modified");
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", new Locale("en", "US"));
Date lastModifiedTimestamp = format.parse(dateTime);
Calendar calendar=Calendar.getInstance();
calendar.setTime(lastModifiedTimestamp);
return calendar;
} catch(ParseException pe) {
throw new EFhirClientException("Error parsing Last-Modified response header " + dateTime, pe);
}
}
protected IParser getParser(String format) {
if(StringUtils.isBlank(format)) {
format = ResourceFormat.RESOURCE_XML.getHeader();
}
if(format.equalsIgnoreCase("json") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader()) || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
return new JsonParser();
} else if(format.equalsIgnoreCase("xml") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader()) || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
return new XmlParser();
} else {
throw new EFhirClientException("Invalid format: " + format);
}
}
if(StringUtils.isBlank(format)) {
format = ResourceFormat.RESOURCE_XML.getHeader();
}
if(format.equalsIgnoreCase("json") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader()) || format.equalsIgnoreCase(ResourceFormat.RESOURCE_JSON.getHeader())) {
return new JsonParser();
} else if(format.equalsIgnoreCase("xml") || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader()) || format.equalsIgnoreCase(ResourceFormat.RESOURCE_XML.getHeader())) {
return new XmlParser();
} else {
throw new EFhirClientException("Invalid format: " + format);
}
}
public Bundle issuePostFeedRequest(URI resourceUri, Map<String, String> parameters, String resourceName, Resource resource, String resourceFormat) throws IOException {
HttpPost httppost = new HttpPost(resourceUri);
String boundary = "----WebKitFormBoundarykbMUo6H8QaUnYtRy";
@ -511,7 +524,7 @@ public class ClientUtils {
HttpResponse response = sendPayload(httppost, encodeFormSubmission(parameters, resourceName, resource, boundary));
return unmarshalFeed(response, resourceFormat);
}
private byte[] encodeFormSubmission(Map<String, String> parameters, String resourceName, Resource resource, String boundary) throws IOException {
ByteArrayOutputStream b = new ByteArrayOutputStream();
OutputStreamWriter w = new OutputStreamWriter(b, "UTF-8");
@ -557,7 +570,7 @@ public class ClientUtils {
}
return response;
}
private void log(HttpUriRequest request) {
if (logger != null) {
List<String> headers = new ArrayList<>();
@ -584,7 +597,7 @@ public class ClientUtils {
logger.logRequest(request.getMethod(), request.getURI().toString(), headers, cnt);
}
}
private byte[] log(HttpResponse response) {
byte[] cnt = null;
try {
@ -611,7 +624,7 @@ public class ClientUtils {
this.logger = logger;
}
/**
* Used for debugging
*
@ -630,5 +643,13 @@ public class ClientUtils {
return value;
}
public int getRetryCount() {
return retryCount;
}
public void setRetryCount(int retryCount) {
this.retryCount = retryCount;
}
}

View File

@ -54,6 +54,7 @@ import org.hl7.fhir.dstu3.model.PrimitiveType;
import org.hl7.fhir.dstu3.model.Resource;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities;
/**
@ -92,6 +93,7 @@ public class FHIRToolingClient {
private String base;
private ResourceAddress resourceAddress;
private ResourceFormat preferredResourceFormat;
private HttpHost proxy;
private int maxResultSetSize = -1;//_count
private CapabilityStatement capabilities;
@ -217,6 +219,31 @@ public class FHIRToolingClient {
return result.getPayload();
}
// GET fhir/ValueSet?url=http://hl7.org/fhir/ValueSet/clinical-findings&version=0.8
public <T extends Resource> T getCanonical(Class<T> resourceClass, String canonicalURL) {
ResourceRequest<T> result = null;
try {
result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndCanonical(resourceClass, canonicalURL), getPreferredResourceFormat());
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);//unknown
result.addSuccessStatus(200);//Only one for now
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch (Exception e) {
handleException("An error has occurred while trying to read this version of the resource", e);
}
Bundle bnd = (Bundle) result.getPayload();
if (bnd.getEntry().size() == 0)
throw new EFhirClientException("No matching resource found for canonical URL '"+canonicalURL+"'");
if (bnd.getEntry().size() > 1)
throw new EFhirClientException("Multiple matching resources found for canonical URL '"+canonicalURL+"'");
return (T) bnd.getEntry().get(0).getResource();
}
public Resource update(Resource resource) {
ResourceRequest<Resource> result = null;
try {
@ -246,35 +273,34 @@ public class FHIRToolingClient {
return result.getPayload();
}
//
// public <T extends Resource> T update(Class<T> resourceClass, T resource, String id) {
// ResourceRequest<T> result = null;
// try {
// List<Header> headers = null;
// result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// result.addErrorStatus(410);//gone
// result.addErrorStatus(404);//unknown
// result.addErrorStatus(405);
// result.addErrorStatus(422);//Unprocessable Entity
// result.addSuccessStatus(200);
// result.addSuccessStatus(201);
// if(result.isUnsuccessfulRequest()) {
// throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
// }
// } catch(Exception e) {
// throw new EFhirClientException("An error has occurred while trying to update this resource", e);
// }
// // TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
// try {
// OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
// ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
// return this.vread(resourceClass, resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
// } catch(ClassCastException e) {
// // if we fall throught we have the correct type already in the create
// }
//
// return result.getPayload();
// }
public <T extends Resource> T update(Class<T> resourceClass, T resource, String id) {
ResourceRequest<T> result = null;
try {
List<Header> headers = null;
result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
result.addErrorStatus(422);//Unprocessable Entity
result.addSuccessStatus(200);
result.addSuccessStatus(201);
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch(Exception e) {
throw new EFhirClientException("An error has occurred while trying to update this resource", e);
}
// TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
try {
OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
return this.vread(resourceClass, resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
} catch(ClassCastException e) {
// if we fall throught we have the correct type already in the create
}
return result.getPayload();
}
//
// public <T extends Resource> boolean delete(Class<T> resourceClass, String id) {
@ -802,4 +828,22 @@ public class FHIRToolingClient {
return (Parameters) utils.issueGetResourceRequest(resourceAddress.resolveMetadataTxCaps(), getPreferredResourceFormat()).getReference();
}
public org.hl7.fhir.utilities.ToolingClientLogger getLogger() {
return utils.getLogger();
}
public void setLogger(ToolingClientLogger logger) {
utils.setLogger(logger);
}
public int getRetryCount() {
return utils.getRetryCount();
}
public void setRetryCount(int retryCount) {
utils.setRetryCount(retryCount);
}
}

View File

@ -40,6 +40,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
@ -114,6 +115,13 @@ public class ResourceAddress {
return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id+"/_history/"+version);
}
public <T extends Resource> URI resolveGetUriFromResourceClassAndCanonical(Class<T> resourceClass, String canonicalUrl) {
if (canonicalUrl.contains("|"))
return baseServiceUri.resolve(nameForClass(resourceClass)+"?url="+canonicalUrl.substring(0, canonicalUrl.indexOf("|"))+"&version="+canonicalUrl.substring(canonicalUrl.indexOf("|")+1));
else
return baseServiceUri.resolve(nameForClass(resourceClass)+"?url="+canonicalUrl);
}
public URI resolveGetHistoryForAllResources(int count) {
if(count > 0) {
return appendHttpParameter(baseServiceUri.resolve("_history"), "_count", ""+count);
@ -213,6 +221,11 @@ public class ResourceAddress {
return baseServiceUri.resolve(quick ? "metadata?_summary=true" : "metadata");
}
public URI resolveMetadataTxCaps() {
return baseServiceUri.resolve("metadata?mode=terminology");
}
/**
* For now, assume this type of location header structure.
* Generalize later: http://hl7connect.healthintersections.com.au/svc/fhir/318/_history/1
@ -386,7 +399,7 @@ public class ResourceAddress {
}
public static String getCalendarDateInIsoTimeFormat(Calendar calendar) {
SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd'T'hh:mm:ss");//TODO Move out
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss", new Locale("en", "US"));//TODO Move out
format.setTimeZone(TimeZone.getTimeZone("GMT"));
return format.format(calendar.getTime());
}
@ -417,8 +430,5 @@ public class ResourceAddress {
}
}
public URI resolveMetadataTxCaps() {
return baseServiceUri.resolve("metadata?mode=terminology");
}
}

View File

@ -1,40 +0,0 @@
package org.hl7.fhir.dstu3.utils.client;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import java.util.List;
public interface ToolingClientLogger {
public void logRequest(String method, String url, List<String> headers, byte[] body);
public void logResponse(String outcome, List<String> headers, byte[] body);
}

View File

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

View File

@ -37,7 +37,7 @@ import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.hl7.fhir.r4.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities;
public class HTMLClientLogger implements ToolingClientLogger {

View File

@ -53,7 +53,6 @@ import org.hl7.fhir.r4.model.Bundle.BundleType;
import org.hl7.fhir.r4.model.Bundle.HTTPVerb;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.utils.client.FHIRToolingClient;
import org.hl7.fhir.r4.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.IniFile;
import org.hl7.fhir.utilities.Utilities;

View File

@ -50,6 +50,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
@ -84,6 +85,7 @@ import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.ResourceType;
import org.hl7.fhir.r4.utils.ResourceUtilities;
import org.hl7.fhir.utilities.ToolingClientLogger;
/**
* Helper class handling lower level HTTP transport concerns.
@ -100,6 +102,7 @@ public class ClientUtils {
private String username;
private String password;
private ToolingClientLogger logger;
private int retryCount;
public HttpHost getProxy() {
return proxy;
@ -277,16 +280,26 @@ public class ClientUtils {
*/
protected HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload, HttpHost proxy) {
HttpResponse response = null;
try {
HttpClient httpclient = new DefaultHttpClient();
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
boolean ok = false;
int tryCount = 0;
while (!ok) {
try {
tryCount++;
HttpClient httpclient = new DefaultHttpClient();
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
request.setEntity(new ByteArrayEntity(payload));
log(request);
response = httpclient.execute(request);
ok = true;
} catch(IOException ioe) {
if (tryCount <= retryCount) {
ok = false;
} else {
throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe);
}
}
request.setEntity(new ByteArrayEntity(payload));
log(request);
response = httpclient.execute(request);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending HTTP Post/Put Payload", ioe);
}
return response;
}
@ -480,7 +493,7 @@ public class ClientUtils {
String dateTime = null;
try {
dateTime = serverConnection.getHeaderField("Last-Modified");
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", new Locale("en", "US"));
Date lastModifiedTimestamp = format.parse(dateTime);
Calendar calendar=Calendar.getInstance();
calendar.setTime(lastModifiedTimestamp);
@ -585,7 +598,7 @@ public class ClientUtils {
logger.logRequest(request.getMethod(), request.getURI().toString(), headers, cnt);
}
}
private byte[] log(HttpResponse response) {
byte[] cnt = null;
try {
@ -612,7 +625,7 @@ public class ClientUtils {
this.logger = logger;
}
/**
* Used for debugging
*
@ -631,5 +644,13 @@ public class ClientUtils {
return value;
}
public int getRetryCount() {
return retryCount;
}
public void setRetryCount(int retryCount) {
this.retryCount = retryCount;
}
}

View File

@ -54,6 +54,7 @@ import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.TerminologyCapabilities;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities;
/**
@ -829,5 +830,13 @@ public class FHIRToolingClient {
utils.setLogger(logger);
}
public int getRetryCount() {
return utils.getRetryCount();
}
public void setRetryCount(int retryCount) {
utils.setRetryCount(retryCount);
}
}

View File

@ -40,6 +40,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
@ -397,7 +398,7 @@ public class ResourceAddress {
}
public static String getCalendarDateInIsoTimeFormat(Calendar calendar) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");//TODO Move out
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss", new Locale("en", "US"));//TODO Move out
format.setTimeZone(TimeZone.getTimeZone("GMT"));
return format.format(calendar.getTime());
}

View File

@ -1,40 +0,0 @@
package org.hl7.fhir.r4.utils.client;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import java.util.List;
public interface ToolingClientLogger {
public void logRequest(String method, String url, List<String> headers, byte[] body);
public void logResponse(String outcome, List<String> headers, byte[] body);
}

View File

@ -1,149 +0,0 @@
package org.hl7.fhir.r4.test;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.context.SimpleWorkerContext;
import org.hl7.fhir.r4.elementmodel.Manager;
import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat;
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
import org.hl7.fhir.r4.formats.JsonParser;
import org.hl7.fhir.r4.model.*;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r4.terminologies.ConceptMapEngine;
import org.hl7.fhir.r4.test.utils.TestingUtilities;
import org.hl7.fhir.r4.utils.StructureMapUtilities;
import org.hl7.fhir.r4.utils.StructureMapUtilities.ITransformerServices;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import static org.junit.Assert.assertTrue;
@Disabled
public class FHIRMappingLanguageTests implements ITransformerServices {
private List<Resource> outputs = new ArrayList<Resource>();
static private SimpleWorkerContext context;
static private JsonParser jsonParser;
public static Stream<Arguments> data()
throws FileNotFoundException, IOException, ParserConfigurationException, SAXException {
Document tests = XMLUtil.parseFileToDom(TestingUtilities.resourceNameToFile("fml", "manifest.xml"));
Element test = XMLUtil.getFirstChild(tests.getDocumentElement());
List<Arguments> objects = new ArrayList();
while (test != null && test.getNodeName().equals("test")) {
objects.add(Arguments.of(test.getAttribute("name"), test.getAttribute("source"), test.getAttribute("map"),
test.getAttribute("output")));
test = XMLUtil.getNextSibling(test);
}
return objects.stream();
}
@BeforeAll
static public void setUp() throws Exception {
if (context == null) {
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
context = SimpleWorkerContext.fromPackage(pcm.loadPackage("hl7.fhir.core", "4.0.0"));
jsonParser = new JsonParser();
jsonParser.setOutputStyle(OutputStyle.PRETTY);
}
}
@ParameterizedTest(name = "{index}: {0}")
@MethodSource("data")
public void test(String name, String source, String map, String output) throws Exception {
String fileSource = TestingUtilities.resourceNameToFile("fml", source);
String fileMap = TestingUtilities.resourceNameToFile("fml", map);
String fileOutput = TestingUtilities.resourceNameToFile("fml", output);
String fileOutputRes = TestingUtilities.resourceNameToFile("fml", output) + ".out";
outputs.clear();
boolean ok = false;
String msg = null;
Resource resource = null;
try {
StructureMapUtilities scu = new StructureMapUtilities(context, this);
org.hl7.fhir.r4.elementmodel.Element src = Manager.parse(context,
new ByteArrayInputStream(TextFile.fileToBytes(fileSource)), FhirFormat.JSON);
StructureMap structureMap = scu.parse(TextFile.fileToString(fileMap), name);
String typeName = scu.getTargetType(structureMap).getType();
resource = ResourceFactory.createResource(typeName);
scu.transform(null, src, structureMap, resource);
ok = true;
} catch (Exception e) {
ok = false;
msg = e.getMessage();
}
if (ok) {
ByteArrayOutputStream boas = new ByteArrayOutputStream();
jsonParser.compose(boas, resource);
log(boas.toString());
TextFile.bytesToFile(boas.toByteArray(), fileOutputRes);
msg = TestingUtilities.checkJsonIsSame(fileOutputRes, fileOutput);
assertTrue(msg, Utilities.noString(msg));
} else
assertTrue("Error, but proper output was expected (" + msg + ")", output.equals("$error"));
}
@Override
public void log(String message) {
System.out.println(message);
}
@Override
public Base createType(Object appInfo, String name) throws FHIRException {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, name);
if (sd != null && sd.getKind() == StructureDefinitionKind.LOGICAL) {
return Manager.build(context, sd);
} else {
if (name.startsWith("http://hl7.org/fhir/StructureDefinition/"))
name = name.substring("http://hl7.org/fhir/StructureDefinition/".length());
return ResourceFactory.createResourceOrType(name);
}
}
@Override
public Base createResource(Object appInfo, Base res, boolean atRootofTransform) {
if (atRootofTransform)
outputs.add((Resource) res);
return res;
}
@Override
public Coding translate(Object appInfo, Coding source, String conceptMapUrl) throws FHIRException {
ConceptMapEngine cme = new ConceptMapEngine(context);
return cme.translate(source, conceptMapUrl);
}
@Override
public Base resolveReference(Object appContext, String url) throws FHIRException {
throw new FHIRException("resolveReference is not supported yet");
}
@Override
public List<Base> performSearch(Object appContext, String url) throws FHIRException {
throw new FHIRException("performSearch is not supported yet");
}
}

View File

@ -1 +0,0 @@
*.out

View File

@ -1,6 +0,0 @@
<fml-tests>
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patassignment" source="qr.json" map="qr2pat-assignment.map" output="qr2pat-assignment-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patgender" source="qr.json" map="qr2pat-gender.map" output="qr2pat-gender-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pathumannametwice" source="qr.json" map="qr2pat-humannametwice.map" output="qr2pat-humannametwice-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pathumannameshared" source="qr.json" map="qr2pat-humannameshared.map" output="qr2pat-humannameshared-res.json" />
</fml-tests>

View File

@ -1,39 +0,0 @@
{
"resourceType": "QuestionnaireResponse",
"status": "in-progress",
"item": [
{
"linkId": "patient",
"text": "Patient",
"item": [
{
"linkId": "patient.lastname",
"text": "Name",
"answer": [
{
"valueString": "Brönnimann-Bertholet"
}
]
},
{
"linkId": "patient.firstname",
"text": "Vorname",
"answer": [
{
"valueString": "Elisabeth"
}
]
},
{
"linkId": "patient.sex",
"text": "Geschlecht",
"answer": [
{
"valueString": "female"
}
]
}
]
}
]
}

View File

@ -1,4 +0,0 @@
{
"resourceType" : "Patient",
"gender" : "female"
}

View File

@ -1,8 +0,0 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patassignment" = "qr2patassignment"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target
group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : Patient) {
src -> tgt.gender = 'female' "Simple Assignment";
}

View File

@ -1,4 +0,0 @@
{
"resourceType" : "Patient",
"gender" : "female"
}

View File

@ -1,12 +0,0 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patgender" = "qr2patgender"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target
group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : Patient) {
src.item as item -> tgt as patient then item(item, patient);
}
group item(source src, target tgt: Patient) {
src.item as item where linkId.value in ('patient.sex') -> tgt.gender = (item.answer.valueString);
}

View File

@ -1,8 +0,0 @@
{
"resourceType" : "Patient",
"name" : [{
"family" : "Brönnimann-Bertholet",
"given" : ["Elisabeth"]
}],
"gender" : "female"
}

View File

@ -1,26 +0,0 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pathumannameshared" = "qr2pathumannametwice"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target
group entry(source src : QuestionnaireResponse, target tgt : Patient) {
src.item as item then item(item, tgt);
}
group item(source src, target tgt) {
src.item as item then item(item, tgt);
src.item as item where linkId.value = 'patient.lastname' -> tgt.name as name share patientName then humanNameFamily(item, name);
src.item as item where linkId.value = 'patient.firstname' -> tgt.name as name share patientName then humanNameGiven(item, name);
src.item as item where linkId.value = 'patient.sex' -> tgt.gender = (item.answer.valueString);
}
group humanNameFamily(source src, target tgt: HumanName) {
src.answer as answer -> tgt.family = (answer.valueString);
}
group humanNameGiven(source src, target tgt: HumanName) {
src.answer as answer -> tgt.given = (answer.valueString);
}
group administrativeGender(source src, target tgt: code) {
src.answer as answer -> tgt = (answer.valueString);
}

View File

@ -1,10 +0,0 @@
{
"resourceType" : "Patient",
"name" : [{
"family" : "Brönnimann-Bertholet"
},
{
"given" : ["Elisabeth"]
}],
"gender" : "female"
}

View File

@ -1,26 +0,0 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pathumannametwice" = "qr2pathumannametwice"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target
group entry(source src : QuestionnaireResponse, target tgt : Patient) {
src.item as item then item(item, tgt);
}
group item(source src, target tgt) {
src.item as item then item(item, tgt);
src.item as item where linkId.value = 'patient.lastname' -> tgt.name as name then humanNameFamily(item, name);
src.item as item where linkId.value = 'patient.firstname' -> tgt.name as name then humanNameGiven(item, name);
src.item as item where linkId.value = 'patient.sex' -> tgt.gender = (item.answer.valueString);
}
group humanNameFamily(source src, target tgt: HumanName) {
src.answer as answer -> tgt.family = (answer.valueString);
}
group humanNameGiven(source src, target tgt: HumanName) {
src.answer as answer -> tgt.given = (answer.valueString);
}
group administrativeGender(source src, target tgt: code) {
src.answer as answer -> tgt = (answer.valueString);
}

View File

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

View File

@ -24,7 +24,7 @@ import org.hl7.fhir.utilities.xhtml.XhtmlNode;
public abstract class CanonicalResourceComparer extends ResourceComparer {
public class CanonicalResourceComparison<T extends CanonicalResource> extends ResourceComparison {
public abstract class CanonicalResourceComparison<T extends CanonicalResource> extends ResourceComparison {
protected T left;
protected T right;
@ -34,7 +34,7 @@ public abstract class CanonicalResourceComparer extends ResourceComparer {
public CanonicalResourceComparison(T left, T right) {
super();
super(left.getId(), right.getId());
this.left = left;
this.right = right;
}

View File

@ -45,6 +45,11 @@ public class CodeSystemComparer extends CanonicalResourceComparer {
public StructuralMatch<ConceptDefinitionComponent> getCombined() {
return combined;
}
@Override
protected String abbreviation() {
return "cs";
}
}
private CodeSystem right;
@ -226,7 +231,6 @@ public class CodeSystemComparer extends CanonicalResourceComparer {
}
}
private boolean hasDesignation(ConceptDefinitionDesignationComponent td, List<ConceptDefinitionDesignationComponent> designation) {
for (ConceptDefinitionDesignationComponent t : designation) {
if (designationsMatch(td, t)) {
@ -303,7 +307,6 @@ public class CodeSystemComparer extends CanonicalResourceComparer {
return null;
}
public XhtmlNode renderConcepts(CodeSystemComparison comparison, String id, String prefix) throws FHIRException, IOException {
// columns: code, display (left|right), properties (left|right)
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false);

View File

@ -0,0 +1,190 @@
package org.hl7.fhir.r5.comparison;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.PathEngineException;
import org.hl7.fhir.r5.comparison.CodeSystemComparer.CodeSystemComparison;
import org.hl7.fhir.r5.comparison.ProfileComparer.ProfileComparison;
import org.hl7.fhir.r5.comparison.ResourceComparer.ResourceComparison;
import org.hl7.fhir.r5.comparison.ValueSetComparer.ValueSetComparison;
import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.model.Base;
import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
import org.hl7.fhir.r5.model.StringType;
import org.hl7.fhir.r5.model.Tuple;
import org.hl7.fhir.r5.model.TypeDetails;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
import org.hl7.fhir.r5.utils.LiquidEngine;
import org.hl7.fhir.r5.utils.LiquidEngine.LiquidDocument;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
public class ComparisonRenderer implements IEvaluationContext {
private IWorkerContext context;
private ComparisonSession session;
private Map<String, String> templates = new HashMap<>();
private String folder;
public ComparisonRenderer(IWorkerContext context, String folder, ComparisonSession session) {
super();
this.context = context;
this.folder = folder;
this.session = session;
}
public Map<String, String> getTemplates() {
return templates;
}
public void render() throws IOException {
dumpBinaries();
for (String id : session.getCompares().keySet()) {
renderComparison(id, session.getCompares().get(id));
}
}
private void dumpBinaries() throws IOException {
for (String k : context.getBinaries().keySet()) {
TextFile.bytesToFile(context.getBinaries().get(k), Utilities.path(folder, k));
}
}
private void renderComparison(String id, ResourceComparison comp) throws IOException {
if (comp instanceof ProfileComparison) {
renderProfile(id, (ProfileComparison) comp);
} else if (comp instanceof ValueSetComparison) {
renderValueSet(id, (ValueSetComparison) comp);
} else if (comp instanceof CodeSystemComparison) {
renderCodeSystem(id, (CodeSystemComparison) comp);
}
}
private void renderCodeSystem(String id, CodeSystemComparison comp) throws IOException {
String template = templates.get("CodeSystem");
Map<String, Base> vars = new HashMap<>();
CodeSystemComparer cs = new CodeSystemComparer(session);
vars.put("left", new StringType(comp.getLeft().present()));
vars.put("right", new StringType(comp.getRight().present()));
vars.put("leftId", new StringType(comp.getLeft().getId()));
vars.put("rightId", new StringType(comp.getRight().getId()));
vars.put("leftUrl", new StringType(comp.getLeft().getUrl()));
vars.put("rightUrl", new StringType(comp.getRight().getUrl()));
vars.put("errors", new StringType(new XhtmlComposer(true).compose(cs.renderErrors(comp))));
vars.put("metadata", new StringType(new XhtmlComposer(true).compose(cs.renderMetadata(comp, "", ""))));
vars.put("concepts", new StringType(new XhtmlComposer(true).compose(cs.renderConcepts(comp, "", ""))));
String cnt = processTemplate(template, "CodeSystem", vars);
TextFile.stringToFile(cnt, file(comp.getId()+".html"));
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "comparison", comp.getId() + "-union.json")), comp.getUnion());
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "comparison", comp.getId() + "-intersection.json")), comp.getIntersection());
}
private String file(String name) throws IOException {
return Utilities.path(folder, name);
}
private void renderValueSet(String id, ValueSetComparison comp) throws FHIRException, IOException {
String template = templates.get("ValueSet");
Map<String, Base> vars = new HashMap<>();
ValueSetComparer cs = new ValueSetComparer(session);
vars.put("left", new StringType(comp.getLeft().present()));
vars.put("right", new StringType(comp.getRight().present()));
vars.put("leftId", new StringType(comp.getLeft().getId()));
vars.put("rightId", new StringType(comp.getRight().getId()));
vars.put("leftUrl", new StringType(comp.getLeft().getUrl()));
vars.put("rightUrl", new StringType(comp.getRight().getUrl()));
vars.put("errors", new StringType(new XhtmlComposer(true).compose(cs.renderErrors(comp))));
vars.put("metadata", new StringType(new XhtmlComposer(true).compose(cs.renderMetadata(comp, "", ""))));
vars.put("compose", new StringType(new XhtmlComposer(true).compose(cs.renderCompose(comp, "", ""))));
vars.put("expansion", new StringType(new XhtmlComposer(true).compose(cs.renderExpansion(comp, "", ""))));
String cnt = processTemplate(template, "ValueSet", vars);
TextFile.stringToFile(cnt, file(comp.getId()+".html"));
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "comparison", comp.getId() + "-union.json")), comp.getUnion());
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "comparison", comp.getId() + "-intersection.json")), comp.getIntersection());
}
private void renderProfile(String id, ProfileComparison comp) throws IOException {
String template = templates.get("Profile");
Map<String, Base> vars = new HashMap<>();
ProfileComparer cs = new ProfileComparer(session);
vars.put("left", new StringType(comp.getLeft().present()));
vars.put("right", new StringType(comp.getRight().present()));
vars.put("leftId", new StringType(comp.getLeft().getId()));
vars.put("rightId", new StringType(comp.getRight().getId()));
vars.put("leftUrl", new StringType(comp.getLeft().getUrl()));
vars.put("rightUrl", new StringType(comp.getRight().getUrl()));
vars.put("errors", new StringType(new XhtmlComposer(true).compose(cs.renderErrors(comp))));
vars.put("metadata", new StringType(new XhtmlComposer(true).compose(cs.renderMetadata(comp, "", ""))));
// vars.put("concepts", new StringType(new XhtmlComposer(true).compose(cs.renderConcepts(comp, "", ""))));
String cnt = processTemplate(template, "CodeSystem", vars);
TextFile.stringToFile(cnt, file(comp.getId()+".html"));
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "comparison", comp.getId() + "-union.json")), comp.getUnion());
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "comparison", comp.getId() + "-intersection.json")), comp.getIntersection());
}
private String processTemplate(String template, String name, Map<String, Base> vars) {
LiquidEngine engine = new LiquidEngine(context, this);
LiquidDocument doc = engine.parse(template, name+".template");
return engine.evaluate(doc, Tuple.fromMap(vars), vars);
}
@Override
public Base resolveConstant(Object appContext, String name, boolean beforeContext) throws PathEngineException {
@SuppressWarnings("unchecked")
Map<String, Base> vars = (Map<String, Base>) appContext;
return vars.get(name);
}
@Override
public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException {
@SuppressWarnings("unchecked")
Map<String, Base> vars = (Map<String, Base>) appContext;
Base b = vars.get(name);
return new TypeDetails(CollectionStatus.SINGLETON, b == null ? "Base" : b.fhirType());
}
@Override
public boolean log(String argument, List<Base> focus) {
return false;
}
@Override
public FunctionDetails resolveFunction(String functionName) {
return null;
}
@Override
public TypeDetails checkFunction(Object appContext, String functionName, List<TypeDetails> parameters) throws PathEngineException {
return null;
}
@Override
public List<Base> executeFunction(Object appContext, String functionName, List<List<Base>> parameters) {
return null;
}
@Override
public Base resolveReference(Object appContext, String url, Base refContext) throws FHIRException {
return null;
}
@Override
public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException {
return false;
}
@Override
public ValueSet resolveValueSet(Object appContext, String url) {
return null;
}
}

View File

@ -18,6 +18,7 @@ import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.utilities.Utilities;
public class ComparisonSession {
@ -25,6 +26,7 @@ public class ComparisonSession {
private IWorkerContext context;
private String sessiondId;
private int count;
private boolean debug;
public ComparisonSession(IWorkerContext context) {
super();
@ -89,7 +91,25 @@ public class ComparisonSession {
public void identify(ResourceComparison res) {
count++;
res.setId(sessiondId+"-"+count);
if (!Utilities.isValidId(res.getId())) {
res.setId(sessiondId+"-"+count);
}
}
public boolean isDebug() {
return debug;
}
public void setDebug(boolean debug) {
this.debug = debug;
}
public Map<String, ResourceComparison> getCompares() {
return compares;
}
}

View File

@ -45,6 +45,11 @@ public class ProfileComparer extends CanonicalResourceComparer {
public StructuralMatch<ElementDefinition> getCombined() {
return combined;
}
@Override
protected String abbreviation() {
return "sd";
}
}
public ProfileComparer(ComparisonSession session) {
@ -113,6 +118,10 @@ public class ProfileComparer extends CanonicalResourceComparer {
assert(right != null);
assert(left.path().equals(right.path()));
if (session.isDebug()) {
System.out.println("Compare elements at "+path);
}
// not allowed to be different:
ruleEqual(comp, res, left.current().getDefaultValue(), right.current().getDefaultValue(), "defaultValue", path);
ruleEqual(comp, res, left.current().getMeaningWhenMissingElement(), right.current().getMeaningWhenMissingElement(), "meaningWhenMissing", path);
@ -256,7 +265,7 @@ public class ProfileComparer extends CanonicalResourceComparer {
matchR.add(r);
StructuralMatch<ElementDefinition> sm = new StructuralMatch<ElementDefinition>(l.current(), r.current());
res.getChildren().add(sm);
compareElements(comp, sm, l.path(), null, left, right);
compareElements(comp, sm, l.path(), null, l, r);
}
}
for (DefinitionNavigator r : rc) {
@ -332,7 +341,6 @@ public class ProfileComparer extends CanonicalResourceComparer {
return "left: "+left+"; right: "+right;
}
private List<Coding> mergeCodings(List<Coding> left, List<Coding> right) {
List<Coding> result = new ArrayList<Coding>();
result.addAll(left);
@ -347,7 +355,6 @@ public class ProfileComparer extends CanonicalResourceComparer {
return result;
}
private List<StringType> mergeStrings(List<StringType> left, List<StringType> right) {
List<StringType> result = new ArrayList<StringType>();
result.addAll(left);
@ -434,7 +441,6 @@ public class ProfileComparer extends CanonicalResourceComparer {
return Integer.toString(defn.current().getMin())+".."+defn.current().getMax();
}
private Collection<? extends TypeRefComponent> unionTypes(ProfileComparison comp, StructuralMatch<ElementDefinition> res, String path, List<TypeRefComponent> left, List<TypeRefComponent> right) throws DefinitionException, IOException, FHIRFormatError {
List<TypeRefComponent> result = new ArrayList<TypeRefComponent>();
for (TypeRefComponent l : left)
@ -514,14 +520,12 @@ public class ProfileComparer extends CanonicalResourceComparer {
results.add(nw);
}
private boolean derivesFrom(StructureDefinition left, StructureDefinition right) {
// left derives from right if it's base is the same as right
// todo: recursive...
return left.hasBaseDefinition() && left.getBaseDefinition().equals(right.getUrl());
}
private Collection<? extends TypeRefComponent> intersectTypes(ProfileComparison comp, StructuralMatch<ElementDefinition> res, ElementDefinition ed, String path, List<TypeRefComponent> left, List<TypeRefComponent> right) throws DefinitionException, IOException, FHIRFormatError {
List<TypeRefComponent> result = new ArrayList<TypeRefComponent>();
for (TypeRefComponent l : left) {
@ -601,7 +605,6 @@ public class ProfileComparer extends CanonicalResourceComparer {
return b.toString();
}
private boolean compareBindings(ProfileComparison comp, StructuralMatch<ElementDefinition> res, ElementDefinition subset, ElementDefinition superset, String path, ElementDefinition lDef, ElementDefinition rDef) throws FHIRFormatError, DefinitionException, IOException {
assert(lDef.hasBinding() || rDef.hasBinding());
if (!lDef.hasBinding()) {
@ -689,6 +692,9 @@ public class ProfileComparer extends CanonicalResourceComparer {
} else if (rvs == null) {
vm(IssueSeverity.ERROR, "Unable to resolve right value set "+right.getValueSet().toString()+" at "+path, path, comp.getMessages(), res.getMessages());
return true;
} else if (sameValueSets(lvs, rvs)) {
subBinding.setValueSet(lvs.getUrl());
superBinding.setValueSet(lvs.getUrl());
} else {
ValueSetComparison compP = (ValueSetComparison) session.compare(lvs, rvs);
if (compP != null) {
@ -700,6 +706,20 @@ public class ProfileComparer extends CanonicalResourceComparer {
return false;
}
private boolean sameValueSets(ValueSet lvs, ValueSet rvs) {
if (!lvs.getUrl().equals(rvs.getUrl())) {
return false;
}
if (lvs.hasVersion()) {
if (!lvs.getVersion().equals(rvs.getVersion())) {
return false;
} else if (!rvs.hasVersion()) {
return false;
}
}
return true;
}
private List<ElementDefinitionConstraintComponent> intersectConstraints(String path, List<ElementDefinitionConstraintComponent> left, List<ElementDefinitionConstraintComponent> right) {
List<ElementDefinitionConstraintComponent> result = new ArrayList<ElementDefinitionConstraintComponent>();
for (ElementDefinitionConstraintComponent l : left) {
@ -746,8 +766,6 @@ public class ProfileComparer extends CanonicalResourceComparer {
return sd;
}
private boolean isPreferredOrExample(ElementDefinitionBindingComponent binding) {
return binding.getStrength() == BindingStrength.EXAMPLE || binding.getStrength() == BindingStrength.PREFERRED;
}

View File

@ -15,15 +15,30 @@ import org.hl7.fhir.utilities.xhtml.XhtmlNode;
public class ResourceComparer {
public class ResourceComparison {
public abstract class ResourceComparison {
private String id;
private String leftId;
private String rightId;
protected List<ValidationMessage> messages = new ArrayList<>();
public ResourceComparison() {
public ResourceComparison(String leftId, String rightId) {
super();
this.leftId = leftId;
this.rightId = rightId;
id = abbreviation()+"-"+leftId + "-" + rightId;
}
protected abstract String abbreviation();
public String getLeftId() {
return leftId;
}
public String getRightId() {
return rightId;
}
protected List<ValidationMessage> messages = new ArrayList<>();
public List<ValidationMessage> getMessages() {
return messages;
}
@ -33,10 +48,8 @@ public class ResourceComparer {
}
public void setId(String id) {
this.id = id;
this.id = abbreviation()+"-"+id;
}
}
public final static String COLOR_NO_ROW_LEFT = "#ffffb3";

View File

@ -56,6 +56,11 @@ public class ValueSetComparer extends CanonicalResourceComparer {
expansion = new StructuralMatch<>();
}
return expansion;
}
@Override
protected String abbreviation() {
return "sd";
}
}

View File

@ -94,8 +94,8 @@ import org.hl7.fhir.r5.terminologies.ValueSetExpander.TerminologyServiceErrorCla
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.r5.terminologies.ValueSetExpanderSimple;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.r5.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.OIDUtils;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.TranslationServices;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;

View File

@ -37,7 +37,7 @@ import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.hl7.fhir.r5.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities;
public class HTMLClientLogger implements ToolingClientLogger {

View File

@ -1,33 +1,33 @@
package org.hl7.fhir.r5.context;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/

View File

@ -37,7 +37,7 @@ import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.hl7.fhir.r5.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities;
public class TextClientLogger implements ToolingClientLogger {

View File

@ -542,7 +542,7 @@ public class Element extends Base {
return null;
Element result = null;
for (Element child : children) {
if (child.getName().equals(name) || (child.getName().startsWith(name) && child.getProperty().getDefinition().isChoice())) {
if (child.getName().equals(name) || (child.getName().length() > child.fhirType().length() && child.getName().substring(0, child.getName().length() - child.fhirType().length()).equals(name) && child.getProperty().getDefinition().isChoice())) {
if (result == null)
result = child;
else

View File

@ -39,7 +39,25 @@ import java.util.Map;
import org.hl7.fhir.exceptions.FHIRException;
public class Tuple extends Base {
private static final long serialVersionUID = -8402411970797277451L;
private Map<String, List<Base>> properties = new HashMap<>();
public static Tuple fromMapList(Map<String, List<Base>> map) {
Tuple res = new Tuple();
res.properties.putAll(map);
return res;
}
public static Tuple fromMap(Map<String, Base> map) {
Tuple res = new Tuple();
for (String key : map.keySet()) {
List<Base> list = new ArrayList<>();
list.add(map.get(key));
res.properties.put(key, list);
}
return res;
}
@Override
public String fhirType() {

View File

@ -231,6 +231,9 @@ public class DataRenderer {
}
public String display(DataType type) {
if (type.isEmpty())
return "";
if (type instanceof Coding) {
return displayCoding((Coding) type);
} else if (type instanceof CodeableConcept) {
@ -693,7 +696,7 @@ public class DataRenderer {
}
public static String displayPeriod(Period p) {
String s = !p.hasStart() ? "?ngen-5?" : p.getStartElement().toHumanDisplay();
String s = !p.hasStart() ? "(?)" : p.getStartElement().toHumanDisplay();
s = s + " --> ";
return s + (!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
}

View File

@ -83,7 +83,8 @@ public abstract class ResourceRenderer extends DataRenderer {
public abstract boolean render(XhtmlNode x, DomainResource r) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome;
public boolean render(XhtmlNode x, ResourceWrapper r) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome {
throw new NotImplementedException("Rendering using the wrapper is not implemented yet for resources of type "+r.getName());
ProfileDrivenRenderer pr = new ProfileDrivenRenderer(context);
return pr.render(x, r);
}
public void describe(XhtmlNode x, DomainResource r) throws UnsupportedEncodingException, IOException {

View File

@ -25,44 +25,44 @@ public class RenderingContext {
String findTemplate(RenderingContext rcontext, DomainResource r);
String findTemplate(RenderingContext rcontext, String resourceName);
}
public interface ITypeParser {
Base parseType(String xml, String type) throws FHIRFormatError, IOException, FHIRException ;
}
public enum ResourceRendererMode{
RESOURCE, IG
}
public enum QuestionnaireRendererMode {
/**
* A visual presentation of the questionnaire, with a set of property panes that can be toggled on and off.
* Note that this is not the same as how the questionnaire would like on a form filler, since all dynamic behavior is ignored
*/
FORM,
/**
* a structured tree that presents the content of the questionnaire in a logical fashion
*/
TREE,
/**
* A structured tree that presents the enableWhen, terminology and expression bindings for the questionnaire
*/
LOGIC,
/**
* A presentation that lists all the items, with full details about them
*/
DEFNS,
/**
* Rendered links to various openly available Form Filler applications that know how to render a questionnaire published in a package
*/
LINKS
}
private IWorkerContext worker;
private MarkDownProcessor markdown;
private ResourceRendererMode mode;
@ -92,9 +92,9 @@ public class RenderingContext {
private String definitionsTarget;
private String destDir;
private boolean inlineGraphics;
private QuestionnaireRendererMode questionnaireMode = QuestionnaireRendererMode.FORM;
/**
*
* @param context - access to all related resources that might be needed
@ -329,32 +329,36 @@ public class RenderingContext {
return inlineGraphics;
}
public void setInlineGraphics(boolean inlineGraphics) {
public RenderingContext setInlineGraphics(boolean inlineGraphics) {
this.inlineGraphics = inlineGraphics;
return this;
}
public boolean isHeader() {
return header;
}
public void setHeader(boolean header) {
public RenderingContext setHeader(boolean header) {
this.header = header;
return this;
}
public QuestionnaireRendererMode getQuestionnaireMode() {
return questionnaireMode;
}
public void setQuestionnaireMode(QuestionnaireRendererMode questionnaireMode) {
public RenderingContext setQuestionnaireMode(QuestionnaireRendererMode questionnaireMode) {
this.questionnaireMode = questionnaireMode;
return this;
}
public String getSelfLink() {
return selfLink;
}
public void setSelfLink(String selfLink) {
public RenderingContext setSelfLink(String selfLink) {
this.selfLink = selfLink;
return this;
}
public String fixReference(String ref) {
@ -366,7 +370,17 @@ public class RenderingContext {
}
return ref;
}
public RenderingContext setLang(String lang) {
this.lang = lang;
return this;
}
public RenderingContext setLocalPrefix(String localPrefix) {
this.localPrefix = localPrefix;
return this;
}
}

View File

@ -38,7 +38,7 @@ import org.hl7.fhir.r5.model.CapabilityStatement;
import org.hl7.fhir.r5.model.Parameters;
import org.hl7.fhir.r5.model.TerminologyCapabilities;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.utils.client.ToolingClientLogger;
import org.hl7.fhir.utilities.ToolingClientLogger;
public interface TerminologyClient {
public String getAddress();
@ -46,8 +46,9 @@ public interface TerminologyClient {
public ValueSet expandValueset(ValueSet vs, Parameters p, Map<String, String> params) throws FHIRException;
public Parameters validateCS(Parameters pin) throws FHIRException;
public Parameters validateVS(Parameters pin) throws FHIRException;
public void setTimeout(int i) throws FHIRException;
public void setLogger(ToolingClientLogger txLog) throws FHIRException;
public TerminologyClient setTimeout(int i) throws FHIRException;
public TerminologyClient setLogger(ToolingClientLogger txLog) throws FHIRException;
public TerminologyClient setRetryCount(int retryCount) throws FHIRException;
public CapabilityStatement getCapabilitiesStatementQuick() throws FHIRException;
public Parameters lookupCode(Map<String, String> params) throws FHIRException;
}

View File

@ -213,18 +213,26 @@ public class StructureMapUtilities {
return services.resolveReference(appContext, url);
}
private boolean noErrorValidationMessages(List<ValidationMessage> valerrors) {
boolean ok = true;
for (ValidationMessage v : valerrors)
ok = ok && !v.getLevel().isError();
return ok;
}
@Override
public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException {
IResourceValidator val = worker.newValidator();
List<ValidationMessage> valerrors = new ArrayList<ValidationMessage>();
if (item instanceof Resource) {
val.validate(appContext, valerrors, (Resource) item, url);
boolean ok = true;
for (ValidationMessage v : valerrors)
ok = ok && v.getLevel().isError();
return ok;
return noErrorValidationMessages(valerrors);
}
throw new NotImplementedException("Not done yet (FFHIRPathHostServices.conformsToProfile), when item is element");
if (item instanceof Element) {
val.validate(appContext, valerrors, (Element) item, url);
return noErrorValidationMessages(valerrors);
}
throw new NotImplementedException("Not done yet (FFHIRPathHostServices.conformsToProfile), when item is not element or not resource");
}
@Override

View File

@ -85,6 +85,7 @@ import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.ResourceType;
import org.hl7.fhir.r5.utils.ResourceUtilities;
import org.hl7.fhir.utilities.ToolingClientLogger;
/**
* Helper class handling lower level HTTP transport concerns.
@ -101,6 +102,7 @@ public class ClientUtils {
private String username;
private String password;
private ToolingClientLogger logger;
private int retryCount;
public HttpHost getProxy() {
return proxy;
@ -278,7 +280,11 @@ public class ClientUtils {
*/
protected HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload, HttpHost proxy) {
HttpResponse response = null;
boolean ok = false;
int tryCount = 0;
while (!ok) {
try {
tryCount++;
HttpClient httpclient = new DefaultHttpClient();
if(proxy != null) {
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
@ -286,9 +292,15 @@ public class ClientUtils {
request.setEntity(new ByteArrayEntity(payload));
log(request);
response = httpclient.execute(request);
ok = true;
} catch(IOException ioe) {
throw new EFhirClientException("Error sending HTTP Post/Put Payload", ioe);
if (tryCount <= retryCount) {
ok = false;
} else {
throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe);
}
}
}
return response;
}
@ -632,5 +644,13 @@ public class ClientUtils {
return value;
}
public int getRetryCount() {
return retryCount;
}
public void setRetryCount(int retryCount) {
this.retryCount = retryCount;
}
}

View File

@ -1,9 +1,5 @@
package org.hl7.fhir.r5.utils.client;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@ -54,6 +50,7 @@ import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StringType;
import org.hl7.fhir.r5.model.TerminologyCapabilities;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.utilities.ToolingClientLogger;
import org.hl7.fhir.utilities.Utilities;
/**
@ -245,35 +242,64 @@ public class FHIRToolingClient {
return (T) bnd.getEntry().get(0).getResource();
}
//
// public <T extends Resource> T update(Class<T> resourceClass, T resource, String id) {
// ResourceRequest<T> result = null;
// try {
// List<Header> headers = null;
// result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers, proxy);
// result.addErrorStatus(410);//gone
// result.addErrorStatus(404);//unknown
// result.addErrorStatus(405);
// result.addErrorStatus(422);//Unprocessable Entity
// result.addSuccessStatus(200);
// result.addSuccessStatus(201);
// if(result.isUnsuccessfulRequest()) {
// throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
// }
// } catch(Exception e) {
// throw new EFhirClientException("An error has occurred while trying to update this resource", e);
// }
// // TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
// try {
// OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
// ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
// return this.vread(resourceClass, resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
// } catch(ClassCastException e) {
// // if we fall throught we have the correct type already in the create
// }
//
// return result.getPayload();
// }
public Resource update(Resource resource) {
ResourceRequest<Resource> result = null;
try {
List<Header> headers = null;
result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resource.getClass(), resource.getId()),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
result.addErrorStatus(422);//Unprocessable Entity
result.addSuccessStatus(200);
result.addSuccessStatus(201);
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch(Exception e) {
throw new EFhirClientException("An error has occurred while trying to update this resource", e);
}
// TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
try {
OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
return this.vread(resource.getClass(), resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
} catch(ClassCastException e) {
// if we fall throught we have the correct type already in the create
}
return result.getPayload();
}
public <T extends Resource> T update(Class<T> resourceClass, T resource, String id) {
ResourceRequest<T> result = null;
try {
List<Header> headers = null;
result = utils.issuePutRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id),utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
result.addErrorStatus(410);//gone
result.addErrorStatus(404);//unknown
result.addErrorStatus(405);
result.addErrorStatus(422);//Unprocessable Entity
result.addSuccessStatus(200);
result.addSuccessStatus(201);
if(result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
}
} catch(Exception e) {
throw new EFhirClientException("An error has occurred while trying to update this resource", e);
}
// TODO oe 26.1.2015 could be made nicer if only OperationOutcome locationheader is returned with an operationOutcome would be returned (and not the resource also) we make another read
try {
OperationOutcome operationOutcome = (OperationOutcome)result.getPayload();
ResourceAddress.ResourceVersionedIdentifier resVersionedIdentifier = ResourceAddress.parseCreateLocation(result.getLocation());
return this.vread(resourceClass, resVersionedIdentifier.getId(),resVersionedIdentifier.getVersionId());
} catch(ClassCastException e) {
// if we fall throught we have the correct type already in the create
}
return result.getPayload();
}
//
// public <T extends Resource> boolean delete(Class<T> resourceClass, String id) {
@ -800,5 +826,13 @@ public class FHIRToolingClient {
utils.setLogger(logger);
}
public int getRetryCount() {
return utils.getRetryCount();
}
public void setRetryCount(int retryCount) {
utils.setRetryCount(retryCount);
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.6-SNAPSHOT</version>
<version>5.0.7-SNAPSHOT</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.0.6-SNAPSHOT</version>
<version>5.0.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.r5.utils.client;
package org.hl7.fhir.utilities;
/*
Copyright (c) 2011+, HL7, Inc.

View File

@ -182,7 +182,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
if (!CACHE_VERSION.equals(v)) {
clearCache();
ini.setStringProperty("cache", "version", CACHE_VERSION, null);
save = true;
ini.save();
}
}

View File

@ -25,7 +25,7 @@ import com.google.gson.JsonObject;
public class PackageHacker {
public static void main(String[] args) throws FileNotFoundException, IOException {
new PackageHacker().edit("C:\\Users\\graha\\Downloads\\package.tgz");
new PackageHacker().edit("M:\\web\\hl7.org\\fhir\\R4\\package.tgz");
}
private void edit(String name) throws FileNotFoundException, IOException {
@ -58,33 +58,31 @@ public class PackageHacker {
private void change(JsonObject npm, Map<String, byte[]> content) throws FileNotFoundException, IOException {
// fixVersions(npm);
// npm.addProperty("name", "hl7.terminology");
npm.addProperty("url", "http://terminology.hl7.org/1.0.0");
// npm.remove("version");
// npm.addProperty("version", "4.2.0");
// npm.remove("canonical");
// npm.addProperty("canonical", "http://hl7.org/fhir/us/davinci-drug-formulary");
//// npm.remove("description");
//// npm.addProperty("description", "Group Wrapper that includes all the R4 packages");
// npm.remove("url");
// npm.addProperty("url", "http://hl7.org/fhir/us/davinci-drug-formulary/Jun2019");
// JsonObject dep = npm.getAsJsonObject("dependencies");
// dep.remove("hl7.fhir.r3.core");
// dep.remove("hl7.fhir.r3.examples");
// dep.remove("hl7.fhir.r3.expansions");
// dep.remove("hl7.fhir.r3.elements");
// dep.addProperty("hl7.fhir.r3.core", "4.0.1");
// dep.addProperty("hl7.fhir.r3.examples", "4.0.1");
// dep.addProperty("hl7.fhir.r3.expansions", "4.0.1");
// dep.addProperty("hl7.fhir.r3.elements", "4.0.1");
JsonObject dep = new JsonObject();
npm.add("dependencies", dep);
dep.addProperty("hl7.fhir.r4.core", "4.0.1");
dep.addProperty("hl7.fhir.r4.examples", "4.0.1");
dep.addProperty("hl7.fhir.r4.expansions", "4.0.1");
dep.addProperty("hl7.fhir.r4.elements", "4.0.1");
}
private void fixVersions(JsonObject npm) {
npm.remove("fhirVersions");
JsonArray a = new JsonArray();
npm.add("fhirVersions", a);
a.add("4.0.1");
a.add("4.2.0");
npm.remove("fhir-version-list");
a = new JsonArray();
npm.add("fhir-version-list", a);
a.add("4.0.1");
a.add("4.2.0");
}
private void setProperty(JsonObject npm, String name, String value) {

View File

@ -2,500 +2,502 @@ package org.hl7.fhir.utilities.i18n;
public class I18nConstants {
public final static String BUNDLE_BUNDLE_ENTRY_CANONICAL = "Bundle_BUNDLE_Entry_Canonical";
public final static String BUNDLE_BUNDLE_ENTRY_DOCUMENT = "Bundle_BUNDLE_Entry_Document";
public final static String BUNDLE_BUNDLE_ENTRY_IDURLMISMATCH = "Bundle_BUNDLE_Entry_IdUrlMismatch";
public final static String BUNDLE_BUNDLE_ENTRY_MISMATCHIDURL = "Bundle_BUNDLE_Entry_MismatchIdUrl";
public final static String BUNDLE_BUNDLE_ENTRY_NOFIRST = "Bundle_BUNDLE_Entry_NoFirst";
public final static String BUNDLE_BUNDLE_ENTRY_NOFIRSTRESOURCE = "Bundle_BUNDLE_Entry_NoFirstResource";
public final static String BUNDLE_BUNDLE_ENTRY_NOFULLURL = "Bundle_BUNDLE_Entry_NoFullUrl";
public final static String BUNDLE_BUNDLE_ENTRY_NOPROFILE = "Bundle_BUNDLE_Entry_NoProfile";
public final static String BUNDLE_BUNDLE_ENTRY_NOTFOUND = "Bundle_BUNDLE_Entry_NotFound";
public final static String BUNDLE_BUNDLE_ENTRY_ORPHAN = "Bundle_BUNDLE_Entry_Orphan";
public final static String BUNDLE_BUNDLE_ENTRY_TYPE = "Bundle_BUNDLE_Entry_Type";
public final static String BUNDLE_BUNDLE_ENTRY_TYPE2 = "Bundle_BUNDLE_Entry_Type2";
public final static String BUNDLE_BUNDLE_ENTRY_TYPE3 = "Bundle_BUNDLE_Entry_Type3";
public final static String BUNDLE_BUNDLE_FULLURL_MISSING = "Bundle_BUNDLE_FullUrl_Missing";
public final static String BUNDLE_BUNDLE_FULLURL_NEEDVERSION = "Bundle_BUNDLE_FullUrl_NeedVersion";
public final static String BUNDLE_BUNDLE_MULTIPLEMATCHES = "Bundle_BUNDLE_MultipleMatches";
public final static String BUNDLE_BUNDLE_NOT_LOCAL = "Bundle_BUNDLE_Not_Local";
public final static String BUNDLE_MSG_EVENT_COUNT = "Bundle_MSG_Event_Count";
public final static String CAPABALITYSTATEMENT_CS_SP_WRONGTYPE = "CapabalityStatement_CS_SP_WrongType";
public final static String CODESYSTEM_CS_VS_INCLUDEDETAILS = "CodeSystem_CS_VS_IncludeDetails";
public final static String CODESYSTEM_CS_VS_INVALID = "CodeSystem_CS_VS_Invalid";
public final static String CODESYSTEM_CS_VS_MISMATCH = "CodeSystem_CS_VS_MisMatch";
public final static String CODESYSTEM_CS_VS_WRONGSYSTEM = "CodeSystem_CS_VS_WrongSystem";
public final static String EXTENSION_EXT_CONTEXT_WRONG = "Extension_EXT_Context_Wrong";
public final static String EXTENSION_EXT_CONTEXT_WRONG_XVER = "EXTENSION_EXT_CONTEXT_WRONG_XVER";
public final static String EXTENSION_EXT_COUNT_MISMATCH = "Extension_EXT_Count_Mismatch";
public final static String EXTENSION_EXT_COUNT_NOTFOUND = "Extension_EXT_Count_NotFound";
public final static String EXTENSION_EXT_FIXED_BANNED = "Extension_EXT_Fixed_Banned";
public final static String EXTENSION_EXT_MODIFIER_MISMATCHN = "Extension_EXT_Modifier_MismatchN";
public final static String EXTENSION_EXT_MODIFIER_MISMATCHY = "Extension_EXT_Modifier_MismatchY";
public final static String EXTENSION_EXT_MODIFIER_N = "Extension_EXT_Modifier_N";
public final static String EXTENSION_EXT_MODIFIER_Y = "Extension_EXT_Modifier_Y";
public final static String EXTENSION_EXT_SIMPLE = "Extension_EXT_Simple";
public final static String EXTENSION_EXT_SUBEXTENSION_INVALID = "Extension_EXT_SubExtension_Invalid";
public final static String EXTENSION_EXT_TYPE = "Extension_EXT_Type";
public final static String EXTENSION_EXT_UNKNOWN = "Extension_EXT_Unknown";
public final static String EXTENSION_EXT_UNKNOWN_NOTHERE = "Extension_EXT_Unknown_NotHere";
public final static String EXTENSION_EXT_URL_ABSOLUTE = "Extension_EXT_URL_Absolute";
public final static String EXTENSION_EXT_URL_NOTFOUND = "Extension_EXT_Url_NotFound";
public final static String EXTENSION_EXT_VERSION_INTERNAL = "Extension_EXT_Version_Internal";
public final static String EXTENSION_EXT_VERSION_INVALID = "Extension_EXT_Version_Invalid";
public final static String EXTENSION_EXT_VERSION_INVALIDID = "Extension_EXT_Version_InvalidId";
public final static String EXTENSION_EXT_VERSION_NOCHANGE = "Extension_EXT_Version_NoChange";
public final static String FIXED_TYPE_CHECKS_DT_ADDRESS_LINE = "Fixed_Type_Checks_DT_Address_Line";
public final static String FIXED_TYPE_CHECKS_DT_NAME_FAMILY = "Fixed_Type_Checks_DT_Name_Family";
public final static String FIXED_TYPE_CHECKS_DT_NAME_GIVEN = "Fixed_Type_Checks_DT_Name_Given";
public final static String FIXED_TYPE_CHECKS_DT_NAME_PREFIX = "Fixed_Type_Checks_DT_Name_Prefix";
public final static String FIXED_TYPE_CHECKS_DT_NAME_SUFFIX = "Fixed_Type_Checks_DT_Name_Suffix";
public final static String INTERNAL_INT_BAD_TYPE = "Internal_INT_Bad_Type";
public final static String LANGUAGE_XHTML_LANG_DIFFERENT1 = "Language_XHTML_Lang_Different1";
public final static String LANGUAGE_XHTML_LANG_DIFFERENT2 = "Language_XHTML_Lang_Different2";
public final static String LANGUAGE_XHTML_LANG_MISSING1 = "Language_XHTML_Lang_Missing1";
public final static String LANGUAGE_XHTML_LANG_MISSING2 = "Language_XHTML_Lang_Missing2";
public final static String LANGUAGE_XHTML_LANG_MISSING3 = "Language_XHTML_Lang_Missing3";
public final static String META_RES_SECURITY_DUPLICATE = "Meta_RES_Security_Duplicate";
public final static String MUSTSUPPORT_VAL_MUSTSUPPORT = "MustSupport_VAL_MustSupport";
public final static String PROFILE_EXT_NOT_HERE = "Profile_EXT_Not_Here";
public final static String PROFILE_VAL_MISSINGELEMENT = "Profile_VAL_MissingElement";
public final static String PROFILE_VAL_NOTALLOWED = "Profile_VAL_NotAllowed";
public final static String QUESTIONNAIRE_QR_ITEM_BADOPTION = "Questionnaire_QR_Item_BadOption";
public final static String QUESTIONNAIRE_QR_ITEM_CODING = "Questionnaire_QR_Item_Coding";
public final static String QUESTIONNAIRE_QR_ITEM_CODINGNOOPTIONS = "Questionnaire_QR_Item_CodingNoOptions";
public final static String QUESTIONNAIRE_QR_ITEM_DATENOOPTIONS = "Questionnaire_QR_Item_DateNoOptions";
public final static String QUESTIONNAIRE_QR_ITEM_DISPLAY = "Questionnaire_QR_Item_Display";
public final static String QUESTIONNAIRE_QR_ITEM_GROUP = "Questionnaire_QR_Item_Group";
public final static String QUESTIONNAIRE_QR_ITEM_GROUP_ANSWER = "Questionnaire_QR_Item_GroupAnswer";
public final static String QUESTIONNAIRE_QR_ITEM_INTNOOPTIONS = "Questionnaire_QR_Item_IntNoOptions";
public final static String QUESTIONNAIRE_QR_ITEM_MISSING = "Questionnaire_QR_Item_Missing";
public final static String QUESTIONNAIRE_QR_ITEM_NOCODING = "Questionnaire_QR_Item_NoCoding";
public final static String QUESTIONNAIRE_QR_ITEM_NODATE = "Questionnaire_QR_Item_NoDate";
public final static String QUESTIONNAIRE_QR_ITEM_NOINTEGER = "Questionnaire_QR_Item_NoInteger";
public final static String QUESTIONNAIRE_QR_ITEM_NOLINKID = "Questionnaire_QR_Item_NoLinkId";
public final static String QUESTIONNAIRE_QR_ITEM_NOOPTIONS = "Questionnaire_QR_Item_NoOptions";
public final static String QUESTIONNAIRE_QR_ITEM_NOOPTIONSCODING = "Questionnaire_QR_Item_NoOptionsCoding";
public final static String QUESTIONNAIRE_QR_ITEM_NOOPTIONSDATE = "Questionnaire_QR_Item_NoOptionsDate";
public final static String QUESTIONNAIRE_QR_ITEM_NOOPTIONSINTEGER = "Questionnaire_QR_Item_NoOptionsInteger";
public final static String QUESTIONNAIRE_QR_ITEM_NOOPTIONSSTRING = "Questionnaire_QR_Item_NoOptionsString";
public final static String QUESTIONNAIRE_QR_ITEM_NOOPTIONSTIME = "Questionnaire_QR_Item_NoOptionsTime";
public final static String QUESTIONNAIRE_QR_ITEM_NOSTRING = "Questionnaire_QR_Item_NoString";
public final static String QUESTIONNAIRE_QR_ITEM_NOTENABLED = "Questionnaire_QR_Item_NotEnabled";
public final static String QUESTIONNAIRE_QR_ITEM_NOTENABLED2 = "Questionnaire_QR_Item_NotEnabled2";
public final static String QUESTIONNAIRE_QR_ITEM_NOTFOUND = "Questionnaire_QR_Item_NotFound";
public final static String QUESTIONNAIRE_QR_ITEM_NOTIME = "Questionnaire_QR_Item_NoTime";
public final static String QUESTIONNAIRE_QR_ITEM_NOTYPE = "Questionnaire_QR_Item_NoType";
public final static String QUESTIONNAIRE_QR_ITEM_ONLYONEA = "Questionnaire_QR_Item_OnlyOneA";
public final static String QUESTIONNAIRE_QR_ITEM_ONLYONEI = "Questionnaire_QR_Item_OnlyOneI";
public final static String QUESTIONNAIRE_QR_ITEM_ORDER = "Questionnaire_QR_Item_Order";
public final static String QUESTIONNAIRE_QR_ITEM_STRINGNOOPTIONS = "Questionnaire_QR_Item_StringNoOptions";
public final static String QUESTIONNAIRE_QR_ITEM_TEXT = "Questionnaire_QR_Item_Text";
public final static String QUESTIONNAIRE_QR_ITEM_TIMENOOPTIONS = "Questionnaire_QR_Item_TimeNoOptions";
public final static String QUESTIONNAIRE_QR_ITEM_WRONGTYPE = "Questionnaire_QR_Item_WrongType";
public final static String QUESTIONNAIRE_QR_ITEM_WRONGTYPE2 = "Questionnaire_QR_Item_WrongType2";
public final static String QUESTIONNAIRE_QR_Q_NONE = "Questionnaire_QR_Q_None";
public final static String QUESTIONNAIRE_QR_Q_NOTFOUND = "Questionnaire_QR_Q_NotFound";
public final static String QUESTIONNAIRE_Q_ENABLEWHEN_AFTER = "Questionnaire_Q_EnableWhen_After";
public final static String QUESTIONNAIRE_Q_ENABLEWHEN_ISINNER = "Questionnaire_Q_EnableWhen_IsInner";
public final static String QUESTIONNAIRE_Q_ENABLEWHEN_NOLINK = "Questionnaire_Q_EnableWhen_NoLink";
public final static String QUESTIONNAIRE_Q_ENABLEWHEN_NOTARGET = "Questionnaire_Q_EnableWhen_NoTarget";
public final static String QUESTIONNAIRE_Q_ENABLEWHEN_SELF = "Questionnaire_Q_EnableWhen_Self";
public final static String MEASURE_MR_M_NONE = "Measure_MR_M_None";
public final static String MEASURE_MR_M_NOTFOUND = "Measure_MR_M_NotFound";
public final static String REFERENCE_REF_AGGREGATION = "Reference_REF_Aggregation";
public final static String REFERENCE_REF_BADTARGETTYPE = "Reference_REF_BadTargetType";
public final static String REFERENCE_REF_BADTARGETTYPE2 = "Reference_REF_BadTargetType2";
public final static String REFERENCE_REF_CANTMATCHCHOICE = "Reference_REF_CantMatchChoice";
public final static String REFERENCE_REF_CANTMATCHTYPE = "Reference_REF_CantMatchType";
public final static String REFERENCE_REF_CANTRESOLVE = "Reference_REF_CantResolve";
public final static String REFERENCE_REF_CANTRESOLVEPROFILE = "Reference_REF_CantResolveProfile";
public final static String REFERENCE_REF_FORMAT1 = "Reference_REF_Format1";
public final static String REFERENCE_REF_FORMAT2 = "Reference_REF_Format2";
public final static String REFERENCE_REF_MULTIPLEMATCHES = "Reference_REF_MultipleMatches";
public final static String REFERENCE_REF_NODISPLAY = "Reference_REF_NoDisplay";
public final static String REFERENCE_REF_NOTFOUND_BUNDLE = "Reference_REF_NotFound_Bundle";
public final static String REFERENCE_REF_NOTYPE = "Reference_REF_NoType";
public final static String REFERENCE_REF_RESOURCETYPE = "Reference_REF_ResourceType";
public final static String REFERENCE_REF_WRONGTARGET = "Reference_REF_WrongTarget";
public final static String RESOURCE_RES_ID_MISSING = "Resource_RES_ID_Missing";
public final static String RESOURCE_RES_ID_PROHIBITED = "Resource_RES_ID_Prohibited";
public final static String TERMINOLOGY_PASSTHROUGH_TX_MESSAGE = "Terminology_PassThrough_TX_Message";
public final static String TERMINOLOGY_TX_BINDING_CANTCHECK = "Terminology_TX_Binding_CantCheck";
public final static String TERMINOLOGY_TX_BINDING_MISSING = "Terminology_TX_Binding_Missing";
public final static String TERMINOLOGY_TX_BINDING_MISSING2 = "Terminology_TX_Binding_Missing2";
public final static String TERMINOLOGY_TX_BINDING_NOSERVER = "Terminology_TX_Binding_NoServer";
public final static String TERMINOLOGY_TX_BINDING_NOSOURCE = "Terminology_TX_Binding_NoSource";
public final static String TERMINOLOGY_TX_BINDING_NOSOURCE2 = "Terminology_TX_Binding_NoSource2";
public final static String TERMINOLOGY_TX_CODE_NOTVALID = "Terminology_TX_Code_NotValid";
public final static String TERMINOLOGY_TX_CODE_UNKNOWN = "Terminology_TX_Code_Unknown";
public final static String TERMINOLOGY_TX_CODE_VALUESET = "Terminology_TX_Code_ValueSet";
public final static String TERMINOLOGY_TX_CODE_VALUESETMAX = "Terminology_TX_Code_ValueSetMax";
public final static String TERMINOLOGY_TX_CODE_VALUESET_EXT = "Terminology_TX_Code_ValueSet_Ext";
public final static String TERMINOLOGY_TX_CODING_COUNT = "Terminology_TX_Coding_Count";
public final static String TERMINOLOGY_TX_CONFIRM_1 = "Terminology_TX_Confirm_1";
public final static String TERMINOLOGY_TX_CONFIRM_2 = "Terminology_TX_Confirm_2";
public final static String TERMINOLOGY_TX_CONFIRM_3 = "Terminology_TX_Confirm_3";
public final static String TERMINOLOGY_TX_CONFIRM_4 = "Terminology_TX_Confirm_4";
public final static String TERMINOLOGY_TX_CONFIRM_5 = "Terminology_TX_Confirm_5";
public final static String TERMINOLOGY_TX_CONFIRM_6 = "Terminology_TX_Confirm_6";
public final static String TERMINOLOGY_TX_DISPLAY_WRONG = "Terminology_TX_Display_Wrong";
public final static String TERMINOLOGY_TX_ERROR_CODEABLECONCEPT = "Terminology_TX_Error_CodeableConcept";
public final static String TERMINOLOGY_TX_ERROR_CODEABLECONCEPT_MAX = "Terminology_TX_Error_CodeableConcept_Max";
public final static String TERMINOLOGY_TX_ERROR_CODING1 = "Terminology_TX_Error_Coding1";
public final static String TERMINOLOGY_TX_ERROR_CODING2 = "Terminology_TX_Error_Coding2";
public final static String TERMINOLOGY_TX_NOVALID_1 = "Terminology_TX_NoValid_1";
public final static String TERMINOLOGY_TX_NOVALID_10 = "Terminology_TX_NoValid_10";
public final static String TERMINOLOGY_TX_NOVALID_11 = "Terminology_TX_NoValid_11";
public final static String TERMINOLOGY_TX_NOVALID_12 = "Terminology_TX_NoValid_12";
public final static String TERMINOLOGY_TX_NOVALID_13 = "Terminology_TX_NoValid_13";
public final static String TERMINOLOGY_TX_NOVALID_14 = "Terminology_TX_NoValid_14";
public final static String TERMINOLOGY_TX_NOVALID_15 = "Terminology_TX_NoValid_15";
public final static String TERMINOLOGY_TX_NOVALID_16 = "Terminology_TX_NoValid_16";
public final static String TERMINOLOGY_TX_NOVALID_17 = "Terminology_TX_NoValid_17";
public final static String TERMINOLOGY_TX_NOVALID_18 = "Terminology_TX_NoValid_18";
public final static String TERMINOLOGY_TX_NOVALID_2 = "Terminology_TX_NoValid_2";
public final static String TERMINOLOGY_TX_NOVALID_3 = "Terminology_TX_NoValid_3";
public final static String TERMINOLOGY_TX_NOVALID_4 = "Terminology_TX_NoValid_4";
public final static String TERMINOLOGY_TX_NOVALID_5 = "Terminology_TX_NoValid_5";
public final static String TERMINOLOGY_TX_NOVALID_6 = "Terminology_TX_NoValid_6";
public final static String TERMINOLOGY_TX_NOVALID_7 = "Terminology_TX_NoValid_7";
public final static String TERMINOLOGY_TX_NOVALID_8 = "Terminology_TX_NoValid_8";
public final static String TERMINOLOGY_TX_NOVALID_9 = "Terminology_TX_NoValid_9";
public final static String TERMINOLOGY_TX_SYSTEM_INVALID = "Terminology_TX_System_Invalid";
public final static String TERMINOLOGY_TX_SYSTEM_NOTKNOWN = "Terminology_TX_System_NotKnown";
public final static String TERMINOLOGY_TX_SYSTEM_RELATIVE = "Terminology_TX_System_Relative";
public final static String TERMINOLOGY_TX_SYSTEM_NO_CODE = "TERMINOLOGY_TX_SYSTEM_NO_CODE";
public final static String TERMINOLOGY_TX_SYSTEM_UNKNOWN = "Terminology_TX_System_Unknown";
public final static String TERMINOLOGY_TX_SYSTEM_VALUESET = "Terminology_TX_System_ValueSet";
public final static String TERMINOLOGY_TX_SYSTEM_VALUESET2 = "Terminology_TX_System_ValueSet2";
public final static String TERMINOLOGY_TX_VALUESET_NOTFOUND = "Terminology_TX_ValueSet_NotFound";
public final static String TERMINOLOGY_TX_VALUESET_NOTFOUND2 = "Terminology_TX_ValueSet_NotFound2";
public final static String TYPE_SPECIFIC_CHECKS_DT_BASE64_VALID = "Type_Specific_Checks_DT_Base64_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_BASE64_TOO_LONG = "TYPE_SPECIFIC_CHECKS_DT_BASE64_TOO_LONG";
public final static String TYPE_SPECIFIC_CHECKS_DT_BOOLEAN_VALUE = "Type_Specific_Checks_DT_Boolean_Value";
public final static String TYPE_SPECIFIC_CHECKS_DT_CODE_WS = "Type_Specific_Checks_DT_Code_WS";
public final static String TYPE_SPECIFIC_CHECKS_DT_DATETIME_REASONABLE = "Type_Specific_Checks_DT_DateTime_Reasonable";
public final static String TYPE_SPECIFIC_CHECKS_DT_DATETIME_REGEX = "Type_Specific_Checks_DT_DateTime_Regex";
public final static String TYPE_SPECIFIC_CHECKS_DT_DATETIME_TZ = "Type_Specific_Checks_DT_DateTime_TZ";
public final static String TYPE_SPECIFIC_CHECKS_DT_DATETIME_VALID = "Type_Specific_Checks_DT_DateTime_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_DATE_VALID = "Type_Specific_Checks_DT_Date_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_DECIMAL_RANGE = "Type_Specific_Checks_DT_Decimal_Range";
public final static String TYPE_SPECIFIC_CHECKS_DT_DECIMAL_VALID = "Type_Specific_Checks_DT_Decimal_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_DECIMAL_CHARS = "TYPE_SPECIFIC_CHECKS_DT_DECIMAL_CHARS";
public final static String TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_SYSTEM = "Type_Specific_Checks_DT_Identifier_System";
public final static String TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE = "TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE";
public final static String TYPE_SPECIFIC_CHECKS_DT_ID_VALID = "Type_Specific_Checks_DT_ID_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_INSTANT_VALID = "Type_Specific_Checks_DT_Instant_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_INTEGER64_VALID = "Type_Specific_Checks_DT_Integer64_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_INTEGER_GT = "Type_Specific_Checks_DT_Integer_GT";
public final static String TYPE_SPECIFIC_CHECKS_DT_INTEGER_LT = "Type_Specific_Checks_DT_Integer_LT";
public final static String TYPE_SPECIFIC_CHECKS_DT_INTEGER_LT0 = "Type_Specific_Checks_DT_Integer_LT0";
public final static String TYPE_SPECIFIC_CHECKS_DT_INTEGER_LT1 = "Type_Specific_Checks_DT_Integer_LT1";
public final static String TYPE_SPECIFIC_CHECKS_DT_INTEGER_VALID = "Type_Specific_Checks_DT_Integer_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_OID_START = "Type_Specific_Checks_DT_OID_Start";
public final static String TYPE_SPECIFIC_CHECKS_DT_OID_VALID = "Type_Specific_Checks_DT_OID_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_LENGTH = "Type_Specific_Checks_DT_Primitive_Length";
public final static String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_NOTEMPTY = "Type_Specific_Checks_DT_Primitive_NotEmpty";
public final static String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_REGEX = "Type_Specific_Checks_DT_Primitive_Regex";
public final static String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_VALUEEXT = "Type_Specific_Checks_DT_Primitive_ValueExt";
public final static String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_WS = "Type_Specific_Checks_DT_Primitive_WS";
public final static String TYPE_SPECIFIC_CHECKS_DT_STRING_LENGTH = "Type_Specific_Checks_DT_String_Length";
public final static String TYPE_SPECIFIC_CHECKS_DT_STRING_WS = "Type_Specific_Checks_DT_String_WS";
public final static String TYPE_SPECIFIC_CHECKS_DT_TIME_VALID = "Type_Specific_Checks_DT_Time_Valid";
public final static String TYPE_SPECIFIC_CHECKS_DT_URI_OID = "Type_Specific_Checks_DT_URI_OID";
public final static String TYPE_SPECIFIC_CHECKS_DT_URI_UUID = "Type_Specific_Checks_DT_URI_UUID";
public final static String TYPE_SPECIFIC_CHECKS_DT_URI_WS = "Type_Specific_Checks_DT_URI_WS";
public final static String TYPE_SPECIFIC_CHECKS_DT_URL_RESOLVE = "Type_Specific_Checks_DT_URL_Resolve";
public final static String TYPE_SPECIFIC_CHECKS_DT_UUID_STRAT = "Type_Specific_Checks_DT_UUID_Strat";
public final static String TYPE_SPECIFIC_CHECKS_DT_UUID_VAID = "Type_Specific_Checks_DT_UUID_Vaid";
public final static String TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_CORRECT = "TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_CORRECT";
public final static String TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_INVALID = "TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_INVALID";
public final static String TYPE_SPECIFIC_CHECKS_DT_ATT_NO_FETCHER = "TYPE_SPECIFIC_CHECKS_DT_ATT_NO_FETCHER";
public final static String TYPE_SPECIFIC_CHECKS_DT_ATT_UNKNOWN_URL_SCHEME = "TYPE_SPECIFIC_CHECKS_DT_ATT_UNKNOWN_URL_SCHEME";
public final static String TYPE_SPECIFIC_CHECKS_DT_ATT_URL_ERROR = "TYPE_SPECIFIC_CHECKS_DT_ATT_URL_ERROR";
public final static String TYPE_SPECIFIC_CHECKS_DT_ATT_TOO_LONG = "TYPE_SPECIFIC_CHECKS_DT_ATT_TOO_LONG";
public final static String TYPE_SPECIFIC_CHECKS_DT_ATT_NO_CONTENT = "TYPE_SPECIFIC_CHECKS_DT_ATT_NO_CONTENT";
public final static String VALIDATION_BUNDLE_MESSAGE = "Validation_BUNDLE_Message";
public final static String VALIDATION_VAL_CONTENT_UNKNOWN = "Validation_VAL_Content_Unknown";
public final static String VALIDATION_VAL_NOTYPE = "Validation_VAL_NoType";
public final static String VALIDATION_VAL_PROFILE_MATCHMULTIPLE = "Validation_VAL_Profile_MatchMultiple";
public final static String VALIDATION_VAL_PROFILE_MAXIMUM = "Validation_VAL_Profile_Maximum";
public final static String VALIDATION_VAL_PROFILE_MINIMUM = "Validation_VAL_Profile_Minimum";
public final static String VALIDATION_VAL_PROFILE_MULTIPLEMATCHES = "Validation_VAL_Profile_MultipleMatches";
public final static String VALIDATION_VAL_PROFILE_NOCHECKMAX = "Validation_VAL_Profile_NoCheckMax";
public final static String VALIDATION_VAL_PROFILE_NOCHECKMIN = "Validation_VAL_Profile_NoCheckMin";
public final static String VALIDATION_VAL_PROFILE_NODEFINITION = "Validation_VAL_Profile_NoDefinition";
public final static String VALIDATION_VAL_PROFILE_NOMATCH = "Validation_VAL_Profile_NoMatch";
public final static String VALIDATION_VAL_PROFILE_NOSNAPSHOT = "Validation_VAL_Profile_NoSnapshot";
public final static String VALIDATION_VAL_PROFILE_NOTALLOWED = "Validation_VAL_Profile_NotAllowed";
public final static String VALIDATION_VAL_PROFILE_NOTSLICE = "Validation_VAL_Profile_NotSlice";
public final static String VALIDATION_VAL_PROFILE_NOTYPE = "Validation_VAL_Profile_NoType";
public final static String VALIDATION_VAL_PROFILE_OUTOFORDER = "Validation_VAL_Profile_OutOfOrder";
public final static String VALIDATION_VAL_PROFILE_SLICEORDER = "Validation_VAL_Profile_SliceOrder";
public final static String VALIDATION_VAL_PROFILE_UNKNOWN = "Validation_VAL_Profile_Unknown";
public final static String VALIDATION_VAL_PROFILE_WRONGTYPE = "Validation_VAL_Profile_WrongType";
public final static String VALIDATION_VAL_UNKNOWN_PROFILE = "Validation_VAL_Unknown_Profile";
public final static String XHTML_XHTML_ATTRIBUTE_ILLEGAL = "XHTML_XHTML_Attribute_Illegal";
public final static String XHTML_XHTML_ELEMENT_ILLEGAL = "XHTML_XHTML_Element_Illegal";
public final static String XHTML_XHTML_NAME_INVALID = "XHTML_XHTML_Name_Invalid";
public final static String XHTML_XHTML_NS_INVALID = "XHTML_XHTML_NS_InValid";
public final static String XHTML_URL_INVALID = "XHTML_URL_INVALID";
public final static String _DT_FIXED_WRONG = "_DT_Fixed_Wrong";
public final static String ALL_OBSERVATIONS_SHOULD_HAVE_AN_EFFECTIVEDATETIME_OR_AN_EFFECTIVEPERIOD = "All_observations_should_have_an_effectiveDateTime_or_an_effectivePeriod";
public final static String ALL_OBSERVATIONS_SHOULD_HAVE_A_PERFORMER = "All_observations_should_have_a_performer";
public final static String ALL_OBSERVATIONS_SHOULD_HAVE_A_SUBJECT = "All_observations_should_have_a_subject";
public final static String UNABLE_TO_RESOLVE_SLICE_MATCHING__NO_FIXED_VALUE_OR_REQUIRED_VALUE_SET = "Unable_to_resolve_slice_matching__no_fixed_value_or_required_value_set";
public final static String UNABLE_TO_RESOLVE_SLICE_MATCHING__SLICE_MATCHING_BY_VALUE_SET_NOT_DONE = "Unable_to_resolve_slice_matching__slice_matching_by_value_set_not_done";
public final static String PROBLEM_PROCESSING_EXPRESSION__IN_PROFILE__PATH__ = "Problem_processing_expression__in_profile__path__";
public final static String UNABLE_TO_FIND_ELEMENT_WITH_ID_ = "Unable_to_find_element_with_id_";
public final static String SLICE_ENCOUNTERED_MIDWAY_THROUGH_SET_PATH___ID___ = "Slice_encountered_midway_through_set_path___id___";
public final static String UNABLE_TO_RESOLVE_ACTUAL_TYPE_ = "Unable_to_resolve_actual_type_";
public final static String UNSUPPORTED_VERSION_R1 = "Unsupported_version_R1";
public final static String UNSUPPORTED_VERSION_R2 = "Unsupported_version_R2";
public final static String UNSUPPORTED_VERSION_R2B = "Unsupported_version_R2B";
public final static String UNSUPPORTED_FIXED_VALUE_TYPE_FOR_DISCRIMINATOR_FOR_SLICE__ = "Unsupported_fixed_value_type_for_discriminator_for_slice__";
public final static String UNSUPPORTED_CODEABLECONCEPT_PATTERN__EXTENSIONS_ARE_NOT_ALLOWED__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_CodeableConcept_pattern__extensions_are_not_allowed__for_discriminator_for_slice_";
public final static String UNSUPPORTED_CODEABLECONCEPT_PATTERN__MUST_HAVE_AT_LEAST_ONE_CODING__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_CodeableConcept_pattern__must_have_at_least_one_coding__for_discriminator_for_slice_";
public final static String UNSUPPORTED_CODEABLECONCEPT_PATTERN__USING_TEXT__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_CodeableConcept_pattern__using_text__for_discriminator_for_slice_";
public final static String UNSUPPORTED_IDENTIFIER_PATTERN__EXTENSIONS_ARE_NOT_ALLOWED__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_Identifier_pattern__extensions_are_not_allowed__for_discriminator_for_slice_";
public final static String UNSUPPORTED_FIXED_PATTERN_TYPE_FOR_DISCRIMINATOR_FOR_SLICE__ = "Unsupported_fixed_pattern_type_for_discriminator_for_slice__";
public final static String PROBLEM_EVALUATING_SLICING_EXPRESSION_FOR_ELEMENT_IN_PROFILE__PATH__FHIRPATH___ = "Problem_evaluating_slicing_expression_for_element_in_profile__path__fhirPath___";
public final static String COULD_NOT_MATCH_DISCRIMINATOR__FOR_SLICE__IN_PROFILE___THE_DISCRIMINATOR__DOES_NOT_HAVE_FIXED_VALUE_BINDING_OR_EXISTENCE_ASSERTIONS = "Could_not_match_discriminator__for_slice__in_profile___the_discriminator__does_not_have_fixed_value_binding_or_existence_assertions";
public final static String COULD_NOT_MATCH_ANY_DISCRIMINATORS__FOR_SLICE__IN_PROFILE___NONE_OF_THE_DISCRIMINATOR__HAVE_FIXED_VALUE_BINDING_OR_EXISTENCE_ASSERTIONS = "Could_not_match_any_discriminators__for_slice__in_profile___None_of_the_discriminator__have_fixed_value_binding_or_existence_assertions";
public final static String DISCRIMINATOR__IS_BASED_ON_ELEMENT_EXISTENCE_BUT_SLICE__NEITHER_SETS_MIN1_OR_MAX0 = "Discriminator__is_based_on_element_existence_but_slice__neither_sets_min1_or_max0";
public final static String PROFILE_BASED_DISCRIMINATORS_MUST_HAVE_A_TYPE_WITH_A_PROFILE__IN_PROFILE_ = "Profile_based_discriminators_must_have_a_type_with_a_profile__in_profile_";
public final static String PROFILE_BASED_DISCRIMINATORS_MUST_HAVE_ONLY_ONE_TYPE__IN_PROFILE_ = "Profile_based_discriminators_must_have_only_one_type__in_profile_";
public final static String PROFILE_BASED_DISCRIMINATORS_MUST_HAVE_A_TYPE__IN_PROFILE_ = "Profile_based_discriminators_must_have_a_type__in_profile_";
public final static String DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_NO_TYPES = "Discriminator__is_based_on_type_but_slice__in__has_no_types";
public final static String DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_MULTIPLE_TYPES_ = "Discriminator__is_based_on_type_but_slice__in__has_multiple_types_";
public final static String FOUND__ITEMS_FOR__RESOLVING_DISCRIMINATOR__FROM_ = "Found__items_for__resolving_discriminator__from_";
public final static String UNABLE_TO_FIND__RESOLVING_DISCRIMINATOR__FROM_ = "Unable_to_find__resolving_discriminator__from_";
public final static String UNABLE_TO_FIND_RESOURCE__AT__RESOLVING_DISCRIMINATOR__FROM_ = "Unable_to_find_resource__at__resolving_discriminator__from_";
public final static String NO_REFERENCE_RESOLVING_DISCRIMINATOR__FROM_ = "No_reference_resolving_discriminator__from_";
public final static String UNABLE_TO_RESOLVE_ELEMENT__IN_PROFILE_ = "Unable_to_resolve_element__in_profile_";
public final static String UNABLE_TO_RESOLVE_PROFILE_ = "Unable_to_resolve_profile_";
public final static String RESOURCE_RESOLUTION_SERVICES_NOT_PROVIDED = "Resource_resolution_services_not_provided";
public final static String UNRECOGNISED_EXTENSION_CONTEXT_ = "Unrecognised_extension_context_";
public final static String UNABLE_TO_LOCATE_THE_PROFILE__IN_ORDER_TO_VALIDATE_AGAINST_IT = "Unable_to_locate_the_profile__in_order_to_validate_against_it";
public final static String REFERENCE__REFERS_TO_A__NOT_A_VALUESET = "Reference__refers_to_a__not_a_ValueSet";
public final static String NOT_DONE_YET_VALIDATORHOSTSERVICESCONFORMSTOPROFILE_WHEN_ITEM_IS_NOT_AN_ELEMENT = "Not_done_yet_ValidatorHostServicesconformsToProfile_when_item_is_not_an_element";
public final static String NOT_SUPPORTED_YET = "Not_supported_yet";
public final static String UNABLE_TO_RESOLVE_ = "Unable_to_resolve_";
public final static String NOT_DONE_YET__RESOLVE__LOCALLY_2 = "Not_done_yet__resolve__locally_2";
public final static String NOT_DONE_YET_VALIDATORHOSTSERVICESEXECUTEFUNCTION = "Not_done_yet_ValidatorHostServicesexecuteFunction";
public final static String NOT_DONE_YET_VALIDATORHOSTSERVICESCHECKFUNCTION = "Not_done_yet_ValidatorHostServicescheckFunction";
public final static String NOT_DONE_YET_VALIDATORHOSTSERVICESRESOLVEFUNCTION_ = "Not_done_yet_ValidatorHostServicesresolveFunction_";
public final static String UNABLE_TO_FIND_BASE_DEFINITION_FOR_LOGICAL_MODEL__FROM_ = "Unable_to_find_base_definition_for_logical_model__from_";
public final static String SAME_ID_ON_MULTIPLE_ELEMENTS__IN_ = "Same_id_on_multiple_elements__in_";
public final static String NO_PATH_ON_ELEMENT_DEFINITION__IN_ = "No_path_on_element_Definition__in_";
public final static String NEEDS_A_SNAPSHOT = "needs_a_snapshot";
public final static String NOT_THE_RIGHT_KIND_OF_STRUCTURE_TO_GENERATE_SCHEMATRONS_FOR = "not_the_right_kind_of_structure_to_generate_schematrons_for";
public final static String NOT_HANDLED_YET_SORTELEMENTS_ = "Not_handled_yet_sortElements_";
public final static String UNABLE_TO_RESOLVE_PROFILE__IN_ELEMENT_ = "Unable_to_resolve_profile__in_element_";
public final static String CANT_HAVE_CHILDREN_ON_AN_ELEMENT_WITH_A_POLYMORPHIC_TYPE__YOU_MUST_SLICE_AND_CONSTRAIN_THE_TYPES_FIRST_SORTELEMENTS_ = "Cant_have_children_on_an_element_with_a_polymorphic_type__you_must_slice_and_constrain_the_types_first_sortElements_";
public final static String UNABLE_TO_FIND_PROFILE__AT_ = "Unable_to_find_profile__at_";
public final static String UNHANDLED_SITUATION_RESOURCE_IS_PROFILED_TO_MORE_THAN_ONE_OPTION__CANNOT_SORT_PROFILE = "Unhandled_situation_resource_is_profiled_to_more_than_one_option__cannot_sort_profile";
public final static String INTERNAL_RECURSION_DETECTION_FIND_LOOP_PATH_RECURSION____CHECK_PATHS_ARE_VALID_FOR_PATH_ = "Internal_recursion_detection_find_loop_path_recursion____check_paths_are_valid_for_path_";
public final static String INTERNAL_ERROR___TYPE_NOT_KNOWN_ = "Internal_error___type_not_known_";
public final static String UNABLE_TO_FIND_ELEMENT_ = "Unable_to_find_element_";
public final static String ERROR_GENERATING_TABLE_FOR_PROFILE__ = "Error_generating_table_for_profile__";
public final static String STRUCTUREDEFINITION__AT__ILLEGAL_CONSTRAINED_TYPE__FROM__IN_ = "StructureDefinition__at__illegal_constrained_type__from__in_";
public final static String ERROR_AT__THE_TARGET_PROFILE__IS_NOT__VALID_CONSTRAINT_ON_THE_BASE_ = "Error_at__The_target_profile__is_not__valid_constraint_on_the_base_";
public final static String ERROR_IN_PROFILE__AT__BASE_ISSUMMARY___DERIVED_ISSUMMARY__ = "Error_in_profile__at__Base_isSummary___derived_isSummary__";
public final static String UNEXPECTED_CONDITION_IN_DIFFERENTIAL_TYPESLICETYPELISTSIZE__1_AT_ = "Unexpected_condition_in_differential_typeslicetypelistsize__1_at_";
public final static String UNEXPECTED_CONDITION_IN_DIFFERENTIAL_TYPESLICETYPELISTSIZE__10_AND_IMPLICIT_SLICE_NAME_DOES_NOT_CONTAIN_A_VALID_TYPE__AT_ = "Unexpected_condition_in_differential_typeslicetypelistsize__10_and_implicit_slice_name_does_not_contain_a_valid_type__at_";
public final static String ATTEMPT_TO_USE_A_SNAPSHOT_ON_PROFILE__AS__BEFORE_IT_IS_GENERATED = "Attempt_to_use_a_snapshot_on_profile__as__before_it_is_generated";
public final static String NULL_MIN = "null_min";
public final static String _HAS_CHILDREN__FOR_TYPE__IN_PROFILE__BUT_CANT_FIND_TYPE = "_has_children__for_type__in_profile__but_cant_find_type";
public final static String _HAS_CHILDREN__AND_MULTIPLE_TYPES__IN_PROFILE_ = "_has_children__and_multiple_types__in_profile_";
public final static String ADDING_WRONG_PATH = "Adding_wrong_path";
public final static String NAMED_ITEMS_ARE_OUT_OF_ORDER_IN_THE_SLICE = "Named_items_are_out_of_order_in_the_slice";
public final static String THE_BASE_SNAPSHOT_MARKS_A_SLICING_AS_CLOSED_BUT_THE_DIFFERENTIAL_TRIES_TO_EXTEND_IT_IN__AT__ = "The_base_snapshot_marks_a_slicing_as_closed_but_the_differential_tries_to_extend_it_in__at__";
public final static String NOT_DONE_YET = "Not_done_yet";
public final static String UNKNOWN_TYPE__AT_ = "Unknown_type__at_";
public final static String DIFFERENTIAL_WALKS_INTO____BUT_THE_BASE_DOES_NOT_AND_THERE_IS_NOT_A_SINGLE_FIXED_TYPE_THE_TYPE_IS__THIS_IS_NOT_HANDLED_YET = "Differential_walks_into____but_the_base_does_not_and_there_is_not_a_single_fixed_type_The_type_is__This_is_not_handled_yet";
public final static String SLICING_RULES_ON_DIFFERENTIAL__DO_NOT_MATCH_THOSE_ON_BASE___RULE___ = "Slicing_rules_on_differential__do_not_match_those_on_base___rule___";
public final static String SLICING_RULES_ON_DIFFERENTIAL__DO_NOT_MATCH_THOSE_ON_BASE___DISCIMINATOR___ = "Slicing_rules_on_differential__do_not_match_those_on_base___disciminator___";
public final static String SLICING_RULES_ON_DIFFERENTIAL__DO_NOT_MATCH_THOSE_ON_BASE___ORDER___ = "Slicing_rules_on_differential__do_not_match_those_on_base___order___";
public final static String INVALID_SLICING__THERE_IS_MORE_THAN_ONE_TYPE_SLICE_AT__BUT_ONE_OF_THEM__HAS_MIN__1_SO_THE_OTHER_SLICES_CANNOT_EXIST = "Invalid_slicing__there_is_more_than_one_type_slice_at__but_one_of_them__has_min__1_so_the_other_slices_cannot_exist";
public final static String DID_NOT_FIND_TYPE_ROOT_ = "Did_not_find_type_root_";
public final static String ERROR_AT_PATH__SLICE_FOR_TYPE__HAS_WRONG_TYPE_ = "Error_at_path__Slice_for_type__has_wrong_type_";
public final static String ERROR_AT_PATH__SLICE_FOR_TYPE__HAS_MORE_THAN_ONE_TYPE_ = "Error_at_path__Slice_for_type__has_more_than_one_type_";
public final static String ERROR_AT_PATH__SLICE_NAME_MUST_BE__BUT_IS_ = "Error_at_path__Slice_name_must_be__but_is_";
public final static String ERROR_AT_PATH__IN__TYPE_SLICING_WITH_SLICINGDISCRIMINATORPATH__THIS = "Error_at_path__in__Type_slicing_with_slicingdiscriminatorpath__this";
public final static String ERROR_AT_PATH__IN__TYPE_SLICING_WITH_SLICINGDISCRIMINATORTYPE__TYPE = "Error_at_path__in__Type_slicing_with_slicingdiscriminatortype__type";
public final static String ERROR_AT_PATH__IN__TYPE_SLICING_WITH_SLICINGDISCRIMINATORCOUNT__1 = "Error_at_path__in__Type_slicing_with_slicingdiscriminatorcount__1";
public final static String ERROR_AT_PATH__IN__TYPE_SLICING_WITH_SLICINGORDERED__TRUE = "Error_at_path__in__Type_slicing_with_slicingordered__true";
public final static String ADDING_WRONG_PATH_IN_PROFILE___VS_ = "Adding_wrong_path_in_profile___vs_";
public final static String _HAS_NO_CHILDREN__AND_NO_TYPES_IN_PROFILE_ = "_has_no_children__and_no_types_in_profile_";
public final static String DID_NOT_FIND_SINGLE_SLICE_ = "Did_not_find_single_slice_";
public final static String DIFFERENTIAL_DOES_NOT_HAVE_A_SLICE__B_OF_____IN_PROFILE_ = "Differential_does_not_have_a_slice__b_of_____in_profile_";
public final static String ATTEMPT_TO_A_SLICE_AN_ELEMENT_THAT_DOES_NOT_REPEAT__FROM__IN_ = "Attempt_to_a_slice_an_element_that_does_not_repeat__from__in_";
public final static String UNABLE_TO_RESOLVE_REFERENCE_TO_ = "Unable_to_resolve_reference_to_";
public final static String UNABLE_TO_FIND_ELEMENT__IN_ = "Unable_to_find_element__in_";
public final static String UNABLE_TO_FIND_BASE__FOR_ = "Unable_to_find_base__for_";
public final static String ADDING_WRONG_PATH__OUTCOMEGETPATH___RESULTPATHBASE__ = "Adding_wrong_path__outcomegetPath___resultPathBase__";
public final static String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__ILLEGAL_CHARACTERS_ = "Illegal_path__in_differential_in__illegal_characters_";
public final static String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__ILLEGAL_CHARACTER_ = "Illegal_path__in_differential_in__illegal_character_";
public final static String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__NO_UNICODE_WHITESPACE = "Illegal_path__in_differential_in__no_unicode_whitespace";
public final static String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__NAME_PORTION_EXCEEDS_64_CHARS_IN_LENGTH = "Illegal_path__in_differential_in__name_portion_exceeds_64_chars_in_length";
public final static String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__NAME_PORTION_MISING_ = "Illegal_path__in_differential_in__name_portion_mising_";
public final static String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__MUST_START_WITH_ = "Illegal_path__in_differential_in__must_start_with_";
public final static String NO_PATH_VALUE_ON_ELEMENT_IN_DIFFERENTIAL_IN_ = "No_path_value_on_element_in_differential_in_";
public final static String NO_PATH_ON_ELEMENT_IN_DIFFERENTIAL_IN_ = "No_path_on_element_in_differential_in_";
public final static String UNXPECTED_INTERNAL_CONDITION__NO_SOURCE_ON_DIFF_ELEMENT = "Unxpected_internal_condition__no_source_on_diff_element";
public final static String TYPE_ON_FIRST_SNAPSHOT_ELEMENT_FOR__IN__FROM_ = "type_on_first_snapshot_element_for__in__from_";
public final static String TYPE_ON_FIRST_DIFFERENTIAL_ELEMENT = "type_on_first_differential_element";
public final static String CIRCULAR_SNAPSHOT_REFERENCES_DETECTED_CANNOT_GENERATE_SNAPSHOT_STACK__ = "Circular_snapshot_references_detected_cannot_generate_snapshot_stack__";
public final static String BASE__DERIVED_PROFILES_HAVE_DIFFERENT_TYPES____VS___ = "Base__Derived_profiles_have_different_types____vs___";
public final static String DERIVED_PROFILE__HAS_NO_DERIVATION_VALUE_AND_SO_CANT_BE_PROCESSED = "Derived_profile__has_no_derivation_value_and_so_cant_be_processed";
public final static String DERIVED_PROFILE__HAS_NO_TYPE = "Derived_profile__has_no_type";
public final static String BASE_PROFILE__HAS_NO_TYPE = "Base_profile__has_no_type";
public final static String NO_DERIVED_STRUCTURE_PROVIDED = "no_derived_structure_provided";
public final static String NO_BASE_PROFILE_PROVIDED = "no_base_profile_provided";
public final static String ELEMENT_ID__NULL__ON_ = "element_id__null__on_";
public final static String ELEMENT__NULL_ = "element__null_";
public final static String GETSLICELIST_SHOULD_ONLY_BE_CALLED_WHEN_THE_ELEMENT_HAS_SLICING = "getSliceList_should_only_be_called_when_the_element_has_slicing";
public final static String UNABLE_TO_RESOLVE_NAME_REFERENCE__AT_PATH_ = "Unable_to_resolve_name_reference__at_path_";
public final static String DETAILS_FOR__MATCHING_AGAINST_PROFILE_ = "Details_for__matching_against_Profile_";
public final static String DOES_NOT_MATCH_SLICE_ = "Does_not_match_slice_";
public final static String PROFILE__DOES_NOT_MATCH_FOR__BECAUSE_OF_THE_FOLLOWING_PROFILE_ISSUES__ = "Profile__does_not_match_for__because_of_the_following_profile_issues__";
public final static String THIS_ELEMENT_DOES_NOT_MATCH_ANY_KNOWN_SLICE_ = "This_element_does_not_match_any_known_slice_";
public final static String DEFINED_IN_THE_PROFILE = "defined_in_the_profile";
public final static String THIS_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_ = "This_does_not_appear_to_be_a_FHIR_resource_unknown_name_";
public final static String THIS_CANNOT_BE_PARSED_AS_A_FHIR_OBJECT_NO_NAME = "This_cannot_be_parsed_as_a_FHIR_object_no_name";
public final static String THIS_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAMESPACENAME_ = "This_does_not_appear_to_be_a_FHIR_resource_unknown_namespacename_";
public final static String THIS__CANNOT_BE_PARSED_AS_A_FHIR_OBJECT_NO_NAMESPACE = "This__cannot_be_parsed_as_a_FHIR_object_no_namespace";
public final static String UNABLE_TO_FIND_RESOURCETYPE_PROPERTY = "Unable_to_find_resourceType_property";
public final static String ERROR_PARSING_JSON_THE_PRIMITIVE_VALUE_MUST_BE_A_STRING = "Error_parsing_JSON_the_primitive_value_must_be_a_string";
public final static String ERROR_PARSING_JSON_THE_PRIMITIVE_VALUE_MUST_BE_A_NUMBER = "Error_parsing_JSON_the_primitive_value_must_be_a_number";
public final static String ERROR_PARSING_JSON_THE_PRIMITIVE_VALUE_MUST_BE_A_BOOLEAN = "Error_parsing_JSON_the_primitive_value_must_be_a_boolean";
public final static String ERROR_PARSING_XHTML_ = "Error_parsing_XHTML_";
public final static String THIS_PROPERTY_MUST_BE_AN_OBJECT_NOT_ = "This_property_must_be_an_object_not_";
public final static String THIS_PROPERTY_MUST_BE_AN_SIMPLE_VALUE_NOT_ = "This_property_must_be_an_simple_value_not_";
public final static String THIS_PROPERTY_MUST_BE__NOT_ = "This_property_must_be__not_";
public final static String THIS_PROPERTY_MUST_BE_AN_ARRAY_NOT_ = "This_property_must_be_an_Array_not_";
public final static String UNRECOGNISED_PROPERTY_ = "Unrecognised_property_";
public final static String OBJECT_MUST_HAVE_SOME_CONTENT = "Object_must_have_some_content";
public final static String ERROR_PARSING_JSON_ = "Error_parsing_JSON_";
public final static String NODE_TYPE__IS_NOT_ALLOWED = "Node_type__is_not_allowed";
public final static String CDATA_IS_NOT_ALLOWED = "CDATA_is_not_allowed";
public final static String UNDEFINED_ELEMENT_ = "Undefined_element_";
public final static String UNDEFINED_ATTRIBUTE__ON__FOR_TYPE__PROPERTIES__ = "Undefined_attribute__on__for_type__properties__";
public final static String TEXT_SHOULD_NOT_BE_PRESENT = "Text_should_not_be_present";
public final static String WRONG_NAMESPACE__EXPECTED_ = "Wrong_namespace__expected_";
public final static String ELEMENT_MUST_HAVE_SOME_CONTENT = "Element_must_have_some_content";
public final static String NO_PROCESSING_INSTRUCTIONS_ALLOWED_IN_RESOURCES = "No_processing_instructions_allowed_in_resources";
public final static String UNKNOWN_RESOURCE_TYPE_MISSING_RDFSTYPE = "Unknown_resource_type_missing_rdfstype";
public final static String REFERENCE_TO__CANNOT_BE_RESOLVED = "reference_to__cannot_be_resolved";
public final static String THIS_PROPERTY_MUST_BE_A_URI_OR_BNODE_NOT_A_ = "This_property_must_be_a_URI_or_bnode_not_a_";
public final static String THIS_PROPERTY_MUST_BE_A_LITERAL_NOT_A_ = "This_property_must_be_a_Literal_not_a_";
public final static String UNRECOGNISED_PREDICATE_ = "Unrecognised_predicate_";
public final static String ERROR_PARSING_TURTLE_ = "Error_parsing_Turtle_";
public final static String UNEXPECTED_DATATYPE_FOR_RDFSTYPE = "Unexpected_datatype_for_rdfstype";
public final static String ATTEMPT_TO_REPLACE_ELEMENT_NAME_FOR_A_NONCHOICE_TYPE = "Attempt_to_replace_element_name_for_a_nonchoice_type";
public final static String WRONG_TYPE_FOR_RESOURCE = "Wrong_type_for_resource";
public final static String CONTAINED_RESOURCE_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_ = "Contained_resource_does_not_appear_to_be_a_FHIR_resource_unknown_name_";
public final static String UNKNOWN_DATE_FORMAT_ = "Unknown_Date_format_";
public final static String UNKNOWN_DATA_FORMAT_ = "Unknown_Data_format_";
public final static String NO_TYPE_FOUND_ON_ = "No_type_found_on_";
public final static String ERROR_WRITING_NUMBER__TO_JSON = "error_writing_number__to_JSON";
public final static String UNABLE_TO_PROCESS_REQUEST_FOR_RESOURCE_FOR___ = "Unable_to_process_request_for_resource_for___";
public final static String RESOURCE_TYPE_MISMATCH_FOR___ = "Resource_type_mismatch_for___";
public final static String NOT_DONE_YET_CANT_FETCH_ = "not_done_yet_cant_fetch_";
public final static String ATTEMPT_TO_USE_TERMINOLOGY_SERVER_WHEN_NO_TERMINOLOGY_SERVER_IS_AVAILABLE = "Attempt_to_use_Terminology_server_when_no_Terminology_server_is_available";
public final static String NO_EXPANSIONPROFILE_PROVIDED = "No_ExpansionProfile_provided";
public final static String CAN_ONLY_SPECIFY_PROFILE_IN_THE_CONTEXT = "Can_only_specify_profile_in_the_context";
public final static String NO_URL_IN_EXPAND_VALUE_SET_2 = "no_url_in_expand_value_set_2";
public final static String NO_URL_IN_EXPAND_VALUE_SET = "no_url_in_expand_value_set";
public final static String NO_VALUE_SET_IN_URL = "no_value_set";
public final static String NO_PARAMETERS_PROVIDED_TO_EXPANDVS = "No_Parameters_provided_to_expandVS";
public final static String NO_EXPANSION_PARAMETERS_PROVIDED = "No_Expansion_Parameters_provided";
public final static String UNABLE_TO_RESOLVE_VALUE_SET_ = "Unable_to_resolve_value_Set_";
public final static String DELIMITED_VERSIONS_HAVE_EXACT_MATCH_FOR_DELIMITER____VS_ = "Delimited_versions_have_exact_match_for_delimiter____vs_";
public final static String DUPLICATE_RESOURCE_ = "Duplicate_Resource_";
public final static String ERROR_EXPANDING_VALUESET_RUNNING_WITHOUT_TERMINOLOGY_SERVICES = "Error_expanding_ValueSet_running_without_terminology_services";
public final static String ERROR_VALIDATING_CODE_RUNNING_WITHOUT_TERMINOLOGY_SERVICES = "Error_validating_code_running_without_terminology_services";
public final static String UNABLE_TO_VALIDATE_CODE_WITHOUT_USING_SERVER = "Unable_to_validate_code_without_using_server";
public final static String PROFILE___ERROR_GENERATING_SNAPSHOT = "Profile___Error_generating_snapshot";
public final static String PROFILE___ELEMENT__ERROR_GENERATING_SNAPSHOT_ = "Profile___element__Error_generating_snapshot_";
public final static String PROFILE___BASE__COULD_NOT_BE_RESOLVED = "Profile___base__could_not_be_resolved";
public final static String PROFILE___HAS_NO_BASE_AND_NO_SNAPSHOT = "Profile___has_no_base_and_no_snapshot";
public final static String NO_VALIDATOR_CONFIGURED = "No_validator_configured";
public final static String PARSER_TYPE__NOT_SUPPORTED = "Parser_Type__not_supported";
public final static String VERSION_MISMATCH_THE_CONTEXT_HAS_VERSION__LOADED_AND_THE_NEW_CONTENT_BEING_LOADED_IS_VERSION_ = "Version_mismatch_The_context_has_version__loaded_and_the_new_content_being_loaded_is_version_";
public final static String ERROR_READING__FROM_PACKAGE__ = "Error_reading__from_package__";
public final static String ERROR_PARSING_ = "Error_parsing_";
public final static String UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__ = "Unable_to_connect_to_terminology_server_Use_parameter_tx_na_tun_run_without_using_terminology_services_to_validate_LOINC_SNOMED_ICDX_etc_Error__";
public final static String DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF_ = "Display_Name_for__should_be_one_of__instead_of_";
public final static String UNKNOWN_CODE__IN_ = "Unknown_Code__in_";
public final static String UNKNOWN_CODE__IN_FRAGMENT = "UNKNOWN_CODE__IN_FRAGMENT";
public final static String CODE_FOUND_IN_EXPANSION_HOWEVER_ = "Code_found_in_expansion_however_";
public final static String NONE_OF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_ = "None_of_the_provided_codes_are_in_the_value_set_";
public final static String CODING_HAS_NO_SYSTEM__CANNOT_VALIDATE = "Coding_has_no_system__cannot_validate";
public final static String UNABLE_TO_HANDLE_SYSTEM__CONCEPT_FILTER_WITH_OP__ = "Unable_to_handle_system__concept_filter_with_op__";
public final static String UNABLE_TO_HANDLE_SYSTEM__FILTER_WITH_PROPERTY__ = "Unable_to_handle_system__filter_with_property__";
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_NO_SYSTEM = "Unable_to_resolve_system__value_set_has_include_with_no_system";
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_IMPORTS = "Unable_to_resolve_system__value_set_has_imports";
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_EXPANSION_HAS_MULTIPLE_SYSTEMS = "Unable_to_resolve_system__value_set_expansion_has_multiple_systems";
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_NO_INCLUDES_OR_EXPANSION = "Unable_to_resolve_system__value_set_has_no_includes_or_expansion";
public final static String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_EXCLUDES = "Unable_to_resolve_system__value_set_has_excludes";
public final static String UNABLE_TO_RESOLVE_SYSTEM__NO_VALUE_SET = "Unable_to_resolve_system__no_value_set";
public final static String THIS_BASE_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_ = "This_base_property_must_be_an_Array_not_a_";
public final static String THIS_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_ = "This_property_must_be_an_Array_not_a_";
public final static String DOCUMENT = "documentmsg";
public final static String DOCUMENT_DATE_REQUIRED = "Bundle_Document_Date_Missing";
public final static String DOCUMENT_DATE_REQUIRED_HTML = "Bundle_Document_Date_Missing_html";
public final static String XML_ATTR_VALUE_INVALID = "xml_attr_value_invalid";
public final static String XML_ENCODING_INVALID = "xml_encoding_invalid";
public final static String XML_STATED_ENCODING_INVALID = "xml_stated_encoding_invalid";
public static final String MEASURE_MR_GRP_NO_CODE = "MEASURE_MR_GRP_NO_CODE";
public static final String MEASURE_MR_GRP_UNK_CODE = "MEASURE_MR_GRP_UNK_CODE";
public static final String ADDING_WRONG_PATH = "Adding_wrong_path";
public static final String ADDING_WRONG_PATH_IN_PROFILE___VS_ = "Adding_wrong_path_in_profile___vs_";
public static final String ADDING_WRONG_PATH__OUTCOMEGETPATH___RESULTPATHBASE__ = "Adding_wrong_path__outcomegetPath___resultPathBase__";
public static final String ALL_OBSERVATIONS_SHOULD_HAVE_AN_EFFECTIVEDATETIME_OR_AN_EFFECTIVEPERIOD = "All_observations_should_have_an_effectiveDateTime_or_an_effectivePeriod";
public static final String ALL_OBSERVATIONS_SHOULD_HAVE_A_PERFORMER = "All_observations_should_have_a_performer";
public static final String ALL_OBSERVATIONS_SHOULD_HAVE_A_SUBJECT = "All_observations_should_have_a_subject";
public static final String ATTEMPT_TO_A_SLICE_AN_ELEMENT_THAT_DOES_NOT_REPEAT__FROM__IN_ = "Attempt_to_a_slice_an_element_that_does_not_repeat__from__in_";
public static final String ATTEMPT_TO_REPLACE_ELEMENT_NAME_FOR_A_NONCHOICE_TYPE = "Attempt_to_replace_element_name_for_a_nonchoice_type";
public static final String ATTEMPT_TO_USE_A_SNAPSHOT_ON_PROFILE__AS__BEFORE_IT_IS_GENERATED = "Attempt_to_use_a_snapshot_on_profile__as__before_it_is_generated";
public static final String ATTEMPT_TO_USE_TERMINOLOGY_SERVER_WHEN_NO_TERMINOLOGY_SERVER_IS_AVAILABLE = "Attempt_to_use_Terminology_server_when_no_Terminology_server_is_available";
public static final String BASE_PROFILE__HAS_NO_TYPE = "Base_profile__has_no_type";
public static final String BASE__DERIVED_PROFILES_HAVE_DIFFERENT_TYPES____VS___ = "Base__Derived_profiles_have_different_types____vs___";
public static final String BUNDLE_BUNDLE_ENTRY_CANONICAL = "Bundle_BUNDLE_Entry_Canonical";
public static final String BUNDLE_BUNDLE_ENTRY_DOCUMENT = "Bundle_BUNDLE_Entry_Document";
public static final String BUNDLE_BUNDLE_ENTRY_IDURLMISMATCH = "Bundle_BUNDLE_Entry_IdUrlMismatch";
public static final String BUNDLE_BUNDLE_ENTRY_MISMATCHIDURL = "Bundle_BUNDLE_Entry_MismatchIdUrl";
public static final String BUNDLE_BUNDLE_ENTRY_NOFIRST = "Bundle_BUNDLE_Entry_NoFirst";
public static final String BUNDLE_BUNDLE_ENTRY_NOFIRSTRESOURCE = "Bundle_BUNDLE_Entry_NoFirstResource";
public static final String BUNDLE_BUNDLE_ENTRY_NOFULLURL = "Bundle_BUNDLE_Entry_NoFullUrl";
public static final String BUNDLE_BUNDLE_ENTRY_NOPROFILE = "Bundle_BUNDLE_Entry_NoProfile";
public static final String BUNDLE_BUNDLE_ENTRY_NOTFOUND = "Bundle_BUNDLE_Entry_NotFound";
public static final String BUNDLE_BUNDLE_ENTRY_ORPHAN = "Bundle_BUNDLE_Entry_Orphan";
public static final String BUNDLE_BUNDLE_ENTRY_TYPE = "Bundle_BUNDLE_Entry_Type";
public static final String BUNDLE_BUNDLE_ENTRY_TYPE2 = "Bundle_BUNDLE_Entry_Type2";
public static final String BUNDLE_BUNDLE_ENTRY_TYPE3 = "Bundle_BUNDLE_Entry_Type3";
public static final String BUNDLE_BUNDLE_FULLURL_MISSING = "Bundle_BUNDLE_FullUrl_Missing";
public static final String BUNDLE_BUNDLE_FULLURL_NEEDVERSION = "Bundle_BUNDLE_FullUrl_NeedVersion";
public static final String BUNDLE_BUNDLE_MULTIPLEMATCHES = "Bundle_BUNDLE_MultipleMatches";
public static final String BUNDLE_BUNDLE_NOT_LOCAL = "Bundle_BUNDLE_Not_Local";
public static final String BUNDLE_MSG_EVENT_COUNT = "Bundle_MSG_Event_Count";
public static final String CANT_HAVE_CHILDREN_ON_AN_ELEMENT_WITH_A_POLYMORPHIC_TYPE__YOU_MUST_SLICE_AND_CONSTRAIN_THE_TYPES_FIRST_SORTELEMENTS_ = "Cant_have_children_on_an_element_with_a_polymorphic_type__you_must_slice_and_constrain_the_types_first_sortElements_";
public static final String CAN_ONLY_SPECIFY_PROFILE_IN_THE_CONTEXT = "Can_only_specify_profile_in_the_context";
public static final String CAPABALITYSTATEMENT_CS_SP_WRONGTYPE = "CapabalityStatement_CS_SP_WrongType";
public static final String CDATA_IS_NOT_ALLOWED = "CDATA_is_not_allowed";
public static final String CIRCULAR_SNAPSHOT_REFERENCES_DETECTED_CANNOT_GENERATE_SNAPSHOT_STACK__ = "Circular_snapshot_references_detected_cannot_generate_snapshot_stack__";
public static final String CODESYSTEM_CS_NO_VS_NOTCOMPLETE = "CODESYSTEM_CS_NO_VS_NOTCOMPLETE";
public static final String CODESYSTEM_CS_VS_INCLUDEDETAILS = "CodeSystem_CS_VS_IncludeDetails";
public static final String CODESYSTEM_CS_VS_INVALID = "CodeSystem_CS_VS_Invalid";
public static final String CODESYSTEM_CS_VS_MISMATCH = "CodeSystem_CS_VS_MisMatch";
public static final String CODESYSTEM_CS_VS_WRONGSYSTEM = "CodeSystem_CS_VS_WrongSystem";
public static final String CODE_FOUND_IN_EXPANSION_HOWEVER_ = "Code_found_in_expansion_however_";
public static final String CODING_HAS_NO_SYSTEM__CANNOT_VALIDATE = "Coding_has_no_system__cannot_validate";
public static final String CONTAINED_RESOURCE_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_ = "Contained_resource_does_not_appear_to_be_a_FHIR_resource_unknown_name_";
public static final String COULD_NOT_MATCH_ANY_DISCRIMINATORS__FOR_SLICE__IN_PROFILE___NONE_OF_THE_DISCRIMINATOR__HAVE_FIXED_VALUE_BINDING_OR_EXISTENCE_ASSERTIONS = "Could_not_match_any_discriminators__for_slice__in_profile___None_of_the_discriminator__have_fixed_value_binding_or_existence_assertions";
public static final String COULD_NOT_MATCH_DISCRIMINATOR__FOR_SLICE__IN_PROFILE___THE_DISCRIMINATOR__DOES_NOT_HAVE_FIXED_VALUE_BINDING_OR_EXISTENCE_ASSERTIONS = "Could_not_match_discriminator__for_slice__in_profile___the_discriminator__does_not_have_fixed_value_binding_or_existence_assertions";
public static final String DEFINED_IN_THE_PROFILE = "defined_in_the_profile";
public static final String DELIMITED_VERSIONS_HAVE_EXACT_MATCH_FOR_DELIMITER____VS_ = "Delimited_versions_have_exact_match_for_delimiter____vs_";
public static final String DERIVED_PROFILE__HAS_NO_DERIVATION_VALUE_AND_SO_CANT_BE_PROCESSED = "Derived_profile__has_no_derivation_value_and_so_cant_be_processed";
public static final String DERIVED_PROFILE__HAS_NO_TYPE = "Derived_profile__has_no_type";
public static final String DETAILS_FOR__MATCHING_AGAINST_PROFILE_ = "Details_for__matching_against_Profile_";
public static final String DID_NOT_FIND_SINGLE_SLICE_ = "Did_not_find_single_slice_";
public static final String DID_NOT_FIND_TYPE_ROOT_ = "Did_not_find_type_root_";
public static final String DIFFERENTIAL_DOES_NOT_HAVE_A_SLICE__B_OF_____IN_PROFILE_ = "Differential_does_not_have_a_slice__b_of_____in_profile_";
public static final String DIFFERENTIAL_WALKS_INTO____BUT_THE_BASE_DOES_NOT_AND_THERE_IS_NOT_A_SINGLE_FIXED_TYPE_THE_TYPE_IS__THIS_IS_NOT_HANDLED_YET = "Differential_walks_into____but_the_base_does_not_and_there_is_not_a_single_fixed_type_The_type_is__This_is_not_handled_yet";
public static final String DISCRIMINATOR__IS_BASED_ON_ELEMENT_EXISTENCE_BUT_SLICE__NEITHER_SETS_MIN1_OR_MAX0 = "Discriminator__is_based_on_element_existence_but_slice__neither_sets_min1_or_max0";
public static final String DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_MULTIPLE_TYPES_ = "Discriminator__is_based_on_type_but_slice__in__has_multiple_types_";
public static final String DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_NO_TYPES = "Discriminator__is_based_on_type_but_slice__in__has_no_types";
public static final String DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF_ = "Display_Name_for__should_be_one_of__instead_of_";
public static final String DOCUMENT = "documentmsg";
public static final String DOCUMENT_DATE_REQUIRED = "Bundle_Document_Date_Missing";
public static final String DOCUMENT_DATE_REQUIRED_HTML = "Bundle_Document_Date_Missing_html";
public static final String DOES_NOT_MATCH_SLICE_ = "Does_not_match_slice_";
public static final String DUPLICATE_ID = "DUPLICATE_ID";
public static final String DUPLICATE_RESOURCE_ = "Duplicate_Resource_";
public static final String ELEMENT_ID__NULL__ON_ = "element_id__null__on_";
public static final String ELEMENT_MUST_HAVE_SOME_CONTENT = "Element_must_have_some_content";
public static final String ELEMENT__NULL_ = "element__null_";
public static final String ERROR_AT_PATH__IN__TYPE_SLICING_WITH_SLICINGDISCRIMINATORCOUNT__1 = "Error_at_path__in__Type_slicing_with_slicingdiscriminatorcount__1";
public static final String ERROR_AT_PATH__IN__TYPE_SLICING_WITH_SLICINGDISCRIMINATORPATH__THIS = "Error_at_path__in__Type_slicing_with_slicingdiscriminatorpath__this";
public static final String ERROR_AT_PATH__IN__TYPE_SLICING_WITH_SLICINGDISCRIMINATORTYPE__TYPE = "Error_at_path__in__Type_slicing_with_slicingdiscriminatortype__type";
public static final String ERROR_AT_PATH__IN__TYPE_SLICING_WITH_SLICINGORDERED__TRUE = "Error_at_path__in__Type_slicing_with_slicingordered__true";
public static final String ERROR_AT_PATH__SLICE_FOR_TYPE__HAS_MORE_THAN_ONE_TYPE_ = "Error_at_path__Slice_for_type__has_more_than_one_type_";
public static final String ERROR_AT_PATH__SLICE_FOR_TYPE__HAS_WRONG_TYPE_ = "Error_at_path__Slice_for_type__has_wrong_type_";
public static final String ERROR_AT_PATH__SLICE_NAME_MUST_BE__BUT_IS_ = "Error_at_path__Slice_name_must_be__but_is_";
public static final String ERROR_AT__THE_TARGET_PROFILE__IS_NOT__VALID_CONSTRAINT_ON_THE_BASE_ = "Error_at__The_target_profile__is_not__valid_constraint_on_the_base_";
public static final String ERROR_EXPANDING_VALUESET_RUNNING_WITHOUT_TERMINOLOGY_SERVICES = "Error_expanding_ValueSet_running_without_terminology_services";
public static final String ERROR_GENERATING_TABLE_FOR_PROFILE__ = "Error_generating_table_for_profile__";
public static final String ERROR_IN_PROFILE__AT__BASE_ISSUMMARY___DERIVED_ISSUMMARY__ = "Error_in_profile__at__Base_isSummary___derived_isSummary__";
public static final String ERROR_PARSING_ = "Error_parsing_";
public static final String ERROR_PARSING_JSON_ = "Error_parsing_JSON_";
public static final String ERROR_PARSING_JSON_THE_PRIMITIVE_VALUE_MUST_BE_A_BOOLEAN = "Error_parsing_JSON_the_primitive_value_must_be_a_boolean";
public static final String ERROR_PARSING_JSON_THE_PRIMITIVE_VALUE_MUST_BE_A_NUMBER = "Error_parsing_JSON_the_primitive_value_must_be_a_number";
public static final String ERROR_PARSING_JSON_THE_PRIMITIVE_VALUE_MUST_BE_A_STRING = "Error_parsing_JSON_the_primitive_value_must_be_a_string";
public static final String ERROR_PARSING_TURTLE_ = "Error_parsing_Turtle_";
public static final String ERROR_PARSING_XHTML_ = "Error_parsing_XHTML_";
public static final String ERROR_READING__FROM_PACKAGE__ = "Error_reading__from_package__";
public static final String ERROR_VALIDATING_CODE_RUNNING_WITHOUT_TERMINOLOGY_SERVICES = "Error_validating_code_running_without_terminology_services";
public static final String ERROR_WRITING_NUMBER__TO_JSON = "error_writing_number__to_JSON";
public static final String EXTENSION_EXT_CONTEXT_WRONG = "Extension_EXT_Context_Wrong";
public static final String EXTENSION_EXT_CONTEXT_WRONG_XVER = "EXTENSION_EXT_CONTEXT_WRONG_XVER";
public static final String EXTENSION_EXT_COUNT_MISMATCH = "Extension_EXT_Count_Mismatch";
public static final String EXTENSION_EXT_COUNT_NOTFOUND = "Extension_EXT_Count_NotFound";
public static final String EXTENSION_EXT_FIXED_BANNED = "Extension_EXT_Fixed_Banned";
public static final String EXTENSION_EXT_MODIFIER_MISMATCHN = "Extension_EXT_Modifier_MismatchN";
public static final String EXTENSION_EXT_MODIFIER_MISMATCHY = "Extension_EXT_Modifier_MismatchY";
public static final String EXTENSION_EXT_MODIFIER_N = "Extension_EXT_Modifier_N";
public static final String EXTENSION_EXT_MODIFIER_Y = "Extension_EXT_Modifier_Y";
public static final String EXTENSION_EXT_SIMPLE = "Extension_EXT_Simple";
public static final String EXTENSION_EXT_SUBEXTENSION_INVALID = "Extension_EXT_SubExtension_Invalid";
public static final String EXTENSION_EXT_TYPE = "Extension_EXT_Type";
public static final String EXTENSION_EXT_UNKNOWN = "Extension_EXT_Unknown";
public static final String EXTENSION_EXT_UNKNOWN_NOTHERE = "Extension_EXT_Unknown_NotHere";
public static final String EXTENSION_EXT_URL_ABSOLUTE = "Extension_EXT_URL_Absolute";
public static final String EXTENSION_EXT_URL_NOTFOUND = "Extension_EXT_Url_NotFound";
public static final String EXTENSION_EXT_VERSION_INTERNAL = "Extension_EXT_Version_Internal";
public static final String EXTENSION_EXT_VERSION_INVALID = "Extension_EXT_Version_Invalid";
public static final String EXTENSION_EXT_VERSION_INVALIDID = "Extension_EXT_Version_InvalidId";
public static final String EXTENSION_EXT_VERSION_NOCHANGE = "Extension_EXT_Version_NoChange";
public static final String FIXED_TYPE_CHECKS_DT_ADDRESS_LINE = "Fixed_Type_Checks_DT_Address_Line";
public static final String FIXED_TYPE_CHECKS_DT_NAME_FAMILY = "Fixed_Type_Checks_DT_Name_Family";
public static final String FIXED_TYPE_CHECKS_DT_NAME_GIVEN = "Fixed_Type_Checks_DT_Name_Given";
public static final String FIXED_TYPE_CHECKS_DT_NAME_PREFIX = "Fixed_Type_Checks_DT_Name_Prefix";
public static final String FIXED_TYPE_CHECKS_DT_NAME_SUFFIX = "Fixed_Type_Checks_DT_Name_Suffix";
public static final String FOUND__ITEMS_FOR__RESOLVING_DISCRIMINATOR__FROM_ = "Found__items_for__resolving_discriminator__from_";
public static final String GETSLICELIST_SHOULD_ONLY_BE_CALLED_WHEN_THE_ELEMENT_HAS_SLICING = "getSliceList_should_only_be_called_when_the_element_has_slicing";
public static final String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__ILLEGAL_CHARACTERS_ = "Illegal_path__in_differential_in__illegal_characters_";
public static final String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__ILLEGAL_CHARACTER_ = "Illegal_path__in_differential_in__illegal_character_";
public static final String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__MUST_START_WITH_ = "Illegal_path__in_differential_in__must_start_with_";
public static final String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__NAME_PORTION_EXCEEDS_64_CHARS_IN_LENGTH = "Illegal_path__in_differential_in__name_portion_exceeds_64_chars_in_length";
public static final String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__NAME_PORTION_MISING_ = "Illegal_path__in_differential_in__name_portion_mising_";
public static final String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__NO_UNICODE_WHITESPACE = "Illegal_path__in_differential_in__no_unicode_whitespace";
public static final String INTERNAL_ERROR___TYPE_NOT_KNOWN_ = "Internal_error___type_not_known_";
public static final String INTERNAL_INT_BAD_TYPE = "Internal_INT_Bad_Type";
public static final String INTERNAL_RECURSION_DETECTION_FIND_LOOP_PATH_RECURSION____CHECK_PATHS_ARE_VALID_FOR_PATH_ = "Internal_recursion_detection_find_loop_path_recursion____check_paths_are_valid_for_path_";
public static final String INVALID_SLICING__THERE_IS_MORE_THAN_ONE_TYPE_SLICE_AT__BUT_ONE_OF_THEM__HAS_MIN__1_SO_THE_OTHER_SLICES_CANNOT_EXIST = "Invalid_slicing__there_is_more_than_one_type_slice_at__but_one_of_them__has_min__1_so_the_other_slices_cannot_exist";
public static final String LANGUAGE_XHTML_LANG_DIFFERENT1 = "Language_XHTML_Lang_Different1";
public static final String LANGUAGE_XHTML_LANG_DIFFERENT2 = "Language_XHTML_Lang_Different2";
public static final String LANGUAGE_XHTML_LANG_MISSING1 = "Language_XHTML_Lang_Missing1";
public static final String LANGUAGE_XHTML_LANG_MISSING2 = "Language_XHTML_Lang_Missing2";
public static final String LANGUAGE_XHTML_LANG_MISSING3 = "Language_XHTML_Lang_Missing3";
public static final String MEASURE_MR_GRP_DUPL_CODE = "MEASURE_MR_GRP_DUPL_CODE";
public static final String MEASURE_MR_GRP_MISSING_BY_CODE = "MEASURE_MR_GRP_MISSING_BY_CODE";
public static final String MEASURE_MR_GRP_POP_NO_CODE = "MEASURE_MR_GRP_POP_NO_CODE";
public static final String MEASURE_MR_GRP_POP_UNK_CODE = "MEASURE_MR_GRP_POP_UNK_CODE";
public static final String MEASURE_MR_GRP_POP_DUPL_CODE = "MEASURE_MR_GRP_POP_DUPL_CODE";
public static final String MEASURE_MR_GRP_POP_MISSING_BY_CODE = "MEASURE_MR_GRP_POP_MISSING_BY_CODE";
public static final String MEASURE_MR_GRP_NO_CODE = "MEASURE_MR_GRP_NO_CODE";
public static final String MEASURE_MR_GRP_NO_USABLE_CODE = "MEASURE_MR_GRP_NO_USABLE_CODE";
public static final String MEASURE_MR_GRP_NO_WRONG_CODE = "MEASURE_MR_GRP_NO_WRONG_CODE";
public static final String DUPLICATE_ID = "DUPLICATE_ID";
public static final String MEASURE_MR_GRP_POP_COUNT_MISMATCH = "MEASURE_MR_GRP_POP_COUNT_MISMATCH";
public static final String MEASURE_MR_GRP_POP_NO_SUBJECTS = "MEASURE_MR_GRP_POP_NO_SUBJECTS";
public static final String MEASURE_MR_GRP_POP_DUPL_CODE = "MEASURE_MR_GRP_POP_DUPL_CODE";
public static final String MEASURE_MR_GRP_POP_MISSING_BY_CODE = "MEASURE_MR_GRP_POP_MISSING_BY_CODE";
public static final String MEASURE_MR_GRP_POP_NO_CODE = "MEASURE_MR_GRP_POP_NO_CODE";
public static final String MEASURE_MR_GRP_POP_NO_COUNT = "MEASURE_MR_GRP_POP_NO_COUNT";
public static final String MEASURE_M_GROUP_CODE = "MEASURE_M_GROUP_CODE";
public static final String MEASURE_M_GROUP_POP_NO_CODE = "MEASURE_M_GROUP_POP_NO_CODE";
public static final String MEASURE_M_GROUP_STRATA_NO_CODE = "MEASURE_M_GROUP_STRATA_NO_CODE";
public static final String MEASURE_M_GROUP_STRATA_COMP_NO_CODE = "MEASURE_M_GROUP_STRATA_COMP_NO_CODE";
public static final String MEASURE_M_NO_GROUPS = "MEASURE_M_NO_GROUPS";
public static final String MEASURE_M_GROUP_POP = "MEASURE_M_GROUP_POP";
public static final String MEASURE_M_GROUP_STRATA = "MEASURE_M_GROUP_STRATA";
public static final String MEASURE_M_LIB_UNKNOWN = "MEASURE_M_LIB_UNKNOWN";
public static final String TYPE_SPECIFIC_CHECKS_CANONICAL_ABSOLUTE = "TYPE_SPECIFIC_CHECKS_CANONICAL_ABSOLUTE";
public static final String MEASURE_MR_SCORE_PROHIBITED_RT = "MEASURE_MR_SCORE_PROHIBITED_RT";
public static final String MEASURE_MR_SCORE_PROHIBITED_MS = "MEASURE_MR_SCORE_PROHIBITED_MS";
public static final String MEASURE_MR_SCORE_REQUIRED = "MEASURE_MR_SCORE_REQUIRED";
public static final String MEASURE_MR_GRP_POP_NO_SUBJECTS = "MEASURE_MR_GRP_POP_NO_SUBJECTS";
public static final String MEASURE_MR_GRP_POP_UNK_CODE = "MEASURE_MR_GRP_POP_UNK_CODE";
public static final String MEASURE_MR_GRP_UNK_CODE = "MEASURE_MR_GRP_UNK_CODE";
public static final String MEASURE_MR_M_NONE = "Measure_MR_M_None";
public static final String MEASURE_MR_M_NOTFOUND = "Measure_MR_M_NotFound";
public static final String MEASURE_MR_M_SCORING_UNK = "MEASURE_MR_M_SCORING_UNK";
public static final String MEASURE_MR_SCORE_UNIT_PROHIBITED = "MEASURE_MR_SCORE_UNIT_PROHIBITED";
public static final String MEASURE_MR_SCORE_VALUE_REQUIRED = "MEASURE_MR_SCORE_VALUE_REQUIRED";
public static final String MEASURE_MR_SCORE_VALUE_INVALID_01 = "MEASURE_MR_SCORE_VALUE_INVALID_01";
public static final String MEASURE_MR_SCORE_FIXED = "MEASURE_MR_SCORE_FIXED";
public static final String MEASURE_MR_SCORE_PROHIBITED_MS = "MEASURE_MR_SCORE_PROHIBITED_MS";
public static final String MEASURE_MR_SCORE_PROHIBITED_RT = "MEASURE_MR_SCORE_PROHIBITED_RT";
public static final String MEASURE_MR_SCORE_REQUIRED = "MEASURE_MR_SCORE_REQUIRED";
public static final String MEASURE_MR_SCORE_UNIT_PROHIBITED = "MEASURE_MR_SCORE_UNIT_PROHIBITED";
public static final String MEASURE_MR_SCORE_UNIT_REQUIRED = "MEASURE_MR_SCORE_UNIT_REQUIRED";
public static final String MEASURE_M_CRITERIA_UNKNOWN = "MEASURE_M_CRITERIA_UNKNOWN";
public static final String MEASURE_MR_SCORE_VALUE_INVALID_01 = "MEASURE_MR_SCORE_VALUE_INVALID_01";
public static final String MEASURE_MR_SCORE_VALUE_REQUIRED = "MEASURE_MR_SCORE_VALUE_REQUIRED";
public static final String MEASURE_M_CQL_NOT_FOUND = "MEASURE_M_CQL_NOT_FOUND";
public static final String MEASURE_M_CRITERIA_CQL_ERROR = "MEASURE_M_CRITERIA_CQL_ERROR";
public static final String MEASURE_M_CRITERIA_CQL_ONLY_ONE_LIB = "MEASURE_M_CRITERIA_CQL_ONLY_ONE_LIB";
public static final String MEASURE_M_CRITERIA_CQL_NO_LIB = "MEASURE_M_CRITERIA_CQL_NO_LIB";
public static final String MEASURE_M_CRITERIA_CQL_LIB_NOT_FOUND = "MEASURE_M_CRITERIA_CQL_LIB_NOT_FOUND";
public static final String MEASURE_M_CRITERIA_CQL_LIB_DUPL = "MEASURE_M_CRITERIA_CQL_LIB_DUPL";
public static final String MEASURE_M_CRITERIA_CQL_NO_ELM = "MEASURE_M_CRITERIA_CQL_NO_ELM";
public static final String MEASURE_M_CRITERIA_CQL_ELM_NOT_VALID = "MEASURE_M_CRITERIA_CQL_ELM_NOT_VALID";
public static final String MEASURE_M_CRITERIA_CQL_ERROR = "MEASURE_M_CRITERIA_CQL_ERROR";
public static final String MEASURE_M_CRITERIA_CQL_LIB_DUPL = "MEASURE_M_CRITERIA_CQL_LIB_DUPL";
public static final String MEASURE_M_CRITERIA_CQL_LIB_NOT_FOUND = "MEASURE_M_CRITERIA_CQL_LIB_NOT_FOUND";
public static final String MEASURE_M_CRITERIA_CQL_NOT_FOUND = "MEASURE_M_CRITERIA_CQL_NOT_FOUND";
public static final String VALIDATION_VAL_PROFILE_WRONGTYPE2 = "Validation_VAL_Profile_WrongType2";
public static final String XHTML_URL_EMPTY = "XHTML_URL_EMPTY";
public static final String XHTML_URL_INVALID_CHARS = "XHTML_URL_INVALID_CHARS";
public static final String MEASURE_M_CRITERIA_CQL_NO_ELM = "MEASURE_M_CRITERIA_CQL_NO_ELM";
public static final String MEASURE_M_CRITERIA_CQL_NO_LIB = "MEASURE_M_CRITERIA_CQL_NO_LIB";
public static final String MEASURE_M_CRITERIA_CQL_ONLY_ONE_LIB = "MEASURE_M_CRITERIA_CQL_ONLY_ONE_LIB";
public static final String MEASURE_M_CRITERIA_UNKNOWN = "MEASURE_M_CRITERIA_UNKNOWN";
public static final String MEASURE_M_GROUP_CODE = "MEASURE_M_GROUP_CODE";
public static final String MEASURE_M_GROUP_POP = "MEASURE_M_GROUP_POP";
public static final String MEASURE_M_GROUP_POP_NO_CODE = "MEASURE_M_GROUP_POP_NO_CODE";
public static final String MEASURE_M_GROUP_STRATA = "MEASURE_M_GROUP_STRATA";
public static final String MEASURE_M_GROUP_STRATA_COMP_NO_CODE = "MEASURE_M_GROUP_STRATA_COMP_NO_CODE";
public static final String MEASURE_M_GROUP_STRATA_NO_CODE = "MEASURE_M_GROUP_STRATA_NO_CODE";
public static final String MEASURE_M_LIB_UNKNOWN = "MEASURE_M_LIB_UNKNOWN";
public static final String MEASURE_M_NO_GROUPS = "MEASURE_M_NO_GROUPS";
public static final String META_RES_SECURITY_DUPLICATE = "Meta_RES_Security_Duplicate";
public static final String MUSTSUPPORT_VAL_MUSTSUPPORT = "MustSupport_VAL_MustSupport";
public static final String NAMED_ITEMS_ARE_OUT_OF_ORDER_IN_THE_SLICE = "Named_items_are_out_of_order_in_the_slice";
public static final String NEEDS_A_SNAPSHOT = "needs_a_snapshot";
public static final String NODE_TYPE__IS_NOT_ALLOWED = "Node_type__is_not_allowed";
public static final String NONE_OF_THE_PROVIDED_CODES_ARE_IN_THE_VALUE_SET_ = "None_of_the_provided_codes_are_in_the_value_set_";
public static final String NOT_DONE_YET = "Not_done_yet";
public static final String NOT_DONE_YET_CANT_FETCH_ = "not_done_yet_cant_fetch_";
public static final String NOT_DONE_YET_VALIDATORHOSTSERVICESCHECKFUNCTION = "Not_done_yet_ValidatorHostServicescheckFunction";
public static final String NOT_DONE_YET_VALIDATORHOSTSERVICESCONFORMSTOPROFILE_WHEN_ITEM_IS_NOT_AN_ELEMENT = "Not_done_yet_ValidatorHostServicesconformsToProfile_when_item_is_not_an_element";
public static final String NOT_DONE_YET_VALIDATORHOSTSERVICESEXECUTEFUNCTION = "Not_done_yet_ValidatorHostServicesexecuteFunction";
public static final String NOT_DONE_YET_VALIDATORHOSTSERVICESRESOLVEFUNCTION_ = "Not_done_yet_ValidatorHostServicesresolveFunction_";
public static final String NOT_DONE_YET__RESOLVE__LOCALLY_2 = "Not_done_yet__resolve__locally_2";
public static final String NOT_HANDLED_YET_SORTELEMENTS_ = "Not_handled_yet_sortElements_";
public static final String NOT_SUPPORTED_YET = "Not_supported_yet";
public static final String NOT_THE_RIGHT_KIND_OF_STRUCTURE_TO_GENERATE_SCHEMATRONS_FOR = "not_the_right_kind_of_structure_to_generate_schematrons_for";
public static final String NO_BASE_PROFILE_PROVIDED = "no_base_profile_provided";
public static final String NO_DERIVED_STRUCTURE_PROVIDED = "no_derived_structure_provided";
public static final String NO_EXPANSIONPROFILE_PROVIDED = "No_ExpansionProfile_provided";
public static final String NO_EXPANSION_PARAMETERS_PROVIDED = "No_Expansion_Parameters_provided";
public static final String NO_PARAMETERS_PROVIDED_TO_EXPANDVS = "No_Parameters_provided_to_expandVS";
public static final String NO_PATH_ON_ELEMENT_DEFINITION__IN_ = "No_path_on_element_Definition__in_";
public static final String NO_PATH_ON_ELEMENT_IN_DIFFERENTIAL_IN_ = "No_path_on_element_in_differential_in_";
public static final String NO_PATH_VALUE_ON_ELEMENT_IN_DIFFERENTIAL_IN_ = "No_path_value_on_element_in_differential_in_";
public static final String NO_PROCESSING_INSTRUCTIONS_ALLOWED_IN_RESOURCES = "No_processing_instructions_allowed_in_resources";
public static final String NO_REFERENCE_RESOLVING_DISCRIMINATOR__FROM_ = "No_reference_resolving_discriminator__from_";
public static final String NO_TYPE_FOUND_ON_ = "No_type_found_on_";
public static final String NO_URL_IN_EXPAND_VALUE_SET = "no_url_in_expand_value_set";
public static final String NO_URL_IN_EXPAND_VALUE_SET_2 = "no_url_in_expand_value_set_2";
public static final String NO_VALIDATOR_CONFIGURED = "No_validator_configured";
public static final String NO_VALUE_SET_IN_URL = "no_value_set";
public static final String NULL_MIN = "null_min";
public static final String OBJECT_MUST_HAVE_SOME_CONTENT = "Object_must_have_some_content";
public static final String PARSER_TYPE__NOT_SUPPORTED = "Parser_Type__not_supported";
public static final String PROBLEM_EVALUATING_SLICING_EXPRESSION_FOR_ELEMENT_IN_PROFILE__PATH__FHIRPATH___ = "Problem_evaluating_slicing_expression_for_element_in_profile__path__fhirPath___";
public static final String PROBLEM_PROCESSING_EXPRESSION__IN_PROFILE__PATH__ = "Problem_processing_expression__in_profile__path__";
public static final String PROFILE_BASED_DISCRIMINATORS_MUST_HAVE_A_TYPE_WITH_A_PROFILE__IN_PROFILE_ = "Profile_based_discriminators_must_have_a_type_with_a_profile__in_profile_";
public static final String PROFILE_BASED_DISCRIMINATORS_MUST_HAVE_A_TYPE__IN_PROFILE_ = "Profile_based_discriminators_must_have_a_type__in_profile_";
public static final String PROFILE_BASED_DISCRIMINATORS_MUST_HAVE_ONLY_ONE_TYPE__IN_PROFILE_ = "Profile_based_discriminators_must_have_only_one_type__in_profile_";
public static final String PROFILE_EXT_NOT_HERE = "Profile_EXT_Not_Here";
public static final String PROFILE_VAL_MISSINGELEMENT = "Profile_VAL_MissingElement";
public static final String PROFILE_VAL_NOTALLOWED = "Profile_VAL_NotAllowed";
public static final String PROFILE__DOES_NOT_MATCH_FOR__BECAUSE_OF_THE_FOLLOWING_PROFILE_ISSUES__ = "Profile__does_not_match_for__because_of_the_following_profile_issues__";
public static final String PROFILE___BASE__COULD_NOT_BE_RESOLVED = "Profile___base__could_not_be_resolved";
public static final String PROFILE___ELEMENT__ERROR_GENERATING_SNAPSHOT_ = "Profile___element__Error_generating_snapshot_";
public static final String PROFILE___ERROR_GENERATING_SNAPSHOT = "Profile___Error_generating_snapshot";
public static final String PROFILE___HAS_NO_BASE_AND_NO_SNAPSHOT = "Profile___has_no_base_and_no_snapshot";
public static final String QUESTIONNAIRE_QR_ITEM_BADOPTION = "Questionnaire_QR_Item_BadOption";
public static final String QUESTIONNAIRE_QR_ITEM_CODING = "Questionnaire_QR_Item_Coding";
public static final String QUESTIONNAIRE_QR_ITEM_CODINGNOOPTIONS = "Questionnaire_QR_Item_CodingNoOptions";
public static final String QUESTIONNAIRE_QR_ITEM_DATENOOPTIONS = "Questionnaire_QR_Item_DateNoOptions";
public static final String QUESTIONNAIRE_QR_ITEM_DISPLAY = "Questionnaire_QR_Item_Display";
public static final String QUESTIONNAIRE_QR_ITEM_GROUP = "Questionnaire_QR_Item_Group";
public static final String QUESTIONNAIRE_QR_ITEM_GROUP_ANSWER = "Questionnaire_QR_Item_GroupAnswer";
public static final String QUESTIONNAIRE_QR_ITEM_INTNOOPTIONS = "Questionnaire_QR_Item_IntNoOptions";
public static final String QUESTIONNAIRE_QR_ITEM_MISSING = "Questionnaire_QR_Item_Missing";
public static final String QUESTIONNAIRE_QR_ITEM_NOCODING = "Questionnaire_QR_Item_NoCoding";
public static final String QUESTIONNAIRE_QR_ITEM_NODATE = "Questionnaire_QR_Item_NoDate";
public static final String QUESTIONNAIRE_QR_ITEM_NOINTEGER = "Questionnaire_QR_Item_NoInteger";
public static final String QUESTIONNAIRE_QR_ITEM_NOLINKID = "Questionnaire_QR_Item_NoLinkId";
public static final String QUESTIONNAIRE_QR_ITEM_NOOPTIONS = "Questionnaire_QR_Item_NoOptions";
public static final String QUESTIONNAIRE_QR_ITEM_NOOPTIONSCODING = "Questionnaire_QR_Item_NoOptionsCoding";
public static final String QUESTIONNAIRE_QR_ITEM_NOOPTIONSDATE = "Questionnaire_QR_Item_NoOptionsDate";
public static final String QUESTIONNAIRE_QR_ITEM_NOOPTIONSINTEGER = "Questionnaire_QR_Item_NoOptionsInteger";
public static final String QUESTIONNAIRE_QR_ITEM_NOOPTIONSSTRING = "Questionnaire_QR_Item_NoOptionsString";
public static final String QUESTIONNAIRE_QR_ITEM_NOOPTIONSTIME = "Questionnaire_QR_Item_NoOptionsTime";
public static final String QUESTIONNAIRE_QR_ITEM_NOSTRING = "Questionnaire_QR_Item_NoString";
public static final String QUESTIONNAIRE_QR_ITEM_NOTENABLED = "Questionnaire_QR_Item_NotEnabled";
public static final String QUESTIONNAIRE_QR_ITEM_NOTENABLED2 = "Questionnaire_QR_Item_NotEnabled2";
public static final String QUESTIONNAIRE_QR_ITEM_NOTFOUND = "Questionnaire_QR_Item_NotFound";
public static final String QUESTIONNAIRE_QR_ITEM_NOTIME = "Questionnaire_QR_Item_NoTime";
public static final String QUESTIONNAIRE_QR_ITEM_NOTYPE = "Questionnaire_QR_Item_NoType";
public static final String QUESTIONNAIRE_QR_ITEM_ONLYONEA = "Questionnaire_QR_Item_OnlyOneA";
public static final String QUESTIONNAIRE_QR_ITEM_ONLYONEI = "Questionnaire_QR_Item_OnlyOneI";
public static final String QUESTIONNAIRE_QR_ITEM_ORDER = "Questionnaire_QR_Item_Order";
public static final String QUESTIONNAIRE_QR_ITEM_STRINGNOOPTIONS = "Questionnaire_QR_Item_StringNoOptions";
public static final String QUESTIONNAIRE_QR_ITEM_TEXT = "Questionnaire_QR_Item_Text";
public static final String QUESTIONNAIRE_QR_ITEM_TIMENOOPTIONS = "Questionnaire_QR_Item_TimeNoOptions";
public static final String QUESTIONNAIRE_QR_ITEM_WRONGTYPE = "Questionnaire_QR_Item_WrongType";
public static final String QUESTIONNAIRE_QR_ITEM_WRONGTYPE2 = "Questionnaire_QR_Item_WrongType2";
public static final String QUESTIONNAIRE_QR_Q_NONE = "Questionnaire_QR_Q_None";
public static final String QUESTIONNAIRE_QR_Q_NOTFOUND = "Questionnaire_QR_Q_NotFound";
public static final String QUESTIONNAIRE_Q_ENABLEWHEN_AFTER = "Questionnaire_Q_EnableWhen_After";
public static final String QUESTIONNAIRE_Q_ENABLEWHEN_ISINNER = "Questionnaire_Q_EnableWhen_IsInner";
public static final String QUESTIONNAIRE_Q_ENABLEWHEN_NOLINK = "Questionnaire_Q_EnableWhen_NoLink";
public static final String QUESTIONNAIRE_Q_ENABLEWHEN_NOTARGET = "Questionnaire_Q_EnableWhen_NoTarget";
public static final String QUESTIONNAIRE_Q_ENABLEWHEN_SELF = "Questionnaire_Q_EnableWhen_Self";
public static final String REFERENCE_REF_AGGREGATION = "Reference_REF_Aggregation";
public static final String REFERENCE_REF_BADTARGETTYPE = "Reference_REF_BadTargetType";
public static final String REFERENCE_REF_BADTARGETTYPE2 = "Reference_REF_BadTargetType2";
public static final String REFERENCE_REF_CANTMATCHCHOICE = "Reference_REF_CantMatchChoice";
public static final String REFERENCE_REF_CANTMATCHTYPE = "Reference_REF_CantMatchType";
public static final String REFERENCE_REF_CANTRESOLVE = "Reference_REF_CantResolve";
public static final String REFERENCE_REF_CANTRESOLVEPROFILE = "Reference_REF_CantResolveProfile";
public static final String REFERENCE_REF_FORMAT1 = "Reference_REF_Format1";
public static final String REFERENCE_REF_FORMAT2 = "Reference_REF_Format2";
public static final String REFERENCE_REF_MULTIPLEMATCHES = "Reference_REF_MultipleMatches";
public static final String REFERENCE_REF_NODISPLAY = "Reference_REF_NoDisplay";
public static final String REFERENCE_REF_NOTFOUND_BUNDLE = "Reference_REF_NotFound_Bundle";
public static final String REFERENCE_REF_NOTYPE = "Reference_REF_NoType";
public static final String REFERENCE_REF_RESOURCETYPE = "Reference_REF_ResourceType";
public static final String REFERENCE_REF_WRONGTARGET = "Reference_REF_WrongTarget";
public static final String REFERENCE_TO__CANNOT_BE_RESOLVED = "reference_to__cannot_be_resolved";
public static final String REFERENCE__REFERS_TO_A__NOT_A_VALUESET = "Reference__refers_to_a__not_a_ValueSet";
public static final String RESOURCE_RESOLUTION_SERVICES_NOT_PROVIDED = "Resource_resolution_services_not_provided";
public static final String RESOURCE_RES_ID_MISSING = "Resource_RES_ID_Missing";
public static final String RESOURCE_RES_ID_PROHIBITED = "Resource_RES_ID_Prohibited";
public static final String RESOURCE_TYPE_MISMATCH_FOR___ = "Resource_type_mismatch_for___";
public static final String SAME_ID_ON_MULTIPLE_ELEMENTS__IN_ = "Same_id_on_multiple_elements__in_";
public static final String SECURITY_STRING_CONTENT_ERROR = "SECURITY_STRING_CONTENT_ERROR";
public static final String SECURITY_STRING_CONTENT_WARNING = "SECURITY_STRING_CONTENT_WARNING";
public static final String SLICE_ENCOUNTERED_MIDWAY_THROUGH_SET_PATH___ID___ = "Slice_encountered_midway_through_set_path___id___";
public static final String SLICING_RULES_ON_DIFFERENTIAL__DO_NOT_MATCH_THOSE_ON_BASE___DISCIMINATOR___ = "Slicing_rules_on_differential__do_not_match_those_on_base___disciminator___";
public static final String SLICING_RULES_ON_DIFFERENTIAL__DO_NOT_MATCH_THOSE_ON_BASE___ORDER___ = "Slicing_rules_on_differential__do_not_match_those_on_base___order___";
public static final String SLICING_RULES_ON_DIFFERENTIAL__DO_NOT_MATCH_THOSE_ON_BASE___RULE___ = "Slicing_rules_on_differential__do_not_match_those_on_base___rule___";
public static final String STRUCTUREDEFINITION__AT__ILLEGAL_CONSTRAINED_TYPE__FROM__IN_ = "StructureDefinition__at__illegal_constrained_type__from__in_";
public static final String TERMINOLOGY_PASSTHROUGH_TX_MESSAGE = "Terminology_PassThrough_TX_Message";
public static final String TERMINOLOGY_TX_BINDING_CANTCHECK = "Terminology_TX_Binding_CantCheck";
public static final String TERMINOLOGY_TX_BINDING_MISSING = "Terminology_TX_Binding_Missing";
public static final String TERMINOLOGY_TX_BINDING_MISSING2 = "Terminology_TX_Binding_Missing2";
public static final String TERMINOLOGY_TX_BINDING_NOSERVER = "Terminology_TX_Binding_NoServer";
public static final String TERMINOLOGY_TX_BINDING_NOSOURCE = "Terminology_TX_Binding_NoSource";
public static final String TERMINOLOGY_TX_BINDING_NOSOURCE2 = "Terminology_TX_Binding_NoSource2";
public static final String TERMINOLOGY_TX_CODE_NOTVALID = "Terminology_TX_Code_NotValid";
public static final String TERMINOLOGY_TX_CODE_UNKNOWN = "Terminology_TX_Code_Unknown";
public static final String TERMINOLOGY_TX_CODE_VALUESET = "Terminology_TX_Code_ValueSet";
public static final String TERMINOLOGY_TX_CODE_VALUESETMAX = "Terminology_TX_Code_ValueSetMax";
public static final String TERMINOLOGY_TX_CODE_VALUESET_EXT = "Terminology_TX_Code_ValueSet_Ext";
public static final String TERMINOLOGY_TX_CODING_COUNT = "Terminology_TX_Coding_Count";
public static final String TERMINOLOGY_TX_CONFIRM_1 = "Terminology_TX_Confirm_1";
public static final String TERMINOLOGY_TX_CONFIRM_2 = "Terminology_TX_Confirm_2";
public static final String TERMINOLOGY_TX_CONFIRM_3 = "Terminology_TX_Confirm_3";
public static final String TERMINOLOGY_TX_CONFIRM_4 = "Terminology_TX_Confirm_4";
public static final String TERMINOLOGY_TX_CONFIRM_5 = "Terminology_TX_Confirm_5";
public static final String TERMINOLOGY_TX_CONFIRM_6 = "Terminology_TX_Confirm_6";
public static final String TERMINOLOGY_TX_DISPLAY_WRONG = "Terminology_TX_Display_Wrong";
public static final String TERMINOLOGY_TX_ERROR_CODEABLECONCEPT = "Terminology_TX_Error_CodeableConcept";
public static final String TERMINOLOGY_TX_ERROR_CODEABLECONCEPT_MAX = "Terminology_TX_Error_CodeableConcept_Max";
public static final String TERMINOLOGY_TX_ERROR_CODING1 = "Terminology_TX_Error_Coding1";
public static final String TERMINOLOGY_TX_ERROR_CODING2 = "Terminology_TX_Error_Coding2";
public static final String TERMINOLOGY_TX_NOVALID_1 = "Terminology_TX_NoValid_1";
public static final String TERMINOLOGY_TX_NOVALID_10 = "Terminology_TX_NoValid_10";
public static final String TERMINOLOGY_TX_NOVALID_11 = "Terminology_TX_NoValid_11";
public static final String TERMINOLOGY_TX_NOVALID_12 = "Terminology_TX_NoValid_12";
public static final String TERMINOLOGY_TX_NOVALID_13 = "Terminology_TX_NoValid_13";
public static final String TERMINOLOGY_TX_NOVALID_14 = "Terminology_TX_NoValid_14";
public static final String TERMINOLOGY_TX_NOVALID_15 = "Terminology_TX_NoValid_15";
public static final String TERMINOLOGY_TX_NOVALID_16 = "Terminology_TX_NoValid_16";
public static final String TERMINOLOGY_TX_NOVALID_17 = "Terminology_TX_NoValid_17";
public static final String TERMINOLOGY_TX_NOVALID_18 = "Terminology_TX_NoValid_18";
public static final String TERMINOLOGY_TX_NOVALID_2 = "Terminology_TX_NoValid_2";
public static final String TERMINOLOGY_TX_NOVALID_3 = "Terminology_TX_NoValid_3";
public static final String TERMINOLOGY_TX_NOVALID_4 = "Terminology_TX_NoValid_4";
public static final String TERMINOLOGY_TX_NOVALID_5 = "Terminology_TX_NoValid_5";
public static final String TERMINOLOGY_TX_NOVALID_6 = "Terminology_TX_NoValid_6";
public static final String TERMINOLOGY_TX_NOVALID_7 = "Terminology_TX_NoValid_7";
public static final String TERMINOLOGY_TX_NOVALID_8 = "Terminology_TX_NoValid_8";
public static final String TERMINOLOGY_TX_NOVALID_9 = "Terminology_TX_NoValid_9";
public static final String TERMINOLOGY_TX_SYSTEM_HTTPS = "TERMINOLOGY_TX_SYSTEM_HTTPS";
public static final String CODESYSTEM_CS_NO_VS_NOTCOMPLETE = "CODESYSTEM_CS_NO_VS_NOTCOMPLETE";
public static final String TERMINOLOGY_TX_SYSTEM_INVALID = "Terminology_TX_System_Invalid";
public static final String TERMINOLOGY_TX_SYSTEM_NOTKNOWN = "Terminology_TX_System_NotKnown";
public static final String TERMINOLOGY_TX_SYSTEM_NO_CODE = "TERMINOLOGY_TX_SYSTEM_NO_CODE";
public static final String TERMINOLOGY_TX_SYSTEM_RELATIVE = "Terminology_TX_System_Relative";
public static final String TERMINOLOGY_TX_SYSTEM_UNKNOWN = "Terminology_TX_System_Unknown";
public static final String TERMINOLOGY_TX_SYSTEM_VALUESET = "Terminology_TX_System_ValueSet";
public static final String TERMINOLOGY_TX_SYSTEM_VALUESET2 = "Terminology_TX_System_ValueSet2";
public static final String TERMINOLOGY_TX_VALUESET_NOTFOUND = "Terminology_TX_ValueSet_NotFound";
public static final String TERMINOLOGY_TX_VALUESET_NOTFOUND2 = "Terminology_TX_ValueSet_NotFound2";
public static final String TEXT_SHOULD_NOT_BE_PRESENT = "Text_should_not_be_present";
public static final String THE_BASE_SNAPSHOT_MARKS_A_SLICING_AS_CLOSED_BUT_THE_DIFFERENTIAL_TRIES_TO_EXTEND_IT_IN__AT__ = "The_base_snapshot_marks_a_slicing_as_closed_but_the_differential_tries_to_extend_it_in__at__";
public static final String THIS_BASE_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_ = "This_base_property_must_be_an_Array_not_a_";
public static final String THIS_CANNOT_BE_PARSED_AS_A_FHIR_OBJECT_NO_NAME = "This_cannot_be_parsed_as_a_FHIR_object_no_name";
public static final String THIS_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAMESPACENAME_ = "This_does_not_appear_to_be_a_FHIR_resource_unknown_namespacename_";
public static final String THIS_DOES_NOT_APPEAR_TO_BE_A_FHIR_RESOURCE_UNKNOWN_NAME_ = "This_does_not_appear_to_be_a_FHIR_resource_unknown_name_";
public static final String THIS_ELEMENT_DOES_NOT_MATCH_ANY_KNOWN_SLICE_ = "This_element_does_not_match_any_known_slice_";
public static final String THIS_PROPERTY_MUST_BE_AN_ARRAY_NOT_ = "This_property_must_be_an_Array_not_";
public static final String THIS_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_ = "This_property_must_be_an_Array_not_a_";
public static final String THIS_PROPERTY_MUST_BE_AN_OBJECT_NOT_ = "This_property_must_be_an_object_not_";
public static final String THIS_PROPERTY_MUST_BE_AN_SIMPLE_VALUE_NOT_ = "This_property_must_be_an_simple_value_not_";
public static final String THIS_PROPERTY_MUST_BE_A_LITERAL_NOT_A_ = "This_property_must_be_a_Literal_not_a_";
public static final String THIS_PROPERTY_MUST_BE_A_URI_OR_BNODE_NOT_A_ = "This_property_must_be_a_URI_or_bnode_not_a_";
public static final String THIS_PROPERTY_MUST_BE__NOT_ = "This_property_must_be__not_";
public static final String THIS__CANNOT_BE_PARSED_AS_A_FHIR_OBJECT_NO_NAMESPACE = "This__cannot_be_parsed_as_a_FHIR_object_no_namespace";
public static final String TYPE_ON_FIRST_DIFFERENTIAL_ELEMENT = "type_on_first_differential_element";
public static final String TYPE_ON_FIRST_SNAPSHOT_ELEMENT_FOR__IN__FROM_ = "type_on_first_snapshot_element_for__in__from_";
public static final String TYPE_SPECIFIC_CHECKS_CANONICAL_ABSOLUTE = "TYPE_SPECIFIC_CHECKS_CANONICAL_ABSOLUTE";
public static final String TYPE_SPECIFIC_CHECKS_DT_ATT_NO_CONTENT = "TYPE_SPECIFIC_CHECKS_DT_ATT_NO_CONTENT";
public static final String TYPE_SPECIFIC_CHECKS_DT_ATT_NO_FETCHER = "TYPE_SPECIFIC_CHECKS_DT_ATT_NO_FETCHER";
public static final String TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_CORRECT = "TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_CORRECT";
public static final String TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_INVALID = "TYPE_SPECIFIC_CHECKS_DT_ATT_SIZE_INVALID";
public static final String TYPE_SPECIFIC_CHECKS_DT_ATT_TOO_LONG = "TYPE_SPECIFIC_CHECKS_DT_ATT_TOO_LONG";
public static final String TYPE_SPECIFIC_CHECKS_DT_ATT_UNKNOWN_URL_SCHEME = "TYPE_SPECIFIC_CHECKS_DT_ATT_UNKNOWN_URL_SCHEME";
public static final String TYPE_SPECIFIC_CHECKS_DT_ATT_URL_ERROR = "TYPE_SPECIFIC_CHECKS_DT_ATT_URL_ERROR";
public static final String TYPE_SPECIFIC_CHECKS_DT_BASE64_TOO_LONG = "TYPE_SPECIFIC_CHECKS_DT_BASE64_TOO_LONG";
public static final String TYPE_SPECIFIC_CHECKS_DT_BASE64_VALID = "Type_Specific_Checks_DT_Base64_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_BOOLEAN_VALUE = "Type_Specific_Checks_DT_Boolean_Value";
public static final String TYPE_SPECIFIC_CHECKS_DT_CODE_WS = "Type_Specific_Checks_DT_Code_WS";
public static final String TYPE_SPECIFIC_CHECKS_DT_DATETIME_REASONABLE = "Type_Specific_Checks_DT_DateTime_Reasonable";
public static final String TYPE_SPECIFIC_CHECKS_DT_DATETIME_REGEX = "Type_Specific_Checks_DT_DateTime_Regex";
public static final String TYPE_SPECIFIC_CHECKS_DT_DATETIME_TZ = "Type_Specific_Checks_DT_DateTime_TZ";
public static final String TYPE_SPECIFIC_CHECKS_DT_DATETIME_VALID = "Type_Specific_Checks_DT_DateTime_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_DATE_VALID = "Type_Specific_Checks_DT_Date_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_DECIMAL_CHARS = "TYPE_SPECIFIC_CHECKS_DT_DECIMAL_CHARS";
public static final String TYPE_SPECIFIC_CHECKS_DT_DECIMAL_RANGE = "Type_Specific_Checks_DT_Decimal_Range";
public static final String TYPE_SPECIFIC_CHECKS_DT_DECIMAL_VALID = "Type_Specific_Checks_DT_Decimal_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE = "TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE";
public static final String TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_SYSTEM = "Type_Specific_Checks_DT_Identifier_System";
public static final String TYPE_SPECIFIC_CHECKS_DT_ID_VALID = "Type_Specific_Checks_DT_ID_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_INSTANT_VALID = "Type_Specific_Checks_DT_Instant_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_INTEGER64_VALID = "Type_Specific_Checks_DT_Integer64_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_INTEGER_GT = "Type_Specific_Checks_DT_Integer_GT";
public static final String TYPE_SPECIFIC_CHECKS_DT_INTEGER_LT = "Type_Specific_Checks_DT_Integer_LT";
public static final String TYPE_SPECIFIC_CHECKS_DT_INTEGER_LT0 = "Type_Specific_Checks_DT_Integer_LT0";
public static final String TYPE_SPECIFIC_CHECKS_DT_INTEGER_LT1 = "Type_Specific_Checks_DT_Integer_LT1";
public static final String TYPE_SPECIFIC_CHECKS_DT_INTEGER_VALID = "Type_Specific_Checks_DT_Integer_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_OID_START = "Type_Specific_Checks_DT_OID_Start";
public static final String TYPE_SPECIFIC_CHECKS_DT_OID_VALID = "Type_Specific_Checks_DT_OID_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_LENGTH = "Type_Specific_Checks_DT_Primitive_Length";
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_NOTEMPTY = "Type_Specific_Checks_DT_Primitive_NotEmpty";
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_REGEX = "Type_Specific_Checks_DT_Primitive_Regex";
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_VALUEEXT = "Type_Specific_Checks_DT_Primitive_ValueExt";
public static final String TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_WS = "Type_Specific_Checks_DT_Primitive_WS";
public static final String TYPE_SPECIFIC_CHECKS_DT_STRING_LENGTH = "Type_Specific_Checks_DT_String_Length";
public static final String TYPE_SPECIFIC_CHECKS_DT_STRING_WS = "Type_Specific_Checks_DT_String_WS";
public static final String TYPE_SPECIFIC_CHECKS_DT_TIME_VALID = "Type_Specific_Checks_DT_Time_Valid";
public static final String TYPE_SPECIFIC_CHECKS_DT_URI_OID = "Type_Specific_Checks_DT_URI_OID";
public static final String TYPE_SPECIFIC_CHECKS_DT_URI_UUID = "Type_Specific_Checks_DT_URI_UUID";
public static final String TYPE_SPECIFIC_CHECKS_DT_URI_WS = "Type_Specific_Checks_DT_URI_WS";
public static final String TYPE_SPECIFIC_CHECKS_DT_URL_RESOLVE = "Type_Specific_Checks_DT_URL_Resolve";
public static final String TYPE_SPECIFIC_CHECKS_DT_UUID_STRAT = "Type_Specific_Checks_DT_UUID_Strat";
public static final String TYPE_SPECIFIC_CHECKS_DT_UUID_VAID = "Type_Specific_Checks_DT_UUID_Vaid";
public static final String UNABLE_TO_CONNECT_TO_TERMINOLOGY_SERVER_USE_PARAMETER_TX_NA_TUN_RUN_WITHOUT_USING_TERMINOLOGY_SERVICES_TO_VALIDATE_LOINC_SNOMED_ICDX_ETC_ERROR__ = "Unable_to_connect_to_terminology_server_Use_parameter_tx_na_tun_run_without_using_terminology_services_to_validate_LOINC_SNOMED_ICDX_etc_Error__";
public static final String UNABLE_TO_FIND_BASE_DEFINITION_FOR_LOGICAL_MODEL__FROM_ = "Unable_to_find_base_definition_for_logical_model__from_";
public static final String UNABLE_TO_FIND_BASE__FOR_ = "Unable_to_find_base__for_";
public static final String UNABLE_TO_FIND_ELEMENT_ = "Unable_to_find_element_";
public static final String UNABLE_TO_FIND_ELEMENT_WITH_ID_ = "Unable_to_find_element_with_id_";
public static final String UNABLE_TO_FIND_ELEMENT__IN_ = "Unable_to_find_element__in_";
public static final String UNABLE_TO_FIND_PROFILE__AT_ = "Unable_to_find_profile__at_";
public static final String UNABLE_TO_FIND_RESOURCETYPE_PROPERTY = "Unable_to_find_resourceType_property";
public static final String UNABLE_TO_FIND_RESOURCE__AT__RESOLVING_DISCRIMINATOR__FROM_ = "Unable_to_find_resource__at__resolving_discriminator__from_";
public static final String UNABLE_TO_FIND__RESOLVING_DISCRIMINATOR__FROM_ = "Unable_to_find__resolving_discriminator__from_";
public static final String UNABLE_TO_HANDLE_SYSTEM__CONCEPT_FILTER_WITH_OP__ = "Unable_to_handle_system__concept_filter_with_op__";
public static final String UNABLE_TO_HANDLE_SYSTEM__FILTER_WITH_PROPERTY__ = "Unable_to_handle_system__filter_with_property__";
public static final String UNABLE_TO_LOCATE_THE_PROFILE__IN_ORDER_TO_VALIDATE_AGAINST_IT = "Unable_to_locate_the_profile__in_order_to_validate_against_it";
public static final String UNABLE_TO_PROCESS_REQUEST_FOR_RESOURCE_FOR___ = "Unable_to_process_request_for_resource_for___";
public static final String UNABLE_TO_RESOLVE_ = "Unable_to_resolve_";
public static final String UNABLE_TO_RESOLVE_ACTUAL_TYPE_ = "Unable_to_resolve_actual_type_";
public static final String UNABLE_TO_RESOLVE_ELEMENT__IN_PROFILE_ = "Unable_to_resolve_element__in_profile_";
public static final String UNABLE_TO_RESOLVE_NAME_REFERENCE__AT_PATH_ = "Unable_to_resolve_name_reference__at_path_";
public static final String UNABLE_TO_RESOLVE_PROFILE_ = "Unable_to_resolve_profile_";
public static final String UNABLE_TO_RESOLVE_PROFILE__IN_ELEMENT_ = "Unable_to_resolve_profile__in_element_";
public static final String UNABLE_TO_RESOLVE_REFERENCE_TO_ = "Unable_to_resolve_reference_to_";
public static final String UNABLE_TO_RESOLVE_SLICE_MATCHING__NO_FIXED_VALUE_OR_REQUIRED_VALUE_SET = "Unable_to_resolve_slice_matching__no_fixed_value_or_required_value_set";
public static final String UNABLE_TO_RESOLVE_SLICE_MATCHING__SLICE_MATCHING_BY_VALUE_SET_NOT_DONE = "Unable_to_resolve_slice_matching__slice_matching_by_value_set_not_done";
public static final String UNABLE_TO_RESOLVE_SYSTEM__NO_VALUE_SET = "Unable_to_resolve_system__no_value_set";
public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_EXPANSION_HAS_MULTIPLE_SYSTEMS = "Unable_to_resolve_system__value_set_expansion_has_multiple_systems";
public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_EXCLUDES = "Unable_to_resolve_system__value_set_has_excludes";
public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_IMPORTS = "Unable_to_resolve_system__value_set_has_imports";
public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_NO_SYSTEM = "Unable_to_resolve_system__value_set_has_include_with_no_system";
public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_NO_INCLUDES_OR_EXPANSION = "Unable_to_resolve_system__value_set_has_no_includes_or_expansion";
public static final String UNABLE_TO_RESOLVE_VALUE_SET_ = "Unable_to_resolve_value_Set_";
public static final String UNABLE_TO_VALIDATE_CODE_WITHOUT_USING_SERVER = "Unable_to_validate_code_without_using_server";
public static final String UNDEFINED_ATTRIBUTE__ON__FOR_TYPE__PROPERTIES__ = "Undefined_attribute__on__for_type__properties__";
public static final String UNDEFINED_ELEMENT_ = "Undefined_element_";
public static final String UNEXPECTED_CONDITION_IN_DIFFERENTIAL_TYPESLICETYPELISTSIZE__10_AND_IMPLICIT_SLICE_NAME_DOES_NOT_CONTAIN_A_VALID_TYPE__AT_ = "Unexpected_condition_in_differential_typeslicetypelistsize__10_and_implicit_slice_name_does_not_contain_a_valid_type__at_";
public static final String UNEXPECTED_CONDITION_IN_DIFFERENTIAL_TYPESLICETYPELISTSIZE__1_AT_ = "Unexpected_condition_in_differential_typeslicetypelistsize__1_at_";
public static final String UNEXPECTED_DATATYPE_FOR_RDFSTYPE = "Unexpected_datatype_for_rdfstype";
public static final String UNHANDLED_SITUATION_RESOURCE_IS_PROFILED_TO_MORE_THAN_ONE_OPTION__CANNOT_SORT_PROFILE = "Unhandled_situation_resource_is_profiled_to_more_than_one_option__cannot_sort_profile";
public static final String UNKNOWN_CODE__IN_ = "Unknown_Code__in_";
public static final String UNKNOWN_CODE__IN_FRAGMENT = "UNKNOWN_CODE__IN_FRAGMENT";
public static final String UNKNOWN_DATA_FORMAT_ = "Unknown_Data_format_";
public static final String UNKNOWN_DATE_FORMAT_ = "Unknown_Date_format_";
public static final String UNKNOWN_RESOURCE_TYPE_MISSING_RDFSTYPE = "Unknown_resource_type_missing_rdfstype";
public static final String UNKNOWN_TYPE__AT_ = "Unknown_type__at_";
public static final String UNRECOGNISED_EXTENSION_CONTEXT_ = "Unrecognised_extension_context_";
public static final String UNRECOGNISED_PREDICATE_ = "Unrecognised_predicate_";
public static final String UNRECOGNISED_PROPERTY_ = "Unrecognised_property_";
public static final String UNSUPPORTED_CODEABLECONCEPT_PATTERN__EXTENSIONS_ARE_NOT_ALLOWED__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_CodeableConcept_pattern__extensions_are_not_allowed__for_discriminator_for_slice_";
public static final String UNSUPPORTED_CODEABLECONCEPT_PATTERN__MUST_HAVE_AT_LEAST_ONE_CODING__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_CodeableConcept_pattern__must_have_at_least_one_coding__for_discriminator_for_slice_";
public static final String UNSUPPORTED_CODEABLECONCEPT_PATTERN__USING_TEXT__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_CodeableConcept_pattern__using_text__for_discriminator_for_slice_";
public static final String UNSUPPORTED_FIXED_PATTERN_TYPE_FOR_DISCRIMINATOR_FOR_SLICE__ = "Unsupported_fixed_pattern_type_for_discriminator_for_slice__";
public static final String UNSUPPORTED_FIXED_VALUE_TYPE_FOR_DISCRIMINATOR_FOR_SLICE__ = "Unsupported_fixed_value_type_for_discriminator_for_slice__";
public static final String UNSUPPORTED_IDENTIFIER_PATTERN__EXTENSIONS_ARE_NOT_ALLOWED__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_Identifier_pattern__extensions_are_not_allowed__for_discriminator_for_slice_";
public static final String UNSUPPORTED_VERSION_R1 = "Unsupported_version_R1";
public static final String UNSUPPORTED_VERSION_R2 = "Unsupported_version_R2";
public static final String UNSUPPORTED_VERSION_R2B = "Unsupported_version_R2B";
public static final String UNXPECTED_INTERNAL_CONDITION__NO_SOURCE_ON_DIFF_ELEMENT = "Unxpected_internal_condition__no_source_on_diff_element";
public static final String VALIDATION_BUNDLE_MESSAGE = "Validation_BUNDLE_Message";
public static final String VALIDATION_VAL_CONTENT_UNKNOWN = "Validation_VAL_Content_Unknown";
public static final String VALIDATION_VAL_ILLEGAL_TYPE_CONSTRAINT = "VALIDATION_VAL_ILLEGAL_TYPE_CONSTRAINT";
public static final String VALIDATION_VAL_NOTYPE = "Validation_VAL_NoType";
public static final String VALIDATION_VAL_PROFILE_MATCHMULTIPLE = "Validation_VAL_Profile_MatchMultiple";
public static final String VALIDATION_VAL_PROFILE_MAXIMUM = "Validation_VAL_Profile_Maximum";
public static final String VALIDATION_VAL_PROFILE_MINIMUM = "Validation_VAL_Profile_Minimum";
public static final String VALIDATION_VAL_PROFILE_MULTIPLEMATCHES = "Validation_VAL_Profile_MultipleMatches";
public static final String VALIDATION_VAL_PROFILE_NOCHECKMAX = "Validation_VAL_Profile_NoCheckMax";
public static final String VALIDATION_VAL_PROFILE_NOCHECKMIN = "Validation_VAL_Profile_NoCheckMin";
public static final String VALIDATION_VAL_PROFILE_NODEFINITION = "Validation_VAL_Profile_NoDefinition";
public static final String VALIDATION_VAL_PROFILE_NOMATCH = "Validation_VAL_Profile_NoMatch";
public static final String VALIDATION_VAL_PROFILE_NOSNAPSHOT = "Validation_VAL_Profile_NoSnapshot";
public static final String VALIDATION_VAL_PROFILE_NOTALLOWED = "Validation_VAL_Profile_NotAllowed";
public static final String VALIDATION_VAL_PROFILE_NOTSLICE = "Validation_VAL_Profile_NotSlice";
public static final String VALIDATION_VAL_PROFILE_NOTYPE = "Validation_VAL_Profile_NoType";
public static final String VALIDATION_VAL_PROFILE_OUTOFORDER = "Validation_VAL_Profile_OutOfOrder";
public static final String VALIDATION_VAL_PROFILE_SLICEORDER = "Validation_VAL_Profile_SliceOrder";
public static final String VALIDATION_VAL_PROFILE_UNKNOWN = "Validation_VAL_Profile_Unknown";
public static final String VALIDATION_VAL_PROFILE_WRONGTYPE = "Validation_VAL_Profile_WrongType";
public static final String VALIDATION_VAL_PROFILE_WRONGTYPE2 = "Validation_VAL_Profile_WrongType2";
public static final String VALIDATION_VAL_UNKNOWN_PROFILE = "Validation_VAL_Unknown_Profile";
public static final String VERSION_MISMATCH_THE_CONTEXT_HAS_VERSION__LOADED_AND_THE_NEW_CONTENT_BEING_LOADED_IS_VERSION_ = "Version_mismatch_The_context_has_version__loaded_and_the_new_content_being_loaded_is_version_";
public static final String WRONG_NAMESPACE__EXPECTED_ = "Wrong_namespace__expected_";
public static final String WRONG_TYPE_FOR_RESOURCE = "Wrong_type_for_resource";
public static final String XHTML_URL_EMPTY = "XHTML_URL_EMPTY";
public static final String XHTML_URL_INVALID = "XHTML_URL_INVALID";
public static final String XHTML_URL_INVALID_CHARS = "XHTML_URL_INVALID_CHARS";
public static final String XHTML_XHTML_ATTRIBUTE_ILLEGAL = "XHTML_XHTML_Attribute_Illegal";
public static final String XHTML_XHTML_ELEMENT_ILLEGAL = "XHTML_XHTML_Element_Illegal";
public static final String XHTML_XHTML_NAME_INVALID = "XHTML_XHTML_Name_Invalid";
public static final String XHTML_XHTML_NS_INVALID = "XHTML_XHTML_NS_InValid";
public static final String XML_ATTR_VALUE_INVALID = "xml_attr_value_invalid";
public static final String XML_ENCODING_INVALID = "xml_encoding_invalid";
public static final String XML_STATED_ENCODING_INVALID = "xml_stated_encoding_invalid";
public static final String _DT_FIXED_WRONG = "_DT_Fixed_Wrong";
public static final String _HAS_CHILDREN__AND_MULTIPLE_TYPES__IN_PROFILE_ = "_has_children__and_multiple_types__in_profile_";
public static final String _HAS_CHILDREN__FOR_TYPE__IN_PROFILE__BUT_CANT_FIND_TYPE = "_has_children__for_type__in_profile__but_cant_find_type";
public static final String _HAS_NO_CHILDREN__AND_NO_TYPES_IN_PROFILE_ = "_has_no_children__and_no_types_in_profile_";
}

View File

@ -687,6 +687,11 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
readChar();
}
private void skipWhiteSpaceInternal() throws IOException {
while (Character.isWhitespace(peekChar()) || (peekChar() == 0xfeff))
readChar();
}
private void pushChar(char ch) {
cache = Character.toString(ch)+cache;
}
@ -1151,7 +1156,7 @@ private boolean elementIsOk(String name) throws FHIRFormatError {
readChar();
if (peekChar() == '?') {
readToTagEnd();
skipWhiteSpace();
skipWhiteSpaceInternal();
if (peekChar() != '<')
throw new FHIRException("Unable to Parse HTML - does not start with tag after processing instruction. Found "+peekChar()+descLoc());
readChar();

View File

@ -99,7 +99,7 @@ Questionnaire_QR_Q_NotFound = The questionnaire "{0}" could not be resolved, so
Questionnaire_Q_EnableWhen_After = The target of this enableWhen rule ({0}) comes after the question itself
Questionnaire_Q_EnableWhen_IsInner = Questions with an enableWhen cannot refer to an inner question for it''s enableWhen condition
Questionnaire_Q_EnableWhen_NoLink = Questions with an enableWhen must have a value for the question link
Questionnaire_Q_EnableWhen_NoTarget = Unable to find target "{0}" for this question enableWhen
Questionnaire_Q_EnableWhen_NoTarget = Unable to find an item with the linkId "{0}" which is referenced in the enableWhen for "{1}"
Questionnaire_Q_EnableWhen_Self = Target for this question enableWhen can''t reference itself
Reference_REF_Aggregation = Reference is {0} which isn''t supported by the specified aggregation mode(s) for the reference
Reference_REF_BadTargetType = Invalid Resource target type. Found {0}, but expected one of ({1})
@ -492,10 +492,12 @@ TYPE_SPECIFIC_CHECKS_DT_ATT_NO_FETCHER = Attachment size cannot be checked becau
TYPE_SPECIFIC_CHECKS_DT_ATT_UNKNOWN_URL_SCHEME = Attachment size cannot be checked because the validator doesn't understand how to access {0}
TYPE_SPECIFIC_CHECKS_DT_ATT_URL_ERROR = Attachment size cannot be checked because there was an error accesssing {0}: {1}
TYPE_SPECIFIC_CHECKS_DT_ATT_TOO_LONG = Attachment size is {0} bytes which exceeds the stated limit of {1} bytes
TYPE_SPECIFIC_CHECKS_DT_ATT_NO_CONTENT = Attachments have data and/or url, or else must have either contentType and/oor language
TYPE_SPECIFIC_CHECKS_DT_ATT_NO_CONTENT = Attachments have data and/or url, or else SHOULD have either contentType and/or language
TYPE_SPECIFIC_CHECKS_DT_BASE64_TOO_LONG = Base64 size is {0} bytes which exceeds the stated limit of {1} bytes
TYPE_SPECIFIC_CHECKS_DT_DECIMAL_CHARS = Found {0} decimal places which exceeds the stated limit of {1} digits
Validation_VAL_Profile_WrongType = Specified profile type was "{0}", but found type "{1}"
Validation_VAL_Profile_WrongType2 = Type mismatch processing profile {0} at path {1}: The element type is {4}, but the profile {3} is for a different type {2}
VALIDATION_VAL_ILLEGAL_TYPE_CONSTRAINT = Illegal constraint in profile {0} at path {1} - cannot constrain to type {2} from base types {3}
EXTENSION_EXT_CONTEXT_WRONG_XVER = The extension {0} from FHIR version {3} is not allowed to be used at this point (allowed = {1}; this element is [{2}; this is a warning since contexts may be renamed between FHIR versions)
SECURITY_STRING_CONTENT_ERROR = The string value contains embedded HTML tags, which are not allowed for security reasons in this context
SECURITY_STRING_CONTENT_WARNING = The string value contains embedded HTML tags. Note that all inputs should be escaped when rendered to HTML as a matter of course

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.6-SNAPSHOT</version>
<version>5.0.7-SNAPSHOT</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.0.6-SNAPSHOT</version>
<version>5.0.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -2,6 +2,11 @@ package org.hl7.fhir.validation;
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.convertors.*;
import org.hl7.fhir.convertors.loaders.R2016MayToR5Loader;
import org.hl7.fhir.convertors.loaders.R2ToR5Loader;
import org.hl7.fhir.convertors.loaders.R3ToR5Loader;
import org.hl7.fhir.convertors.loaders.R4ToR5Loader;
import org.hl7.fhir.convertors.txClient.TerminologyClientFactory;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.conformance.ProfileUtilities;
@ -257,6 +262,7 @@ public class ValidationEngine implements IValidatorResourceFetcher {
private IValidatorResourceFetcher fetcher;
private boolean assumeValidRestReferences;
private boolean noExtensibleBindingMessages;
private boolean securityChecks;
private Locale locale;
private class AsteriskFilter implements FilenameFilter {
@ -823,7 +829,7 @@ public class ValidationEngine implements IValidatorResourceFetcher {
res = new org.hl7.fhir.dstu2.formats.JsonParser().parse(new ByteArrayInputStream(content));
else
throw new Exception("Unsupported format for "+fn);
VersionConvertorAdvisor50 advisor = new org.hl7.fhir.convertors.IGR2ConvertorAdvisor5();
VersionConvertorAdvisor50 advisor = new org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor5();
r = VersionConvertor_10_50.convertResource(res, advisor);
} else if (version.equals(Constants.VERSION) || "current".equals(version)) {
if (fn.endsWith(".xml") && !fn.endsWith("template.xml"))
@ -1297,6 +1303,7 @@ public class ValidationEngine implements IValidatorResourceFetcher {
validator.setValidationLanguage(language);
validator.setAssumeValidRestReferences(assumeValidRestReferences);
validator.setNoExtensibleWarnings(noExtensibleBindingMessages);
validator.setSecurityChecks(securityChecks);
validator.getContext().setLocale(locale);
validator.setFetcher(this);
return validator;
@ -1687,7 +1694,7 @@ public class ValidationEngine implements IValidatorResourceFetcher {
else
throw new Exception("Unsupported format for "+fn);
} else if (version.startsWith("1.0")) {
VersionConvertorAdvisor50 advisor = new org.hl7.fhir.convertors.IGR2ConvertorAdvisor5();
VersionConvertorAdvisor50 advisor = new org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor5();
org.hl7.fhir.dstu2.model.Resource res = VersionConvertor_10_50.convertResource(r, advisor);
if (fn.endsWith(".xml") && !fn.endsWith("template.xml"))
new org.hl7.fhir.dstu2.formats.JsonParser().setOutputStyle(org.hl7.fhir.dstu2.formats.IParser.OutputStyle.PRETTY).compose(s, res);
@ -1733,6 +1740,16 @@ public class ValidationEngine implements IValidatorResourceFetcher {
public void setNoExtensibleBindingMessages(boolean noExtensibleBindingMessages) {
this.noExtensibleBindingMessages = noExtensibleBindingMessages;
}
public boolean isSecurityChecks() {
return securityChecks;
}
public void setSecurityChecks(boolean securityChecks) {
this.securityChecks = securityChecks;
}
public byte[] transformVersion(String source, String targetVer, FhirFormat format, Boolean canDoNative) throws FHIRException, IOException, Exception {
Content cnt = loadContent(source, "validate");

View File

@ -63,6 +63,9 @@ public class CliContext {
@JsonProperty("mode")
private Validator.EngineMode mode = Validator.EngineMode.VALIDATION;
@JsonProperty("securityChecks")
private boolean securityChecks = false;
@JsonProperty("locale")
private String locale = Locale.ENGLISH.getDisplayLanguage();
@ -406,6 +409,17 @@ public class CliContext {
return this;
}
@JsonProperty("securityChecks")
public boolean isSecurityChecks() {
return securityChecks;
}
@JsonProperty("securityChecks")
public CliContext setSecurityChecks(boolean securityChecks) {
this.securityChecks = securityChecks;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@ -193,6 +193,7 @@ public class ValidationService {
validator.setSnomedExtension(cliContext.getSnomedCTCode());
validator.setAssumeValidRestReferences(cliContext.isAssumeValidRestReferences());
validator.setNoExtensibleBindingMessages(cliContext.isNoExtensibleBindingMessages());
validator.setSecurityChecks(cliContext.isSecurityChecks());
TerminologyCache.setNoCaching(cliContext.isNoInternalCaching());
return validator;
}

View File

@ -98,6 +98,8 @@ public class Display {
System.out.println(" marked as mustSupport=true. Useful to identify elements included that may be ignored by recipients");
System.out.println("-assumeValidRestReferences: If present, assume that URLs that reference resources follow the RESTful URI pattern");
System.out.println(" and it is safe to infer the type from the URL");
System.out.println("-security-checks: If present, check that string content doesn't include any html-like tags that might create");
System.out.println(" problems downstream (though all external input must always be santized by escaping for either html or sql)");
System.out.println("");
System.out.println("The validator also supports the param -proxy=[address]:[port] for if you use a proxy");
System.out.println("");

View File

@ -49,6 +49,7 @@ public class Params {
public static final String RIGHT = "-right";
public static final String NO_INTERNAL_CACHING = "-no-internal-caching";
public static final String NO_EXTENSIBLE_BINDING_WARNINGS = "-no-extensible-binding-warnings";
public static final String SECURITY_CHECKS = "-security-checks";
/**
* Checks the list of passed in params to see if it contains the passed in param.
@ -151,6 +152,8 @@ public class Params {
cliContext.setMode(Validator.EngineMode.NARRATIVE);
} else if (args[i].equals(SNAPSHOT)) {
cliContext.setMode(Validator.EngineMode.SNAPSHOT);
} else if (args[i].equals(SECURITY_CHECKS)) {
cliContext.setSecurityChecks(true);
} else if (args[i].equals(SCAN)) {
cliContext.setMode(Validator.EngineMode.SCAN);
} else if (args[i].equals(TERMINOLOGY)) {

View File

@ -176,6 +176,7 @@ import com.google.gson.JsonObject;
public class InstanceValidator extends BaseValidator implements IResourceValidator {
private static final String EXECUTED_CONSTRAINT_LIST = "validator.executed.invariant.list";
private static final String EXECUTION_ID = "validator.execution.id";
private static final String HTML_FRAGMENT_REGEX = "[a-zA-Z]\\w*(((\\s+)(\\S)*)*)";
private class ValidatorHostServices implements IEvaluationContext {
@ -352,6 +353,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
private ValidatorHostServices validatorServices;
private boolean assumeValidRestReferences;
private boolean allowExamples;
private boolean securityChecks;
private ProfileUtilities profileUtilities;
public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices) {
@ -1773,8 +1775,16 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return;
}
String regex = context.getExtensionString(ToolingExtensions.EXT_REGEX);
if (regex != null)
if (regex != null) {
rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().matches(regex), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_PRIMITIVE_REGEX, e.primitiveValue(), regex);
}
if (!"xhtml".equals(type)) {
if (securityChecks) {
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !containsHtmlTags(e.primitiveValue()), I18nConstants.SECURITY_STRING_CONTENT_ERROR);
} else {
hint(errors, IssueType.INVALID, e.line(), e.col(), path, !containsHtmlTags(e.primitiveValue()), I18nConstants.SECURITY_STRING_CONTENT_WARNING);
}
}
if (type.equals("boolean")) {
@ -1961,6 +1971,22 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
// for nothing to check
}
private boolean containsHtmlTags(String cnt) {
int i = cnt.indexOf("<");
while (i > -1) {
cnt = cnt.substring(i+1);
i = cnt.indexOf("<");
int e = cnt.indexOf(">");
if (e > -1 && e < i) {
String s = cnt.substring(0, e);
if (s.matches(HTML_FRAGMENT_REGEX)) {
return true;
}
}
}
return false;
}
/**
* Technically this is not bulletproof as some invalid base64 won't be caught,
* but I think it's good enough. The original code used Java8 Base64 decoder
@ -2207,7 +2233,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, size <= def, I18nConstants.TYPE_SPECIFIC_CHECKS_DT_ATT_TOO_LONG, size, def);
}
}
rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, (element.hasChild("data") || element.hasChild("url")) || (element.hasChild("contentType") || element.hasChild("language")),
warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, (element.hasChild("data") || element.hasChild("url")) || (element.hasChild("contentType") || element.hasChild("language")),
I18nConstants.TYPE_SPECIFIC_CHECKS_DT_ATT_NO_CONTENT);
}
@ -4575,4 +4601,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
}
public boolean isSecurityChecks() {
return securityChecks;
}
public void setSecurityChecks(boolean securityChecks) {
this.securityChecks = securityChecks;
}
}

View File

@ -95,7 +95,7 @@ public class QuestionnaireValidator extends BaseValidator {
Element tgt = getQuestionById(item, ql);
if (rule(errors, IssueType.BUSINESSRULE, ns.getLiteralPath(), tgt == null, I18nConstants.QUESTIONNAIRE_Q_ENABLEWHEN_ISINNER)) {
tgt = getQuestionById(questionnaire, ql);
if (rule(errors, IssueType.BUSINESSRULE, ns.getLiteralPath(), tgt != null, I18nConstants.QUESTIONNAIRE_Q_ENABLEWHEN_NOTARGET, ql)) {
if (rule(errors, IssueType.BUSINESSRULE, ns.getLiteralPath(), tgt != null, I18nConstants.QUESTIONNAIRE_Q_ENABLEWHEN_NOTARGET, ql, item.getChildValue("linkId"))) {
if (rule(errors, IssueType.BUSINESSRULE, ns.getLiteralPath(), tgt != item, I18nConstants.QUESTIONNAIRE_Q_ENABLEWHEN_SELF)) {
if (!isBefore(item, tgt, parents)) {
warning(errors, IssueType.BUSINESSRULE, ns.getLiteralPath(), false, I18nConstants.QUESTIONNAIRE_Q_ENABLEWHEN_AFTER, ql);

View File

@ -1,7 +1,8 @@
package org.hl7.fhir.conversion.tests;
import com.google.gson.*;
import org.hl7.fhir.convertors.R3ToR4Loader;
import org.hl7.fhir.convertors.loaders.R3ToR4Loader;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;

View File

@ -46,10 +46,10 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.fhir.ucum.UcumEssenceService;
import org.hl7.fhir.convertors.R2016MayToR5Loader;
import org.hl7.fhir.convertors.R2ToR5Loader;
import org.hl7.fhir.convertors.R3ToR5Loader;
import org.hl7.fhir.convertors.R4ToR5Loader;
import org.hl7.fhir.convertors.loaders.R2016MayToR5Loader;
import org.hl7.fhir.convertors.loaders.R2ToR5Loader;
import org.hl7.fhir.convertors.loaders.R3ToR5Loader;
import org.hl7.fhir.convertors.loaders.R4ToR5Loader;
import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;

View File

@ -36,8 +36,8 @@ import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.cache.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.cache.ToolsVersion;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.hl7.fhir.validation.instance.InstanceValidatorFactory;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
@ -68,14 +68,16 @@ public class FHIRMappingLanguageTests implements ITransformerServices {
@BeforeAll
public static void setUp() throws Exception {
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
context = SimpleWorkerContext.fromPackage(pcm.loadPackage("hl7.fhir.core", "4.0.1"));
context = SimpleWorkerContext.fromPackage(pcm.loadPackage("hl7.fhir.r5.core", "current"));
if (context.getValidatorFactory() == null) {
context.setValidatorFactory(new InstanceValidatorFactory());
}
jsonParser = new JsonParser();
jsonParser.setOutputStyle(OutputStyle.PRETTY);
}
@ParameterizedTest(name = "{index}: {0}")
@MethodSource("data")
@Disabled // Test fails: java.lang.AssertionError: Error, but proper output was expected (This does not appear to be a FHIR resource (unknown name "QuestionnaireResponse")
public void test(String name, String source, String map, String output) throws Exception {
InputStream fileSource = TestingUtilities.loadTestResourceStream("r5", "fml", source);

View File

@ -185,6 +185,9 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
} else {
val.setAllowExamples(true);
}
if (content.has("security-checks")) {
val.setSecurityChecks(content.get("security-checks").getAsBoolean());
}
val.setAssumeValidRestReferences(content.has("assumeValidRestReferences") ? content.get("assumeValidRestReferences").getAsBoolean() : false);
System.out.println(String.format("Start Validating (%d to set up)", (System.nanoTime() - setup) / 1000000));
if (name.endsWith(".json"))

Some files were not shown because too many files have changed in this diff Show More