use of org.hisp.dhis.common.DeleteNotAllowedException in project dhis2-core by dhis2.
the class RemoveProgramStageAction method execute.
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute() throws Exception {
try {
ProgramStage programStage = programStageService.getProgramStage(id);
Program program = programStage.getProgram();
program.getProgramStages().remove(programStage);
programStageService.deleteProgramStage(programStage);
} catch (DeleteNotAllowedException ex) {
if (ex.getErrorCode().equals(DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS)) {
message = i18n.getString("object_not_deleted_associated_by_objects") + " " + ex.getMessage();
return ERROR;
}
}
return SUCCESS;
}
Aggregations