Skip to content

Commit

Permalink
Merge pull request #71 from IBM/issue-67-aw
Browse files Browse the repository at this point in the history
issue #67 change importchunkjob to take tenant and storeID
  • Loading branch information
lmsurpre committed Sep 14, 2019
2 parents 732bc2b + 697b4a9 commit 571c518
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
<property name="cos.bucket.objectname" value="#{jobParameters['cos.bucket.objectname']}"/>
</properties>
</reader>
<writer ref="com.ibm.watson.health.fhir.bulkimport.ChunkWriter" />
<writer ref="com.ibm.watson.health.fhir.bulkimport.ChunkWriter">
<properties >
<property name="fhir.tenant" value="#{jobParameters['fhir.tenant']}"/>
<property name="fhir.datastoreid" value="#{jobParameters['fhir.datastoreid']}"/>
</properties>
</writer>
</chunk>
</step>
</job>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.json.JSONArray;
import org.json.JSONObject;

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 All @@ -42,6 +43,13 @@ public class ChunkWriter extends AbstractItemWriter {
@Inject
@BatchProperty(name = "fhir.tenant")
String fhirTenant;

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

/**
* @see AbstractItemWriter#AbstractItemWriter()
Expand Down Expand Up @@ -69,8 +77,14 @@ public void writeItems(List<java.lang.Object> arg0) throws Exception {
fhirTenant = "default";
log("writeItems", "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

0 comments on commit 571c518

Please sign in to comment.