Search in sources :

Example 1 with ErrorReport

use of net.geoprism.dhis2.dhis2adapter.response.model.ErrorReport 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();
}
Also used : ErrorReport(net.geoprism.dhis2.dhis2adapter.response.model.ErrorReport) ExportError(net.geoprism.registry.etl.export.ExportError) DHIS2ImportResponse(net.geoprism.dhis2.dhis2adapter.response.DHIS2ImportResponse)

Aggregations

DHIS2ImportResponse (net.geoprism.dhis2.dhis2adapter.response.DHIS2ImportResponse)1 ErrorReport (net.geoprism.dhis2.dhis2adapter.response.model.ErrorReport)1 ExportError (net.geoprism.registry.etl.export.ExportError)1