use of org.hisp.dhis.actions.MaintenanceActions in project dhis2-core by dhis2.
the class EventActions method delete.
/**
* Hard deletes event.
*
* @param eventId
* @return
*/
@Override
public ApiResponse delete(String eventId) {
ApiResponse response = super.delete(eventId);
new MaintenanceActions().removeSoftDeletedEvents();
return response;
}
use of org.hisp.dhis.actions.MaintenanceActions in project dhis2-core by dhis2.
the class TestCleanUp method deleteCreatedEntities.
/**
* Deletes entities created during test run. Entities deleted one by one
* starting from last created one.
*/
public void deleteCreatedEntities() {
Map<String, String> createdEntities = TestRunStorage.getCreatedEntities();
List<String> reverseOrderedKeys = new ArrayList<>(createdEntities.keySet());
Collections.reverse(reverseOrderedKeys);
Iterator<String> iterator = reverseOrderedKeys.iterator();
while (iterator.hasNext()) {
String key = iterator.next();
boolean deleted = deleteEntity(createdEntities.get(key), key);
if (deleted) {
TestRunStorage.removeEntity(createdEntities.get(key), key);
createdEntities.remove(createdEntities.get(key), key);
}
new MaintenanceActions().removeSoftDeletedData();
}
while (deleteCount < 2 && !createdEntities.isEmpty()) {
deleteCount++;
deleteCreatedEntities();
}
TestRunStorage.removeAllEntities();
}
use of org.hisp.dhis.actions.MaintenanceActions in project dhis2-core by dhis2.
the class TrackerNtiApiTest method afterEachNTI.
@AfterEach
public void afterEachNTI() {
loginActions.loginAsSuperUser();
new MaintenanceActions().removeSoftDeletedData();
}
Aggregations