use of com.google.api.services.healthcare.v1.model.FhirStore in project beam by apache.
the class FhirIOTestUtil method executeFhirBundles.
/**
* Populate the test resources into the FHIR store and returns a list of resource IDs.
*/
static List<String> executeFhirBundles(HealthcareApiClient client, String fhirStore, List<String> bundles) throws IOException, HealthcareHttpException {
List<String> resourceNames = new ArrayList<>();
for (String bundle : bundles) {
HttpBody resp = client.executeFhirBundle(fhirStore, bundle);
JsonObject jsonResponse = JsonParser.parseString(resp.toString()).getAsJsonObject();
for (JsonElement entry : jsonResponse.getAsJsonArray("entry")) {
String location = entry.getAsJsonObject().getAsJsonObject("response").getAsJsonPrimitive("location").getAsString();
String resourceName = location.substring(location.indexOf("project"), location.indexOf("/_history"));
resourceNames.add(resourceName);
}
}
return resourceNames;
}
Aggregations