public String execute() throws Exception {
    // System.out.println( " DeTarget ID : "  + deTargetId );

    deTarget = deTargetService.getDeTarget(deTargetId);
    // survey = surveyService.getSurvey( surveyId );

    List<DeTargetMember> targetDataElements =
        new ArrayList<DeTargetMember>(deTargetService.getDeTargetMembers(deTarget));

    if (targetDataElements == null || targetDataElements.size() == 0) {
      dataElementSize = 0;
    } else {
      dataElementSize = targetDataElements.size();
    }

    // System.out.println( " DeTarget Id : "  + deTarget.getId() + " DETarget Name "  +
    // deTarget.getName() + " DETarget Description "  + deTarget.getDescription()  );
    // System.out.println( " DeTarget URL : "  + deTarget.getUrl() + " dataElementSize "
    // +dataElementSize );

    // surveyIndicators = new ArrayList<Indicator>( survey.getIndicators() );

    // Collections.sort( surveyIndicators, dataElementComparator );

    // displayPropertyHandler.handle( dataSetDataElements );

    // dataEntryForm = dataEntryFormService.getDataEntryFormByDataSet( dataSet );

    return SUCCESS;
  }
Ejemplo n.º 2
0
  public String execute() throws Exception {
    // ---------------------------------------------------------------------
    // Name
    // ---------------------------------------------------------------------

    if (name == null) {
      message = i18n.getString("specify_name");

      return INPUT;
    } else {
      name = name.trim();

      if (name.length() == 0) {
        message = i18n.getString("specify_name");

        return INPUT;
      }

      DeTarget match = deTargetService.getDeTargetByName(name);

      if (match != null && (deTargetId == null || match.getId() != deTargetId)) {
        message = i18n.getString("duplicate_names");

        return INPUT;
      }
    }
    // ---------------------------------------------------------------------
    // Short name
    // ---------------------------------------------------------------------

    if (shortName == null) {
      message = i18n.getString("specify_short_name");

      return INPUT;
    } else {
      shortName = shortName.trim();

      if (shortName.length() == 0) {
        message = i18n.getString("specify_short_name");

        return INPUT;
      }

      DeTarget match = deTargetService.getDeTargetByShortName(shortName);

      if (match != null && (deTargetId == null || match.getId() != deTargetId)) {
        message = i18n.getString("duplicate_short_names");

        return INPUT;
      }
    }

    message = "validation success";
    return SUCCESS;
  }