Search in sources :

Example 36 with DELETED

use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.DELETED in project dhis2-core by dhis2.

the class DataValueSetServiceIntegrationTest method testImportAndDeleteValuesXml.

/**
 * Import 12 data values. Then import 12 values where 4 are marked as
 * deleted, 6 are updates and 2 are new.
 */
@Test
void testImportAndDeleteValuesXml() {
    assertDataValuesCount(0);
    in = readFile("datavalueset/dataValueSetB.xml");
    ImportSummary summary = dataValueSetService.importDataValueSetXml(in);
    assertEquals(12, summary.getImportCount().getImported());
    assertDataValuesCount(12);
    // Delete 4 values, add 2 values
    in = readFile("datavalueset/dataValueSetBNewDeleted.xml");
    summary = dataValueSetService.importDataValueSetXml(in);
    assertSuccessWithImportedUpdatedDeleted(2, 6, 4, summary);
    assertDataValuesCount(10);
}
Also used : ImportSummary(org.hisp.dhis.dxf2.importsummary.ImportSummary) DhisTest(org.hisp.dhis.DhisTest) Test(org.junit.jupiter.api.Test)

Example 37 with DELETED

use of org.hisp.dhis.dxf2.events.trackedentity.store.query.EventQuery.COLUMNS.DELETED in project dhis2-core by dhis2.

the class AppController method deleteApp.

@DeleteMapping("/{app}")
@PreAuthorize("hasRole('ALL') or hasRole('M_dhis-web-app-management')")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteApp(@PathVariable("app") String app, @RequestParam(required = false) boolean deleteAppData) throws WebMessageException {
    App appToDelete = appManager.getApp(app);
    if (appToDelete == null) {
        throw new WebMessageException(notFound("App does not exist: " + app));
    }
    if (appToDelete.getAppState() == AppStatus.DELETION_IN_PROGRESS) {
        throw new WebMessageException(conflict("App is already being deleted: " + app));
    }
    appManager.markAppToDelete(appToDelete);
    appManager.deleteApp(appToDelete, deleteAppData);
}
Also used : App(org.hisp.dhis.appmanager.App) WebMessageException(org.hisp.dhis.dxf2.webmessage.WebMessageException) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

ImportSummary (org.hisp.dhis.dxf2.importsummary.ImportSummary)26 Test (org.junit.jupiter.api.Test)12 ImportOptions (org.hisp.dhis.dxf2.common.ImportOptions)7 ProgramStageInstance (org.hisp.dhis.program.ProgramStageInstance)7 DataElement (org.hisp.dhis.dataelement.DataElement)6 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)6 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)6 IOException (java.io.IOException)5 DhisTest (org.hisp.dhis.DhisTest)5 Enrollment (org.hisp.dhis.dxf2.events.enrollment.Enrollment)5 Program (org.hisp.dhis.program.Program)5 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 IdScheme (org.hisp.dhis.common.IdScheme)4 ImportCount (org.hisp.dhis.dxf2.importsummary.ImportCount)4 ProgramStage (org.hisp.dhis.program.ProgramStage)4 Lists (com.google.common.collect.Lists)3 Date (java.util.Date)3 HashMap (java.util.HashMap)3 List (java.util.List)3