Search in sources :

Example 16 with DataEntryForm

use of org.hisp.dhis.dataentryform.DataEntryForm in project dhis2-core by dhis2.

the class ProgramDataEntryFormDeletionHandler method deleteProgramStage.

public void deleteProgramStage(ProgramStage programStage) {
    DataEntryForm dataEntryForm = programStage.getDataEntryForm();
    if (dataEntryForm != null) {
        boolean flag = false;
        Set<ProgramStage> programStages = programStage.getProgram().getProgramStages();
        programStages.remove(programStage);
        for (ProgramStage stage : programStages) {
            if (stage.getDataEntryForm() != null) {
                programStage.setDataEntryForm(null);
                programStageService.updateProgramStage(programStage);
                flag = true;
                break;
            }
        }
        if (!flag) {
            dataEntryFormService.deleteDataEntryForm(dataEntryForm);
        }
    }
}
Also used : DataEntryForm(org.hisp.dhis.dataentryform.DataEntryForm)

Aggregations

DataEntryForm (org.hisp.dhis.dataentryform.DataEntryForm)16 Program (org.hisp.dhis.program.Program)4 DhisSpringTest (org.hisp.dhis.DhisSpringTest)3 DataElement (org.hisp.dhis.dataelement.DataElement)3 DataSet (org.hisp.dhis.dataset.DataSet)3 Test (org.junit.jupiter.api.Test)3 HashSet (java.util.HashSet)2 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)2 ProgramStage (org.hisp.dhis.program.ProgramStage)2 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)2 Action (com.opensymphony.xwork2.Action)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1