use of org.hisp.dhis.tracker.TrackerType in project dhis2-core by dhis2.
the class TrackerImportReport method processBundleReport.
/**
* Calculates the 'ignored' value for each type of entity in the
* {@link TrackerBundleReport}.
*
* The 'ignored' value is calculated by subtracting the sum of all processed
* entities from the TrackerBundleReport (by type) from the bundle size
* specified in the 'bundleSize' map.
*/
private static TrackerBundleReport processBundleReport(TrackerBundleReport bundleReport, Map<TrackerType, Integer> bundleSize) {
for (final TrackerType value : TrackerType.values()) {
final TrackerTypeReport trackerTypeReport = bundleReport.getTypeReportMap().get(value);
if (trackerTypeReport != null) {
final TrackerStats stats = trackerTypeReport.getStats();
if (stats != null) {
int statsSize = stats.getDeleted() + stats.getCreated() + stats.getUpdated();
stats.setIgnored(bundleSize.getOrDefault(value, statsSize) - statsSize);
}
}
}
return bundleReport;
}
use of org.hisp.dhis.tracker.TrackerType in project dhis2-core by dhis2.
the class ValidationErrorReporterTest method hasErrorReportNotFound.
@Test
void hasErrorReportNotFound() {
ValidationErrorReporter reporter = ValidationErrorReporter.emptyReporter();
TrackerBundle bundle = mock(TrackerBundle.class);
TrackerErrorReport error = TrackerErrorReport.builder().errorCode(TrackerErrorCode.E1000).trackerType(TrackerType.EVENT).build(bundle);
reporter.getReportList().add(error);
assertFalse(reporter.hasErrorReport(r -> TrackerType.TRACKED_ENTITY.equals(r.getTrackerType())));
}
use of org.hisp.dhis.tracker.TrackerType in project dhis2-core by dhis2.
the class ValidationErrorReporterTest method hasErrorReportFound.
@Test
void hasErrorReportFound() {
ValidationErrorReporter reporter = ValidationErrorReporter.emptyReporter();
TrackerBundle bundle = mock(TrackerBundle.class);
TrackerErrorReport error = TrackerErrorReport.builder().errorCode(TrackerErrorCode.E1000).trackerType(TrackerType.EVENT).build(bundle);
reporter.getReportList().add(error);
assertTrue(reporter.hasErrorReport(r -> TrackerType.EVENT.equals(r.getTrackerType())));
}
use of org.hisp.dhis.tracker.TrackerType in project dhis2-core by dhis2.
the class ValidationErrorReporterTest method hasWarningReportNotFound.
@Test
void hasWarningReportNotFound() {
ValidationErrorReporter reporter = ValidationErrorReporter.emptyReporter();
TrackerBundle bundle = mock(TrackerBundle.class);
TrackerWarningReport warning = TrackerWarningReport.builder().warningCode(TrackerErrorCode.E1000).trackerType(TrackerType.EVENT).build(bundle);
reporter.getWarningsReportList().add(warning);
assertFalse(reporter.hasWarningReport(r -> TrackerType.TRACKED_ENTITY.equals(r.getTrackerType())));
}
use of org.hisp.dhis.tracker.TrackerType in project dhis2-core by dhis2.
the class ValidationErrorReporterTest method hasWarningReportFound.
@Test
void hasWarningReportFound() {
ValidationErrorReporter reporter = ValidationErrorReporter.emptyReporter();
TrackerBundle bundle = mock(TrackerBundle.class);
TrackerWarningReport warning = TrackerWarningReport.builder().warningCode(TrackerErrorCode.E1000).trackerType(TrackerType.EVENT).build(bundle);
reporter.getWarningsReportList().add(warning);
assertTrue(reporter.hasWarningReport(r -> TrackerType.EVENT.equals(r.getTrackerType())));
}
Aggregations