From 3e249d0261090c20f4799500cb518d5fcfbda3f0 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Wed, 10 Mar 2021 12:03:19 -0500 Subject: [PATCH] Minor cleanup --- .../uhn/fhir/jpa/bulk/job/PatientBulkItemReader.java | 3 +-- .../jpa/bulk/provider/BulkDataExportProvider.java | 2 -- .../uhn/fhir/jpa/bulk/svc/BulkDataExportSvcImpl.java | 11 +++++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/PatientBulkItemReader.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/PatientBulkItemReader.java index 219b4f17368..c206404ac95 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/PatientBulkItemReader.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/PatientBulkItemReader.java @@ -77,10 +77,9 @@ public class PatientBulkItemReader extends BaseBulkItemReader implements ItemRea for (SearchParameterMap map: maps) { //Ensure users did not monkey with the patient compartment search parameter. validateSearchParameters(map); + //Skip adding the parameter querying for patient= if we are in fact querying the patient resource type. if (!myResourceType.equalsIgnoreCase("Patient")) { - //Now that we have our basic built Bulk Export SP map, we inject the condition that the resources returned - //must have a patient= or subject= reference set. map.add(patientSearchParam, new ReferenceParam().setMissing(false)); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/provider/BulkDataExportProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/provider/BulkDataExportProvider.java index 4fde8b3c2f6..034190ef837 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/provider/BulkDataExportProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/provider/BulkDataExportProvider.java @@ -60,8 +60,6 @@ public class BulkDataExportProvider { private IBulkDataExportSvc myBulkDataExportSvc; @Autowired private FhirContext myFhirContext; - @Autowired - private DaoConfig myDaoConfig; @VisibleForTesting public void setFhirContextForUnitTest(FhirContext theFhirContext) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/svc/BulkDataExportSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/svc/BulkDataExportSvcImpl.java index 6da24977af3..cfda28fa1d0 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/svc/BulkDataExportSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/svc/BulkDataExportSvcImpl.java @@ -254,6 +254,10 @@ public class BulkDataExportSvcImpl implements IBulkDataExportSvc { return theBulkExportJobEntity.getRequest().startsWith("/Patient/"); } + private boolean isGroupBulkJob(BulkExportJobEntity theBulkExportJobEntity) { + return theBulkExportJobEntity.getRequest().startsWith("/Group/"); + } + private void enhanceBulkParametersWithGroupParameters(BulkExportJobEntity theBulkExportJobEntity, JobParametersBuilder theParameters) { String theGroupId = getQueryParameterIfPresent(theBulkExportJobEntity.getRequest(), JpaConstants.PARAM_EXPORT_GROUP_ID); String expandMdm = getQueryParameterIfPresent(theBulkExportJobEntity.getRequest(), JpaConstants.PARAM_EXPORT_MDM); @@ -261,10 +265,6 @@ public class BulkDataExportSvcImpl implements IBulkDataExportSvc { theParameters.addString(BulkExportJobConfig.EXPAND_MDM_PARAMETER, expandMdm); } - private boolean isGroupBulkJob(BulkExportJobEntity theBulkExportJobEntity) { - String queryParameterIfPresent = getQueryParameterIfPresent(theBulkExportJobEntity.getRequest(), JpaConstants.PARAM_EXPORT_GROUP_ID); - return queryParameterIfPresent != null; - } @SuppressWarnings("unchecked") private IFhirResourceDao getBinaryDao() { @@ -309,7 +309,6 @@ public class BulkDataExportSvcImpl implements IBulkDataExportSvc { requestBuilder.append("Patient/"); } - requestBuilder.append(JpaConstants.OPERATION_EXPORT); requestBuilder.append("?").append(JpaConstants.PARAM_EXPORT_OUTPUT_FORMAT).append("=").append(escapeUrlParam(outputFormat)); Set resourceTypes = theBulkDataExportOptions.getResourceTypes(); @@ -474,7 +473,7 @@ public class BulkDataExportSvcImpl implements IBulkDataExportSvc { } else if (theExportStyle.equals(GROUP) || theExportStyle.equals(PATIENT)) { return getPatientCompartmentResources(); } else { - return null; + return throw new IllegalArgumentException(String.format("HAPI FHIR does not recognize a Bulk Export request of type: %s", theExportStyle)); } }