fixed provider
This commit is contained in:
parent
1e0981b416
commit
3de51103a3
|
@ -1,17 +1,19 @@
|
||||||
package ca.uhn.fhir.jpa.bulk.api;
|
package ca.uhn.fhir.jpa.bulk.api;
|
||||||
|
|
||||||
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class GroupBulkDataExportOptions extends BulkDataExportOptions {
|
public class GroupBulkDataExportOptions extends BulkDataExportOptions {
|
||||||
private final String myGroupId;
|
private final IIdType myGroupId;
|
||||||
|
|
||||||
public GroupBulkDataExportOptions(String theOutputFormat, Set<String> theResourceTypes, Date theSince, Set<String> theFilters, String theGroupId) {
|
public GroupBulkDataExportOptions(String theOutputFormat, Set<String> theResourceTypes, Date theSince, Set<String> theFilters, IIdType theGroupId) {
|
||||||
super(theOutputFormat, theResourceTypes, theSince, theFilters);
|
super(theOutputFormat, theResourceTypes, theSince, theFilters);
|
||||||
myGroupId = theGroupId;
|
myGroupId = theGroupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGroupId() {
|
public IIdType getGroupId() {
|
||||||
return myGroupId;
|
return myGroupId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import ca.uhn.fhir.jpa.bulk.api.GroupBulkDataExportOptions;
|
||||||
import ca.uhn.fhir.jpa.bulk.api.IBulkDataExportSvc;
|
import ca.uhn.fhir.jpa.bulk.api.IBulkDataExportSvc;
|
||||||
import ca.uhn.fhir.jpa.bulk.model.BulkExportResponseJson;
|
import ca.uhn.fhir.jpa.bulk.model.BulkExportResponseJson;
|
||||||
import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
||||||
|
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||||
import ca.uhn.fhir.rest.annotation.Operation;
|
import ca.uhn.fhir.rest.annotation.Operation;
|
||||||
import ca.uhn.fhir.rest.annotation.OperationParam;
|
import ca.uhn.fhir.rest.annotation.OperationParam;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
@ -39,6 +40,7 @@ import ca.uhn.fhir.util.OperationOutcomeUtil;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
||||||
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
import org.hl7.fhir.r4.model.InstantType;
|
import org.hl7.fhir.r4.model.InstantType;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -184,6 +186,7 @@ public class BulkDataExportProvider {
|
||||||
*/
|
*/
|
||||||
@Operation(name = JpaConstants.OPERATION_EXPORT, manualResponse = true, idempotent = true, typeName = "Group")
|
@Operation(name = JpaConstants.OPERATION_EXPORT, manualResponse = true, idempotent = true, typeName = "Group")
|
||||||
public void groupExport(
|
public void groupExport(
|
||||||
|
@IdParam IIdType theIdParam,
|
||||||
@OperationParam(name = JpaConstants.PARAM_EXPORT_OUTPUT_FORMAT, min = 0, max = 1, typeName = "string") IPrimitiveType<String> theOutputFormat,
|
@OperationParam(name = JpaConstants.PARAM_EXPORT_OUTPUT_FORMAT, min = 0, max = 1, typeName = "string") IPrimitiveType<String> theOutputFormat,
|
||||||
@OperationParam(name = JpaConstants.PARAM_EXPORT_TYPE, min = 0, max = 1, typeName = "string") IPrimitiveType<String> theType,
|
@OperationParam(name = JpaConstants.PARAM_EXPORT_TYPE, min = 0, max = 1, typeName = "string") IPrimitiveType<String> theType,
|
||||||
@OperationParam(name = JpaConstants.PARAM_EXPORT_SINCE, min = 0, max = 1, typeName = "instant") IPrimitiveType<Date> theSince,
|
@OperationParam(name = JpaConstants.PARAM_EXPORT_SINCE, min = 0, max = 1, typeName = "instant") IPrimitiveType<Date> theSince,
|
||||||
|
@ -213,9 +216,7 @@ public class BulkDataExportProvider {
|
||||||
if (theTypeFilter != null) {
|
if (theTypeFilter != null) {
|
||||||
filters = ArrayUtil.commaSeparatedListToCleanSet(theTypeFilter.getValueAsString());
|
filters = ArrayUtil.commaSeparatedListToCleanSet(theTypeFilter.getValueAsString());
|
||||||
}
|
}
|
||||||
// FIXME set this
|
IBulkDataExportSvc.JobInfo outcome = myBulkDataExportSvc.submitJob(new GroupBulkDataExportOptions(outputFormat, resourceTypes, since, filters, theIdParam));
|
||||||
String groupId = "FIXME";
|
|
||||||
IBulkDataExportSvc.JobInfo outcome = myBulkDataExportSvc.submitJob(new GroupBulkDataExportOptions(outputFormat, resourceTypes, since, filters, groupId));
|
|
||||||
|
|
||||||
String serverBase = getServerBase(theRequestDetails);
|
String serverBase = getServerBase(theRequestDetails);
|
||||||
String pollLocation = serverBase + "/" + JpaConstants.OPERATION_EXPORT_POLL_STATUS + "?" + JpaConstants.PARAM_EXPORT_POLL_STATUS_JOB_ID + "=" + outcome.getJobId();
|
String pollLocation = serverBase + "/" + JpaConstants.OPERATION_EXPORT_POLL_STATUS + "?" + JpaConstants.PARAM_EXPORT_POLL_STATUS_JOB_ID + "=" + outcome.getJobId();
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class BulkDataExportProviderTest {
|
||||||
|
|
||||||
private static final String A_JOB_ID = "0000000-AAAAAA";
|
private static final String A_JOB_ID = "0000000-AAAAAA";
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(BulkDataExportProviderTest.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(BulkDataExportProviderTest.class);
|
||||||
private static final String GROUP_ID = "G2401";
|
private static final String GROUP_ID = "Group/G2401";
|
||||||
private static final String G_JOB_ID = "0000000-GGGGGG";
|
private static final String G_JOB_ID = "0000000-GGGGGG";
|
||||||
private Server myServer;
|
private Server myServer;
|
||||||
private final FhirContext myCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
private final FhirContext myCtx = FhirContext.forCached(FhirVersionEnum.R4);
|
||||||
|
@ -309,7 +309,7 @@ public class BulkDataExportProviderTest {
|
||||||
|
|
||||||
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(input));
|
ourLog.info(myCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(input));
|
||||||
|
|
||||||
HttpPost post = new HttpPost("http://localhost:" + myPort + "/Group/" + GROUP_ID + "/" + JpaConstants.OPERATION_EXPORT);
|
HttpPost post = new HttpPost("http://localhost:" + myPort + "/" + GROUP_ID + "/" + JpaConstants.OPERATION_EXPORT);
|
||||||
post.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RESPOND_ASYNC);
|
post.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RESPOND_ASYNC);
|
||||||
post.setEntity(new ResourceEntity(myCtx, input));
|
post.setEntity(new ResourceEntity(myCtx, input));
|
||||||
ourLog.info("Request: {}", post);
|
ourLog.info("Request: {}", post);
|
||||||
|
@ -326,6 +326,6 @@ public class BulkDataExportProviderTest {
|
||||||
assertThat(options.getResourceTypes(), containsInAnyOrder("Observation", "DiagnosticReport"));
|
assertThat(options.getResourceTypes(), containsInAnyOrder("Observation", "DiagnosticReport"));
|
||||||
assertThat(options.getSince(), notNullValue());
|
assertThat(options.getSince(), notNullValue());
|
||||||
assertThat(options.getFilters(), containsInAnyOrder("Observation?code=OBSCODE", "DiagnosticReport?code=DRCODE"));
|
assertThat(options.getFilters(), containsInAnyOrder("Observation?code=OBSCODE", "DiagnosticReport?code=DRCODE"));
|
||||||
assertEquals(GROUP_ID, options.getGroupId());
|
assertEquals(GROUP_ID, options.getGroupId().getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue