diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IClientInterceptor.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IClientInterceptor.java index b1d1ec73e7c..583133c5997 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IClientInterceptor.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IClientInterceptor.java @@ -25,6 +25,14 @@ import java.io.IOException; import ca.uhn.fhir.rest.client.api.IHttpRequest; import ca.uhn.fhir.rest.client.api.IHttpResponse; +/** + * This interface represents an interceptor which can be used to access (and optionally change or take actions upon) + * requests that are being sent by the HTTP client, and responses received by it. + *

+ * See the HAPI Documentation Client Interceptor + * page for more information on how to use this feature. + *

+ */ public interface IClientInterceptor { /** diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java index a853e5320b1..5b5f46976b7 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java @@ -218,6 +218,47 @@ public abstract class BaseHapiFhirSystemDao extends BaseHapiFhirDao 0; i++) { + for (int i = 0; i < 50 && count != 0; i++) { count = mySystemDao.performReindexingPass(100); try { Thread.sleep(DateUtils.MILLIS_PER_SECOND); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java index 24cc8493071..e1f14d6da19 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoSearchParameterDstu3.java @@ -49,7 +49,7 @@ public class FhirResourceDaoSearchParameterDstu3 extends FhirResourceDaoDstu3 0; i++) { + for (int i = 0; i < 50 && count != 0; i++) { count = mySystemDao.performReindexingPass(100); try { Thread.sleep(DateUtils.MILLIS_PER_SECOND); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java index 96919a3d945..7f3dd0e163e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java @@ -35,6 +35,7 @@ import org.hl7.fhir.dstu3.model.Conformance.ConditionalDeleteStatus; import org.hl7.fhir.dstu3.model.Conformance.ConformanceRestComponent; import org.hl7.fhir.dstu3.model.Conformance.ConformanceRestResourceComponent; import org.hl7.fhir.dstu3.model.Conformance.ConformanceRestResourceSearchParamComponent; +import org.hl7.fhir.dstu3.model.Conformance.ResourceVersionPolicy; import org.hl7.fhir.dstu3.model.Enumerations.SearchParamType; import ca.uhn.fhir.context.FhirContext; @@ -42,6 +43,7 @@ import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.IFhirSystemDao; +import ca.uhn.fhir.jpa.entity.ResourceEncodingEnum; import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.util.CoverageIgnore; import ca.uhn.fhir.util.ExtensionConstants; @@ -87,6 +89,8 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se for (ConformanceRestResourceComponent nextResource : nextRest.getResource()) { + nextResource.setVersioning(ResourceVersionPolicy.VERSIONEDUPDATE); + ConditionalDeleteStatus conditionalDelete = nextResource.getConditionalDelete(); if (conditionalDelete == ConditionalDeleteStatus.MULTIPLE && myDaoConfig.isAllowMultipleDelete() == false) { nextResource.setConditionalDelete(ConditionalDeleteStatus.SINGLE); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvc.java index bd89522dfdc..451cde41633 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvc.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvc.java @@ -394,6 +394,24 @@ public abstract class BaseHapiTerminologySvc implements IHapiTerminologySvc { // Grab the existing versions so we can delete them later List existing = myCodeSystemVersionDao.findByCodeSystemResource(theCodeSystemResourcePid); + /* + * For now we always delete old versions.. At some point it would be nice to allow configuration to keep old versions + */ + + ourLog.info("Deleting old code system versions"); + for (TermCodeSystemVersion next : existing) { + ourLog.info(" * Deleting code system version {}", next.getPid()); + myConceptParentChildLinkDao.deleteByCodeSystemVersion(next.getPid()); + myConceptDao.deleteByCodeSystemVersion(next.getPid()); + } + + ourLog.info("Flushing..."); + + myConceptParentChildLinkDao.flush(); + myConceptDao.flush(); + + ourLog.info("Done flushing"); + /* * Do the upload */ @@ -452,17 +470,6 @@ public abstract class BaseHapiTerminologySvc implements IHapiTerminologySvc { myConceptDao.flush(); myConceptParentChildLinkDao.flush(); - /* - * For now we always delete old versions.. At some point it would be nice to allow configuration to keep old versions - */ - - ourLog.info("Deleting old code system versions"); - for (TermCodeSystemVersion next : existing) { - ourLog.info(" * Deleting code system version {}", next.getPid()); - myConceptParentChildLinkDao.deleteByCodeSystemVersion(next.getPid()); - myConceptDao.deleteByCodeSystemVersion(next.getPid()); - } - ourLog.info("Done deleting old code system versions"); if (myConceptsToSaveLater.size() > 0 || myConceptLinksToSaveLater.size() > 0) { diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java index e4f8fffce0b..8c78c67677b 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu1; import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2; import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3; import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3; +import ca.uhn.fhir.jpa.provider.dstu3.TerminologyUploaderProviderDstu3; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.rest.server.ETagSupportEnum; import ca.uhn.fhir.rest.server.EncodingEnum; @@ -71,13 +72,12 @@ public class TestRestfulServer extends RestfulServer { // retrieve all the appropriate resource providers and the // conformance provider List beans; - JpaSystemProviderDstu1 systemProviderDstu1 = null; - JpaSystemProviderDstu2 systemProviderDstu2 = null; - JpaSystemProviderDstu3 systemProviderDstu3 = null; @SuppressWarnings("rawtypes") IFhirSystemDao systemDao; ETagSupportEnum etagSupport; String baseUrlProperty; + List plainProviders = new ArrayList(); + switch (fhirVersionParam.trim().toUpperCase()) { case "DSTU1": { myAppCtx = new AnnotationConfigWebApplicationContext(); @@ -87,7 +87,7 @@ public class TestRestfulServer extends RestfulServer { myAppCtx.refresh(); setFhirContext(FhirContext.forDstu1()); beans = myAppCtx.getBean("myResourceProvidersDstu1", List.class); - systemProviderDstu1 = myAppCtx.getBean("mySystemProviderDstu1", JpaSystemProviderDstu1.class); + plainProviders.add(myAppCtx.getBean("mySystemProviderDstu1", JpaSystemProviderDstu1.class)); systemDao = myAppCtx.getBean("mySystemDaoDstu1", IFhirSystemDao.class); etagSupport = ETagSupportEnum.DISABLED; JpaConformanceProviderDstu1 confProvider = new JpaConformanceProviderDstu1(this, systemDao); @@ -111,7 +111,7 @@ public class TestRestfulServer extends RestfulServer { myAppCtx.refresh(); setFhirContext(FhirContext.forDstu2()); beans = myAppCtx.getBean("myResourceProvidersDstu2", List.class); - systemProviderDstu2 = myAppCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu2.class); + plainProviders.add(myAppCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu2.class)); systemDao = myAppCtx.getBean("mySystemDaoDstu2", IFhirSystemDao.class); etagSupport = ETagSupportEnum.ENABLED; JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao, myAppCtx.getBean(DaoConfig.class)); @@ -134,12 +134,13 @@ public class TestRestfulServer extends RestfulServer { myAppCtx.refresh(); setFhirContext(FhirContext.forDstu3()); beans = myAppCtx.getBean("myResourceProvidersDstu3", List.class); - systemProviderDstu3 = myAppCtx.getBean("mySystemProviderDstu3", JpaSystemProviderDstu3.class); + plainProviders.add(myAppCtx.getBean("mySystemProviderDstu3", JpaSystemProviderDstu3.class)); systemDao = myAppCtx.getBean("mySystemDaoDstu3", IFhirSystemDao.class); etagSupport = ETagSupportEnum.ENABLED; JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao, myAppCtx.getBean(DaoConfig.class)); confProvider.setImplementationDescription(implDesc); setServerConformanceProvider(confProvider); + plainProviders.add(myAppCtx.getBean(TerminologyUploaderProviderDstu3.class)); break; } default: @@ -167,17 +168,7 @@ public class TestRestfulServer extends RestfulServer { } setResourceProviders(beans); - List provList = new ArrayList(); - if (systemProviderDstu1 != null) { - provList.add(systemProviderDstu1); - } - if (systemProviderDstu2 != null) { - provList.add(systemProviderDstu2); - } - if (systemProviderDstu3 != null) { - provList.add(systemProviderDstu3); - } - setPlainProviders(provList); + setPlainProviders(plainProviders); /* * We want to format the response using nice HTML if it's a browser, since this diff --git a/hapi-fhir-osgi-core/pom.xml b/hapi-fhir-osgi-core/pom.xml index f11c34b0afb..601fc310ab0 100644 --- a/hapi-fhir-osgi-core/pom.xml +++ b/hapi-fhir-osgi-core/pom.xml @@ -132,10 +132,10 @@ - ${pom.artifactId} + ${project.artifactId} <_nouses>true - <_removeheaders>Built-By, Include-Resource, Private-Package + <_removeheaders>Built-By, Include-Resource, Private-Package, Require-Capability @@ -146,6 +146,7 @@ com.google.*;resolution:=optional;-remove-attribute:=version, com.phloc.commons;resolution:=optional;-remove-attribute:=version, com.phloc.*;resolution:=optional;-remove-attribute:=version, + javassist;-remove-attribute:=version, javax.*;-remove-attribute:=version, net.sf.saxon;resolution:=optional, org.apache.commons.*;-remove-attribute:=version, diff --git a/hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/impl/FhirServerImpl.java b/hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/FhirServerImpl.java similarity index 97% rename from hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/impl/FhirServerImpl.java rename to hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/FhirServerImpl.java index fbf0da4dc3e..07d81c40c80 100644 --- a/hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/impl/FhirServerImpl.java +++ b/hapi-fhir-osgi-core/src/main/java/ca/uhn/fhir/osgi/FhirServerImpl.java @@ -1,4 +1,4 @@ -package ca.uhn.fhir.osgi.impl; +package ca.uhn.fhir.osgi; /* * #%L @@ -31,8 +31,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.osgi.FhirConfigurationException; -import ca.uhn.fhir.osgi.FhirServer; import ca.uhn.fhir.rest.server.RestfulServer; /** diff --git a/src/site/xdoc/hacking_hapi_fhir.xml b/src/site/xdoc/hacking_hapi_fhir.xml index a69758eb0ba..c70dafadb15 100644 --- a/src/site/xdoc/hacking_hapi_fhir.xml +++ b/src/site/xdoc/hacking_hapi_fhir.xml @@ -120,6 +120,29 @@ import more later.

+ + + +

+ When importing the HAPI projects into Eclipse, sometimes Eclipse + will fail to correctly import libraries. If you import a module + into Eclipse and it fails to compile with many errors relating to + packages other than HAPI's, the following steps will fix this: +

+
    +
  • Delete the project from your Eclipse workspace
  • +
  • + On the local filesystem, delete the files .project + and .classpath, and the directory .settings + from each module you want to open. +
  • +
  • + Import each module again using the instructions above +
  • +
+ +
+