diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/UploadTerminologyCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/UploadTerminologyCommand.java index 756567ed7d4..5179a03afbc 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/UploadTerminologyCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/UploadTerminologyCommand.java @@ -28,9 +28,6 @@ import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; -import org.hl7.fhir.dstu3.model.Parameters; -import org.hl7.fhir.dstu3.model.StringType; -import org.hl7.fhir.dstu3.model.UriType; import org.hl7.fhir.instance.model.api.IBaseParameters; import static org.apache.commons.lang3.StringUtils.isBlank; @@ -82,10 +79,17 @@ public class UploadTerminologyCommand extends BaseCommand { IGenericClient client = super.newClient(theCommandLine); IBaseParameters inputParameters; if (ctx.getVersion().getVersion() == FhirVersionEnum.DSTU3) { - Parameters p = new Parameters(); - p.addParameter().setName("url").setValue(new UriType(termUrl)); + org.hl7.fhir.dstu3.model.Parameters p = new org.hl7.fhir.dstu3.model.Parameters(); + p.addParameter().setName("url").setValue(new org.hl7.fhir.dstu3.model.UriType(termUrl)); for (String next : datafile) { - p.addParameter().setName("localfile").setValue(new StringType(next)); + p.addParameter().setName("localfile").setValue(new org.hl7.fhir.dstu3.model.StringType(next)); + } + inputParameters = p; + } else if (ctx.getVersion().getVersion() == FhirVersionEnum.R4) { + org.hl7.fhir.r4.model.Parameters p = new org.hl7.fhir.r4.model.Parameters(); + p.addParameter().setName("url").setValue(new org.hl7.fhir.r4.model.UriType(termUrl)); + for (String next : datafile) { + p.addParameter().setName("localfile").setValue(new org.hl7.fhir.r4.model.StringType(next)); } inputParameters = p; } else { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java index 77e07267064..92a9cf8808c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseHapiTerminologySvcImpl.java @@ -837,15 +837,16 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc, return; } else if (myDeferredConcepts.isEmpty() && myConceptLinksToSaveLater.isEmpty()) { processReindexing(); - return; } TransactionTemplate tt = new TransactionTemplate(myTransactionMgr); tt.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW); - tt.execute(t -> { - processDeferredConcepts(); - return null; - }); + if(!myDeferredConcepts.isEmpty() || !myConceptLinksToSaveLater.isEmpty()) { + tt.execute(t -> { + processDeferredConcepts(); + return null; + }); + } if (myDeferredValueSets.size() > 0) { tt.execute(t -> { diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 3812fc56b6a..5bbc4f7c607 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -108,6 +108,17 @@ unexpectedly resources could be left in a weird state. This has been corrected. + + A bug was fixed in the JPA terminology uploader, where it was possible + in some cases for some ValueSets and ConceptMaps to not be saved because + of a premature short circuit during deferred uploading. Thanks to + Joel Schneider for the pull request! + + + A bug in the HAPI FHIR CLI was fixed, where uploading terminology for R4 + could cause an error about the incorrect FHIR version. Thanks to + Rob Hausam for the pull request! +