From bd4e1d338855a664045caa271d41616aed973a4d Mon Sep 17 00:00:00 2001 From: James Date: Sun, 9 Jul 2017 21:32:16 -0400 Subject: [PATCH] Finally building correctly! --- hapi-fhir-android/pom.xml | 31 -- .../ca/uhn/fhir/android/BuiltJarDstu2IT.java | 7 +- .../fhir/android/BuiltJarDstu2ShadeIT.java | 3 +- .../android/client/GenericClientDstu3IT.java | 22 +- hapi-fhir-base-test-mindeps-server/pom.xml | 5 + .../parser/MultiVersionXmlParserTest.java | 12 +- .../uhn/fhir/testmindeps/FhirContextTest.java | 4 +- .../uhn/fhir/testmindeps/ValidatorTest.java | 6 +- hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 5 - hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 12 - hapi-fhir-jacoco/pom.xml | 11 +- hapi-fhir-jpaserver-base/pom.xml | 10 - .../ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | 11 +- .../fhir/jpa/dao/FulltextSearchSvcImpl.java | 2 +- .../ca/uhn/fhir/jpa/dao/SearchBuilder.java | 2 +- .../FhirResourceDaoDstu2SearchNoFtTest.java | 1 - .../dao/dstu2/FhirResourceDaoDstu2Test.java | 6 +- .../dao/dstu3/FhirResourceDaoDstu3Test.java | 33 +- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 5 - .../ca/uhn/fhirtest/PopulateProfiles.java | 26 -- .../BaseResourceReturningMethodBinding.java | 387 +++++++++--------- .../server/method/PatchMethodBinding.java | 5 + .../server/servlet/ServletRequestDetails.java | 41 +- hapi-fhir-structures-dstu2.1/pom.xml | 4 + hapi-fhir-structures-dstu2/pom.xml | 4 + hapi-fhir-structures-dstu3/pom.xml | 4 + hapi-fhir-structures-hl7org-dstu2/pom.xml | 4 + hapi-fhir-testpage-overlay/pom.xml | 6 +- .../java/ca/uhn/fhir/to/BaseController.java | 63 --- .../main/java/ca/uhn/fhir/to/Controller.java | 67 +-- .../ca/uhn/fhir/jpa/test/OverlayTestApp.java | 10 +- .../test/java/test/TestCustomStructures.java | 34 -- .../src/test/java/test/TestGenerics.java | 23 -- .../src/test/java/test/TestParticulars.java | 2 +- .../test/java/test/TestProfileGenerator.java | 18 - 35 files changed, 291 insertions(+), 595 deletions(-) delete mode 100644 hapi-fhir-jpaserver-uhnfhirtest/src/test/java/ca/uhn/fhirtest/PopulateProfiles.java delete mode 100644 hapi-tinder-test/src/test/java/test/TestCustomStructures.java delete mode 100644 hapi-tinder-test/src/test/java/test/TestGenerics.java delete mode 100644 hapi-tinder-test/src/test/java/test/TestProfileGenerator.java diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index 3d6b2207e1a..eb0c40608e4 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -37,12 +37,6 @@ - - ca.uhn.hapi.fhir - hapi-fhir-structures-dstu - ${project.version} - true - ca.uhn.hapi.fhir hapi-fhir-structures-dstu2 @@ -230,31 +224,6 @@ shade - - - dstu - package - - shade - - - dstu - - - ca.uhn.hapi.fhir:hapi-fhir-structures-dstu - - - - - - dstu2 diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2IT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2IT.java index 2ac7845d43b..6ca43b407a9 100644 --- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2IT.java +++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2IT.java @@ -1,14 +1,13 @@ package ca.uhn.fhir.android; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import java.io.File; import java.util.*; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import javax.naming.ConfigurationException; - import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.WildcardFileFilter; import org.junit.BeforeClass; @@ -18,7 +17,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.dstu2.composite.QuantityDt; import ca.uhn.fhir.model.dstu2.resource.Observation; import ca.uhn.fhir.model.dstu2.resource.Patient; -import ca.uhn.fhir.rest.client.IGenericClient; +import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException; public class BuiltJarDstu2IT { diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java index 89776450c80..bc062413d14 100644 --- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java +++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java @@ -9,14 +9,13 @@ import java.util.zip.ZipFile; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.WildcardFileFilter; -import org.junit.BeforeClass; import org.junit.Test; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.dstu2.composite.QuantityDt; import ca.uhn.fhir.model.dstu2.resource.Observation; import ca.uhn.fhir.model.dstu2.resource.Patient; -import ca.uhn.fhir.rest.client.IGenericClient; +import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException; public class BuiltJarDstu2ShadeIT { diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java index b6a553099f6..62d60c3696c 100644 --- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java +++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java @@ -1,10 +1,6 @@ package ca.uhn.fhir.android.client; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -12,14 +8,8 @@ import java.io.IOException; import java.util.Date; import org.apache.http.client.ClientProtocolException; -import org.hl7.fhir.dstu3.model.Binary; -import org.hl7.fhir.dstu3.model.Bundle; -import org.hl7.fhir.dstu3.model.OperationOutcome; -import org.hl7.fhir.dstu3.model.Patient; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.hl7.fhir.dstu3.model.*; +import org.junit.*; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; @@ -28,12 +18,12 @@ import org.mockito.stubbing.Answer; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.parser.IParser; +import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.PreferReturnEnum; -import ca.uhn.fhir.rest.client.IGenericClient; -import ca.uhn.fhir.rest.client.ServerValidationModeEnum; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException; -import ca.uhn.fhir.rest.server.Constants; import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.VersionUtil; import okhttp3.*; diff --git a/hapi-fhir-base-test-mindeps-server/pom.xml b/hapi-fhir-base-test-mindeps-server/pom.xml index ab09af379cd..890919bef04 100644 --- a/hapi-fhir-base-test-mindeps-server/pom.xml +++ b/hapi-fhir-base-test-mindeps-server/pom.xml @@ -76,6 +76,11 @@ + + ca.uhn.hapi.fhir + hapi-fhir-validation-resources-dstu2 + ${project.version} + ca.uhn.hapi.fhir hapi-fhir-structures-dstu3 diff --git a/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionXmlParserTest.java b/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionXmlParserTest.java index 9e505a86c18..59ac760b172 100644 --- a/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionXmlParserTest.java +++ b/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionXmlParserTest.java @@ -35,14 +35,14 @@ public class MultiVersionXmlParserTest { String str; str = ourCtxDstu2.newXmlParser().encodeResourceToString(p); ourLog.info(str); - assertThat(str, Matchers.stringContainsInOrder("")); try { - FhirContext.forDstu2().newXmlParser().encodeResourceToString(p); + FhirContext.forDstu3().newXmlParser().encodeResourceToString(p); fail(); } catch (IllegalArgumentException e) { - assertEquals("This parser is for FHIR version DSTU2 - Can not encode a structure for version DSTU1", e.getMessage()); + assertEquals("This parser is for FHIR version DSTU3 - Can not encode a structure for version DSTU2", e.getMessage()); } } @@ -61,16 +61,16 @@ public class MultiVersionXmlParserTest { String res = ourCtxDstu2.newXmlParser().encodeResourceToString(p); try { - ourCtxDstu2.newXmlParser().parseResource(ca.uhn.fhir.model.dstu2.resource.Patient.class, res); + ourCtxDstu3.newXmlParser().parseResource(ca.uhn.fhir.model.dstu2.resource.Patient.class, res); fail(); } catch (ConfigurationException e) { - assertEquals("This context is for FHIR version \"DSTU1\" but the class \"ca.uhn.fhir.model.dstu2.resource.Patient\" is for version \"DSTU2\"", e.getMessage()); + assertEquals("This context is for FHIR version \"DSTU3\" but the class \"ca.uhn.fhir.model.dstu2.resource.Patient\" is for version \"DSTU2\"", e.getMessage()); } try { ourCtxDstu3.newXmlParser().parseResource(Patient.class, res); fail(); } catch (ConfigurationException e) { - assertEquals("This context is for FHIR version \"DSTU2\" but the class \"ca.uhn.fhir.model.dstu.resource.Patient\" is for version \"DSTU1\"", e.getMessage()); + assertEquals("This context is for FHIR version \"DSTU3\" but the class \"ca.uhn.fhir.model.dstu2.resource.Patient\" is for version \"DSTU2\"", e.getMessage()); } } diff --git a/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/testmindeps/FhirContextTest.java b/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/testmindeps/FhirContextTest.java index c5fcd72f324..7024e37b023 100644 --- a/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/testmindeps/FhirContextTest.java +++ b/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/testmindeps/FhirContextTest.java @@ -11,9 +11,9 @@ import ca.uhn.fhir.model.dstu2.resource.Patient; public class FhirContextTest { @Test - public void testWrongVersionDoesntGetInContext1() { + public void testWrongVersionDoesntGetInContext2() { - FhirContext ctx = FhirContext.forDstu1(); + FhirContext ctx = FhirContext.forDstu2(); RuntimeResourceDefinition def = ctx.getResourceDefinition("Patient"); assertEquals(Patient.class, def.getImplementingClass()); } diff --git a/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/testmindeps/ValidatorTest.java b/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/testmindeps/ValidatorTest.java index 363ab56097a..17248c1a681 100644 --- a/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/testmindeps/ValidatorTest.java +++ b/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/testmindeps/ValidatorTest.java @@ -5,10 +5,10 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import org.hl7.fhir.dstu3.model.Patient; import org.junit.Test; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.validation.FhirValidator; public class ValidatorTest { @@ -16,14 +16,14 @@ public class ValidatorTest { @Test public void testValidator() { - FhirContext ctx = FhirContext.forDstu1(); + FhirContext ctx = FhirContext.forDstu2(); FhirValidator val = ctx.newValidator(); try { val.validateWithResult(new Patient()); fail(); } catch (IllegalArgumentException e) { - assertEquals("This parser is for FHIR version DSTU1 - Can not encode a structure for version DSTU2", e.getMessage()); + assertEquals("This parser is for FHIR version DSTU2 - Can not encode a structure for version DSTU3", e.getMessage()); } // Phloc is not onthe classpath diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml index 88400085b33..320090b2643 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml @@ -48,11 +48,6 @@ classes - - ca.uhn.hapi.fhir - hapi-fhir-structures-dstu - ${project.version} - ca.uhn.hapi.fhir hapi-fhir-structures-dstu2 diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml index 1c924d26683..b9264c62705 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml @@ -25,18 +25,6 @@ provided - - - ca.uhn.hapi.fhir - hapi-fhir-structures-dstu - ${project.version} - - - ca.uhn.hapi.fhir - hapi-fhir-structures-dstu2 - ${project.version} - - ca.uhn.hapi.fhir diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index cda98c73f56..5aed33ea23f 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -21,11 +21,6 @@ hapi-fhir-base ${project.version} - - ca.uhn.hapi.fhir - hapi-fhir-structures-dstu - ${project.version} - ca.uhn.hapi.fhir hapi-fhir-structures-dstu2 @@ -264,6 +259,8 @@ ${basedir}/.. hapi-fhir-base/target/jacoco.exec + hapi-fhir-client/target/jacoco.exec + hapi-fhir-server/target/jacoco.exec hapi-fhir-structures-dstu/target/jacoco.exec hapi-fhir-structures-dstu2/target/jacoco.exec hapi-fhir-structures-hl7org-dstu2/target/jacoco.exec @@ -287,6 +284,8 @@ ${env.TRAVIS_JOB_ID} ../hapi-fhir-base/src/main/java + ../hapi-fhir-client/src/main/java + ../hapi-fhir-server/src/main/java ../hapi-fhir-structures-dstu/src/test/java ../hapi-fhir-structures-dstu2/src/test/java ../hapi-fhir-structures-hl7org-dstu2/src/test/java @@ -309,6 +308,8 @@ ../hapi-fhir-base/src/main/java + ../hapi-fhir-client/src/main/java + ../hapi-fhir-server/src/main/java ../hapi-fhir-jpaserver-base/src/main/java diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 0a53b814d53..2f462e919e3 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -64,11 +64,6 @@ hapi-fhir-server ${project.version} - - ca.uhn.hapi.fhir - hapi-fhir-structures-dstu - ${project.version} - ca.uhn.hapi.fhir hapi-fhir-structures-dstu2 @@ -563,11 +558,6 @@ - - ca.uhn.hapi.fhir - hapi-fhir-structures-dstu - ${project.version} - ca.uhn.hapi.fhir hapi-fhir-structures-dstu2 diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java index 8bf4773eff6..82b148900a1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java @@ -1,6 +1,5 @@ package ca.uhn.fhir.jpa.dao; -import static org.apache.commons.lang3.StringUtils.defaultIfBlank; /* * #%L * HAPI FHIR JPA Server @@ -20,9 +19,7 @@ import static org.apache.commons.lang3.StringUtils.defaultIfBlank; * limitations under the License. * #L% */ -import static org.apache.commons.lang3.StringUtils.isBlank; -import static org.apache.commons.lang3.StringUtils.isNotBlank; -import static org.apache.commons.lang3.StringUtils.trim; +import static org.apache.commons.lang3.StringUtils.*; import java.io.UnsupportedEncodingException; import java.text.Normalizer; @@ -37,9 +34,8 @@ import javax.xml.stream.events.XMLEvent; import org.apache.commons.lang3.*; import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; +import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb; -import org.hl7.fhir.dstu3.model.IdType; -import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.instance.model.api.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.PlatformTransactionManager; @@ -61,17 +57,16 @@ import ca.uhn.fhir.jpa.util.DeleteConflict; import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; -import ca.uhn.fhir.model.dstu.resource.BaseResource; import ca.uhn.fhir.model.primitive.*; import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum; import ca.uhn.fhir.parser.*; import ca.uhn.fhir.rest.api.*; +import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.*; import ca.uhn.fhir.rest.server.exceptions.*; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails; -import ca.uhn.fhir.rest.server.method.MethodUtil; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import ca.uhn.fhir.util.*; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java index 9971dfa3f7c..8e5a14861ae 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java @@ -36,6 +36,7 @@ import org.hibernate.search.jpa.FullTextEntityManager; import org.hibernate.search.jpa.FullTextQuery; import org.hibernate.search.query.dsl.BooleanJunction; import org.hibernate.search.query.dsl.QueryBuilder; +import org.hl7.fhir.dstu3.model.BaseResource; import org.hl7.fhir.instance.model.api.IBaseResource; import org.springframework.transaction.annotation.Transactional; @@ -44,7 +45,6 @@ import com.google.common.collect.Sets; import ca.uhn.fhir.jpa.entity.ResourceTable; import ca.uhn.fhir.model.api.IQueryParameterType; -import ca.uhn.fhir.model.dstu.resource.BaseResource; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.param.StringParam; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java index 3be99fee753..cc40452eadd 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java @@ -38,6 +38,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.hibernate.ScrollMode; import org.hibernate.ScrollableResults; import org.hibernate.query.Query; +import org.hl7.fhir.dstu3.model.BaseResource; import org.hl7.fhir.instance.model.api.*; import com.google.common.collect.*; @@ -51,7 +52,6 @@ import ca.uhn.fhir.jpa.term.VersionIndependentConcept; import ca.uhn.fhir.jpa.util.StopWatch; import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.base.composite.*; -import ca.uhn.fhir.model.dstu.resource.BaseResource; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java index cb69e17fe2d..f0cc7d84364 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java @@ -22,7 +22,6 @@ import ca.uhn.fhir.jpa.dao.data.ISearchParamPresentDao; import ca.uhn.fhir.jpa.entity.*; import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.base.composite.BaseCodingDt; -import ca.uhn.fhir.model.dstu.resource.BaseResource; import ca.uhn.fhir.model.dstu2.composite.*; import ca.uhn.fhir.model.dstu2.resource.*; import ca.uhn.fhir.model.dstu2.valueset.*; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java index 4205f2dc0e4..d570530b45d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java @@ -351,13 +351,13 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { * be fixed. */ assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR); - assertEquals(ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum.ERROR.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR); + assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR); assertEquals(ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum.ERROR.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR); assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO); - assertEquals(ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum.INFORMATION.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO); + assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO); assertEquals(ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum.INFORMATION.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO); assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN); - assertEquals(ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum.WARNING.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN); + assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN); assertEquals(ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum.WARNING.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java index dfdcb60ff54..70e0ccd5d21 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java @@ -503,27 +503,6 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { obs = myObservationDao.read(obsId.toUnqualifiedVersionless(), mySrd); } - @Test - public void testCreateDuplicateIdFails() { - String methodName = "testCreateDuplocateIdFailsText"; - - Patient p = new Patient(); - p.addIdentifier().setSystem("urn:system").setValue(methodName); - p.setId("Patient/" + methodName); - IIdType id = myPatientDao.create(p, mySrd).getId(); - ourLog.info("Created patient, got it: {}", id); - - p = new Patient(); - p.addIdentifier().setSystem("urn:system").setValue(methodName); - p.addName().setFamily("Hello"); - p.setId("Patient/" + methodName); - try { - myPatientDao.create(p, mySrd); - fail(); - } catch (UnprocessableEntityException e) { - assertThat(e.getMessage(), containsString("Can not create entity with ID[" + methodName + "], a resource with this ID already exists")); - } - } @Test public void testCreateDuplicateTagsDoesNotCauseDuplicates() { @@ -608,9 +587,9 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue("testCreateNumericIdFails"); p.addName().setFamily("Hello"); - p.setId("Patient/123"); + p.setId("Patient/9999999999999"); try { - myPatientDao.create(p, mySrd); + myPatientDao.update(p, mySrd); fail(); } catch (InvalidRequestException e) { assertThat(e.getMessage(), containsString("clients may only assign IDs which contain at least one non-numeric")); @@ -624,13 +603,13 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { * be fixed. */ assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR); - assertEquals(ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum.ERROR.getCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR); + assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR); assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR); assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO); - assertEquals(ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum.INFORMATION.getCode(), BaseHapiFhirDao.OO_SEVERITY_INFO); + assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO); assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO); assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN); - assertEquals(ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum.WARNING.getCode(), BaseHapiFhirDao.OO_SEVERITY_WARN); + assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN); assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN); } @@ -3563,7 +3542,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { p1.addIdentifier().setSystem("urn:system").setValue("testUpdateRejectsIdWhichPointsToForcedId01"); p1.addName().setFamily("Tester").addGiven("testUpdateRejectsIdWhichPointsToForcedId01"); p1.setId("ABABA"); - IIdType p1id = myPatientDao.create(p1, mySrd).getId(); + IIdType p1id = myPatientDao.update(p1, mySrd).getId(); assertEquals("ABABA", p1id.getIdPart()); Patient p2 = new Patient(); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 4f0dacf5789..66adacd80c7 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -25,11 +25,6 @@ hapi-fhir-jpaserver-base ${project.version} - - ca.uhn.hapi.fhir - hapi-fhir-structures-dstu - ${project.version} - ca.uhn.hapi.fhir hapi-fhir-structures-dstu2 diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/test/java/ca/uhn/fhirtest/PopulateProfiles.java b/hapi-fhir-jpaserver-uhnfhirtest/src/test/java/ca/uhn/fhirtest/PopulateProfiles.java deleted file mode 100644 index 9a40a2d2d63..00000000000 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/test/java/ca/uhn/fhirtest/PopulateProfiles.java +++ /dev/null @@ -1,26 +0,0 @@ -package ca.uhn.fhirtest; - -import ca.uhn.fhir.model.dstu.resource.Profile; -import ca.uhn.fhir.model.dstu.resource.Profile.ExtensionDefn; -import ca.uhn.fhir.model.dstu.valueset.DataTypeEnum; -import ca.uhn.fhir.model.dstu.valueset.ExtensionContextEnum; - -public class PopulateProfiles { - - public static void main(String[] args) { - - Profile hapiExtensions = new Profile(); - - ExtensionDefn ext = hapiExtensions.addExtensionDefn(); - ext.addContext("Conformance.rest.resource"); - ext.getCode().setValue("resourceCount"); - ext.getContextType().setValueAsEnum(ExtensionContextEnum.RESOURCE); - ext.getDisplay().setValue("Resource count on server"); - ext.getDefinition().addType().setCode(DataTypeEnum.DECIMAL); - - - - - } - -} diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java index e159da655bd..52c022424ca 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java @@ -138,37 +138,36 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi Set summaryMode = RestfulServerUtils.determineSummaryMode(theRequest); - for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) { - IServerInterceptor next = theServer.getInterceptors().get(i); - boolean continueProcessing = next.outgoingResponse(theRequest, response); - if (!continueProcessing) { - return null; - } + for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) { + IServerInterceptor next = theServer.getInterceptors().get(i); + boolean continueProcessing = next.outgoingResponse(theRequest, response); + if (!continueProcessing) { + return null; } + } - boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest); - - return theRequest.getResponse().streamResponseAsResource(response, prettyPrint, summaryMode, Constants.STATUS_HTTP_200_OK, null, theRequest.isRespondGzip(), isAddContentLocationHeader()); + boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest); + return theRequest.getResponse().streamResponseAsResource(response, prettyPrint, summaryMode, Constants.STATUS_HTTP_200_OK, null, theRequest.isRespondGzip(), isAddContentLocationHeader()); // DSTU1 Bundle -// // Is this request coming from a browser -// String uaHeader = theRequest.getHeader("user-agent"); -// boolean requestIsBrowser = false; -// if (uaHeader != null && uaHeader.contains("Mozilla")) { -// requestIsBrowser = true; -// } -// -// for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) { -// IServerInterceptor next = theServer.getInterceptors().get(i); -// boolean continueProcessing = next.outgoingResponse(theRequest, responseObject.getDstu1Bundle()); -// if (!continueProcessing) { -// ourLog.debug("Interceptor {} returned false, not continuing processing"); -// return null; -// } -// } -// -// return theRequest.getResponse().streamResponseAsBundle(responseObject.getDstu1Bundle(), summaryMode, theRequest.isRespondGzip(), requestIsBrowser); + // // Is this request coming from a browser + // String uaHeader = theRequest.getHeader("user-agent"); + // boolean requestIsBrowser = false; + // if (uaHeader != null && uaHeader.contains("Mozilla")) { + // requestIsBrowser = true; + // } + // + // for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) { + // IServerInterceptor next = theServer.getInterceptors().get(i); + // boolean continueProcessing = next.outgoingResponse(theRequest, responseObject.getDstu1Bundle()); + // if (!continueProcessing) { + // ourLog.debug("Interceptor {} returned false, not continuing processing"); + // return null; + // } + // } + // + // return theRequest.getResponse().streamResponseAsBundle(responseObject.getDstu1Bundle(), summaryMode, theRequest.isRespondGzip(), requestIsBrowser); } public IBaseResource doInvokeServer(IRestfulServer theServer, RequestDetails theRequest) { @@ -188,195 +187,188 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi final IBaseResource responseObject; switch (getReturnType()) { - case BUNDLE: { + case BUNDLE: { + + /* + * Figure out the self-link for this request + */ + String serverBase = theRequest.getServerBaseForRequest(); + String linkSelf; + StringBuilder b = new StringBuilder(); + b.append(serverBase); + if (isNotBlank(theRequest.getRequestPath())) { + b.append('/'); + b.append(theRequest.getRequestPath()); + } + // For POST the URL parameters get jumbled with the post body parameters so don't include them, they might be huge + if (theRequest.getRequestType() == RequestTypeEnum.GET) { + boolean first = true; + Map parameters = theRequest.getParameters(); + for (String nextParamName : new TreeSet(parameters.keySet())) { + for (String nextParamValue : parameters.get(nextParamName)) { + if (first) { + b.append('?'); + first = false; + } else { + b.append('&'); + } + b.append(UrlUtil.escape(nextParamName)); + b.append('='); + b.append(UrlUtil.escape(nextParamValue)); + } + } + } + linkSelf = b.toString(); + + if (getMethodReturnType() == MethodReturnTypeEnum.BUNDLE_RESOURCE) { + IBaseResource resource; + IPrimitiveType lastUpdated; + if (resultObj instanceof IBundleProvider) { + IBundleProvider result = (IBundleProvider) resultObj; + resource = result.getResources(0, 1).get(0); + lastUpdated = result.getPublished(); + } else { + resource = (IBaseResource) resultObj; + lastUpdated = theServer.getFhirContext().getVersion().getLastUpdated(resource); + } /* - * Figure out the self-link for this request + * We assume that the bundle we got back from the handling method may not have everything populated (e.g. self links, bundle type, etc) so we do that here. */ - String serverBase = theRequest.getServerBaseForRequest(); - String linkSelf; - StringBuilder b = new StringBuilder(); - b.append(serverBase); - if (isNotBlank(theRequest.getRequestPath())) { - b.append('/'); - b.append(theRequest.getRequestPath()); - } - // For POST the URL parameters get jumbled with the post body parameters so don't include them, they might be huge - if (theRequest.getRequestType() == RequestTypeEnum.GET) { - boolean first = true; - Map parameters = theRequest.getParameters(); - for (String nextParamName : new TreeSet(parameters.keySet())) { - for (String nextParamValue : parameters.get(nextParamName)) { - if (first) { - b.append('?'); - first = false; - } else { - b.append('&'); - } - b.append(UrlUtil.escape(nextParamName)); - b.append('='); - b.append(UrlUtil.escape(nextParamValue)); - } - } - } - linkSelf = b.toString(); + IVersionSpecificBundleFactory bundleFactory = theServer.getFhirContext().newBundleFactory(); + bundleFactory.initializeWithBundleResource(resource); + bundleFactory.addRootPropertiesToBundle(null, theRequest.getFhirServerBase(), linkSelf, null, null, count, getResponseBundleType(), lastUpdated); - if (getMethodReturnType() == MethodReturnTypeEnum.BUNDLE_RESOURCE) { - IBaseResource resource; - IPrimitiveType lastUpdated; - if (resultObj instanceof IBundleProvider) { - IBundleProvider result = (IBundleProvider) resultObj; - resource = result.getResources(0, 1).get(0); - lastUpdated = result.getPublished(); - } else { - resource = (IBaseResource) resultObj; - lastUpdated = theServer.getFhirContext().getVersion().getLastUpdated(resource); - } - - /* - * We assume that the bundle we got back from the handling method may not have everything populated (e.g. self links, bundle type, etc) so we do that here. - */ - IVersionSpecificBundleFactory bundleFactory = theServer.getFhirContext().newBundleFactory(); - bundleFactory.initializeWithBundleResource(resource); - bundleFactory.addRootPropertiesToBundle(null, theRequest.getFhirServerBase(), linkSelf, null, null, count, getResponseBundleType(), lastUpdated); - - responseObject = resource; - } else { - Set includes = getRequestIncludesFromParams(params); - - IBundleProvider result = (IBundleProvider) resultObj; - if (count == null) { - count = result.preferredPageSize(); - } - - Integer offsetI = RestfulServerUtils.tryToExtractNamedParameter(theRequest, Constants.PARAM_PAGINGOFFSET); - if (offsetI == null || offsetI < 0) { - offsetI = 0; - } - - Integer resultSize = result.size(); - int start; - if (resultSize != null) { - start = Math.max(0, Math.min(offsetI, resultSize - 1)); - } else { - start = offsetI; - } - - ResponseEncoding responseEncoding = RestfulServerUtils.determineResponseEncodingNoDefault(theRequest, theServer.getDefaultResponseEncoding()); - EncodingEnum linkEncoding = theRequest.getParameters().containsKey(Constants.PARAM_FORMAT) && responseEncoding != null ? responseEncoding.getEncoding() : null; - - responseObject = createBundleFromBundleProvider(theServer, theRequest, count, linkSelf, includes, result, start, getResponseBundleType(), linkEncoding, null); - } - break; - } - case RESOURCE: { - IBundleProvider result = (IBundleProvider) resultObj; - if (result.size() == 0) { - throw new ResourceNotFoundException(theRequest.getId()); - } else if (result.size() > 1) { - throw new InternalErrorException("Method returned multiple resources"); - } - - IBaseResource resource = result.getResources(0, 1).get(0); responseObject = resource; - break; + } else { + Set includes = getRequestIncludesFromParams(params); + + IBundleProvider result = (IBundleProvider) resultObj; + if (count == null) { + count = result.preferredPageSize(); + } + + Integer offsetI = RestfulServerUtils.tryToExtractNamedParameter(theRequest, Constants.PARAM_PAGINGOFFSET); + if (offsetI == null || offsetI < 0) { + offsetI = 0; + } + + Integer resultSize = result.size(); + int start; + if (resultSize != null) { + start = Math.max(0, Math.min(offsetI, resultSize - 1)); + } else { + start = offsetI; + } + + ResponseEncoding responseEncoding = RestfulServerUtils.determineResponseEncodingNoDefault(theRequest, theServer.getDefaultResponseEncoding()); + EncodingEnum linkEncoding = theRequest.getParameters().containsKey(Constants.PARAM_FORMAT) && responseEncoding != null ? responseEncoding.getEncoding() : null; + + responseObject = createBundleFromBundleProvider(theServer, theRequest, count, linkSelf, includes, result, start, getResponseBundleType(), linkEncoding, null); } - default: - throw new IllegalStateException(); // should not happen + break; + } + case RESOURCE: { + IBundleProvider result = (IBundleProvider) resultObj; + if (result.size() == 0) { + throw new ResourceNotFoundException(theRequest.getId()); + } else if (result.size() > 1) { + throw new InternalErrorException("Method returned multiple resources"); + } + + IBaseResource resource = result.getResources(0, 1).get(0); + responseObject = resource; + break; + } + default: + throw new IllegalStateException(); // should not happen } return responseObject; } - protected IBaseResource createBundleFromBundleProvider(IRestfulServer theServer, RequestDetails theRequest, Integer theLimit, String theLinkSelf, Set theIncludes, IBundleProvider theResult, int theOffset, BundleTypeEnum theBundleType, EncodingEnum theLinkEncoding, String theSearchId) { + protected IBaseResource createBundleFromBundleProvider(IRestfulServer theServer, RequestDetails theRequest, Integer theLimit, String theLinkSelf, Set theIncludes, + IBundleProvider theResult, int theOffset, BundleTypeEnum theBundleType, EncodingEnum theLinkEncoding, String theSearchId) { IVersionSpecificBundleFactory bundleFactory = theServer.getFhirContext().newBundleFactory(); - int numToReturn; - String searchId = null; - List resourceList; - Integer numTotalResults = theResult.size(); - if (theServer.getPagingProvider() == null) { - numToReturn = numTotalResults; - if (numToReturn > 0) { - resourceList = theResult.getResources(0, numToReturn); - } else { - resourceList = Collections.emptyList(); - } - RestfulServerUtils.validateResourceListNotNull(resourceList); + int numToReturn; + String searchId = null; + List resourceList; + Integer numTotalResults = theResult.size(); + if (theServer.getPagingProvider() == null) { + numToReturn = numTotalResults; + if (numToReturn > 0) { + resourceList = theResult.getResources(0, numToReturn); + } else { + resourceList = Collections.emptyList(); + } + RestfulServerUtils.validateResourceListNotNull(resourceList); - } else { - IPagingProvider pagingProvider = theServer.getPagingProvider(); - if (theLimit == null || theLimit.equals(Integer.valueOf(0))) { - numToReturn = pagingProvider.getDefaultPageSize(); - } else { - numToReturn = Math.min(pagingProvider.getMaximumPageSize(), theLimit); - } + } else { + IPagingProvider pagingProvider = theServer.getPagingProvider(); + if (theLimit == null || theLimit.equals(Integer.valueOf(0))) { + numToReturn = pagingProvider.getDefaultPageSize(); + } else { + numToReturn = Math.min(pagingProvider.getMaximumPageSize(), theLimit); + } - if (numTotalResults != null) { - numToReturn = Math.min(numToReturn, numTotalResults - theOffset); - } + if (numTotalResults != null) { + numToReturn = Math.min(numToReturn, numTotalResults - theOffset); + } - if (numToReturn > 0) { - resourceList = theResult.getResources(theOffset, numToReturn + theOffset); - } else { - resourceList = Collections.emptyList(); - } - RestfulServerUtils.validateResourceListNotNull(resourceList); + if (numToReturn > 0) { + resourceList = theResult.getResources(theOffset, numToReturn + theOffset); + } else { + resourceList = Collections.emptyList(); + } + RestfulServerUtils.validateResourceListNotNull(resourceList); - if (theSearchId != null) { - searchId = theSearchId; - } else { - if (numTotalResults == null || numTotalResults > numToReturn) { - searchId = pagingProvider.storeResultList(theResult); - if (isBlank(searchId)) { - ourLog.info("Found {} results but paging provider did not provide an ID to use for paging", numTotalResults); - } - } - } - } + if (theSearchId != null) { + searchId = theSearchId; + } else { + if (numTotalResults == null || numTotalResults > numToReturn) { + searchId = pagingProvider.storeResultList(theResult); + if (isBlank(searchId)) { + ourLog.info("Found {} results but paging provider did not provide an ID to use for paging", numTotalResults); + } + } + } + } - for (IBaseResource next : resourceList) { - if (next.getIdElement() == null || next.getIdElement().isEmpty()) { - if (!(next instanceof BaseOperationOutcome)) { - throw new InternalErrorException("Server method returned resource of type[" + next.getClass().getSimpleName() + "] with no ID specified (IResource#setId(IdDt) must be called)"); - } - } - } + for (IBaseResource next : resourceList) { + if (next.getIdElement() == null || next.getIdElement().isEmpty()) { + if (!(next instanceof BaseOperationOutcome)) { + throw new InternalErrorException("Server method returned resource of type[" + next.getClass().getSimpleName() + "] with no ID specified (IResource#setId(IdDt) must be called)"); + } + } + } - String serverBase = theRequest.getFhirServerBase(); - boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest); - - String linkPrev= null; - String linkNext = null; - if (searchId != null) { - if (numTotalResults == null || theOffset + numToReturn < numTotalResults) { - linkNext = (RestfulServerUtils.createPagingLink(theIncludes, serverBase, searchId, theOffset + numToReturn, numToReturn, theLinkEncoding, prettyPrint, theBundleType)); - } - if (theOffset > 0) { - int start = Math.max(0, theOffset - theLimit); - linkPrev = RestfulServerUtils.createPagingLink(theIncludes, serverBase, searchId, start, theLimit, theLinkEncoding, prettyPrint, theBundleType); - } - } + String serverBase = theRequest.getFhirServerBase(); + boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest); - - - bundleFactory.addRootPropertiesToBundle(null, serverBase, theLinkSelf, linkPrev, linkNext, theResult.size(), theBundleType, theResult.getPublished()); - bundleFactory.addResourcesToBundle(new ArrayList(resourceList), theBundleType, serverBase, theServer.getBundleInclusionRule(), theIncludes); + String linkPrev = null; + String linkNext = null; + if (searchId != null) { + if (numTotalResults == null || theOffset + numToReturn < numTotalResults) { + linkNext = (RestfulServerUtils.createPagingLink(theIncludes, serverBase, searchId, theOffset + numToReturn, numToReturn, theLinkEncoding, prettyPrint, theBundleType)); + } + if (theOffset > 0) { + int start = Math.max(0, theOffset - theLimit); + linkPrev = RestfulServerUtils.createPagingLink(theIncludes, serverBase, searchId, start, theLimit, theLinkEncoding, prettyPrint, theBundleType); + } + } - if (theServer.getPagingProvider() != null) { - int limit; - limit = theLimit != null ? theLimit : theServer.getPagingProvider().getDefaultPageSize(); - limit = Math.min(limit, theServer.getPagingProvider().getMaximumPageSize()); + bundleFactory.addRootPropertiesToBundle(null, serverBase, theLinkSelf, linkPrev, linkNext, theResult.size(), theBundleType, theResult.getPublished()); + bundleFactory.addResourcesToBundle(new ArrayList(resourceList), theBundleType, serverBase, theServer.getBundleInclusionRule(), theIncludes); - } + if (theServer.getPagingProvider() != null) { + int limit; + limit = theLimit != null ? theLimit : theServer.getPagingProvider().getDefaultPageSize(); + limit = Math.min(limit, theServer.getPagingProvider().getMaximumPageSize()); + + } return bundleFactory.getResourceBundle(); - - - - - - - + } public abstract Object invokeServer(IRestfulServer theServer, RequestDetails theRequest, Object[] theMethodParams) throws InvalidRequestException, InternalErrorException; @@ -393,12 +385,17 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi } public enum MethodReturnTypeEnum { - BUNDLE, BUNDLE_PROVIDER, BUNDLE_RESOURCE, LIST_OF_RESOURCES, METHOD_OUTCOME, RESOURCE + BUNDLE, + BUNDLE_PROVIDER, + BUNDLE_RESOURCE, + LIST_OF_RESOURCES, + METHOD_OUTCOME, + RESOURCE } - public enum ReturnTypeEnum { - BUNDLE, RESOURCE + BUNDLE, + RESOURCE } } diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/PatchMethodBinding.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/PatchMethodBinding.java index c953a268578..dcc439d8b84 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/PatchMethodBinding.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/PatchMethodBinding.java @@ -72,6 +72,11 @@ public class PatchMethodBinding extends BaseOutcomeReturningMethodBindingWithRes } } + @Override + protected boolean allowVoidReturnType() { + return true; + } + @Override public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) { boolean retVal = super.incomingServerRequestMatchesMethod(theRequest); diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/servlet/ServletRequestDetails.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/servlet/ServletRequestDetails.java index 936254547b2..f5a1f348dfd 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/servlet/ServletRequestDetails.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/servlet/ServletRequestDetails.java @@ -108,6 +108,23 @@ public class ServletRequestDetails extends RequestDetails { } } + @Override + public Charset getCharset() { + Charset charset = null; + + String charsetString = myServletRequest.getCharacterEncoding(); + if (isNotBlank(charsetString)) { + charset = Charset.forName(charsetString); + } + + return charset; + } + + @Override + public FhirContext getFhirContext() { + return getServer().getFhirContext(); + } + @Override public String getHeader(String name) { return getServletRequest().getHeader(name); @@ -159,28 +176,4 @@ public class ServletRequestDetails extends RequestDetails { this.myServletResponse = myServletResponse; } - @Override - public Charset getCharset() { - Charset charset = null; - - String charsetString = myServletResponse.getCharacterEncoding(); - if (isNotBlank(charsetString)) { - charset = Charset.forName(charsetString); - } - -// String ct = getHeader(Constants.HEADER_CONTENT_TYPE); -// -// if (isNotBlank(ct)) { -// ContentType parsedCt = ContentType.parse(ct); -// charset = parsedCt.getCharset(); -// } - - return charset; - } - - @Override - public FhirContext getFhirContext() { - return getServer().getFhirContext(); - } - } diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index d78138f5322..62cee913800 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -221,10 +221,14 @@ ${basedir}/target/classes ${basedir}/../hapi-fhir-base/target/classes + ${basedir}/../hapi-fhir-client/target/classes + ${basedir}/../hapi-fhir-server/target/classes ${basedir}/src/main/java ${basedir}/../hapi-fhir-base/src/main/java + ${basedir}/../hapi-fhir-client/src/main/java + ${basedir}/../hapi-fhir-server/src/main/java true diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index dff0da82aaa..518403d898b 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -185,10 +185,14 @@ ${basedir}/target/classes ${basedir}/../hapi-fhir-base/target/classes + ${basedir}/../hapi-fhir-client/target/classes + ${basedir}/../hapi-fhir-server/target/classes ${basedir}/src/main/java ${basedir}/../hapi-fhir-base/src/main/java + ${basedir}/../hapi-fhir-client/src/main/java + ${basedir}/../hapi-fhir-server/src/main/java true diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml index bd55b7b8e0c..39af89bc3e2 100644 --- a/hapi-fhir-structures-dstu3/pom.xml +++ b/hapi-fhir-structures-dstu3/pom.xml @@ -213,10 +213,14 @@ ${basedir}/target/classes ${basedir}/../hapi-fhir-base/target/classes + ${basedir}/../hapi-fhir-client/target/classes + ${basedir}/../hapi-fhir-server/target/classes ${basedir}/src/main/java ${basedir}/../hapi-fhir-base/src/main/java + ${basedir}/../hapi-fhir-client/src/main/java + ${basedir}/../hapi-fhir-server/src/main/java true diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index 95b7e8e90fe..c7e9df5a1f2 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -220,10 +220,14 @@ ${basedir}/target/classes ${basedir}../hapi-fhir-base/target/classes + ${basedir}/../hapi-fhir-client/target/classes + ${basedir}/../hapi-fhir-server/target/classes ${basedir}/src/main/java ${basedir}/../hapi-fhir-base/src/main/java + ${basedir}/../hapi-fhir-client/src/main/java + ${basedir}/../hapi-fhir-server/src/main/java true diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index 0f5b300aea1..83f95cb94ff 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -36,14 +36,14 @@ ca.uhn.hapi.fhir - hapi-fhir-jpaserver-base + hapi-fhir-server ${project.version} - test ca.uhn.hapi.fhir - hapi-fhir-structures-dstu + hapi-fhir-jpaserver-base ${project.version} + test ca.uhn.hapi.fhir diff --git a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/BaseController.java b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/BaseController.java index 67710203cbf..4ab90ed7c8a 100644 --- a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/BaseController.java +++ b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/BaseController.java @@ -29,8 +29,6 @@ import ca.uhn.fhir.context.*; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.ExtensionDt; import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.dstu.resource.Conformance; -import ca.uhn.fhir.model.dstu.resource.Conformance.Rest; import ca.uhn.fhir.model.primitive.DecimalDt; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.EncodingEnum; @@ -295,8 +293,6 @@ public class BaseController { private IBaseResource loadAndAddConf(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) { switch (theRequest.getFhirVersion(myConfig)) { - case DSTU1: - return loadAndAddConfDstu1(theServletRequest, theRequest, theModel); case DSTU2: return loadAndAddConfDstu2(theServletRequest, theRequest, theModel); case DSTU3: @@ -308,65 +304,6 @@ public class BaseController { throw new IllegalStateException("Unknown version: " + theRequest.getFhirVersion(myConfig)); } - private Conformance loadAndAddConfDstu1(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) { - CaptureInterceptor interceptor = new CaptureInterceptor(); - GenericClient client = theRequest.newClient(theServletRequest, getContext(theRequest), myConfig, interceptor); - - Conformance conformance; - try { - conformance = (Conformance) client.conformance(); - } catch (Exception e) { - ourLog.warn("Failed to load conformance statement", e); - theModel.put("errorMsg", "Failed to load conformance statement, error was: " + e.toString()); - conformance = new Conformance(); - } - - theModel.put("jsonEncodedConf", getContext(theRequest).newJsonParser().encodeResourceToString(conformance)); - - Map resourceCounts = new HashMap(); - long total = 0; - for (Rest nextRest : conformance.getRest()) { - for (ca.uhn.fhir.model.dstu.resource.Conformance.RestResource nextResource : nextRest.getResource()) { - List exts = nextResource.getUndeclaredExtensionsByUrl(RESOURCE_COUNT_EXT_URL); - if (exts != null && exts.size() > 0) { - Number nextCount = ((DecimalDt) (exts.get(0).getValue())).getValueAsNumber(); - resourceCounts.put(nextResource.getType().getValue(), nextCount); - total += nextCount.longValue(); - } - } - } - theModel.put("resourceCounts", resourceCounts); - - if (total > 0) { - for (Rest nextRest : conformance.getRest()) { - Collections.sort(nextRest.getResource(), new Comparator() { - @Override - public int compare(ca.uhn.fhir.model.dstu.resource.Conformance.RestResource theO1, ca.uhn.fhir.model.dstu.resource.Conformance.RestResource theO2) { - DecimalDt count1 = new DecimalDt(); - List count1exts = theO1.getUndeclaredExtensionsByUrl(RESOURCE_COUNT_EXT_URL); - if (count1exts != null && count1exts.size() > 0) { - count1 = (DecimalDt) count1exts.get(0).getValue(); - } - DecimalDt count2 = new DecimalDt(); - List count2exts = theO2.getUndeclaredExtensionsByUrl(RESOURCE_COUNT_EXT_URL); - if (count2exts != null && count2exts.size() > 0) { - count2 = (DecimalDt) count2exts.get(0).getValue(); - } - int retVal = count2.compareTo(count1); - if (retVal == 0) { - retVal = theO1.getType().getValue().compareTo(theO2.getType().getValue()); - } - return retVal; - } - }); - } - } - - theModel.put("conf", conformance); - theModel.put("requiredParamExtension", ExtensionConstants.PARAM_IS_REQUIRED); - - return conformance; - } private IResource loadAndAddConfDstu2(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) { CaptureInterceptor interceptor = new CaptureInterceptor(); diff --git a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java index 6cd8d7658d5..1f858bdb8cb 100644 --- a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java +++ b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java @@ -21,11 +21,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import com.google.gson.stream.JsonWriter; import ca.uhn.fhir.context.*; -import ca.uhn.fhir.model.api.ExtensionDt; import ca.uhn.fhir.model.api.Include; -import ca.uhn.fhir.model.dstu.resource.Conformance; -import ca.uhn.fhir.model.dstu.resource.Conformance.*; -import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum; +import ca.uhn.fhir.model.dstu2.resource.Conformance; import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum; import ca.uhn.fhir.model.primitive.*; import ca.uhn.fhir.parser.DataFormatException; @@ -36,7 +33,6 @@ import ca.uhn.fhir.rest.gclient.*; import ca.uhn.fhir.rest.gclient.NumberClientParam.IMatches; import ca.uhn.fhir.rest.gclient.QuantityClientParam.IAndUnits; import ca.uhn.fhir.to.model.*; -import ca.uhn.fhir.util.ExtensionConstants; @org.springframework.stereotype.Controller() public class Controller extends BaseController { @@ -309,19 +305,15 @@ public class Controller extends BaseController { TreeSet includes = new TreeSet(); TreeSet revIncludes = new TreeSet(); TreeSet sortParams = new TreeSet(); - List queries = new ArrayList(); boolean haveSearchParams = false; List> queryIncludes = new ArrayList>(); switch (theRequest.getFhirVersion(myConfig)) { - case DSTU1: - haveSearchParams = extractSearchParamsDstu1(conformance, resourceName, includes, sortParams, queries, haveSearchParams, queryIncludes); - break; case DSTU2: - haveSearchParams = extractSearchParamsDstu2(conformance, resourceName, includes, revIncludes, sortParams, queries, haveSearchParams, queryIncludes); + haveSearchParams = extractSearchParamsDstu2(conformance, resourceName, includes, revIncludes, sortParams, haveSearchParams, queryIncludes); break; case DSTU3: - haveSearchParams = extractSearchParamsDstu3CapabilityStatement(conformance, resourceName, includes, revIncludes, sortParams, queries, haveSearchParams, queryIncludes); + haveSearchParams = extractSearchParamsDstu3CapabilityStatement(conformance, resourceName, includes, revIncludes, sortParams, haveSearchParams, queryIncludes); break; default: throw new IllegalStateException("Unknown FHIR version: " + theRequest.getFhirVersion(myConfig)); @@ -329,7 +321,7 @@ public class Controller extends BaseController { theModel.put("includes", includes); theModel.put("revincludes", revIncludes); - theModel.put("queries", queries); + theModel.put("queries", Collections.emptyList()); //TODO: remove this, it does nothing theModel.put("haveSearchParams", haveSearchParams); theModel.put("queryIncludes", queryIncludes); theModel.put("sortParams", sortParams); @@ -702,55 +694,8 @@ public class Controller extends BaseController { } - private boolean extractSearchParamsDstu1(IBaseResource theConformance, String resourceName, TreeSet includes, TreeSet sortParams, List queries, boolean haveSearchParams, List> queryIncludes) { - Conformance conformance = (Conformance) theConformance; - for (Rest nextRest : conformance.getRest()) { - for (RestResource nextRes : nextRest.getResource()) { - if (nextRes.getType().getValue().equals(resourceName)) { - for (StringDt next : nextRes.getSearchInclude()) { - if (next.isEmpty() == false) { - includes.add(next.getValue()); - } - } - for (RestResourceSearchParam next : nextRes.getSearchParam()) { - if (next.getType().getValueAsEnum() != SearchParamTypeEnum.COMPOSITE) { - sortParams.add(next.getName().getValue()); - } - } - if (nextRes.getSearchParam().size() > 0) { - haveSearchParams = true; - } - } - } - for (RestQuery nextQuery : nextRest.getQuery()) { - boolean queryMatchesResource = false; - List returnTypeExt = nextQuery.getUndeclaredExtensionsByUrl(ExtensionConstants.QUERY_RETURN_TYPE); - if (returnTypeExt != null) { - for (ExtensionDt nextExt : returnTypeExt) { - if (resourceName.equals(nextExt.getValueAsPrimitive().getValueAsString())) { - queries.add(nextQuery); - queryMatchesResource = true; - break; - } - } - } - if (queryMatchesResource) { - ArrayList nextQueryIncludes = new ArrayList(); - queryIncludes.add(nextQueryIncludes); - List includesExt = nextQuery.getUndeclaredExtensionsByUrl(ExtensionConstants.QUERY_ALLOWED_INCLUDE); - if (includesExt != null) { - for (ExtensionDt nextExt : includesExt) { - nextQueryIncludes.add(nextExt.getValueAsPrimitive().getValueAsString()); - } - } - } - } - } - return haveSearchParams; - } - - private boolean extractSearchParamsDstu2(IBaseResource theConformance, String resourceName, TreeSet includes, TreeSet theRevIncludes, TreeSet sortParams, List queries, boolean haveSearchParams, List> queryIncludes) { + private boolean extractSearchParamsDstu2(IBaseResource theConformance, String resourceName, TreeSet includes, TreeSet theRevIncludes, TreeSet sortParams, boolean haveSearchParams, List> queryIncludes) { ca.uhn.fhir.model.dstu2.resource.Conformance conformance = (ca.uhn.fhir.model.dstu2.resource.Conformance) theConformance; for (ca.uhn.fhir.model.dstu2.resource.Conformance.Rest nextRest : conformance.getRest()) { for (ca.uhn.fhir.model.dstu2.resource.Conformance.RestResource nextRes : nextRest.getResource()) { @@ -786,7 +731,7 @@ public class Controller extends BaseController { return haveSearchParams; } - private boolean extractSearchParamsDstu3CapabilityStatement(IBaseResource theConformance, String resourceName, TreeSet includes, TreeSet theRevIncludes, TreeSet sortParams, List queries, boolean haveSearchParams, List> queryIncludes) { + private boolean extractSearchParamsDstu3CapabilityStatement(IBaseResource theConformance, String resourceName, TreeSet includes, TreeSet theRevIncludes, TreeSet sortParams, boolean haveSearchParams, List> queryIncludes) { CapabilityStatement conformance = (org.hl7.fhir.dstu3.model.CapabilityStatement) theConformance; for (CapabilityStatementRestComponent nextRest : conformance.getRest()) { for (CapabilityStatementRestResourceComponent nextRes : nextRest.getResource()) { diff --git a/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/OverlayTestApp.java b/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/OverlayTestApp.java index f21c3e6e323..6f17ade358f 100644 --- a/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/OverlayTestApp.java +++ b/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/OverlayTestApp.java @@ -10,9 +10,9 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.annotation.Description; -import ca.uhn.fhir.model.dstu.composite.IdentifierDt; -import ca.uhn.fhir.model.dstu.resource.DiagnosticReport; -import ca.uhn.fhir.model.dstu.resource.Patient; +import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; +import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport; +import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.rest.annotation.*; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.rest.param.TokenOrListParam; @@ -139,14 +139,14 @@ public class OverlayTestApp { @Description(shortDefinition = "This is a query by date!") @Search - public List findDiagnosticReportsByPatient(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_NAME) TokenOrListParam theNames, + public List findDiagnosticReportsByPatient(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_CODE) TokenOrListParam theNames, @OptionalParam(name = DiagnosticReport.SP_DATE) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set theIncludes) throws Exception { return null; } @Description(shortDefinition = "This is a query by issued.. blah blah foo bar blah blah") @Search - public List findDiagnosticReportsByPatientIssued(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_NAME) TokenOrListParam theNames, + public List findDiagnosticReportsByPatientIssued(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_CODE) TokenOrListParam theNames, @OptionalParam(name = DiagnosticReport.SP_ISSUED) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set theIncludes) throws Exception { return null; } diff --git a/hapi-tinder-test/src/test/java/test/TestCustomStructures.java b/hapi-tinder-test/src/test/java/test/TestCustomStructures.java deleted file mode 100644 index d591e4399f4..00000000000 --- a/hapi-tinder-test/src/test/java/test/TestCustomStructures.java +++ /dev/null @@ -1,34 +0,0 @@ -package test; - -import static org.junit.Assert.*; - -import java.io.IOException; - -import org.junit.Test; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.parser.DataFormatException; -import ca.uhn.test.customstructs.resource.Organization; -import ca.uhn.test.customstructs.valueset.ConnectingGTAProviderIDNamespacesEnum; - -public class TestCustomStructures { - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TestCustomStructures.class); - - @Test - public void testExtension() throws DataFormatException, IOException { - - Organization org = new Organization(); - org.addProviderIdPool(ConnectingGTAProviderIDNamespacesEnum.UNIVERSITY_HEALTH_NETWORK_PROVIDER_IDS); - - FhirContext ctx = new FhirContext(Organization.class); - String str = ctx.newXmlParser().encodeResourceToString(org); - - ourLog.info(str); - - assertTrue(str.contains("")); - - } - - - -} diff --git a/hapi-tinder-test/src/test/java/test/TestGenerics.java b/hapi-tinder-test/src/test/java/test/TestGenerics.java deleted file mode 100644 index 00b5d5946df..00000000000 --- a/hapi-tinder-test/src/test/java/test/TestGenerics.java +++ /dev/null @@ -1,23 +0,0 @@ -package test; - -import java.util.List; - -import org.junit.Test; - -import ca.uhn.test.generic.single.TestConfigDstu1; -import ca.uhn.test.generic.multi.*; -import test.ResourceTest; - -public class TestGenerics { - - @Test - public void testGeneratedListReferencingGenerics() { - // This won't compile if tinder didn't generate the right names... - TestConfigDstu1 config = new TestConfigDstu1(); - List generics = config.testProvidersDstu1(); - for (ResourceTest generic : generics) { - String name = generic.getResourceName(); - } - } - -} diff --git a/hapi-tinder-test/src/test/java/test/TestParticulars.java b/hapi-tinder-test/src/test/java/test/TestParticulars.java index b4b8fc52066..bda2f3f2461 100644 --- a/hapi-tinder-test/src/test/java/test/TestParticulars.java +++ b/hapi-tinder-test/src/test/java/test/TestParticulars.java @@ -3,7 +3,7 @@ package test; import org.junit.Test; import ca.uhn.test.realstructs.resource.ListResource; -import ca.uhn.test.realstructs.resource.SecurityEvent.ObjectElement; +import ca.uhn.test.realstructs.resource.AuditEvent.ObjectElement; public class TestParticulars { diff --git a/hapi-tinder-test/src/test/java/test/TestProfileGenerator.java b/hapi-tinder-test/src/test/java/test/TestProfileGenerator.java deleted file mode 100644 index e220f375440..00000000000 --- a/hapi-tinder-test/src/test/java/test/TestProfileGenerator.java +++ /dev/null @@ -1,18 +0,0 @@ -package test; - -import static org.junit.Assert.*; - -import org.junit.Test; - -import ca.uhn.test.customstructs.resource.Patient; - -public class TestProfileGenerator { - - @Test - public void testIncludes() { - - assertEquals("Patient.link.other", Patient.INCLUDE_LINK_OTHER.getValue()); - - } - -}