@Override
  public String execute() throws Exception {
    programStage = programStageService.getProgramStage(id);

    sections = new ArrayList<>(programStage.getProgramStageSections());

    Collections.sort(sections, new ProgramStageSectionSortOrderComparator());

    return SUCCESS;
  }
  public String execute() {
    dataElementList =
        new ArrayList<DataElement>(
            programStageDataElementService.getListDataElement(
                programStageService.getProgramStage(psId)));

    if (dataElementList != null && !dataElementList.isEmpty()) {
      Iterator<DataElement> deIterator = dataElementList.iterator();

      while (deIterator.hasNext()) {
        DataElement de = deIterator.next();

        if (!de.getType().equals(DataElement.VALUE_TYPE_INT)) {
          deIterator.remove();
        }
      }
    }

    return SUCCESS;
  }
  @Override
  public String execute() throws Exception {
    DateTimeFormatter sdf = ISODateTimeFormat.yearMonthDay();
    ProgramInstance programInstance = programInstanceService.getProgramInstance(programInstanceId);
    ProgramStage programStage = programStageService.getProgramStage(programStageId);

    patientId = programInstance.getPatient().getId();
    programId = programInstance.getProgram().getId();

    ProgramStageInstance programStageInstance = new ProgramStageInstance();
    try {
      programStageInstance.setDueDate(sdf.parseDateTime(nextDueDate).toDate());
    } catch (Exception e) {
      e.printStackTrace();
    }

    programStageInstance.setProgramInstance(programInstance);
    programStageInstance.setProgramStage(programStage);
    programStageInstanceService.addProgramStageInstance(programStageInstance);

    return SUCCESS;
  }