Skip to content

Commit

Permalink
Merge pull request #78 from IBM/issue-#67-new
Browse files Browse the repository at this point in the history
Issue #67 new
  • Loading branch information
lmsurpre committed Sep 15, 2019
2 parents 6f5780e + 10a298b commit 0bf7bda
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<property name="cos.bucket.pathprefix" value="#{jobParameters['cos.bucket.pathprefix']}"/>
<property name="cos.bucket.objectname" value="#{jobParameters['cos.bucket.objectname']}"/>
<property name="fhir.tenant" value="#{jobParameters['fhir.tenant']}"/>
<property name="fhir.datastoreid" value="#{jobParameters['fhir.datastoreid']}"/>
<property name="fhir.resourcetype" value="#{jobParameters['fhir.resourcetype']}"/>
<property name="fhir.search.fromdate" value="#{jobParameters['fhir.search.fromdate']}"/>
<property name="fhir.search.todate" value="#{jobParameters['fhir.search.todate']}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<property name="cos.credential.ibm" value="#{jobParameters['cos.credential.ibm']}"/>
<property name="cos.bucket.name" value="#{jobParameters['cos.bucket.name']}"/>
<property name="fhir.tenant" value="#{jobParameters['fhir.tenant']}"/>
<property name="fhir.datastoreid" value="#{jobParameters['fhir.datastoreid']}"/>
<property name="cos.bucket.objectname" value="#{jobParameters['cos.bucket.objectname']}"/>
</properties>
</batchlet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ public class BulkExportBatchLet implements Batchlet {
@Inject
@BatchProperty(name = "fhir.tenant")
String fhirTenant;

/**
* Fhir data store id.
*/
@Inject
@BatchProperty(name = "fhir.datastoreid")
String fhirDatastoreId;

/**
* Fhir ResourceType.
Expand Down Expand Up @@ -230,8 +237,14 @@ public String process() throws Exception {
fhirTenant = Constants.DEFAULT_FHIR_TENANT;
log("process", "Set tenant to default!");
}

if (fhirDatastoreId == null) {
fhirDatastoreId = Constants.DEFAULT_FHIR_TENANT;
log("readItem", "Set DatastoreId to default!");
}

FHIRConfiguration.setConfigHome("./");
FHIRRequestContext.set(new FHIRRequestContext(fhirTenant, fhirTenant));
FHIRRequestContext.set(new FHIRRequestContext(fhirTenant, fhirDatastoreId));

FHIRPersistenceHelper fhirPersistenceHelper = new FHIRPersistenceHelper();
FHIRPersistence fhirPersistence = fhirPersistenceHelper.getFHIRPersistenceImplementation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.ibm.cloud.objectstorage.services.s3.model.ListObjectsV2Result;
import com.ibm.cloud.objectstorage.services.s3.model.S3Object;
import com.ibm.cloud.objectstorage.services.s3.model.S3ObjectSummary;
import com.ibm.waston.health.fhir.bulkcommon.Constants;
import com.ibm.watson.health.fhir.config.FHIRConfiguration;
import com.ibm.watson.health.fhir.config.FHIRRequestContext;
import com.ibm.watson.health.fhir.model.format.Format;
Expand Down Expand Up @@ -109,6 +110,13 @@ public class BulkImportBatchLet implements Batchlet {
@Inject
@BatchProperty(name = "fhir.tenant")
String fhirTenant;

/**
* Fhir data store id.
*/
@Inject
@BatchProperty(name = "fhir.datastoreid")
String fhirDatastoreId;

private void getCosClient() {
SDKGlobalConfiguration.IAM_ENDPOINT = "https://iam.cloud.ibm.com/oidc/token";
Expand Down Expand Up @@ -218,8 +226,14 @@ public String process() throws Exception {
fhirTenant = "default";
log("process", "Set tenant to default!");
}

if (fhirDatastoreId == null) {
fhirDatastoreId = Constants.DEFAULT_FHIR_TENANT;
log("readItem", "Set DatastoreId to default!");
}

FHIRConfiguration.setConfigHome("./");
FHIRRequestContext.set(new FHIRRequestContext(fhirTenant, fhirTenant));
FHIRRequestContext.set(new FHIRRequestContext(fhirTenant, fhirDatastoreId));

FHIRPersistenceHelper fhirPersistenceHelper = new FHIRPersistenceHelper();
FHIRPersistence fhirPersistence = fhirPersistenceHelper.getFHIRPersistenceImplementation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public void testBulkExportJobInstanceRequestWithSensitive() throws Exception {
" \"cos.credential.ibm\": \"Y\",\n" +
" \"cos.api.key\": \"key\",\n" +
" \"cos.srvinst.id\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/<>::\",\n" +
" \"fhir.search.fromdate\": \"2019-08-01\"\n" +
" \"fhir.search.fromdate\": \"2019-08-01\",\n" +
" \"fhir.tenant\": \"default\",\n" +
" \"fhir.datastoreid\": \"default\"\n" +
" }\n" +
"}";

Expand Down Expand Up @@ -138,7 +140,9 @@ public void testBulkExportJobInstanceRequestWithoutSensitive() throws Exception
" \"cos.credential.ibm\": \"Y\",\n" +
" \"cos.api.key\": \"key\",\n" +
" \"cos.srvinst.id\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/<>::\",\n" +
" \"fhir.search.fromdate\": \"2019-08-01\"\n" +
" \"fhir.search.fromdate\": \"2019-08-01\",\n" +
" \"fhir.tenant\": \"default\",\n" +
" \"fhir.datastoreid\": \"default\"\n" +
" }\n" +
"}";

Expand Down

0 comments on commit 0bf7bda

Please sign in to comment.