Merge remote-tracking branch 'remotes/origin/master' into im_20200316_lastn_operation_elasticsearch

This commit is contained in:
ianmarshall 2020-05-14 12:09:24 -04:00
commit 529e1e1f5e
166 changed files with 155143 additions and 698585 deletions

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Getting Help / Community
url: https://github.com/jamesagnew/hapi-fhir/wiki/Getting-Help
about: Please click here to learn about where to ask questions about HAPI FHIR

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -184,9 +184,7 @@ class ModelScanner {
} }
} }
if (blockDefinition == null if (blockDefinition == null) {
//Redundant checking && datatypeDefinition == null && resourceDefinition == null
) {
throw new ConfigurationException("Resource class[" + theClass.getName() + "] does not contain any valid HAPI-FHIR annotations"); throw new ConfigurationException("Resource class[" + theClass.getName() + "] does not contain any valid HAPI-FHIR annotations");
} }
} }

View File

@ -61,7 +61,9 @@ public enum VersionEnum {
V4_2_0, V4_2_0,
@Deprecated @Deprecated
V4_3_0, // 4.3.0 was renamed to 5.0.0 during the cycle V4_3_0, // 4.3.0 was renamed to 5.0.0 during the cycle
V5_0_0; V5_0_0,
V5_0_1,
V5_1_0;
public static VersionEnum latestVersion() { public static VersionEnum latestVersion() {
VersionEnum[] values = VersionEnum.values(); VersionEnum[] values = VersionEnum.values();

View File

@ -3,14 +3,14 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId> <artifactId>hapi-fhir-bom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>HAPI FHIR BOM</name> <name>HAPI FHIR BOM</name>
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId> <artifactId>hapi-fhir-cli</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom</relativePath> <relativePath>../../hapi-deployable-pom</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -189,6 +189,13 @@
<dependencySourceIncludes> <dependencySourceIncludes>
<include>ca.uhn.hapi.fhir:org.hl7.fhir.convertors</include> <include>ca.uhn.hapi.fhir:org.hl7.fhir.convertors</include>
</dependencySourceIncludes> </dependencySourceIncludes>
<additionalDependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>${commons_compress_version}</version>
</dependency>
</additionalDependencies>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -73,13 +73,13 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId> <artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-subscription</artifactId> <artifactId>hapi-fhir-jpaserver-subscription</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -96,7 +96,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId> <artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<classifier>classes</classifier> <classifier>classes</classifier>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -0,0 +1,5 @@
---
type: fix
issue: 1837
title: "The FHIR R4 validation resources (StructureDefintion, ValueSet, etc) were not updated to the R4 4.0.1
technical correction versions in HAPI FHIR 4.2.0. This has been corrected."

View File

@ -10,6 +10,9 @@
<li>Guava (JPA): 28.0 -&gt; 28.2</li> <li>Guava (JPA): 28.0 -&gt; 28.2</li>
<li>Spring Boot (Boot): 2.2.0.RELEASE -&gt; 2.2.6.RELEASE</li> <li>Spring Boot (Boot): 2.2.0.RELEASE -&gt; 2.2.6.RELEASE</li>
<li>FlywayDB (JPA) 6.1.0 -&gt; 6.4.1</li> <li>FlywayDB (JPA) 6.1.0 -&gt; 6.4.1</li>
<li>Apache HTTPCliient (JPA): 4.5.9 -&gt; 4.5.12</li>
<li>Apache HTTPCore (JPA): 4.4.11 -&gt; 4.4.14</li>
<li>Commons Compress (All): 1.19 -&gt; 1.20</li>
</ul>" </ul>"
- item: - item:
issue: "1583" issue: "1583"
@ -62,3 +65,9 @@
feature allows data to be segregated using a user defined partitioning strategy. This can be leveraged to take feature allows data to be segregated using a user defined partitioning strategy. This can be leveraged to take
advantags of native RDBMS partition strategies, and also to implement **multitenant servers**. advantags of native RDBMS partition strategies, and also to implement **multitenant servers**.
" "
- item:
issue: "1841"
type: "change"
title: "**Breaking Change**:
The FHIR R5 draft definitions have been updated to the current 'Preview 2' definitions (FHIR 4.4.0).
"

View File

@ -0,0 +1,3 @@
---
release-date: "2020-05-13"
codename: "Labrador"

View File

@ -25,6 +25,16 @@ Note also that after the release of the FHIR DSTU2 specification, the FHIR
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<td>HAPI FHIR 5.0.0</td>
<td>JDK8</td>
<td class="versions-table-cell-empty"></td>
<td class="versions-table-cell-draft">1.0.2</td>
<td class="versions-table-cell-release">1.4.0</td>
<td class="versions-table-cell-draft">3.0.2</td>
<td class="versions-table-cell-draft">4.0.1</td>
<td class="versions-table-cell-release">4.4.0<span class="download-version-hash"><br/>56b0acf73f</span></td>
</tr>
<tr> <tr>
<td>HAPI FHIR 4.2.0</td> <td>HAPI FHIR 4.2.0</td>
<td>JDK8</td> <td>JDK8</td>

View File

@ -65,7 +65,7 @@ The criteria for determining the partition will depend on your use case. For exa
## Identify Partition for Read (Optional) ## Identify Partition for Read (Optional)
A hook against the [`Pointcut.STORAGE_PARTITION_IDENTIFY_CREATE`](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/interceptor/api/Pointcut.html#STORAGE_PARTITION_IDENTIFY_CREATE) pointcut must be registered, and this hook method will be invoked every time a resource is created in order to determine the partition to assign the resource to. A hook against the [`Pointcut.STORAGE_PARTITION_IDENTIFY_READ`](/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/interceptor/api/Pointcut.html#STORAGE_PARTITION_IDENTIFY_READ) pointcut must be registered, and this hook method will be invoked every time a resource is created in order to determine the partition to assign the resource to.
## Example: Partitioning based on Tenant ID ## Example: Partitioning based on Tenant ID

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -11,7 +11,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -39,7 +39,7 @@ public class AbstractJaxRsConformanceProviderR4Test {
headers = new ResteasyHttpHeaders(queryParameters); headers = new ResteasyHttpHeaders(queryParameters);
providers = new ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider>(); providers = new ConcurrentHashMap<>();
provider = createConformanceProvider(providers); provider = createConformanceProvider(providers);
} }

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -109,25 +109,25 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
obs.getCode().getCodingFirstRep().setSystem("http://loinc.org").setCode("non-existing-code").setDisplay("Display 3"); obs.getCode().getCodingFirstRep().setSystem("http://loinc.org").setCode("non-existing-code").setDisplay("Display 3");
oo = validateAndReturnOutcome(obs); oo = validateAndReturnOutcome(obs);
assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult, and a code from this value set is required) (codes = http://loinc.org#non-existing-code)", oo.getIssueFirstRep().getDiagnostics()); assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult), and a code from this value set is required) (codes = http://loinc.org#non-existing-code)", oo.getIssueFirstRep().getDiagnostics());
// Valid code with no system // Valid code with no system
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
obs.getCode().getCodingFirstRep().setSystem(null).setCode("CODE3").setDisplay("Display 3"); obs.getCode().getCodingFirstRep().setSystem(null).setCode("CODE3").setDisplay("Display 3");
oo = validateAndReturnOutcome(obs); oo = validateAndReturnOutcome(obs);
assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult, and a code from this value set is required) (codes = null#CODE3)", oo.getIssueFirstRep().getDiagnostics()); assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult), and a code from this value set is required) (codes = null#CODE3)", oo.getIssueFirstRep().getDiagnostics());
// Valid code with wrong system // Valid code with wrong system
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
obs.getCode().getCodingFirstRep().setSystem("http://foo").setCode("CODE3").setDisplay("Display 3"); obs.getCode().getCodingFirstRep().setSystem("http://foo").setCode("CODE3").setDisplay("Display 3");
oo = validateAndReturnOutcome(obs); oo = validateAndReturnOutcome(obs);
assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult, and a code from this value set is required) (codes = http://foo#CODE3)", oo.getIssueFirstRep().getDiagnostics()); assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult), and a code from this value set is required) (codes = http://foo#CODE3)", oo.getIssueFirstRep().getDiagnostics());
// Code that exists but isn't in the valueset // Code that exists but isn't in the valueset
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
obs.getCode().getCodingFirstRep().setSystem("http://terminology.hl7.org/CodeSystem/observation-category").setCode("vital-signs").setDisplay("Display 3"); obs.getCode().getCodingFirstRep().setSystem("http://terminology.hl7.org/CodeSystem/observation-category").setCode("vital-signs").setDisplay("Display 3");
oo = validateAndReturnOutcome(obs); oo = validateAndReturnOutcome(obs);
assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult, and a code from this value set is required) (codes = http://terminology.hl7.org/CodeSystem/observation-category#vital-signs)", oo.getIssueFirstRep().getDiagnostics()); assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult), and a code from this value set is required) (codes = http://terminology.hl7.org/CodeSystem/observation-category#vital-signs)", oo.getIssueFirstRep().getDiagnostics());
// Invalid code in built-in VS/CS // Invalid code in built-in VS/CS
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
@ -192,25 +192,25 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
obs.getCode().getCodingFirstRep().setSystem("http://loinc.org").setCode("non-existing-code").setDisplay("Display 3"); obs.getCode().getCodingFirstRep().setSystem("http://loinc.org").setCode("non-existing-code").setDisplay("Display 3");
oo = validateAndReturnOutcome(obs); oo = validateAndReturnOutcome(obs);
assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult, and a code from this value set is required) (codes = http://loinc.org#non-existing-code)", oo.getIssueFirstRep().getDiagnostics()); assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult), and a code from this value set is required) (codes = http://loinc.org#non-existing-code)", oo.getIssueFirstRep().getDiagnostics());
// Valid code with no system // Valid code with no system
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
obs.getCode().getCodingFirstRep().setSystem(null).setCode("CODE3").setDisplay("Display 3"); obs.getCode().getCodingFirstRep().setSystem(null).setCode("CODE3").setDisplay("Display 3");
oo = validateAndReturnOutcome(obs); oo = validateAndReturnOutcome(obs);
assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult, and a code from this value set is required) (codes = null#CODE3)", oo.getIssueFirstRep().getDiagnostics()); assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult), and a code from this value set is required) (codes = null#CODE3)", oo.getIssueFirstRep().getDiagnostics());
// Valid code with wrong system // Valid code with wrong system
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
obs.getCode().getCodingFirstRep().setSystem("http://foo").setCode("CODE3").setDisplay("Display 3"); obs.getCode().getCodingFirstRep().setSystem("http://foo").setCode("CODE3").setDisplay("Display 3");
oo = validateAndReturnOutcome(obs); oo = validateAndReturnOutcome(obs);
assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult, and a code from this value set is required) (codes = http://foo#CODE3)", oo.getIssueFirstRep().getDiagnostics()); assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult), and a code from this value set is required) (codes = http://foo#CODE3)", oo.getIssueFirstRep().getDiagnostics());
// Code that exists but isn't in the valueset // Code that exists but isn't in the valueset
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
obs.getCode().getCodingFirstRep().setSystem("http://terminology.hl7.org/CodeSystem/observation-category").setCode("vital-signs").setDisplay("Display 3"); obs.getCode().getCodingFirstRep().setSystem("http://terminology.hl7.org/CodeSystem/observation-category").setCode("vital-signs").setDisplay("Display 3");
oo = validateAndReturnOutcome(obs); oo = validateAndReturnOutcome(obs);
assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult, and a code from this value set is required) (codes = http://terminology.hl7.org/CodeSystem/observation-category#vital-signs)", oo.getIssueFirstRep().getDiagnostics()); assertEquals(encode(oo), "None of the codes provided are in the value set http://example.com/fhir/ValueSet/observation-vitalsignresult (http://example.com/fhir/ValueSet/observation-vitalsignresult), and a code from this value set is required) (codes = http://terminology.hl7.org/CodeSystem/observation-category#vital-signs)", oo.getIssueFirstRep().getDiagnostics());
// Invalid code in built-in VS/CS // Invalid code in built-in VS/CS
obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED); obs.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
@ -346,7 +346,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
// It would be ok for this to produce 0 issues, or just an information message too // It would be ok for this to produce 0 issues, or just an information message too
assertEquals(1, OperationOutcomeUtil.getIssueCount(myFhirCtx, oo)); assertEquals(1, OperationOutcomeUtil.getIssueCount(myFhirCtx, oo));
assertEquals("None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/identifier-type (http://hl7.org/fhir/ValueSet/identifier-type, and a code should come from this value set unless it has no suitable code) (codes = http://foo#bar)", OperationOutcomeUtil.getFirstIssueDetails(myFhirCtx, oo)); assertEquals("None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/identifier-type (http://hl7.org/fhir/ValueSet/identifier-type), and a code should come from this value set unless it has no suitable code) (codes = http://foo#bar)", OperationOutcomeUtil.getFirstIssueDetails(myFhirCtx, oo));
} }
@ -744,7 +744,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
fail("Didn't fail- response was " + encode); fail("Didn't fail- response was " + encode);
} catch (PreconditionFailedException e) { } catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome(); OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
assertEquals("No response found for required item with id = 'link0'", oo.getIssueFirstRep().getDiagnostics()); assertEquals("No response answer found for required item \"link0\"", oo.getIssueFirstRep().getDiagnostics());
} }
} }
@ -762,7 +762,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
QuestionnaireResponse qa = new QuestionnaireResponse(); QuestionnaireResponse qa = new QuestionnaireResponse();
qa.getText().setStatus(Narrative.NarrativeStatus.GENERATED).setDivAsString("<div>aaa</div>"); qa.getText().setStatus(Narrative.NarrativeStatus.GENERATED).setDivAsString("<div>aaa</div>");
qa.setStatus(QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED); qa.setStatus(QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED);
qa.getQuestionnaireElement().setValue("Questionnaire/q"); qa.getQuestionnaireElement().setValue("http://foo/q");
qa.addItem().setLinkId("link1").addAnswer().setValue(new StringType("FOO")); qa.addItem().setLinkId("link1").addAnswer().setValue(new StringType("FOO"));
try { try {
@ -773,7 +773,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
fail("Didn't fail- response was " + encode); fail("Didn't fail- response was " + encode);
} catch (PreconditionFailedException e) { } catch (PreconditionFailedException e) {
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome(); OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
assertEquals("No response found for required item with id = 'link0'", oo.getIssueFirstRep().getDiagnostics()); assertEquals("No response answer found for required item \"link0\"", oo.getIssueFirstRep().getDiagnostics());
} }
} }
@ -791,12 +791,16 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
QuestionnaireResponse qa = new QuestionnaireResponse(); QuestionnaireResponse qa = new QuestionnaireResponse();
qa.getText().setStatus(Narrative.NarrativeStatus.GENERATED).setDivAsString("<div>aaa</div>"); qa.getText().setStatus(Narrative.NarrativeStatus.GENERATED).setDivAsString("<div>aaa</div>");
qa.setStatus(QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED); qa.setStatus(QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED);
qa.getQuestionnaireElement().setValue("Questionnaire/DOES_NOT_EXIST"); qa.getQuestionnaireElement().setValue("http://foo/Questionnaire/DOES_NOT_EXIST");
qa.addItem().setLinkId("link1").addAnswer().setValue(new StringType("FOO")); qa.addItem().setLinkId("link1").addAnswer().setValue(new StringType("FOO"));
MethodOutcome validationOutcome = myQuestionnaireResponseDao.validate(qa, null, null, null, null, null, null); try {
OperationOutcome oo = (OperationOutcome) validationOutcome.getOperationOutcome(); MethodOutcome validationOutcome = myQuestionnaireResponseDao.validate(qa, null, null, null, null, null, null);
assertEquals("The questionnaire \"Questionnaire/DOES_NOT_EXIST\" could not be resolved, so no validation can be performed against the base questionnaire", oo.getIssueFirstRep().getDiagnostics()); OperationOutcome oo = (OperationOutcome) validationOutcome.getOperationOutcome();
assertEquals("The questionnaire \"http://foo/Questionnaire/DOES_NOT_EXIST\" could not be resolved, so no validation can be performed against the base questionnaire", oo.getIssueFirstRep().getDiagnostics());
} catch (PreconditionFailedException e) {
fail(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
}
} }

View File

@ -505,13 +505,13 @@ public abstract class BaseJpaR5Test extends BaseJpaTest {
target = element.addTarget(); target = element.addTarget();
target.setCode("45678"); target.setCode("45678");
target.setDisplay("Target Code 45678"); target.setDisplay("Target Code 45678");
target.setRelationship(Enumerations.ConceptMapRelationship.BROADER); target.setRelationship(Enumerations.ConceptMapRelationship.SOURCEISBROADERTHANTARGET);
// Add a duplicate // Add a duplicate
target = element.addTarget(); target = element.addTarget();
target.setCode("45678"); target.setCode("45678");
target.setDisplay("Target Code 45678"); target.setDisplay("Target Code 45678");
target.setRelationship(Enumerations.ConceptMapRelationship.BROADER); target.setRelationship(Enumerations.ConceptMapRelationship.SOURCEISBROADERTHANTARGET);
group = conceptMap.addGroup(); group = conceptMap.addGroup();
group.setSource(CS_URL); group.setSource(CS_URL);
@ -531,7 +531,7 @@ public abstract class BaseJpaR5Test extends BaseJpaTest {
target = element.addTarget(); target = element.addTarget();
target.setCode("67890"); target.setCode("67890");
target.setDisplay("Target Code 67890"); target.setDisplay("Target Code 67890");
target.setRelationship(Enumerations.ConceptMapRelationship.BROADER); target.setRelationship(Enumerations.ConceptMapRelationship.SOURCEISBROADERTHANTARGET);
group = conceptMap.addGroup(); group = conceptMap.addGroup();
group.setSource(CS_URL_4); group.setSource(CS_URL_4);
@ -546,7 +546,7 @@ public abstract class BaseJpaR5Test extends BaseJpaTest {
target = element.addTarget(); target = element.addTarget();
target.setCode("34567"); target.setCode("34567");
target.setDisplay("Target Code 34567"); target.setDisplay("Target Code 34567");
target.setRelationship(Enumerations.ConceptMapRelationship.NARROWER); target.setRelationship(Enumerations.ConceptMapRelationship.SOURCEISNARROWERTHANTARGET);
return conceptMap; return conceptMap;
} }

View File

@ -17,12 +17,24 @@ import ca.uhn.fhir.rest.client.api.IClientInterceptor;
import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.api.IHttpRequest; import ca.uhn.fhir.rest.client.api.IHttpRequest;
import ca.uhn.fhir.rest.client.api.IHttpResponse; import ca.uhn.fhir.rest.client.api.IHttpResponse;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.gclient.StringClientParam; import ca.uhn.fhir.rest.gclient.StringClientParam;
import ca.uhn.fhir.rest.param.*; import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.server.exceptions.*; import ca.uhn.fhir.rest.param.NumberParam;
import ca.uhn.fhir.rest.param.ParamPrefixEnum;
import ca.uhn.fhir.rest.param.StringAndListParam;
import ca.uhn.fhir.rest.param.StringOrListParam;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.rest.server.interceptor.BaseValidatingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.util.UrlUtil; import ca.uhn.fhir.util.UrlUtil;
import ca.uhn.fhir.validation.IValidatorModule;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -30,23 +42,73 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity; import org.apache.http.entity.StringEntity;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator; import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.dstu3.model.Attachment;
import org.hl7.fhir.dstu3.model.Bundle.*; import org.hl7.fhir.dstu3.model.AuditEvent;
import org.hl7.fhir.dstu3.model.BaseResource;
import org.hl7.fhir.dstu3.model.Basic;
import org.hl7.fhir.dstu3.model.Binary;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent;
import org.hl7.fhir.dstu3.model.Bundle.BundleType;
import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb;
import org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeType;
import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.Condition;
import org.hl7.fhir.dstu3.model.DateTimeType;
import org.hl7.fhir.dstu3.model.DateType;
import org.hl7.fhir.dstu3.model.Device;
import org.hl7.fhir.dstu3.model.DocumentManifest;
import org.hl7.fhir.dstu3.model.DocumentReference;
import org.hl7.fhir.dstu3.model.Encounter;
import org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent; import org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent;
import org.hl7.fhir.dstu3.model.Encounter.EncounterStatus; import org.hl7.fhir.dstu3.model.Encounter.EncounterStatus;
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender; import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
import org.hl7.fhir.dstu3.model.Extension;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.ImagingStudy;
import org.hl7.fhir.dstu3.model.InstantType;
import org.hl7.fhir.dstu3.model.IntegerType;
import org.hl7.fhir.dstu3.model.Location;
import org.hl7.fhir.dstu3.model.Media;
import org.hl7.fhir.dstu3.model.Medication;
import org.hl7.fhir.dstu3.model.MedicationAdministration;
import org.hl7.fhir.dstu3.model.MedicationRequest;
import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus; import org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus;
import org.hl7.fhir.dstu3.model.Observation;
import org.hl7.fhir.dstu3.model.Observation.ObservationStatus; import org.hl7.fhir.dstu3.model.Observation.ObservationStatus;
import org.hl7.fhir.dstu3.model.OperationOutcome;
import org.hl7.fhir.dstu3.model.Organization;
import org.hl7.fhir.dstu3.model.Parameters;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.dstu3.model.Period;
import org.hl7.fhir.dstu3.model.Practitioner;
import org.hl7.fhir.dstu3.model.ProcedureRequest;
import org.hl7.fhir.dstu3.model.Quantity;
import org.hl7.fhir.dstu3.model.Questionnaire;
import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType; import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.dstu3.model.QuestionnaireResponse;
import org.hl7.fhir.dstu3.model.Reference;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.dstu3.model.Subscription;
import org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType; import org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType;
import org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus; import org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus;
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; import org.hl7.fhir.dstu3.model.UnsignedIntType;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.After; import org.junit.After;
@ -66,11 +128,39 @@ import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.contains;
import static org.junit.Assert.*; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsInRelativeOrder;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.emptyString;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.hamcrest.Matchers.matchesPattern;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith;
import static org.hamcrest.Matchers.stringContainsInOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
@ -2074,24 +2164,31 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
@Test @Test
public void testMetaOperations() { public void testMetaOperations() {
String methodName = "testMetaOperations"; String methodName = "testMetaOperations";
ourClient.registerInterceptor(new LoggingInterceptor(true));
ourClient.setPrettyPrint(true);
IValidatorModule module = new FhirInstanceValidator(myFhirCtx);
BaseValidatingInterceptor<String> validatingInterceptor = new RequestValidatingInterceptor().addValidatorModule(module);
ourRestServer.registerInterceptor(validatingInterceptor);
try {
Patient pt = new Patient();
pt.addName().setFamily(methodName);
IIdType id = ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
Patient pt = new Patient(); Meta meta = ourClient.meta().get(Meta.class).fromResource(id).execute();
pt.addName().setFamily(methodName); assertEquals(0, meta.getTag().size());
IIdType id = ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
Meta meta = ourClient.meta().get(Meta.class).fromResource(id).execute(); Meta inMeta = new Meta();
assertEquals(0, meta.getTag().size()); inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
meta = ourClient.meta().add().onResource(id).meta(inMeta).execute();
Meta inMeta = new Meta(); assertEquals(1, meta.getTag().size());
inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
meta = ourClient.meta().add().onResource(id).meta(inMeta).execute();
assertEquals(1, meta.getTag().size());
inMeta = new Meta();
inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
meta = ourClient.meta().delete().onResource(id).meta(inMeta).execute();
assertEquals(0, meta.getTag().size());
inMeta = new Meta();
inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
meta = ourClient.meta().delete().onResource(id).meta(inMeta).execute();
assertEquals(0, meta.getTag().size());
} finally {
ourRestServer.unregisterInterceptor(validatingInterceptor);
}
} }
@Test @Test

View File

@ -30,7 +30,7 @@ import org.hl7.fhir.r5.model.Enumerations;
import org.hl7.fhir.r5.model.IdType; import org.hl7.fhir.r5.model.IdType;
import org.hl7.fhir.r5.model.Observation; import org.hl7.fhir.r5.model.Observation;
import org.hl7.fhir.r5.model.Subscription; import org.hl7.fhir.r5.model.Subscription;
import org.hl7.fhir.r5.model.Topic; import org.hl7.fhir.r5.model.SubscriptionTopic;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
@ -133,20 +133,19 @@ public abstract class BaseSubscriptionsR5Test extends BaseResourceProviderR5Test
} }
protected Subscription newSubscription(String theCriteria, String thePayload) { protected Subscription newSubscription(String theCriteria, String thePayload) {
Topic topic = new Topic(); SubscriptionTopic topic = new SubscriptionTopic();
topic.getResourceTrigger().getQueryCriteria().setCurrent(theCriteria); topic.getResourceTrigger().getQueryCriteria().setCurrent(theCriteria);
Subscription subscription = new Subscription(); Subscription subscription = new Subscription();
subscription.getTopic().setResource(topic); subscription.getTopic().setResource(topic);
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)"); subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED); subscription.setStatus(Enumerations.SubscriptionState.REQUESTED);
Subscription.SubscriptionChannelComponent channel = subscription.getChannel(); subscription.getChannelType()
channel.getType().addCoding()
.setSystem(CanonicalSubscriptionChannelType.RESTHOOK.getSystem()) .setSystem(CanonicalSubscriptionChannelType.RESTHOOK.getSystem())
.setCode(CanonicalSubscriptionChannelType.RESTHOOK.toCode()); .setCode(CanonicalSubscriptionChannelType.RESTHOOK.toCode());
channel.getPayload().setContentType(thePayload); subscription.setContentType(thePayload);
channel.setEndpoint(ourListenerServerBase); subscription.setEndpoint(ourListenerServerBase);
return subscription; return subscription;
} }

View File

@ -299,7 +299,6 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
assertEquals(observation1.getIdElement().getVersionIdPart(), idElement.getVersionIdPart()); assertEquals(observation1.getIdElement().getVersionIdPart(), idElement.getVersionIdPart());
subscription1 subscription1
.getChannel()
.addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true")); .addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true"));
ourLog.info("** About to update subscription"); ourLog.info("** About to update subscription");
@ -376,7 +375,6 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Subscription subscription = newSubscription(criteria1, payload); Subscription subscription = newSubscription(criteria1, payload);
subscription subscription
.getChannel()
.addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION, new BooleanType("true")); .addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION, new BooleanType("true"));
ourClient.create().resource(subscription).execute(); ourClient.create().resource(subscription).execute();
@ -439,7 +437,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp); Assert.assertNotNull(subscriptionTemp);
Topic topic = (Topic) subscriptionTemp.getTopic().getResource(); SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getTopic().getResource();
topic.getResourceTrigger().getQueryCriteria().setCurrent(criteria1); topic.getResourceTrigger().getQueryCriteria().setCurrent(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
@ -521,7 +519,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp); Assert.assertNotNull(subscriptionTemp);
Topic topic = (Topic) subscriptionTemp.getTopic().getResource(); SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getTopic().getResource();
topic.getResourceTrigger().getQueryCriteria().setCurrent(criteria1); topic.getResourceTrigger().getQueryCriteria().setCurrent(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
@ -599,7 +597,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp); Assert.assertNotNull(subscriptionTemp);
Topic topic = (Topic) subscriptionTemp.getTopic().getResource(); SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getTopic().getResource();
topic.getResourceTrigger().getQueryCriteria().setCurrent(criteria1); topic.getResourceTrigger().getQueryCriteria().setCurrent(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain(); waitForQueueToDrain();
@ -727,7 +725,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Assert.assertNotNull(subscriptionTemp); Assert.assertNotNull(subscriptionTemp);
String criteriaGood = "Observation?code=SNOMED-CT|" + code + "&_format=xml"; String criteriaGood = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
Topic topic = (Topic) subscriptionTemp.getTopic().getResource(); SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getTopic().getResource();
topic.getResourceTrigger().getQueryCriteria().setCurrent(criteriaGood); topic.getResourceTrigger().getQueryCriteria().setCurrent(criteriaGood);
ourLog.info("** About to update subscription"); ourLog.info("** About to update subscription");
@ -797,9 +795,9 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Subscription subscription = createSubscription(criteria1, payload); Subscription subscription = createSubscription(criteria1, payload);
waitForActivatedSubscriptionCount(1); waitForActivatedSubscriptionCount(1);
subscription.getChannel().addHeader("X-Foo: FOO"); subscription.addHeader("X-Foo: FOO");
subscription.getChannel().addHeader("X-Bar: BAR"); subscription.addHeader("X-Bar: BAR");
subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED); subscription.setStatus(Enumerations.SubscriptionState.REQUESTED);
ourClient.update().resource(subscription).execute(); ourClient.update().resource(subscription).execute();
waitForQueueToDrain(); waitForQueueToDrain();
@ -832,7 +830,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
waitForSize(1, ourUpdatedObservations); waitForSize(1, ourUpdatedObservations);
// Disable // Disable
subscription.setStatus(Subscription.SubscriptionStatus.OFF); subscription.setStatus(Enumerations.SubscriptionState.OFF);
ourClient.update().resource(subscription).execute(); ourClient.update().resource(subscription).execute();
waitForQueueToDrain(); waitForQueueToDrain();

View File

@ -18,129 +18,126 @@
"author": { "author": {
"reference": "Practitioner/PRLoginID" "reference": "Practitioner/PRLoginID"
}, },
"item": [{ "item": [
"linkId": "Binder Optimization Assessment Test", {
"text": "Binder Optimization Assessment Test", "linkId": "Binder Optimization Assessment Test",
"item": [{ "text": "Binder Optimization Assessment Test",
"linkId": "BINDER OPTIMIZATION ASSESSMENT TEST", "item": [
"text": "BINDER OPTIMIZATION ASSESSMENT TEST",
"item": [{
"linkId": "Home Medications",
"text": "Home Medications",
"item": [{
"linkId": "BO_ConsPharm",
"text": "Pharmacist consult",
"answer": [{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "Yes",
"display": "Yes"
}
}]
},
{
"linkId": "BO_ConsTxt",
"text": "Pharmacy consult notes",
"answer": [{
"valueString": "Pharmacy consult notes comes here"
}]
},
{
"linkId": "BO_RecNotCons",
"text": "Recommendation not consistent with binder optimization guidelines",
"answer": [{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "Yes",
"display": "Yes"
}
}],
"item": [{
"linkId": "BO_NotConsDrop",
"text": "Recommendation not consistent with binder optimization guidelines",
"answer": [{
"valueString": "Chewing difficulty,Other"
}],
"item": [{
"linkId": "BO_OtherTxt",
"text": "Other",
"answer": [{
"valueString": "Other difficulty"
}]
}]
},
{
"linkId": "BO_Recommend",
"text": "What is your recommendation",
"answer": [{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCBinderRecommendation",
"code": "Renvela",
"display": "Renvela"
}
}]
}
]
}
]
},
{ {
"linkId": "Plan", "linkId": "BINDER OPTIMIZATION ASSESSMENT TEST",
"text": "Plan", "text": "BINDER OPTIMIZATION ASSESSMENT TEST",
"item": [{ "item": [
"linkId": "BO_CommPres",
"text": "Binder recommendation communicated to prescriber",
"answer": [{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "No",
"display": "No"
}
}]
},
{ {
"linkId": "BO_ComAssmt", "linkId": "Home Medications",
"text": "Referred to MSW for expressed co-pay concerns", "text": "Home Medications",
"answer": [{ "item": [
"valueCoding": { {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk", "linkId": "BO_ConsPharm",
"code": "No", "text": "Pharmacist consult",
"display": "No" "answer": [
{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "Yes",
"display": "Yes"
}
}
]
},
{
"linkId": "BO_ConsTxt",
"text": "Pharmacy consult notes",
"answer": [
{
"valueString": "Pharmacy consult notes comes here"
}
]
},
{
"linkId": "BO_RecNotCons",
"text": "Recommendation not consistent with binder optimization guidelines",
"answer": [
{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "Yes",
"display": "Yes"
}
}
]
} }
}] ]
}, },
{ {
"linkId": "BO_RefMSW", "linkId": "Plan",
"text": "Referred to MSW for potential medication adherence issues", "text": "Plan",
"answer": [{ "item": [
"valueCoding": { {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk", "linkId": "BO_CommPres",
"code": "No", "text": "Binder recommendation communicated to prescriber",
"display": "No" "answer": [
{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "No",
"display": "No"
}
}
]
},
{
"linkId": "BO_ComAssmt",
"text": "Referred to MSW for expressed co-pay concerns",
"answer": [
{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "No",
"display": "No"
}
}
]
},
{
"linkId": "BO_RefMSW",
"text": "Referred to MSW for potential medication adherence issues",
"answer": [
{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "No",
"display": "No"
}
}
]
},
{
"linkId": "BO_AdjHyp",
"text": "Continue adjustments per CMAB Hyperphosphatemia Algorithm",
"answer": [
{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "No",
"display": "No"
}
}
]
},
{
"linkId": "BO_AdjTxt",
"text": "Adjustment Text",
"answer": [
{
"valueString": "Adjustment Text comes here"
}
]
} }
}] ]
},
{
"linkId": "BO_AdjHyp",
"text": "Continue adjustments per CMAB Hyperphosphatemia Algorithm",
"answer": [{
"valueCoding": {
"system": "http://fkcfhir.org/fhir/cs/FMCYesNoUnk",
"code": "No",
"display": "No"
}
}]
},
{
"linkId": "BO_AdjTxt",
"text": "Adjustment Text",
"answer": [{
"valueString": "Adjustment Text comes here"
}]
} }
] ]
} }
] ]
}] }
}] ]
} }

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -0,0 +1,51 @@
package ca.uhn.fhir.jpa.migrate.taskdef;
/*-
* #%L
* HAPI FHIR JPA Server - Migration
* %%
* Copyright (C) 2014 - 2020 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
public class NopTask extends BaseTask {
public NopTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
@Override
public void validate() {
// nothing
}
@Override
protected void doExecute() {
// nothing
}
@Override
protected void generateHashCode(HashCodeBuilder theBuilder) {
// nothing
}
@Override
protected void generateEquals(EqualsBuilder theBuilder, BaseTask theOtherObject) {
// nothing
}
}

View File

@ -59,9 +59,69 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
init400(); // 20190401 - 20190814 init400(); // 20190401 - 20190814
init410(); // 20190815 - 20191014 init410(); // 20190815 - 20191014
init420(); // 20191015 - 20200217 init420(); // 20191015 - 20200217
init430(); // Replaced by 5.0.0
init500(); // 20200218 - present init500(); // 20200218 - present
} }
/**
* Partway through the 4.3.0 releaase cycle we renumbered to
* 5.0.0 - We have a bunch of NOP tasks here to avoid breakage for anyone
* who installed a prerelease before we made the switch
*/
@SuppressWarnings("deprecation")
private void init430() {
Builder version = forVersion(VersionEnum.V4_3_0);
version.addNop("20200218.1");
version.addNop("20200218.2");
version.addNop("20200218.3");
version.addNop("20200220.1");
version.addNop("20200419.1");
version.addNop("20200419.2");
version.addNop("20200420.0");
version.addNop("20200420.1");
version.addNop("20200420.2");
version.addNop("20200420.3");
version.addNop("20200420.4");
version.addNop("20200420.5");
version.addNop("20200420.6");
version.addNop("20200420.7");
version.addNop("20200420.8");
version.addNop("20200420.9");
version.addNop("20200420.10");
version.addNop("20200420.11");
version.addNop("20200420.12");
version.addNop("20200420.13");
version.addNop("20200420.14");
version.addNop("20200420.15");
version.addNop("20200420.16");
version.addNop("20200420.17");
version.addNop("20200420.18");
version.addNop("20200420.19");
version.addNop("20200420.20");
version.addNop("20200420.21");
version.addNop("20200420.22");
version.addNop("20200420.23");
version.addNop("20200420.24");
version.addNop("20200420.25");
version.addNop("20200420.26");
version.addNop("20200420.27");
version.addNop("20200420.28");
version.addNop("20200420.29");
version.addNop("20200420.30");
version.addNop("20200420.31");
version.addNop("20200420.32");
version.addNop("20200420.33");
version.addNop("20200420.34");
version.addNop("20200420.35");
version.addNop("20200420.36");
version.addNop("20200420.37");
version.addNop("20200420.38");
version.addNop("20200420.39");
version.addNop("20200420.40");
version.addNop("20200420.41");
version.addNop("20200420.42");
}
protected void init500() { // 20200218 - present protected void init500() { // 20200218 - present
Builder version = forVersion(VersionEnum.V5_0_0); Builder version = forVersion(VersionEnum.V5_0_0);

View File

@ -96,7 +96,11 @@ public class Builder {
addTask(task); addTask(task);
} }
public class BuilderAddTableRawSql { public void addNop(String theVersion) {
addTask(new NopTask(myRelease, theVersion));
}
public class BuilderAddTableRawSql {
private final AddTableRawSqlTask myTask; private final AddTableRawSqlTask myTask;

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -23,20 +23,20 @@ package ca.uhn.fhir.jpa.subscription.match.registry;
import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
import ca.uhn.fhir.model.dstu2.resource.Subscription; import ca.uhn.fhir.model.dstu2.resource.Subscription;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
import org.hl7.fhir.instance.model.api.IBaseMetaType; import org.hl7.fhir.instance.model.api.IBaseMetaType;
import org.hl7.fhir.instance.model.api.IBaseReference; import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r5.model.Coding;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -179,7 +179,6 @@ public class SubscriptionCanonicalizer {
case R5: { case R5: {
org.hl7.fhir.r5.model.Subscription subscription = (org.hl7.fhir.r5.model.Subscription) theSubscription; org.hl7.fhir.r5.model.Subscription subscription = (org.hl7.fhir.r5.model.Subscription) theSubscription;
return subscription return subscription
.getChannel()
.getExtension() .getExtension()
.stream() .stream()
.collect(Collectors.groupingBy(t -> t.getUrl(), mapping(t -> t.getValueAsPrimitive().getValueAsString(), toList()))); .collect(Collectors.groupingBy(t -> t.getUrl(), mapping(t -> t.getValueAsPrimitive().getValueAsString(), toList())));
@ -251,24 +250,24 @@ public class SubscriptionCanonicalizer {
org.hl7.fhir.r5.model.Subscription subscription = (org.hl7.fhir.r5.model.Subscription) theSubscription; org.hl7.fhir.r5.model.Subscription subscription = (org.hl7.fhir.r5.model.Subscription) theSubscription;
CanonicalSubscription retVal = new CanonicalSubscription(); CanonicalSubscription retVal = new CanonicalSubscription();
org.hl7.fhir.r5.model.Subscription.SubscriptionStatus status = subscription.getStatus(); org.hl7.fhir.r5.model.Enumerations.SubscriptionState status = subscription.getStatus();
if (status != null) { if (status != null) {
retVal.setStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.fromCode(status.toCode())); retVal.setStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.fromCode(status.toCode()));
} }
retVal.setChannelType(getChannelType(subscription)); retVal.setChannelType(getChannelType(subscription));
retVal.setCriteriaString(getCriteria(theSubscription)); retVal.setCriteriaString(getCriteria(theSubscription));
retVal.setEndpointUrl(subscription.getChannel().getEndpoint()); retVal.setEndpointUrl(subscription.getEndpoint());
retVal.setHeaders(subscription.getChannel().getHeader()); retVal.setHeaders(subscription.getHeader());
retVal.setChannelExtensions(extractExtension(subscription)); retVal.setChannelExtensions(extractExtension(subscription));
retVal.setIdElement(subscription.getIdElement()); retVal.setIdElement(subscription.getIdElement());
retVal.setPayloadString(subscription.getChannel().getPayload().getContentType()); retVal.setPayloadString(subscription.getContentType());
if (retVal.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) { if (retVal.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) {
String from; String from;
String subjectTemplate; String subjectTemplate;
try { try {
from = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM); from = getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM);
subjectTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE); subjectTemplate = getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE);
} catch (FHIRException theE) { } catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
} }
@ -280,8 +279,8 @@ public class SubscriptionCanonicalizer {
String stripVersionIds; String stripVersionIds;
String deliverLatestVersion; String deliverLatestVersion;
try { try {
stripVersionIds = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS); stripVersionIds = getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS);
deliverLatestVersion = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION); deliverLatestVersion = getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION);
} catch (FHIRException theE) { } catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
} }
@ -300,6 +299,18 @@ public class SubscriptionCanonicalizer {
return retVal; return retVal;
} }
private String getExtensionString(IBaseHasExtensions theBase, String theUrl) {
return theBase
.getExtension()
.stream()
.filter(t -> theUrl.equals(t.getUrl()))
.filter(t -> t.getValue() instanceof IPrimitiveType)
.map(t -> (IPrimitiveType<?>) t.getValue())
.map(t -> t.getValueAsString())
.findFirst()
.orElse(null);
}
@SuppressWarnings("EnumSwitchStatementWhichMissesCases") @SuppressWarnings("EnumSwitchStatementWhichMissesCases")
public CanonicalSubscriptionChannelType getChannelType(IBaseResource theSubscription) { public CanonicalSubscriptionChannelType getChannelType(IBaseResource theSubscription) {
CanonicalSubscriptionChannelType retVal = null; CanonicalSubscriptionChannelType retVal = null;
@ -327,11 +338,10 @@ public class SubscriptionCanonicalizer {
break; break;
} }
case R5: { case R5: {
for (Coding nextTypeCode : ((org.hl7.fhir.r5.model.Subscription) theSubscription).getChannel().getType().getCoding()) { org.hl7.fhir.r5.model.Coding nextTypeCode = ((org.hl7.fhir.r5.model.Subscription) theSubscription).getChannelType();
CanonicalSubscriptionChannelType code = CanonicalSubscriptionChannelType.fromCode(nextTypeCode.getSystem(), nextTypeCode.getCode()); CanonicalSubscriptionChannelType code = CanonicalSubscriptionChannelType.fromCode(nextTypeCode.getSystem(), nextTypeCode.getCode());
if (code != null) { if (code != null) {
retVal = code; retVal = code;
}
} }
break; break;
} }
@ -355,7 +365,7 @@ public class SubscriptionCanonicalizer {
retVal = ((org.hl7.fhir.r4.model.Subscription) theSubscription).getCriteria(); retVal = ((org.hl7.fhir.r4.model.Subscription) theSubscription).getCriteria();
break; break;
case R5: case R5:
org.hl7.fhir.r5.model.Topic topic = (org.hl7.fhir.r5.model.Topic) ((org.hl7.fhir.r5.model.Subscription) theSubscription).getTopic().getResource(); org.hl7.fhir.r5.model.SubscriptionTopic topic = (org.hl7.fhir.r5.model.SubscriptionTopic) ((org.hl7.fhir.r5.model.Subscription) theSubscription).getTopic().getResource();
Validate.notNull(topic); Validate.notNull(topic);
retVal = topic.getResourceTrigger().getQueryCriteria().getCurrent(); retVal = topic.getResourceTrigger().getQueryCriteria().getCurrent();
break; break;
@ -372,8 +382,8 @@ public class SubscriptionCanonicalizer {
meta meta
.getTag() .getTag()
.stream() .stream()
.filter(t->JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY.equals(t.getSystem())) .filter(t -> JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY.equals(t.getSystem()))
.forEach(t->{ .forEach(t -> {
t.setCode(null); t.setCode(null);
t.setSystem(null); t.setSystem(null);
t.setDisplay(null); t.setDisplay(null);

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -157,7 +157,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-converter</artifactId> <artifactId>hapi-fhir-converter</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId> <artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>hapi-fhir-spring-boot-sample-client-okhttp</artifactId> <artifactId>hapi-fhir-spring-boot-sample-client-okhttp</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>hapi-fhir-spring-boot-sample-server-jersey</artifactId> <artifactId>hapi-fhir-spring-boot-sample-server-jersey</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>hapi-fhir-spring-boot-sample-server-jpa</artifactId> <artifactId>hapi-fhir-spring-boot-sample-server-jpa</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot</artifactId> <artifactId>hapi-fhir-spring-boot</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>

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