From 9377315c8d878e69f469139596245280f3100d15 Mon Sep 17 00:00:00 2001 From: esteban-aliverti Date: Mon, 9 Feb 2015 12:00:49 +0100 Subject: [PATCH] Misc: - hapi-fhir-testpage-overlay now uses dstu2 classes. - hapi-fhir-jpaserver-examples now use dstu2 classes. - Removed non-existing dependency hapi-fhir-jpaserver-test:0.9-SNAPSHOT from hapi-fhir-testpage-overlay and hapi-fhir-jpaserver-uhnfhirtest --- .../ca/uhn/fhir/jpa/demo/JpaServerDemo.java | 4 +-- .../src/main/webapp/WEB-INF/web.xml | 2 +- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 4 +-- hapi-fhir-testpage-overlay/pom.xml | 14 ++++++++-- .../main/java/ca/uhn/fhir/to/Controller.java | 26 +++++++++---------- .../ca/uhn/fhir/jpa/test/OverlayTestApp.java | 9 ------- 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java index d071b569fd2..ebf6b21e067 100644 --- a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java +++ b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java @@ -38,14 +38,14 @@ public class JpaServerDemo extends RestfulServer { * file which is automatically generated as a part of hapi-fhir-jpaserver-base and * contains bean definitions for a resource provider for each resource type */ - List beans = myAppCtx.getBean("myResourceProvidersDev", List.class); + List beans = myAppCtx.getBean("myResourceProvidersDstu2", List.class); setResourceProviders(beans); /* * The system provider implements non-resource-type methods, such as * transaction, and global history. */ - JpaSystemProvider systemProvider = myAppCtx.getBean("mySystemProviderDev", JpaSystemProvider.class); + JpaSystemProvider systemProvider = myAppCtx.getBean("mySystemProviderDstu2", JpaSystemProvider.class); setPlainProviders(systemProvider); /* diff --git a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml index 7ee3d9af50c..af794b95fb1 100644 --- a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml +++ b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml @@ -9,7 +9,7 @@ contextConfigLocation - classpath:hapi-fhir-server-resourceproviders-dev.xml + classpath:hapi-fhir-server-resourceproviders-dstu2.xml /WEB-INF/hapi-fhir-server-database-config.xml /WEB-INF/hapi-fhir-server-config.xml /WEB-INF/hapi-fhir-tester-application-context.xml diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 8f848ed5c46..e2b7cbfd7bb 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -49,12 +49,12 @@ ${phloc_commons_version} - + org.springframework diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index 230b8c96d8a..ec2ff14ffbd 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -29,11 +29,21 @@ hapi-fhir-base 0.9-SNAPSHOT + + ca.uhn.hapi.fhir + hapi-fhir-jpaserver-base + 0.9-SNAPSHOT + ca.uhn.hapi.fhir hapi-fhir-structures-dstu 0.9-SNAPSHOT + + ca.uhn.hapi.fhir + hapi-fhir-structures-dstu2 + 0.9-SNAPSHOT + ca.uhn.hapi.fhir hapi-fhir-structures-dev @@ -57,12 +67,12 @@ provided - + ch.qos.logback 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 279715db4c0..e5e4d29c046 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 @@ -421,17 +421,17 @@ public class Controller { private boolean extractSearchParamsDev(IResource theConformance, String resourceName, TreeSet includes, TreeSet sortParams, List queries, boolean haveSearchParams, List> queryIncludes) { - ca.uhn.fhir.model.dev.resource.Conformance conformance = (ca.uhn.fhir.model.dev.resource.Conformance) theConformance; - for (ca.uhn.fhir.model.dev.resource.Conformance.Rest nextRest : conformance.getRest()) { - for (ca.uhn.fhir.model.dev.resource.Conformance.RestResource nextRes : nextRest.getResource()) { + 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()) { if (nextRes.getTypeElement().getValue().equals(resourceName)) { for (StringDt next : nextRes.getSearchInclude()) { if (next.isEmpty() == false) { includes.add(next.getValue()); } } - for (ca.uhn.fhir.model.dev.resource.Conformance.RestResourceSearchParam next : nextRes.getSearchParam()) { - if (next.getTypeElement().getValueAsEnum() != ca.uhn.fhir.model.dev.valueset.SearchParamTypeEnum.COMPOSITE) { + for (ca.uhn.fhir.model.dstu2.resource.Conformance.RestResourceSearchParam next : nextRes.getSearchParam()) { + if (next.getTypeElement().getValueAsEnum() != ca.uhn.fhir.model.dstu2.valueset.SearchParamTypeEnum.COMPOSITE) { sortParams.add(next.getNameElement().getValue()); } } @@ -1083,21 +1083,21 @@ public class Controller { private IResource loadAndAddConfDev(final HomeRequest theRequest, final ModelMap theModel) { IGenericClient client = getContext(theRequest).newRestfulGenericClient(theRequest.getServerBase(myConfig)); - ca.uhn.fhir.model.dev.resource.Conformance conformance; + ca.uhn.fhir.model.dstu2.resource.Conformance conformance; try { - conformance = (ca.uhn.fhir.model.dev.resource.Conformance) client.conformance(); + conformance = (ca.uhn.fhir.model.dstu2.resource.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 ca.uhn.fhir.model.dev.resource.Conformance(); + conformance = new ca.uhn.fhir.model.dstu2.resource.Conformance(); } theModel.put("jsonEncodedConf", getContext(theRequest).newJsonParser().encodeResourceToString(conformance)); Map resourceCounts = new HashMap(); long total = 0; - for (ca.uhn.fhir.model.dev.resource.Conformance.Rest nextRest : conformance.getRest()) { - for (ca.uhn.fhir.model.dev.resource.Conformance.RestResource nextResource : nextRest.getResource()) { + for (ca.uhn.fhir.model.dstu2.resource.Conformance.Rest nextRest : conformance.getRest()) { + for (ca.uhn.fhir.model.dstu2.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(); @@ -1109,10 +1109,10 @@ public class Controller { theModel.put("resourceCounts", resourceCounts); if (total > 0) { - for (ca.uhn.fhir.model.dev.resource.Conformance.Rest nextRest : conformance.getRest()) { - Collections.sort(nextRest.getResource(), new Comparator() { + for (ca.uhn.fhir.model.dstu2.resource.Conformance.Rest nextRest : conformance.getRest()) { + Collections.sort(nextRest.getResource(), new Comparator() { @Override - public int compare(ca.uhn.fhir.model.dev.resource.Conformance.RestResource theO1, ca.uhn.fhir.model.dev.resource.Conformance.RestResource theO2) { + public int compare(ca.uhn.fhir.model.dstu2.resource.Conformance.RestResource theO1, ca.uhn.fhir.model.dstu2.resource.Conformance.RestResource theO2) { DecimalDt count1 = new DecimalDt(); List count1exts = theO1.getUndeclaredExtensionsByUrl(RESOURCE_COUNT_EXT_URL); if (count1exts != null && count1exts.size() > 0) { 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 e738b52d1e3..01d08262159 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 @@ -11,14 +11,7 @@ import org.eclipse.jetty.webapp.WebAppContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.dao.IFhirResourceDao; -import ca.uhn.fhir.jpa.dao.IFhirSystemDao; -import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu1; import ca.uhn.fhir.jpa.provider.JpaSystemProvider; -import ca.uhn.fhir.jpa.rp.dstu2.DiagnosticReportResourceProvider; -import ca.uhn.fhir.jpa.rp.dstu2.ObservationResourceProvider; -import ca.uhn.fhir.jpa.rp.dstu2.OrganizationResourceProvider; -import ca.uhn.fhir.jpa.rp.dstu2.PatientResourceProvider; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; @@ -26,10 +19,8 @@ import ca.uhn.fhir.model.api.TagList; 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.Observation; import ca.uhn.fhir.model.dstu.resource.Organization; import ca.uhn.fhir.model.dstu.resource.Patient; -import ca.uhn.fhir.model.dstu.resource.Questionnaire; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.annotation.IncludeParam; import ca.uhn.fhir.rest.annotation.OptionalParam;