use of org.hisp.dhis.tracker.report.TrackerBundleReport in project dhis2-core by dhis2.
the class DefaultTrackerBundleService method delete.
@Override
@Transactional
public TrackerBundleReport delete(TrackerBundle bundle) {
TrackerBundleReport bundleReport = new TrackerBundleReport();
if (TrackerBundleMode.VALIDATE == bundle.getImportMode()) {
return bundleReport;
}
Map<TrackerType, TrackerTypeReport> report = bundleReport.getTypeReportMap();
report.put(TrackerType.RELATIONSHIP, deletionService.deleteRelationShips(bundle));
report.put(TrackerType.EVENT, deletionService.deleteEvents(bundle));
report.put(TrackerType.ENROLLMENT, deletionService.deleteEnrollments(bundle));
report.put(TrackerType.TRACKED_ENTITY, deletionService.deleteTrackedEntityInstances(bundle));
return bundleReport;
}
use of org.hisp.dhis.tracker.report.TrackerBundleReport in project dhis2-core by dhis2.
the class ReportSummaryDeleteIntegrationTest method initTest.
@Override
protected void initTest() throws IOException {
setUpMetadata("tracker/tracker_basic_metadata.json");
TrackerImportParams params = fromJson("tracker/tracker_basic_data_before_deletion.json");
assertEquals(13, params.getTrackedEntities().size());
assertEquals(2, params.getEnrollments().size());
assertEquals(2, params.getEvents().size());
TrackerBundleReport bundleReport = trackerImportService.importTracker(params).getBundleReport();
assertEquals(bundleReport.getTypeReportMap().get(TrackerType.EVENT).getStats().getCreated(), manager.getAll(ProgramStageInstance.class).size());
assertEquals(bundleReport.getTypeReportMap().get(TrackerType.EVENT).getStats().getCreated(), bundleReport.getTypeReportMap().get(TrackerType.EVENT).getObjectReportMap().size());
assertEquals(bundleReport.getTypeReportMap().get(TrackerType.TRACKED_ENTITY).getStats().getCreated(), bundleReport.getTypeReportMap().get(TrackerType.TRACKED_ENTITY).getObjectReportMap().size());
assertEquals(4, manager.getAll(ProgramInstance.class).size());
assertEquals(2, bundleReport.getTypeReportMap().get(TrackerType.ENROLLMENT).getObjectReportMap().size());
}
Aggregations