use of org.hl7.fhir.r4.hapi.fluentpath.FhirPathR4 in project geoprism-registry by terraframe.
the class FhirResourceImporter method process.
private void process(Bundle bundle) {
FhirPathR4 path = new FhirPathR4(FhirContext.forR4());
List<Location> locations = path.evaluate(bundle, "Bundle.entry.resource.ofType(Location)", Location.class);
for (Location location : locations) {
try {
handleLocation(location);
if (this.history != null) {
this.history.appLock();
this.history.setWorkProgress(count++);
this.history.setExportedRecords(exportCount++);
this.history.apply();
}
} catch (Exception e) {
if (this.history != null) {
this.recordExportError(e, this.history, location);
this.history.appLock();
this.history.setWorkProgress(count++);
this.history.apply();
} else {
throw new ProgrammingErrorException(e);
}
}
}
List<Organization> organizations = path.evaluate(bundle, "Bundle.entry.resource.ofType(Organization)", Organization.class);
for (Organization organization : organizations) {
try {
handleOrganization(organization);
if (this.history != null) {
this.history.appLock();
this.history.setWorkProgress(count++);
this.history.setExportedRecords(exportCount++);
this.history.apply();
}
} catch (Exception e) {
if (this.history != null) {
this.recordExportError(e, this.history, organization);
this.history.appLock();
this.history.setWorkProgress(count++);
this.history.apply();
} else {
throw new ProgrammingErrorException(e);
}
}
}
}
Aggregations