Merge branch 'master' into i18n
This commit is contained in:
commit
5be8bc9f74
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -2685,38 +2685,33 @@ public class VersionConvertor_10_30 {
|
||||||
return null;
|
return null;
|
||||||
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.SearchParamType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory());
|
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.SearchParamType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory());
|
||||||
VersionConvertor_10_30.copyElement(src, tgt);
|
VersionConvertor_10_30.copyElement(src, tgt);
|
||||||
switch(src.getValue()) {
|
tgt.setValue(convertSearchParamType(src.getValue()));
|
||||||
case NUMBER:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER);
|
|
||||||
break;
|
|
||||||
case DATE:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE);
|
|
||||||
break;
|
|
||||||
case STRING:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING);
|
|
||||||
break;
|
|
||||||
case TOKEN:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN);
|
|
||||||
break;
|
|
||||||
case REFERENCE:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE);
|
|
||||||
break;
|
|
||||||
case COMPOSITE:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE);
|
|
||||||
break;
|
|
||||||
case QUANTITY:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY);
|
|
||||||
break;
|
|
||||||
case URI:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return tgt;
|
return tgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2.model.Enumerations.SearchParamType src) throws FHIRException {
|
||||||
|
switch(src) {
|
||||||
|
case NUMBER:
|
||||||
|
return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER;
|
||||||
|
case DATE:
|
||||||
|
return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE;
|
||||||
|
case STRING:
|
||||||
|
return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING;
|
||||||
|
case TOKEN:
|
||||||
|
return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN;
|
||||||
|
case REFERENCE:
|
||||||
|
return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE;
|
||||||
|
case COMPOSITE:
|
||||||
|
return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE;
|
||||||
|
case QUANTITY:
|
||||||
|
return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY;
|
||||||
|
case URI:
|
||||||
|
return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI;
|
||||||
|
default:
|
||||||
|
return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.SearchParamType> convertSearchParamType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.SearchParamType> src) throws FHIRException {
|
static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Enumerations.SearchParamType> convertSearchParamType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.SearchParamType> src) throws FHIRException {
|
||||||
if (src == null || src.isEmpty())
|
if (src == null || src.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -105,29 +105,27 @@ public class SearchParameter10_30 {
|
||||||
return null;
|
return null;
|
||||||
org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageTypeEnumFactory());
|
org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageTypeEnumFactory());
|
||||||
VersionConvertor_10_30.copyElement(src, tgt);
|
VersionConvertor_10_30.copyElement(src, tgt);
|
||||||
switch(src.getValue()) {
|
tgt.setValue(convertXPathUsageType(src.getValue()));
|
||||||
case NORMAL:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL);
|
|
||||||
break;
|
|
||||||
case PHONETIC:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC);
|
|
||||||
break;
|
|
||||||
case NEARBY:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY);
|
|
||||||
break;
|
|
||||||
case DISTANCE:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE);
|
|
||||||
break;
|
|
||||||
case OTHER:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tgt.setValue(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return tgt;
|
return tgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException {
|
||||||
|
switch(src) {
|
||||||
|
case NORMAL:
|
||||||
|
return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NORMAL;
|
||||||
|
case PHONETIC:
|
||||||
|
return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.PHONETIC;
|
||||||
|
case NEARBY:
|
||||||
|
return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NEARBY;
|
||||||
|
case DISTANCE:
|
||||||
|
return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.DISTANCE;
|
||||||
|
case OTHER:
|
||||||
|
return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.OTHER;
|
||||||
|
default:
|
||||||
|
return org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType.NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType> convertXPathUsageType(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType> src) throws FHIRException {
|
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType> convertXPathUsageType(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType> src) throws FHIRException {
|
||||||
if (src == null || src.isEmpty())
|
if (src == null || src.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -105,29 +105,27 @@ public class SearchParameter10_40 {
|
||||||
return null;
|
return null;
|
||||||
org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.SearchParameter.XPathUsageType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.SearchParameter.XPathUsageTypeEnumFactory());
|
org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.SearchParameter.XPathUsageType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.SearchParameter.XPathUsageTypeEnumFactory());
|
||||||
VersionConvertor_10_40.copyElement(src, tgt);
|
VersionConvertor_10_40.copyElement(src, tgt);
|
||||||
switch(src.getValue()) {
|
tgt.setValue(convertXPathUsageType(src.getValue()));
|
||||||
case NORMAL:
|
|
||||||
tgt.setValue(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL);
|
|
||||||
break;
|
|
||||||
case PHONETIC:
|
|
||||||
tgt.setValue(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC);
|
|
||||||
break;
|
|
||||||
case NEARBY:
|
|
||||||
tgt.setValue(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY);
|
|
||||||
break;
|
|
||||||
case DISTANCE:
|
|
||||||
tgt.setValue(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE);
|
|
||||||
break;
|
|
||||||
case OTHER:
|
|
||||||
tgt.setValue(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tgt.setValue(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return tgt;
|
return tgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType src) {
|
||||||
|
switch(src) {
|
||||||
|
case NORMAL:
|
||||||
|
return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL;
|
||||||
|
case PHONETIC:
|
||||||
|
return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC;
|
||||||
|
case NEARBY:
|
||||||
|
return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY;
|
||||||
|
case DISTANCE:
|
||||||
|
return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE;
|
||||||
|
case OTHER:
|
||||||
|
return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER;
|
||||||
|
default:
|
||||||
|
return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType> convertXPathUsageType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.SearchParameter.XPathUsageType> src) throws FHIRException {
|
static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.SearchParameter.XPathUsageType> convertXPathUsageType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.SearchParameter.XPathUsageType> src) throws FHIRException {
|
||||||
if (src == null || src.isEmpty())
|
if (src == null || src.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -758,6 +758,10 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public <T extends Resource> T fetchResourceWithException(Class<T> class_, String uri) throws FHIRException {
|
public <T extends Resource> T fetchResourceWithException(Class<T> class_, String uri) throws FHIRException {
|
||||||
|
if (uri == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (class_ == StructureDefinition.class)
|
if (class_ == StructureDefinition.class)
|
||||||
uri = ProfileUtilities.sdNs(uri, getOverrideVersionNs());
|
uri = ProfileUtilities.sdNs(uri, getOverrideVersionNs());
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
|
|
|
@ -3334,12 +3334,14 @@ public class FHIRPathEngine {
|
||||||
Base res = null;
|
Base res = null;
|
||||||
if (s.startsWith("#")) {
|
if (s.startsWith("#")) {
|
||||||
Property p = context.rootResource.getChildByName("contained");
|
Property p = context.rootResource.getChildByName("contained");
|
||||||
|
if (p != null) {
|
||||||
for (Base c : p.getValues()) {
|
for (Base c : p.getValues()) {
|
||||||
if (chompHash(s).equals(chompHash(c.getIdBase()))) {
|
if (chompHash(s).equals(chompHash(c.getIdBase()))) {
|
||||||
res = c;
|
res = c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (hostServices != null) {
|
} else if (hostServices != null) {
|
||||||
res = hostServices.resolveReference(context.appInfo, s, refContext);
|
res = hostServices.resolveReference(context.appInfo, s, refContext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -219,9 +219,9 @@ public class NpmPackage {
|
||||||
}
|
}
|
||||||
loadSubFolders(res, dir.getAbsolutePath(), f);
|
loadSubFolders(res, dir.getAbsolutePath(), f);
|
||||||
} else {
|
} else {
|
||||||
NpmPackageFolder folder = res.new NpmPackageFolder("package/$root");
|
NpmPackageFolder folder = res.new NpmPackageFolder(Utilities.path("package", "$root"));
|
||||||
folder.folder = dir;
|
folder.folder = dir;
|
||||||
res.folders.put("package/$root", folder);
|
res.folders.put(Utilities.path("package", "$root"), folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,9 @@ public class PackageClient {
|
||||||
this.fhirVersion = fhirVersion;
|
this.fhirVersion = fhirVersion;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
if (url == null && id != null && version != null) {
|
||||||
|
url = Utilities.pathURL(address, id, version);
|
||||||
|
}
|
||||||
this.canonical = canonical;
|
this.canonical = canonical;
|
||||||
}
|
}
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
<archive>
|
<archive>
|
||||||
<manifest>
|
<manifest>
|
||||||
<addClasspath>true</addClasspath>
|
<addClasspath>true</addClasspath>
|
||||||
<mainClass>org.hl7.fhir.r5.validation.Validator</mainClass>
|
<mainClass>org.hl7.fhir.validation.Validator</mainClass>
|
||||||
</manifest>
|
</manifest>
|
||||||
</archive>
|
</archive>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -1,228 +0,0 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
|
||||||
|
|
||||||
/*-
|
|
||||||
* #%L
|
|
||||||
* org.hl7.fhir.validation
|
|
||||||
* %%
|
|
||||||
* Copyright (C) 2014 - 2019 Health Level 7
|
|
||||||
* %%
|
|
||||||
* 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.hl7.fhir.exceptions.FHIRException;
|
|
||||||
import org.hl7.fhir.utilities.*;
|
|
||||||
import org.hl7.fhir.utilities.Logger.LogMessageType;
|
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
import org.w3c.dom.ls.LSInput;
|
|
||||||
import org.w3c.dom.ls.LSResourceResolver;
|
|
||||||
import org.xml.sax.ErrorHandler;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
import org.xml.sax.SAXParseException;
|
|
||||||
|
|
||||||
import javax.xml.XMLConstants;
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import javax.xml.transform.stream.StreamSource;
|
|
||||||
import javax.xml.validation.Schema;
|
|
||||||
import javax.xml.validation.SchemaFactory;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class XmlValidator {
|
|
||||||
|
|
||||||
private Schema schema;
|
|
||||||
private Map<String, byte[]> schemas;
|
|
||||||
private Map<String, byte[]> transforms;
|
|
||||||
private List<ValidationMessage> errors;
|
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
public XmlValidator(List<ValidationMessage> errors, Map<String, byte[]> schemas, Map<String, byte[]> transforms) throws FileNotFoundException, IOException, SAXException {
|
|
||||||
this.errors = errors;
|
|
||||||
this.schemas = schemas;
|
|
||||||
this.transforms = transforms;
|
|
||||||
load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public XmlValidator(List<ValidationMessage> validationErrors, String srcDir, String xsltDir, String[] schemaNames) throws FileNotFoundException, IOException, SAXException {
|
|
||||||
loadTransforms(xsltDir);
|
|
||||||
loadSchemas(srcDir, schemaNames);
|
|
||||||
load();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void load() throws SAXException {
|
|
||||||
int c = 0;
|
|
||||||
for (String s : schemas.keySet())
|
|
||||||
if (s.endsWith(".xsd"))
|
|
||||||
c++;
|
|
||||||
StreamSource[] sources = new StreamSource[c];
|
|
||||||
int i = 0;
|
|
||||||
for (String s : schemas.keySet()) {
|
|
||||||
if (s.endsWith(".xsd")) {
|
|
||||||
sources[i] = new StreamSource(new ByteArrayInputStream(schemas.get(s)), s);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
|
||||||
schemaFactory.setErrorHandler(new MyErrorHandler(errors, null));
|
|
||||||
schemaFactory.setResourceResolver(new MyResourceResolver());
|
|
||||||
schema = schemaFactory.newSchema(sources);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadTransforms(String xsltDir) throws FileNotFoundException, IOException {
|
|
||||||
Map<String, byte[]> res = new HashMap<String, byte[]>();
|
|
||||||
for (String s : new File(xsltDir).list()) {
|
|
||||||
if (s.endsWith(".xslt"))
|
|
||||||
res.put(s, TextFile.fileToBytes(Utilities.path(xsltDir, s)));
|
|
||||||
}
|
|
||||||
this.transforms = res;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadSchemas(String dir, String[] names) throws FileNotFoundException, IOException {
|
|
||||||
Map<String, byte[]> res = new HashMap<String, byte[]>();
|
|
||||||
for (String s : new File(dir).list()) {
|
|
||||||
if (s.endsWith(".sch"))
|
|
||||||
res.put(s, TextFile.fileToBytes(Utilities.path(dir, s)));
|
|
||||||
boolean ok = false;
|
|
||||||
for (String b : names)
|
|
||||||
ok = ok || b.equals(s);
|
|
||||||
if (ok)
|
|
||||||
res.put(s, TextFile.fileToBytes(Utilities.path(dir, s)));
|
|
||||||
}
|
|
||||||
this.schemas = res;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element checkBySchema(String fileToCheck, boolean wantThrow) throws FileNotFoundException, SAXException, IOException, ParserConfigurationException, FHIRException {
|
|
||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
|
||||||
factory.setNamespaceAware(true);
|
|
||||||
factory.setValidating(false);
|
|
||||||
factory.setSchema(schema);
|
|
||||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
|
||||||
MyErrorHandler err = new MyErrorHandler(errors, fileToCheck);
|
|
||||||
builder.setErrorHandler(err);
|
|
||||||
CSFileInputStream f = new CSFileInputStream(new CSFile(fileToCheck));
|
|
||||||
Document doc = builder.parse(f);
|
|
||||||
if (wantThrow && err.getErrors().size() > 0)
|
|
||||||
throw new FHIRException("File " + fileToCheck + " failed schema validation");
|
|
||||||
return doc.getDocumentElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkBySchematron(String filename, String sch, boolean wantThrow) throws IOException, ParserConfigurationException, SAXException, FileNotFoundException, FHIRException {
|
|
||||||
DocumentBuilderFactory factory;
|
|
||||||
DocumentBuilder builder;
|
|
||||||
Document doc;
|
|
||||||
byte[] out = null;
|
|
||||||
try {
|
|
||||||
out = XsltUtilities.saxonTransform(transforms, schemas.get(sch), transforms.get("iso_svrl_for_xslt2.xsl"));
|
|
||||||
out = XsltUtilities.saxonTransform(transforms, TextFile.fileToBytes(filename), out);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, -1, -1, filename + ":" + sch, e.getMessage(), IssueSeverity.ERROR));
|
|
||||||
if (wantThrow)
|
|
||||||
throw new FHIRException("Error validating " + filename + " with schematrons", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
factory = DocumentBuilderFactory.newInstance();
|
|
||||||
factory.setNamespaceAware(true);
|
|
||||||
builder = factory.newDocumentBuilder();
|
|
||||||
doc = builder.parse(new ByteArrayInputStream(out));
|
|
||||||
NodeList nl = doc.getDocumentElement().getElementsByTagNameNS("http://purl.oclc.org/dsdl/svrl", "failed-assert");
|
|
||||||
if (nl.getLength() > 0) {
|
|
||||||
logger.log("Schematron Validation Failed for " + filename, LogMessageType.Error);
|
|
||||||
for (int i = 0; i < nl.getLength(); i++) {
|
|
||||||
Element e = (Element) nl.item(i);
|
|
||||||
logger.log(" @" + e.getAttribute("location") + ": " + e.getTextContent(), LogMessageType.Error);
|
|
||||||
errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, -1, -1, filename + ":" + e.getAttribute("location"), e.getTextContent(), IssueSeverity.ERROR));
|
|
||||||
}
|
|
||||||
if (wantThrow)
|
|
||||||
throw new FHIRException("Schematron Validation Failed for " + filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MyErrorHandler implements ErrorHandler {
|
|
||||||
|
|
||||||
private List<String> errors = new ArrayList<String>();
|
|
||||||
private List<ValidationMessage> list;
|
|
||||||
private String path;
|
|
||||||
|
|
||||||
public MyErrorHandler(List<ValidationMessage> list, String path) {
|
|
||||||
this.list = list;
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void error(SAXParseException arg0) throws SAXException {
|
|
||||||
if (list != null)
|
|
||||||
list.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, arg0.getLineNumber(), arg0.getColumnNumber(), path == null ? arg0.getSystemId() : path, arg0.getMessage(), IssueSeverity.ERROR));
|
|
||||||
if (logger != null)
|
|
||||||
logger.log("error: " + arg0.toString(), LogMessageType.Error);
|
|
||||||
errors.add(arg0.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fatalError(SAXParseException arg0) throws SAXException {
|
|
||||||
if (list != null)
|
|
||||||
list.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, arg0.getLineNumber(), arg0.getColumnNumber(), path == null ? arg0.getSystemId() : path, arg0.getMessage(), IssueSeverity.FATAL));
|
|
||||||
if (logger != null)
|
|
||||||
logger.log("fatal error: " + arg0.toString(), LogMessageType.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void warning(SAXParseException arg0) throws SAXException {
|
|
||||||
if (list != null)
|
|
||||||
list.add(new ValidationMessage(Source.InstanceValidator, IssueType.STRUCTURE, arg0.getLineNumber(), arg0.getColumnNumber(), path == null ? arg0.getSystemId() : path, arg0.getMessage(), IssueSeverity.WARNING));
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getErrors() {
|
|
||||||
return errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPath(String path) {
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MyResourceResolver implements LSResourceResolver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LSInput resolveResource(final String type, final String namespaceURI, final String publicId, String systemId, final String baseURI) {
|
|
||||||
try {
|
|
||||||
if (!schemas.containsKey(systemId))
|
|
||||||
return null;
|
|
||||||
return new SchemaInputSource(new ByteArrayInputStream(schemas.get(systemId)), publicId, systemId, namespaceURI);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
package org.hl7.fhir.validation;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* #%L
|
* #%L
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
package org.hl7.fhir.validation;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* #%L
|
* #%L
|
||||||
|
@ -67,7 +67,7 @@ import com.google.gson.JsonObject;
|
||||||
* This class allows you to host the java validator in another service, and use the services it has in a wider context. The way it works is
|
* This class allows you to host the java validator in another service, and use the services it has in a wider context. The way it works is
|
||||||
|
|
||||||
- put the jar in your class path
|
- put the jar in your class path
|
||||||
- Find the class org.hl7.fhir.r5.validation.NativeHostServices or org.hl7.fhir.dstu3.validation.NativeHostServices
|
- Find the class org.hl7.fhir.validation.NativeHostServices
|
||||||
- call init(path) where path refers to one of the definitions files from the main build (e.g. definitions.xml.zip) - required, do only once, do before anything else
|
- call init(path) where path refers to one of the definitions files from the main build (e.g. definitions.xml.zip) - required, do only once, do before anything else
|
||||||
- call load(path) where path refers to the igpack.zip produced by the ig publisher (do this once for each IG you care about)
|
- call load(path) where path refers to the igpack.zip produced by the ig publisher (do this once for each IG you care about)
|
||||||
- call connectToTxSvc(url) where the url is your terminology service of choice (can be http://tx.fhir.org/r4 or /r3)
|
- call connectToTxSvc(url) where the url is your terminology service of choice (can be http://tx.fhir.org/r4 or /r3)
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
package org.hl7.fhir.validation;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.hl7.fhir.convertors.*;
|
import org.hl7.fhir.convertors.*;
|
||||||
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.terminologies.ConceptMapEngine;
|
||||||
import org.hl7.fhir.r5.utils.*;
|
import org.hl7.fhir.r5.utils.*;
|
||||||
import org.hl7.fhir.r5.utils.IResourceValidator.*;
|
import org.hl7.fhir.r5.utils.IResourceValidator.*;
|
||||||
import org.hl7.fhir.r5.utils.StructureMapUtilities.ITransformerServices;
|
import org.hl7.fhir.r5.utils.StructureMapUtilities.ITransformerServices;
|
||||||
import org.hl7.fhir.r5.validation.instancevalidator.InstanceValidator;
|
import org.hl7.fhir.validation.instance.InstanceValidator;
|
||||||
import org.hl7.fhir.utilities.IniFile;
|
import org.hl7.fhir.utilities.IniFile;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
@ -1102,7 +1102,6 @@ public class ValidationEngine implements IValidatorResourceFetcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateXmlSchema(String location, List<ValidationMessage> messages) throws FileNotFoundException, IOException, SAXException {
|
private void validateXmlSchema(String location, List<ValidationMessage> messages) throws FileNotFoundException, IOException, SAXException {
|
||||||
XmlValidator xml = new XmlValidator(messages, loadSchemas(), loadTransforms());
|
|
||||||
messages.add(new ValidationMessage(Source.InstanceValidator, IssueType.INFORMATIONAL, location, "XML Schema Validation is not done yet", IssueSeverity.INFORMATION));
|
messages.add(new ValidationMessage(Source.InstanceValidator, IssueType.INFORMATIONAL, location, "XML Schema Validation is not done yet", IssueSeverity.INFORMATION));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
package org.hl7.fhir.validation;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* #%L
|
* #%L
|
||||||
|
@ -49,13 +49,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -85,14 +80,13 @@ import org.hl7.fhir.r5.model.Resource;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.utils.KeyGenerator;
|
import org.hl7.fhir.r5.utils.KeyGenerator;
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r5.validation.ValidationEngine.ScanOutputItem;
|
import org.hl7.fhir.validation.ValidationEngine.ScanOutputItem;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.VersionUtilities;
|
import org.hl7.fhir.utilities.VersionUtilities;
|
||||||
import org.hl7.fhir.utilities.cache.PackageCacheManager;
|
import org.hl7.fhir.utilities.cache.PackageCacheManager;
|
||||||
import org.hl7.fhir.utilities.cache.ToolsVersion;
|
import org.hl7.fhir.utilities.cache.ToolsVersion;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A executable class that will validate one or more FHIR resources against
|
* A executable class that will validate one or more FHIR resources against
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
package org.hl7.fhir.validation;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
package org.hl7.fhir.validation;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -16,7 +16,6 @@ import org.hl7.fhir.r5.model.StructureDefinition.ExtensionContextType;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule;
|
||||||
import org.hl7.fhir.r5.model.UriType;
|
import org.hl7.fhir.r5.model.UriType;
|
||||||
import org.hl7.fhir.r5.validation.XVerExtensionManager.XVerExtensionStatus;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.VersionUtilities;
|
import org.hl7.fhir.utilities.VersionUtilities;
|
||||||
import org.hl7.fhir.utilities.json.JsonTrackingParser;
|
import org.hl7.fhir.utilities.json.JsonTrackingParser;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
package org.hl7.fhir.validation.codesystem;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* #%L
|
* #%L
|
||||||
|
@ -30,6 +30,7 @@ import org.hl7.fhir.r5.model.CodeSystem;
|
||||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||||
|
import org.hl7.fhir.validation.BaseValidator;
|
||||||
|
|
||||||
public class CodeSystemValidator extends BaseValidator {
|
public class CodeSystemValidator extends BaseValidator {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
package org.hl7.fhir.validation.instance;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* #%L
|
* #%L
|
||||||
|
@ -28,14 +28,13 @@ import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.model.*;
|
import org.hl7.fhir.r5.model.*;
|
||||||
import org.hl7.fhir.r5.model.Questionnaire.*;
|
import org.hl7.fhir.r5.model.Questionnaire.*;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.validation.instancevalidator.utils.ValidatorHostContext;
|
import org.hl7.fhir.validation.instance.utils.ValidatorHostContext;
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates Questionnaire.item.enableWhen against a QuestionnaireResponse.
|
* Evaluates Questionnaire.item.enableWhen against a QuestionnaireResponse.
|
||||||
* Ignores possible modifierExtensions and extensions.
|
* Ignores possible modifierExtensions and extensions.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class EnableWhenEvaluator {
|
public class EnableWhenEvaluator {
|
||||||
public static final String LINKID_ELEMENT = "linkId";
|
public static final String LINKID_ELEMENT = "linkId";
|
||||||
|
@ -52,14 +51,17 @@ public class EnableWhenEvaluator {
|
||||||
this.q = q;
|
this.q = q;
|
||||||
this.a = a;
|
this.a = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuestionnaireItemComponent getQ() {
|
public QuestionnaireItemComponent getQ() {
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Element getA() {
|
public Element getA() {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class QStack extends ArrayList<QuestionnaireAnswerPair> {
|
public static class QStack extends ArrayList<QuestionnaireAnswerPair> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -98,14 +100,8 @@ public class EnableWhenEvaluator {
|
||||||
/**
|
/**
|
||||||
* Evaluation result of enableWhen condition
|
* Evaluation result of enableWhen condition
|
||||||
*
|
*
|
||||||
* @param enabled
|
* @param enabled Evaluation result
|
||||||
* Evaluation result
|
* @param enableWhenCondition Evaluated enableWhen condition
|
||||||
* @param linkId
|
|
||||||
* LinkId of the questionnaire item
|
|
||||||
* @param enableWhenCondition
|
|
||||||
* Evaluated enableWhen condition
|
|
||||||
* @param responseItem
|
|
||||||
* item in QuestionnaireResponse
|
|
||||||
*/
|
*/
|
||||||
public EnableWhenResult(boolean enabled, QuestionnaireItemEnableWhenComponent enableWhenCondition) {
|
public EnableWhenResult(boolean enabled, QuestionnaireItemEnableWhenComponent enableWhenCondition) {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
|
@ -120,17 +116,13 @@ public class EnableWhenEvaluator {
|
||||||
return enableWhenCondition;
|
return enableWhenCondition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the stack contains a set of QR items that represent the tree of the QR being validated, each tagged with the definition of the item from the Q for the QR being validated
|
* the stack contains a set of QR items that represent the tree of the QR being validated, each tagged with the definition of the item from the Q for the QR being validated
|
||||||
*
|
* <p>
|
||||||
* the itembeing validated is in the context of the stack. For root items, the stack is empty.
|
* the itembeing validated is in the context of the stack. For root items, the stack is empty.
|
||||||
*
|
* <p>
|
||||||
* The context Questionnaire and QuestionnaireResponse are always available
|
* The context Questionnaire and QuestionnaireResponse are always available
|
||||||
*
|
|
||||||
* @param questionnaireItem
|
|
||||||
* @param questionnaireResponse
|
|
||||||
* @param qstack
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public boolean isQuestionEnabled(ValidatorHostContext hostContext, QuestionnaireItemComponent qitem, QStack qstack, FHIRPathEngine engine) {
|
public boolean isQuestionEnabled(ValidatorHostContext hostContext, QuestionnaireItemComponent qitem, QStack qstack, FHIRPathEngine engine) {
|
||||||
if (hasExpressionExtension(qitem)) {
|
if (hasExpressionExtension(qitem)) {
|
||||||
|
@ -174,7 +166,8 @@ public class EnableWhenEvaluator {
|
||||||
public boolean checkConditionResults(List<EnableWhenResult> evaluationResults, QuestionnaireItemComponent questionnaireItem) {
|
public boolean checkConditionResults(List<EnableWhenResult> evaluationResults, QuestionnaireItemComponent questionnaireItem) {
|
||||||
if ((questionnaireItem.hasEnableBehavior() && questionnaireItem.getEnableBehavior() == EnableWhenBehavior.ANY) || evaluationResults.size() == 1) {
|
if ((questionnaireItem.hasEnableBehavior() && questionnaireItem.getEnableBehavior() == EnableWhenBehavior.ANY) || evaluationResults.size() == 1) {
|
||||||
return evaluationResults.stream().anyMatch(EnableWhenResult::isEnabled);
|
return evaluationResults.stream().anyMatch(EnableWhenResult::isEnabled);
|
||||||
} if (questionnaireItem.hasEnableBehavior() && questionnaireItem.getEnableBehavior() == EnableWhenBehavior.ALL){
|
}
|
||||||
|
if (questionnaireItem.hasEnableBehavior() && questionnaireItem.getEnableBehavior() == EnableWhenBehavior.ALL) {
|
||||||
return evaluationResults.stream().allMatch(EnableWhenResult::isEnabled);
|
return evaluationResults.stream().allMatch(EnableWhenResult::isEnabled);
|
||||||
}
|
}
|
||||||
//TODO: Throw exception? enableBehavior is mandatory when there are multiple conditions
|
//TODO: Throw exception? enableBehavior is mandatory when there are multiple conditions
|
||||||
|
@ -289,13 +282,13 @@ public class EnableWhenEvaluator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively look for answers to questions with the given link id, working upwards given the context
|
* Recursively look for answers to questions with the given link id, working upwards given the context
|
||||||
*
|
* <p>
|
||||||
* For discussion about this, see https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/enable-when
|
* For discussion about this, see https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/enable-when
|
||||||
*
|
* <p>
|
||||||
- given sourceQ - question that contains the enableWhen reference and targetQ - question that the enableWhen references in the Q and also sourceA - answer for sourceQ and targetA - answer for targetQ in the QR
|
* - given sourceQ - question that contains the enableWhen reference and targetQ - question that the enableWhen references in the Q and also sourceA - answer for sourceQ and targetA - answer for targetQ in the QR
|
||||||
- work up from sourceQ until you find the Q group that also contains targetQ - this is groupQ
|
* - work up from sourceQ until you find the Q group that also contains targetQ - this is groupQ
|
||||||
- work up from sourceA until you find the QR group that matches groupQ - this is groupA
|
* - work up from sourceA until you find the QR group that matches groupQ - this is groupA
|
||||||
- any targetA in groupA are input for the enableWhen decision
|
* - any targetA in groupA are input for the enableWhen decision
|
||||||
*/
|
*/
|
||||||
private List<Element> findQuestionAnswers(QStack qstack, QuestionnaireItemComponent sourceQ, QuestionnaireItemEnableWhenComponent ew) {
|
private List<Element> findQuestionAnswers(QStack qstack, QuestionnaireItemComponent sourceQ, QuestionnaireItemEnableWhenComponent ew) {
|
||||||
QuestionnaireItemComponent targetQ = qstack.getQ().getQuestion(ew.getQuestion());
|
QuestionnaireItemComponent targetQ = qstack.getQ().getQuestion(ew.getQuestion());
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation.instancevalidator;
|
package org.hl7.fhir.validation.instance;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* #%L
|
* #%L
|
||||||
|
@ -126,11 +126,9 @@ import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||||
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
||||||
import org.hl7.fhir.r5.utils.IResourceValidator;
|
import org.hl7.fhir.r5.utils.IResourceValidator;
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.r5.validation.BaseValidator;
|
import org.hl7.fhir.validation.BaseValidator;
|
||||||
import org.hl7.fhir.r5.validation.EnableWhenEvaluator;
|
import org.hl7.fhir.validation.instance.EnableWhenEvaluator.QStack;
|
||||||
import org.hl7.fhir.r5.validation.EnableWhenEvaluator.QStack;
|
import org.hl7.fhir.validation.XVerExtensionManager;
|
||||||
import org.hl7.fhir.r5.validation.XVerExtensionManager;
|
|
||||||
import org.hl7.fhir.r5.validation.instancevalidator.utils.*;
|
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.Utilities.DecimalStatus;
|
import org.hl7.fhir.utilities.Utilities.DecimalStatus;
|
||||||
|
@ -142,6 +140,7 @@ import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
||||||
import org.hl7.fhir.utilities.xhtml.NodeType;
|
import org.hl7.fhir.utilities.xhtml.NodeType;
|
||||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||||
|
import org.hl7.fhir.validation.instance.utils.*;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
@ -152,7 +151,7 @@ import ca.uhn.fhir.util.ObjectUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thinking of using this in a java program? Don't!
|
* Thinking of using this in a java program? Don't!
|
||||||
* You should use one of the wrappers instead. Either in HAPI, or use ValidationEngine
|
* You should use one of the wrappers instead. Either in HAPI, or use ValidationEngine, or NativeHostServices
|
||||||
* <p>
|
* <p>
|
||||||
* Validation todo:
|
* Validation todo:
|
||||||
* - support @default slices
|
* - support @default slices
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation.instancevalidator;
|
package org.hl7.fhir.validation.instance;
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.hl7.fhir.r5.validation.instancevalidator.utils;
|
package org.hl7.fhir.validation.instance.utils;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.validation.instancevalidator.InstanceValidator;
|
import org.hl7.fhir.validation.instance.InstanceValidator;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
|
||||||
public class ChildIterator {
|
public class ChildIterator {
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation.instancevalidator.utils;
|
package org.hl7.fhir.validation.instance.utils;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
|
@ -1,7 +1,6 @@
|
||||||
package org.hl7.fhir.r5.validation.instancevalidator.utils;
|
package org.hl7.fhir.validation.instance.utils;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.validation.instancevalidator.InstanceValidator;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation.instancevalidator.utils;
|
package org.hl7.fhir.validation.instance.utils;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.hl7.fhir.r5.validation.instancevalidator.utils;
|
package org.hl7.fhir.validation.instance.utils;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.validation.instancevalidator.InstanceValidator;
|
import org.hl7.fhir.validation.instance.InstanceValidator;
|
||||||
|
|
||||||
public class ResolvedReference {
|
public class ResolvedReference {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation.instancevalidator.utils;
|
package org.hl7.fhir.validation.instance.utils;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation.instancevalidator.utils;
|
package org.hl7.fhir.validation.instance.utils;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Element;
|
import org.hl7.fhir.r5.elementmodel.Element;
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.hl7.fhir.r5.validation;
|
package org.hl7.fhir.validation.profile;
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* #%L
|
* #%L
|
||||||
|
@ -20,7 +20,6 @@ package org.hl7.fhir.r5.validation;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -34,6 +33,7 @@ import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||||
|
import org.hl7.fhir.validation.BaseValidator;
|
||||||
|
|
||||||
public class ProfileValidator extends BaseValidator {
|
public class ProfileValidator extends BaseValidator {
|
||||||
|
|
|
@ -2,8 +2,7 @@ package org.hl7.fhir.validation.tests;
|
||||||
|
|
||||||
import org.hl7.fhir.r4.context.SimpleWorkerContext;
|
import org.hl7.fhir.r4.context.SimpleWorkerContext;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.validation.Validator;
|
import org.hl7.fhir.validation.Validator;
|
||||||
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class CDAValidationTestCase {
|
public class CDAValidationTestCase {
|
||||||
|
|
|
@ -2,9 +2,7 @@ package org.hl7.fhir.validation.tests;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.validation.NativeHostServices;
|
import org.hl7.fhir.validation.NativeHostServices;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
|
||||||
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class NativeHostServiceTester {
|
public class NativeHostServiceTester {
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
package org.hl7.fhir.validation.tests;
|
package org.hl7.fhir.validation.tests;
|
||||||
|
|
||||||
import java.awt.Desktop;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.hl7.fhir.r5.conformance.ProfileComparer;
|
import org.hl7.fhir.r5.conformance.ProfileComparer;
|
||||||
import org.hl7.fhir.r5.model.FhirPublication;
|
import org.hl7.fhir.r5.model.FhirPublication;
|
||||||
import org.hl7.fhir.r5.model.OperationOutcome;
|
|
||||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||||
import org.hl7.fhir.r5.utils.KeyGenerator;
|
import org.hl7.fhir.r5.utils.KeyGenerator;
|
||||||
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
|
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.validation.ValidationEngine;
|
import org.hl7.fhir.validation.ValidationEngine;
|
||||||
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
|
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class ProfileComparisonTests {
|
public class ProfileComparisonTests {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.hl7.fhir.validation.tests;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.hl7.fhir.r4.test.utils.TestingUtilities;
|
import org.hl7.fhir.r4.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.validation.Validator;
|
import org.hl7.fhir.validation.Validator;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.hl7.fhir.validation.tests;
|
package org.hl7.fhir.validation.tests;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -10,8 +9,7 @@ import org.hl7.fhir.r5.model.OperationOutcome;
|
||||||
import org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity;
|
import org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity;
|
||||||
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
|
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
|
||||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
import org.hl7.fhir.r5.validation.ValidationEngine;
|
import org.hl7.fhir.validation.ValidationEngine;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
|
||||||
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
|
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
|
@ -26,8 +26,8 @@ import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
|
||||||
import org.hl7.fhir.r5.utils.IResourceValidator;
|
import org.hl7.fhir.r5.utils.IResourceValidator;
|
||||||
import org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher;
|
import org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher;
|
||||||
import org.hl7.fhir.r5.utils.IResourceValidator.ReferenceValidationPolicy;
|
import org.hl7.fhir.r5.utils.IResourceValidator.ReferenceValidationPolicy;
|
||||||
import org.hl7.fhir.r5.validation.instancevalidator.InstanceValidator;
|
import org.hl7.fhir.validation.instance.InstanceValidator;
|
||||||
import org.hl7.fhir.r5.validation.ValidationEngine;
|
import org.hl7.fhir.validation.ValidationEngine;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
import org.hl7.fhir.utilities.VersionUtilities;
|
import org.hl7.fhir.utilities.VersionUtilities;
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
each other. It is fine to bump the point version of this POM without affecting
|
each other. It is fine to bump the point version of this POM without affecting
|
||||||
HAPI FHIR.
|
HAPI FHIR.
|
||||||
-->
|
-->
|
||||||
<version>4.2.1-SNAPSHOT</version>
|
<version>4.2.3-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<hapi_fhir_version>4.2.0</hapi_fhir_version>
|
<hapi_fhir_version>4.2.0</hapi_fhir_version>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
set oldver=4.1.63
|
set oldver=4.2.2
|
||||||
set newver=4.2.1
|
set newver=4.2.3
|
||||||
|
|
||||||
echo ..
|
echo ..
|
||||||
echo =========================================================================
|
echo =========================================================================
|
||||||
|
|
Loading…
Reference in New Issue