adding additional data to (bulk data export) parameters (#5541)

* adding additional data to parameters

* checkstyle

* updated consent service

* updating documentation

* working

* updating and cleaning

* some review points

* spotless

* review fixes

* bumping version

* consent interceotpr fixes

---------

Co-authored-by: leif stawnyczy <leifstawnyczy@leifs-mbp.home>
Co-authored-by: leif stawnyczy <leifstawnyczy@leifs-MacBook-Pro.local>
This commit is contained in:
TipzCM 2024-01-12 09:49:45 -05:00 committed by GitHub
parent 01c748163d
commit d6128dece0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
86 changed files with 367 additions and 92 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,51 @@
package ca.uhn.fhir.model.api;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.Validate;
import java.util.HashMap;
import java.util.Map;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
public abstract class BaseBatchJobParameters implements IModelJson {
/**
* A serializable map of key-value pairs that can be
* added to any extending job.
*/
@JsonProperty("userData")
private Map<String, Object> myUserData;
public Map<String, Object> getUserData() {
if (myUserData == null) {
myUserData = new HashMap<>();
}
return myUserData;
}
public void setUserData(String theKey, Object theValue) {
Validate.isTrue(isNotBlank(theKey), "Invalid key; key must be non-empty, non-null.");
if (theValue == null) {
getUserData().remove(theKey);
} else {
Validate.isTrue(
validateValue(theValue),
String.format(
"Invalid data type provided %s", theValue.getClass().getName()));
getUserData().put(theKey, theValue);
}
}
private boolean validateValue(Object theValue) {
if (theValue instanceof Boolean) {
return true;
}
if (theValue instanceof Number) {
return true;
}
if (theValue instanceof String) {
return true;
}
return false;
}
}

View File

@ -105,7 +105,7 @@ public final class HapiSystemProperties {
}
/**
* This property is used to ensure unit test behaviour is deterministic. It is also used to add extra logging for unit tests.
* This property is used to ensure unit test behaviour is deterministic.
*/
public static void enableUnitTestMode() {
System.setProperty(UNIT_TEST_MODE, Boolean.TRUE.toString());

View File

@ -0,0 +1,114 @@
package ca.uhn.fhir.model.api;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class BaseBatchJobParametersTest {
private static class TestParameters extends BaseBatchJobParameters {
}
private static class TestParam {
private final Object myTestValue;
private final boolean myExpectedToWork;
public TestParam(Object theValue, boolean theExpected) {
myTestValue = theValue;
myExpectedToWork = theExpected;
}
public Object getTestValue() {
return myTestValue;
}
public boolean isExpectedToWork() {
return myExpectedToWork;
}
}
private static List<TestParam> parameters() {
List<TestParam> params = new ArrayList<>();
// should pass
params.add(new TestParam("string", true));
params.add(new TestParam(1, true));
params.add(new TestParam(1.1f, true));
params.add(new TestParam(1.1d, true));
params.add(new TestParam(true, true));
params.add(new TestParam(-1, true));
// should not pass
params.add(new TestParam(List.of("strings"), false));
params.add(new TestParam(new Object(), false));
return params;
}
@ParameterizedTest
@MethodSource("parameters")
public void setUserData_acceptsStringNumberAndBooleansOnly(TestParam theParams) {
// setup
String key = "key";
TestParameters parameters = new TestParameters();
Object testValue = theParams.getTestValue();
// test
if (theParams.isExpectedToWork()) {
parameters.setUserData(key, testValue);
assertFalse(parameters.getUserData().isEmpty());
assertEquals(testValue, parameters.getUserData().get(key));
} else {
try {
parameters.setUserData(key, testValue);
fail();
} catch (IllegalArgumentException ex) {
String dataType = testValue.getClass().getName();
assertTrue(ex.getMessage().contains("Invalid data type provided " + dataType),
ex.getMessage());
assertTrue(parameters.getUserData().isEmpty());
}
}
}
@Test
public void setUserData_invalidKey_throws() {
// setup
TestParameters parameters = new TestParameters();
// test
for (String key : new String[] { null, "" }) {
try {
parameters.setUserData(key, "test");
fail();
} catch (IllegalArgumentException ex) {
assertTrue(ex.getMessage().contains("Invalid key; key must be non-empty, non-null"),
ex.getMessage());
}
}
}
@Test
public void setUserData_nullValue_removes() {
// setup
TestParameters parameters = new TestParameters();
String key = "key";
// test
parameters.setUserData(key, "test");
assertTrue(parameters.getUserData().containsKey(key));
parameters.setUserData(key, null);
assertFalse(parameters.getUserData().containsKey(key));
}
}

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>
@ -12,7 +12,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,10 @@
---
type: add
issue: 5527
title: "Added a map of `additionalData` to BulkExport job params.
This will allow consumers of BulkExport to add additional
data to be accessed at later steps by using various pointcuts
in the system.
Updated ConsentService so that BulkExport operations will
call the willSeeResource method for each exported resource.
"

View File

@ -11,7 +11,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -31,6 +31,7 @@ import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.SortOrderEnum;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.UriParam;
@ -172,7 +173,7 @@ public class JpaPersistedResourceValidationSupport implements IValidationSupport
}
IBundleProvider search = myDaoRegistry
.getResourceDao("StructureDefinition")
.search(new SearchParameterMap().setLoadSynchronousUpTo(1000));
.search(new SearchParameterMap().setLoadSynchronousUpTo(1000), new SystemRequestDetails());
return (List<T>) search.getResources(0, 1000);
}

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -12,16 +12,12 @@ import ca.uhn.fhir.jpa.api.model.BulkExportJobResults;
import ca.uhn.fhir.jpa.batch.models.Batch2JobStartResponse;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.RequestTypeEnum;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters;
import ca.uhn.fhir.rest.client.apache.ResourceEntity;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import ca.uhn.fhir.test.utilities.HttpClientExtension;
@ -95,6 +91,7 @@ import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@ -409,6 +406,72 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test {
verifyBulkExportResults(options, List.of("Patient/P1", obsId, encId), List.of("Patient/P2", obsId2, encId2, obsId3));
}
@Test
public void testBulkExportParametersPersistExtraData() {
// setup
myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED);
List<String> ids = new ArrayList<>();
// create some resources
Patient patient = new Patient();
patient.setId("P1");
patient.setActive(true);
myClient.update().resource(patient).execute();
ids.add("Patient/P1");
Observation observation;
for (int i = 0; i < 5; i++) {
observation = new Observation();
observation.setSubject(new Reference().setReference("Patient/P1"));
observation.setStatus(Observation.ObservationStatus.PRELIMINARY);
String obsId = myClient.create().resource(observation).execute().getId().toUnqualifiedVersionless().getValue();
ids.add(obsId);
}
Encounter encounter = new Encounter();
encounter.setSubject(new Reference().setReference("Patient/P1"));
encounter.setStatus(Encounter.EncounterStatus.INPROGRESS);
String encId = myClient.create().resource(encounter).execute().getId().toUnqualifiedVersionless().getValue();
ids.add(encId);
// set the export options
BulkExportJobParameters options = new BulkExportJobParameters();
options.setResourceTypes(Sets.newHashSet("Patient", "Observation", "Encounter"));
options.setPatientIds(Set.of("Patient/P1"));
options.setFilters(new HashSet<>());
options.setExportStyle(BulkExportJobParameters.ExportStyle.PATIENT);
options.setOutputFormat(Constants.CT_FHIR_NDJSON);
String key = "counter";
String value = "value_";
options.setUserData(key, value);
List<String> valueSet = new ArrayList<>();
Object interceptor = new Object() {
@Hook(Pointcut.STORAGE_BULK_EXPORT_RESOURCE_INCLUSION)
public void onExpandResources(IBaseResource theBaseResource, BulkExportJobParameters theParams) {
// this will be called once per every resource
String value = (String) theParams.getUserData().get(key);
valueSet.add(value + theBaseResource.getIdElement().toUnqualifiedVersionless().getValue());
}
};
myInterceptorRegistry.registerInterceptor(interceptor);
try {
verifyBulkExportResults(options, ids, new ArrayList<>());
assertFalse(valueSet.isEmpty());
assertEquals(ids.size(), valueSet.size());
for (String id : valueSet) {
// should start with our value from the key-value pairs
assertTrue(id.startsWith(value));
assertTrue(ids.contains(id.substring(value.length())));
}
} finally {
myInterceptorRegistry.unregisterInterceptor(interceptor);
}
}
@Test
public void testPatientBulkExportWithMultiIds() {
myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED);

View File

@ -6,6 +6,7 @@ import ca.uhn.fhir.batch2.api.IJobPersistence;
import ca.uhn.fhir.batch2.model.JobInstance;
import ca.uhn.fhir.batch2.model.JobInstanceStartRequest;
import ca.uhn.fhir.batch2.model.StatusEnum;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.model.BulkExportJobResults;
import ca.uhn.fhir.jpa.batch.models.Batch2JobStartResponse;
@ -107,6 +108,8 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test {
private IBatch2JobInstanceRepository myJobInstanceRepository;
@Autowired
private IBatch2WorkChunkRepository myWorkChunkRepository;
@Autowired
private IInterceptorService myInterceptorService;
@BeforeEach
public void beforeEach() {
@ -557,8 +560,8 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test {
RequestDetails details = new SystemRequestDetails();
List<String> patientIds = new ArrayList<>();
for(int i = 0; i < numPatients; i++){
String id = "p-"+i;
for (int i = 0; i < numPatients; i++) {
String id = "p-" + i;
Patient patient = new Patient();
patient.setId(id);
myPatientDao.update(patient, details);
@ -594,7 +597,7 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test {
List<String> binaryUrls = results.getResourceTypeToBinaryIds().get("Patient");
IParser jsonParser = myFhirContext.newJsonParser();
for(String url : binaryUrls){
for (String url : binaryUrls) {
Binary binary = myClient.read().resource(Binary.class).withUrl(url).execute();
assertEquals(Constants.CT_FHIR_NDJSON, binary.getContentType());
String resourceContents = new String(binary.getContent(), Constants.CHARSET_UTF8);

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -20,7 +20,7 @@
package ca.uhn.fhir.rest.api.server.bulk;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.model.api.IModelJson;
import ca.uhn.fhir.model.api.BaseBatchJobParameters;
import ca.uhn.fhir.rest.server.util.JsonDateDeserializer;
import ca.uhn.fhir.rest.server.util.JsonDateSerializer;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -32,7 +32,7 @@ import java.util.Collection;
import java.util.Date;
import java.util.List;
public class BulkExportJobParameters implements IModelJson {
public class BulkExportJobParameters extends BaseBatchJobParameters {
/**
* List of resource types to export.

View File

@ -31,6 +31,8 @@ import ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails;
import ca.uhn.fhir.rest.api.server.IPreResourceShowDetails;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.ResponseDetails;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
import ca.uhn.fhir.rest.server.exceptions.ForbiddenOperationException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
@ -497,6 +499,37 @@ public class ConsentInterceptor {
}
}
protected RequestDetails getRequestDetailsForCurrentExportOperation(
BulkExportJobParameters theParameters, IBaseResource theBaseResource) {
// bulk exports are system operations
SystemRequestDetails details = new SystemRequestDetails();
return details;
}
@Hook(value = Pointcut.STORAGE_BULK_EXPORT_RESOURCE_INCLUSION)
public boolean shouldBulkExportIncludeResource(BulkExportJobParameters theParameters, IBaseResource theResource) {
RequestDetails requestDetails = getRequestDetailsForCurrentExportOperation(theParameters, theResource);
for (IConsentService next : myConsentService) {
ConsentOutcome nextOutcome = next.willSeeResource(requestDetails, theResource, myContextConsentServices);
ConsentOperationStatusEnum status = nextOutcome.getStatus();
switch (status) {
case AUTHORIZED:
case PROCEED:
// go to the next
break;
case REJECT:
// if any consent service rejects,
// reject the resource
return false;
}
}
// default is to include the resource
return true;
}
private boolean isRequestAuthorized(RequestDetails theRequestDetails) {
boolean retVal = false;
if (theRequestDetails != null) {
@ -515,11 +548,11 @@ public class ConsentInterceptor {
}
private boolean isMetaOperation(RequestDetails theRequestDetails) {
return OPERATION_META.equals(theRequestDetails.getOperation());
return theRequestDetails != null && OPERATION_META.equals(theRequestDetails.getOperation());
}
private boolean isMetadataPath(RequestDetails theRequestDetails) {
return URL_TOKEN_METADATA.equals(theRequestDetails.getRequestPath());
return theRequestDetails != null && URL_TOKEN_METADATA.equals(theRequestDetails.getRequestPath());
}
private void validateParameter(Map<String, String[]> theParameterMap) {

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -21,7 +21,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-caching-api</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>hapi-deployable-pom</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -9,7 +9,7 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<name>HAPI-FHIR</name>
<description>An open-source implementation of the FHIR specification in Java.</description>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.11.8-SNAPSHOT</version>
<version>6.11.9-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>