use of net.geoprism.registry.etl.export.ExportError in project geoprism-registry by terraframe.
the class DHIS2SynchronizationManager method recordExportError.
private void recordExportError(DHIS2SyncError ee, ExportHistory history) {
DHIS2ImportResponse resp = ee.response;
Throwable ex = ee.error;
String geoObjectCode = ee.geoObjectCode;
ExportError exportError = new ExportError();
if (ee.submittedJson != null) {
exportError.setSubmittedJson(ee.submittedJson);
}
if (resp != null) {
if (resp.getResponse() != null && resp.getResponse().length() > 0) {
exportError.setResponseJson(resp.getResponse());
if (resp.hasErrorReports()) {
List<ErrorReport> reports = resp.getErrorReports();
ErrorReport report = reports.get(0);
exportError.setErrorMessage(report.getMessage());
}
}
exportError.setErrorCode(resp.getStatusCode());
}
exportError.setCode(geoObjectCode);
if (ex != null) {
exportError.setErrorJson(JobHistory.exceptionToJson(ex).toString());
}
exportError.setRowIndex(ee.rowIndex);
exportError.setHistory(history);
exportError.apply();
}
use of net.geoprism.registry.etl.export.ExportError in project geoprism-registry by terraframe.
the class FhirResourceImporter method recordExportError.
@Transaction
private void recordExportError(Exception ex, ExportHistory history, Resource resource) {
if (ex instanceof ProgrammingErrorException) {
logger.error("Unknown error while processing the FHIR resource [" + resource.getId() + "]", ex);
}
if (this.history != null) {
ExportError exportError = new ExportError();
exportError.setCode(resource.getId());
if (ex != null) {
exportError.setErrorJson(JobHistory.exceptionToJson(ex).toString());
}
// exportError.setRowIndex(ee.rowIndex);
exportError.setHistory(history);
exportError.apply();
}
}
use of net.geoprism.registry.etl.export.ExportError in project geoprism-registry by terraframe.
the class ETLService method getExportErrors.
@Request(RequestType.SESSION)
public JsonObject getExportErrors(String sessionId, String historyId, int pageSize, int pageNumber) {
JsonArray ja = new JsonArray();
ExportErrorQuery query = new ExportErrorQuery(new QueryFactory());
query.WHERE(query.getHistory().EQ(historyId));
query.ORDER_BY(query.getRowIndex(), SortOrder.ASC);
query.restrictRows(pageSize, pageNumber);
try (OIterator<? extends ExportError> it = query.getIterator()) {
List<ExportError> results = new LinkedList<>(it.getAll());
return new Page<ExportError>(query.getCount(), query.getPageNumber(), query.getPageSize(), results).toJSON();
}
}
Aggregations