Merge remote-tracking branch 'remotes/origin/master' into ks-in-memory-date-compare
# Conflicts: # src/changes/changes.xml
This commit is contained in:
commit
7cfbf710fe
|
@ -182,4 +182,13 @@ public class TestUtil {
|
||||||
return defaultString(theString).replace("\r", "");
|
return defaultString(theString).replace("\r", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b>THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODE</b>
|
||||||
|
* <p>
|
||||||
|
* Strip \r chars from a string to account for line ending platform differences
|
||||||
|
*/
|
||||||
|
public static String stripWhitespace(String theString) {
|
||||||
|
return stripReturns(theString).replace(" ", "");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class TermValueSetConceptDesignation implements Serializable {
|
||||||
@JoinColumn(name = "VALUESET_CONCEPT_PID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_TRM_VALUESET_CONCEPT_PID"))
|
@JoinColumn(name = "VALUESET_CONCEPT_PID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_TRM_VALUESET_CONCEPT_PID"))
|
||||||
private TermValueSetConcept myConcept;
|
private TermValueSetConcept myConcept;
|
||||||
|
|
||||||
@ManyToOne()
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "VALUESET_PID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_TRM_VSCD_VS_PID"))
|
@JoinColumn(name = "VALUESET_PID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_TRM_VSCD_VS_PID"))
|
||||||
private TermValueSet myValueSet;
|
private TermValueSet myValueSet;
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,11 @@ import static org.hamcrest.Matchers.startsWith;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
public class GraphQLR4ProviderTest {
|
public class JpaGraphQLR4ProviderTest {
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GraphQLR4ProviderTest.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JpaGraphQLR4ProviderTest.class);
|
||||||
|
public static final String DATA_PREFIX = "{\"data\": ";
|
||||||
|
public static final String DATA_SUFFIX = "}";
|
||||||
private static CloseableHttpClient ourClient;
|
private static CloseableHttpClient ourClient;
|
||||||
private static FhirContext ourCtx = FhirContext.forR4();
|
private static FhirContext ourCtx = FhirContext.forR4();
|
||||||
private static int ourPort;
|
private static int ourPort;
|
||||||
|
@ -67,14 +69,14 @@ public class GraphQLR4ProviderTest {
|
||||||
ourLog.info(responseContent);
|
ourLog.info(responseContent);
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
assertEquals(TestUtil.stripReturns("{\n" +
|
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" +
|
||||||
" \"name\":[{\n" +
|
" \"name\":[{\n" +
|
||||||
" \"family\":\"FAMILY\",\n" +
|
" \"family\":\"FAMILY\",\n" +
|
||||||
" \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" +
|
" \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" +
|
||||||
" },{\n" +
|
" },{\n" +
|
||||||
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
|
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
"}"), TestUtil.stripReturns(responseContent));
|
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(responseContent));
|
||||||
assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json"));
|
assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json"));
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -93,12 +95,12 @@ public class GraphQLR4ProviderTest {
|
||||||
ourLog.info(responseContent);
|
ourLog.info(responseContent);
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
assertEquals(TestUtil.stripReturns("{\n" +
|
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" +
|
||||||
" \"name\":[{\n" +
|
" \"name\":[{\n" +
|
||||||
" \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" +
|
" \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" +
|
||||||
" \"family\":\"FAMILY\"\n" +
|
" \"family\":\"FAMILY\"\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
"}"), TestUtil.stripReturns(responseContent));
|
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(responseContent));
|
||||||
assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json"));
|
assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json"));
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -117,7 +119,7 @@ public class GraphQLR4ProviderTest {
|
||||||
ourLog.info(responseContent);
|
ourLog.info(responseContent);
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
assertEquals(TestUtil.stripReturns("{\n" +
|
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" +
|
||||||
" \"Patient\":{\n" +
|
" \"Patient\":{\n" +
|
||||||
" \"name\":[{\n" +
|
" \"name\":[{\n" +
|
||||||
" \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" +
|
" \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" +
|
||||||
|
@ -126,7 +128,7 @@ public class GraphQLR4ProviderTest {
|
||||||
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
|
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
"}"), TestUtil.stripReturns(responseContent));
|
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(responseContent));
|
||||||
assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json"));
|
assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json"));
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -145,7 +147,7 @@ public class GraphQLR4ProviderTest {
|
||||||
ourLog.info(responseContent);
|
ourLog.info(responseContent);
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
assertEquals(TestUtil.stripReturns("{\n" +
|
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" +
|
||||||
" \"PatientList\":[{\n" +
|
" \"PatientList\":[{\n" +
|
||||||
" \"name\":[{\n" +
|
" \"name\":[{\n" +
|
||||||
" \"family\":\"pet\",\n" +
|
" \"family\":\"pet\",\n" +
|
||||||
|
@ -158,7 +160,7 @@ public class GraphQLR4ProviderTest {
|
||||||
" \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" +
|
" \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
"}"), TestUtil.stripReturns(responseContent));
|
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(responseContent));
|
||||||
assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json"));
|
assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json"));
|
||||||
|
|
||||||
} finally {
|
} finally {
|
|
@ -5,8 +5,8 @@ import ca.uhn.fhir.util.UrlUtil;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
|
||||||
import org.hl7.fhir.dstu3.model.Patient;
|
import org.hl7.fhir.dstu3.model.Patient;
|
||||||
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -14,6 +14,8 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import static ca.uhn.fhir.jpa.provider.JpaGraphQLR4ProviderTest.DATA_PREFIX;
|
||||||
|
import static ca.uhn.fhir.jpa.provider.JpaGraphQLR4ProviderTest.DATA_SUFFIX;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
|
@ -30,14 +32,14 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
|
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
|
||||||
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||||
ourLog.info(resp);
|
ourLog.info(resp);
|
||||||
assertEquals(TestUtil.stripReturns("{\n" +
|
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX +"{\n" +
|
||||||
" \"name\":[{\n" +
|
" \"name\":[{\n" +
|
||||||
" \"family\":\"FAM\",\n" +
|
" \"family\":\"FAM\",\n" +
|
||||||
" \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" +
|
" \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" +
|
||||||
" },{\n" +
|
" },{\n" +
|
||||||
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
|
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
"}"), TestUtil.stripReturns(resp));
|
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -52,7 +54,7 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
|
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
|
||||||
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||||
ourLog.info(resp);
|
ourLog.info(resp);
|
||||||
assertEquals(TestUtil.stripReturns("{\n" +
|
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX +"{\n" +
|
||||||
" \"PatientList\":[{\n" +
|
" \"PatientList\":[{\n" +
|
||||||
" \"name\":[{\n" +
|
" \"name\":[{\n" +
|
||||||
" \"family\":\"FAM\",\n" +
|
" \"family\":\"FAM\",\n" +
|
||||||
|
@ -65,7 +67,7 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
" \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" +
|
" \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
"}"), TestUtil.stripReturns(resp));
|
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import static ca.uhn.fhir.jpa.provider.JpaGraphQLR4ProviderTest.DATA_PREFIX;
|
||||||
|
import static ca.uhn.fhir.jpa.provider.JpaGraphQLR4ProviderTest.DATA_SUFFIX;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class GraphQLProviderR4Test extends BaseResourceProviderR4Test {
|
public class GraphQLProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
|
@ -30,14 +32,14 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
|
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
|
||||||
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||||
ourLog.info(resp);
|
ourLog.info(resp);
|
||||||
assertEquals(TestUtil.stripReturns("{\n" +
|
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" +
|
||||||
" \"name\":[{\n" +
|
" \"name\":[{\n" +
|
||||||
" \"family\":\"FAM\",\n" +
|
" \"family\":\"FAM\",\n" +
|
||||||
" \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" +
|
" \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" +
|
||||||
" },{\n" +
|
" },{\n" +
|
||||||
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
|
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
"}"), TestUtil.stripReturns(resp));
|
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -52,7 +54,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
|
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
|
||||||
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||||
ourLog.info(resp);
|
ourLog.info(resp);
|
||||||
assertEquals(TestUtil.stripReturns("{\n" +
|
assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" +
|
||||||
" \"PatientList\":[{\n" +
|
" \"PatientList\":[{\n" +
|
||||||
" \"name\":[{\n" +
|
" \"name\":[{\n" +
|
||||||
" \"family\":\"FAM\",\n" +
|
" \"family\":\"FAM\",\n" +
|
||||||
|
@ -65,7 +67,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
" \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" +
|
" \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
" }]\n" +
|
" }]\n" +
|
||||||
"}"), TestUtil.stripReturns(resp));
|
"}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -877,6 +877,11 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements
|
||||||
public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException {
|
public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ValueSet resolveValueSet(Object appContext, String url) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T extends Enum<?>> String extractSystem(Enumeration<T> theBoundCode) {
|
private static <T extends Enum<?>> String extractSystem(Enumeration<T> theBoundCode) {
|
||||||
|
|
|
@ -29,8 +29,6 @@ public class InMemoryResourceMatcherTest {
|
||||||
public static final String OBS_DATE = "1970-10-17";
|
public static final String OBS_DATE = "1970-10-17";
|
||||||
private static final String EARLY_DATE = "1965-08-09";
|
private static final String EARLY_DATE = "1965-08-09";
|
||||||
private static final String LATE_DATE = "2000-06-29";
|
private static final String LATE_DATE = "2000-06-29";
|
||||||
// FIXME KHS move this
|
|
||||||
private static final String NOW = "NOW";
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private
|
private
|
||||||
|
@ -71,29 +69,29 @@ public class InMemoryResourceMatcherTest {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnsupportedOps() {
|
public void testDateUnsupportedOps() {
|
||||||
testUnsupportedOp(ParamPrefixEnum.APPROXIMATE);
|
testDateUnsupportedOp(ParamPrefixEnum.APPROXIMATE);
|
||||||
testUnsupportedOp(ParamPrefixEnum.STARTS_AFTER);
|
testDateUnsupportedOp(ParamPrefixEnum.STARTS_AFTER);
|
||||||
testUnsupportedOp(ParamPrefixEnum.ENDS_BEFORE);
|
testDateUnsupportedOp(ParamPrefixEnum.ENDS_BEFORE);
|
||||||
testUnsupportedOp(ParamPrefixEnum.NOT_EQUAL);
|
testDateUnsupportedOp(ParamPrefixEnum.NOT_EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testUnsupportedOp(ParamPrefixEnum theOperator) {
|
private void testDateUnsupportedOp(ParamPrefixEnum theOperator) {
|
||||||
InMemoryMatchResult result = myInMemoryResourceMatcher.match("date=" + theOperator.getValue() + OBS_DATE, myObservation, mySearchParams);
|
InMemoryMatchResult result = myInMemoryResourceMatcher.match("date=" + theOperator.getValue() + OBS_DATE, myObservation, mySearchParams);
|
||||||
assertFalse(result.supported());
|
assertFalse(result.supported());
|
||||||
assertEquals("Parameter: <date> Reason: The prefix " + theOperator + " is not supported for param type DATE", result.getUnsupportedReason());
|
assertEquals("Parameter: <date> Reason: The prefix " + theOperator + " is not supported for param type DATE", result.getUnsupportedReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSupportedOps() {
|
public void testDateSupportedOps() {
|
||||||
testSupportedOp(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, true, true, false);
|
testDateSupportedOp(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, true, true, false);
|
||||||
testSupportedOp(ParamPrefixEnum.GREATERTHAN, true, false, false);
|
testDateSupportedOp(ParamPrefixEnum.GREATERTHAN, true, false, false);
|
||||||
testSupportedOp(ParamPrefixEnum.EQUAL, false, true, false);
|
testDateSupportedOp(ParamPrefixEnum.EQUAL, false, true, false);
|
||||||
testSupportedOp(ParamPrefixEnum.LESSTHAN_OR_EQUALS, false, true, true);
|
testDateSupportedOp(ParamPrefixEnum.LESSTHAN_OR_EQUALS, false, true, true);
|
||||||
testSupportedOp(ParamPrefixEnum.LESSTHAN, false, false, true);
|
testDateSupportedOp(ParamPrefixEnum.LESSTHAN, false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testSupportedOp(ParamPrefixEnum theOperator, boolean theEarly, boolean theSame, boolean theLater) {
|
private void testDateSupportedOp(ParamPrefixEnum theOperator, boolean theEarly, boolean theSame, boolean theLater) {
|
||||||
String equation = "date=" + theOperator.getValue();
|
String equation = "date=" + theOperator.getValue();
|
||||||
{
|
{
|
||||||
InMemoryMatchResult result = myInMemoryResourceMatcher.match(equation + EARLY_DATE, myObservation, mySearchParams);
|
InMemoryMatchResult result = myInMemoryResourceMatcher.match(equation + EARLY_DATE, myObservation, mySearchParams);
|
||||||
|
|
|
@ -336,6 +336,18 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
||||||
expandedValueSet = new ValueSetExpansionOutcome(expansion);
|
expandedValueSet = new ValueSetExpansionOutcome(expansion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We'll just accept all mimetypes, since this is pretty much impossible to exhaustively
|
||||||
|
* validate.
|
||||||
|
*/
|
||||||
|
if (theVs != null && "http://hl7.org/fhir/ValueSet/mimetypes".equals(theVs.getUrl())) {
|
||||||
|
ConceptDefinitionComponent definition = new ConceptDefinitionComponent();
|
||||||
|
definition.setCode(wantCode);
|
||||||
|
definition.setDisplay(wantCode);
|
||||||
|
ValidationResult retVal = new ValidationResult(definition);
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
if (expandedValueSet == null) {
|
if (expandedValueSet == null) {
|
||||||
expandedValueSet = expand(theVs, null);
|
expandedValueSet = expand(theVs, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,6 +389,11 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLinkForUrl(String corePath, String url) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTypeNames() {
|
public List<String> getTypeNames() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|
|
@ -6,7 +6,10 @@ import org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport;
|
||||||
import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext;
|
import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext;
|
||||||
import org.hl7.fhir.r4.model.*;
|
import org.hl7.fhir.r4.model.*;
|
||||||
import org.hl7.fhir.r4.utils.GraphQLEngine;
|
import org.hl7.fhir.r4.utils.GraphQLEngine;
|
||||||
import org.hl7.fhir.utilities.graphql.*;
|
import org.hl7.fhir.utilities.graphql.EGraphEngine;
|
||||||
|
import org.hl7.fhir.utilities.graphql.EGraphQLException;
|
||||||
|
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
|
||||||
|
import org.hl7.fhir.utilities.graphql.Parser;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
|
@ -66,7 +69,8 @@ public class GraphQLEngineTest {
|
||||||
engine.setGraphQL(Parser.parse("{valueQuantity{value,unit}}"));
|
engine.setGraphQL(Parser.parse("{valueQuantity{value,unit}}"));
|
||||||
engine.execute();
|
engine.execute();
|
||||||
|
|
||||||
ObjectValue output = engine.getOutput();
|
GraphQLResponse output = engine.getOutput();
|
||||||
|
output.setWriteWrapper(false);
|
||||||
StringBuilder outputBuilder = new StringBuilder();
|
StringBuilder outputBuilder = new StringBuilder();
|
||||||
output.write(outputBuilder, 0, "\n");
|
output.write(outputBuilder, 0, "\n");
|
||||||
|
|
||||||
|
@ -100,7 +104,8 @@ public class GraphQLEngineTest {
|
||||||
engine.setServices(createStorageServices());
|
engine.setServices(createStorageServices());
|
||||||
engine.execute();
|
engine.execute();
|
||||||
|
|
||||||
ObjectValue output = engine.getOutput();
|
GraphQLResponse output = engine.getOutput();
|
||||||
|
output.setWriteWrapper(false);
|
||||||
StringBuilder outputBuilder = new StringBuilder();
|
StringBuilder outputBuilder = new StringBuilder();
|
||||||
output.write(outputBuilder, 0, "\n");
|
output.write(outputBuilder, 0, "\n");
|
||||||
|
|
||||||
|
|
|
@ -438,4 +438,9 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLinkForUrl(String corePath, String url) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import ca.uhn.fhir.validation.IValidationContext;
|
import ca.uhn.fhir.validation.IValidationContext;
|
||||||
import ca.uhn.fhir.validation.IValidatorModule;
|
import ca.uhn.fhir.validation.IValidatorModule;
|
||||||
import com.github.benmanes.caffeine.cache.CacheLoader;
|
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
@ -339,6 +338,11 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLinkForUrl(String corePath, String url) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition p) throws FHIRException {
|
public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition p) throws FHIRException {
|
||||||
// nothing yet
|
// nothing yet
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
package org.hl7.fhir.instance.hapi.validation;
|
package org.hl7.fhir.instance.hapi.validation;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
import ca.uhn.fhir.context.*;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
|
|
||||||
import ca.uhn.fhir.context.ConfigurationException;
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
|
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import ca.uhn.fhir.validation.IValidationContext;
|
import ca.uhn.fhir.validation.IValidationContext;
|
||||||
|
@ -14,11 +8,7 @@ import ca.uhn.fhir.validation.IValidatorModule;
|
||||||
import com.github.benmanes.caffeine.cache.CacheLoader;
|
import com.github.benmanes.caffeine.cache.CacheLoader;
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.*;
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
@ -27,16 +17,10 @@ import org.fhir.ucum.UcumService;
|
||||||
import org.hl7.fhir.convertors.NullVersionConverterAdvisor50;
|
import org.hl7.fhir.convertors.NullVersionConverterAdvisor50;
|
||||||
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
|
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
|
||||||
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
||||||
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
import org.hl7.fhir.dstu2.model.*;
|
||||||
import org.hl7.fhir.exceptions.DefinitionException;
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.TerminologyServiceException;
|
import org.hl7.fhir.exceptions.TerminologyServiceException;
|
||||||
import org.hl7.fhir.dstu2.model.CodeableConcept;
|
|
||||||
import org.hl7.fhir.dstu2.model.Coding;
|
|
||||||
import org.hl7.fhir.dstu2.model.Questionnaire;
|
|
||||||
import org.hl7.fhir.dstu2.model.Resource;
|
|
||||||
import org.hl7.fhir.dstu2.model.StructureDefinition;
|
|
||||||
import org.hl7.fhir.dstu2.model.ValueSet;
|
|
||||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||||
import org.hl7.fhir.r5.formats.IParser;
|
import org.hl7.fhir.r5.formats.IParser;
|
||||||
import org.hl7.fhir.r5.formats.ParserType;
|
import org.hl7.fhir.r5.formats.ParserType;
|
||||||
|
@ -58,20 +42,17 @@ import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
|
|
||||||
public class FhirInstanceValidator extends BaseValidatorBridge implements IValidatorModule {
|
public class FhirInstanceValidator extends BaseValidatorBridge implements IValidatorModule {
|
||||||
|
|
||||||
|
@ -522,6 +503,11 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLinkForUrl(String corePath, String url) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Parameters getExpansionParameters() {
|
public Parameters getExpansionParameters() {
|
||||||
return myExpansionProfile;
|
return myExpansionProfile;
|
||||||
|
|
|
@ -30,9 +30,6 @@ import org.hl7.fhir.utilities.TerminologyServiceOptions;
|
||||||
import org.hl7.fhir.utilities.TranslationServices;
|
import org.hl7.fhir.utilities.TranslationServices;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -669,6 +666,11 @@ public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseV
|
||||||
return convertValidationResult(result);
|
return convertValidationResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLinkForUrl(String corePath, String url) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ResourceKey {
|
private static class ResourceKey {
|
||||||
|
|
|
@ -145,6 +145,12 @@ public class SnapshotGeneratingValidationSupport implements IValidationSupport {
|
||||||
public boolean prependLinks() {
|
public boolean prependLinks() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLinkForUrl(String corePath, String url) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,6 +282,11 @@ public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseV
|
||||||
// nothing yet
|
// nothing yet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLinkForUrl(String corePath, String url) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.hl7.fhir.r5.model.Parameters getExpansionParameters() {
|
public org.hl7.fhir.r5.model.Parameters getExpansionParameters() {
|
||||||
return myExpansionProfile;
|
return myExpansionProfile;
|
||||||
|
|
|
@ -131,6 +131,11 @@ public class SnapshotGeneratingValidationSupport implements IValidationSupport {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLinkForUrl(String corePath, String url) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BindingResolution resolveBinding(StructureDefinition def, String url, String path) throws FHIRException {
|
public BindingResolution resolveBinding(StructureDefinition def, String url, String path) throws FHIRException {
|
||||||
return null;
|
return null;
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -562,7 +562,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
||||||
<fhir_core_version>4.0.2-SNAPSHOT</fhir_core_version>
|
<fhir_core_version>4.0.8-SNAPSHOT</fhir_core_version>
|
||||||
<ucum_version>1.0.2</ucum_version>
|
<ucum_version>1.0.2</ucum_version>
|
||||||
|
|
||||||
<!-- configure timestamp in MANIFEST.MF for maven-war-provider -->
|
<!-- configure timestamp in MANIFEST.MF for maven-war-provider -->
|
||||||
|
|
|
@ -117,6 +117,10 @@
|
||||||
the RequestValidatingInterceptor, but not including any HAPI FHIR security interceptors)
|
the RequestValidatingInterceptor, but not including any HAPI FHIR security interceptors)
|
||||||
could be bypassed if a Content Type was not included.
|
could be bypassed if a Content Type was not included.
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
The GraphQL provider did not wrap the respone in a "data" element as described in the FHIR
|
||||||
|
specification. This has been corrected.
|
||||||
|
</action>
|
||||||
<action type="add">
|
<action type="add">
|
||||||
Added support for comparing resource dates to the current time via a new variable %now. E.g.
|
Added support for comparing resource dates to the current time via a new variable %now. E.g.
|
||||||
Procedure?date=gt%now would match future procedures.
|
Procedure?date=gt%now would match future procedures.
|
||||||
|
|
Loading…
Reference in New Issue