예제 #1
0
  public void populate(ActionForm form, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    try {
      EscalationForm escalationForm = (EscalationForm) form;
      EscalationDao escalationDaoImpl = new EscalationDaoImpl();

      // Work Flow Rule Name
      List workflow_rule_name_list = escalationDaoImpl.getworkflow_rule_name_list();
      escalationForm.setWorkflow_rule_name_list(workflow_rule_name_list);

      // Flow Levels
      if (escalationForm.getEscalation_type() != null) {
        String escalation_type = escalationForm.getEscalation_type();
        List flow_level_list = escalationDaoImpl.getflow_levels_list(escalation_type);
        escalationForm.setFlow_level_list(flow_level_list);
      }

      // Escalation Type template
      List escalation_template_list = escalationDaoImpl.getEscalation_Template_List();
      escalationForm.setEscalation_template_list(escalation_template_list);
      System.out.println("escalation_template_list----" + escalation_template_list);
    } catch (Exception e) {
      logger.error("Exception Occurred" + e);
      errors.add("name", new ActionError("id"));
    }
  }
예제 #2
0
  /**
   * <br>
   * [機 能] 削除(TODO情報)ボタンクリック時の入力チェックを行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param con コネクション
   * @param buMdl セッションユーザ情報
   * @param reqMdl RequestModel
   * @return エラー
   * @throws SQLException SQL実行例外
   */
  public ActionErrors validateDelTodo(Connection con, BaseUserModel buMdl, RequestModel reqMdl)
      throws SQLException {

    ActionErrors errors = new ActionErrors();
    ActionMessage msg = null;
    GsMessage gsMsg = new GsMessage(reqMdl);
    // 削除
    String textDelete = gsMsg.getMessage("cmn.delete");
    PrjCommonBiz pcBiz = new PrjCommonBiz(con, gsMsg, reqMdl);
    if (!pcBiz.getTodoEditKengen(getPrj030prjSid(), buMdl)) {
      msg = new ActionMessage("error.not.edit.permissions.project", textDelete);
      StrutsUtil.addMessage(
          errors, msg, "prj030selectEditStatus.error.not.edit.permissions.project");
      return errors;
    }

    // 選択されたTODO
    if (prj030selectTodo__ == null || prj030selectTodo__.length < 1) {
      msg = new ActionMessage("error.select.required.text", GSConstProject.MSG_TODO);
      StrutsUtil.addMessage(errors, msg, "prj030selectTodo.error.select.required.text");
    }

    if (errors.isEmpty()) {
      List<Integer> prjSidList = new ArrayList<Integer>();
      prjSidList.add(getPrj030prjSid());

      validateCanEditTodo(errors, con, buMdl, prjSidList, "prj030selectTodo", textDelete, reqMdl);
    }

    return errors;
  }
  /*Method to validate the keyword and the technology names*/
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    try {
      logger.info("In SearchPageForm validate method");
      ActionErrors errors = new ActionErrors(); // ActionError object is created to add the errors

      Pattern keywordPattern =
          Pattern.compile("^[A-za-z ]{1,20}$"); // Keyword is validated using regular expression

      Matcher keywordMatcher = keywordPattern.matcher(searchresultdto.getKeyword());

      if ((searchresultdto.getKeyword() == "")
          && (searchresultdto.getTechCode().equals("--Select--"))) {
        errors.add("errors", new ActionError("errors.Empty"));
      } else if ((searchresultdto.getTechCode().equals("--Select--"))) {
        if (!keywordMatcher.find()) {
          errors.add("errors", new ActionError("errors.InvalidKeyword"));
        }
      }

      return errors;
    } catch (NullPointerException e) {

    }
    return null;
  }
예제 #4
0
 protected void validateCustomFields(HttpServletRequest request, ActionErrors errors) {
   try {
     List<CustomFieldDefinitionEntity> customFieldDefs =
         (List<CustomFieldDefinitionEntity>)
             SessionUtils.getAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, request);
     for (CustomFieldView customField : customFields) {
       boolean isErrorFound = false;
       for (CustomFieldDefinitionEntity customFieldDef : customFieldDefs) {
         if (customField.getFieldId().equals(customFieldDef.getFieldId())
             && customFieldDef.isMandatory()) {
           if (StringUtils.isBlank(customField.getFieldValue())) {
             errors.add(
                 CustomerConstants.CUSTOM_FIELD,
                 new ActionMessage(CustomerConstants.ERRORS_SPECIFY_CUSTOM_FIELD_VALUE));
             isErrorFound = true;
             break;
           }
         }
       }
       if (isErrorFound) {
         break;
       }
     }
   } catch (PageExpiredException pee) {
     errors.add(
         ExceptionConstants.PAGEEXPIREDEXCEPTION,
         new ActionMessage(ExceptionConstants.PAGEEXPIREDEXCEPTION));
   }
 }
예제 #5
0
 protected void validateForFeeRecurrence(HttpServletRequest request, ActionErrors errors)
     throws ApplicationException {
   MeetingBO meeting = getCustomerMeeting(request);
   if (meeting != null) {
     List<FeeView> feeList = getDefaultFees();
     for (FeeView fee : feeList) {
       if (!fee.isRemoved() && fee.isPeriodic() && !isFrequencyMatches(fee, meeting)) {
         errors.add(
             CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH,
             new ActionMessage(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH));
         return;
       }
     }
     List<FeeView> additionalFeeList =
         (List<FeeView>)
             SessionUtils.getAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, request);
     for (FeeView selectedFee : getAdditionalFees()) {
       for (FeeView fee : additionalFeeList) {
         if (selectedFee.getFeeIdValue() != null
             && selectedFee.getFeeId().equals(fee.getFeeId())) {
           if (fee.isPeriodic() && !isFrequencyMatches(fee, meeting)) {
             errors.add(
                 CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH,
                 new ActionMessage(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH));
             return;
           }
         }
       }
     }
   }
 }
예제 #6
0
  /* (非 Javadoc)
   * @see jp.go.jsps.kaken.web.struts.BaseAction#doMainProcessing(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, jp.go.jsps.kaken.web.common.UserContainer)
   */
  public ActionForward doMainProcessing(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      UserContainer container)
      throws ApplicationException {

    // -----ActionErrorsの宣言(定型処理)-----
    ActionErrors errors = new ActionErrors();

    // 検索条件があればクリアする。
    removeFormBean(mapping, request);

    // 検索条件をフォームをセットする。
    ShozokuSearchForm searchForm = new ShozokuSearchForm();

    // ------プルダウンデータセット
    searchForm.setShubetuCdList(LabelValueManager.getKikanShubetuCdList()); // 機関種別リスト
    searchForm.setBukyokuSearchFlgList(
        LabelValueManager.getBukyokuSearchFlgList()); // 部局担当者検索フラグリスト

    updateFormBean(mapping, request, searchForm);

    // -----画面遷移(定型処理)-----
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return forwardFailure(mapping);
    }
    return forwardSuccess(mapping);
  }
 @Override
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   ActionErrors errors = new ActionErrors();
   try {
     return super.execute(mapping, actionForm, request, response);
   } catch (WrongImportFileSpreadsheetImporterException e) {
     errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("import.status.corrupted_file"));
   } catch (MissingFieldSpreadsheetImporterException e) {
     errors.add(
         ActionErrors.GLOBAL_ERROR,
         new ActionError("import.status.missing_required_field", e.getField()));
   } catch (MissingColumnHeaderSpreadsheetImporterException e) {
     errors.add(
         ActionErrors.GLOBAL_ERROR,
         new ActionError("import.status.wrong_header", e.getColumnName()));
   } catch (MissingWorksheetException e) {
     errors.add(
         ActionErrors.GLOBAL_ERROR,
         new ActionError("import.status.worksheet_not_found", e.getWorksheetName()));
   }
   saveErrors(request, errors);
   return mapping.getInputForward();
 }
예제 #8
0
  public ActionForward initCreateEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward();

    try {
      EscalationForm escalataionForm = (EscalationForm) form;
      escalataionForm.setEscalation_type(null);
      escalataionForm.setWorkflow_step_id(null);
      escalataionForm.setEscalation_level(null);
      escalataionForm.setEscalation_level_status(null);
      escalataionForm.setEscalation_template(null);
      populate(form, request);
    } catch (Exception e) {
      logger.error("Exception Occurred" + e);
      errors.add("name", new ActionError("id"));
    }
    forward = mapping.findForward("CreateEscalation");
    return (forward);
  }
예제 #9
0
파일: GasForm.java 프로젝트: jma505/sonata
  /**
   * Method validate
   *
   * @param mapping
   * @param request
   * @return ActionErrors
   */
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {

    ActionErrors errors = new ActionErrors();
    if (gas_date != null && gas_date.length() > 0) {
      try {
        String temp1 = DateUtils.parseToInput(gas_date);
        gas_date = temp1;
      } catch (Exception e) {
        errors.add("gas_date", new ActionError("error.gas_date.bad.format"));
      }
    }

    if (gas_date == null || gas_date.length() < 1) {
      gas_date = DateFormat.getDateInstance(DateFormat.SHORT).format(new Date());
    }

    if (gas_gallons <= 0.0) {
      errors.add("gas_gallons", new ActionError("error.gas_gallons.required"));
    }

    if (gas_cost <= 0.0) {
      errors.add("gas_cost", new ActionError("error.gas_cost.required"));
    }

    return errors;
  }
예제 #10
0
  /**
   * This method is called by the RequestProcessor immediately after populating the CustomerForm
   * only if the validate=true flag is set in the struts-config.xml Do validation here and return
   * ActionErrors if any, to the RequestProcessor
   */
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();

    // Need to do this explicitly now. Since the Button is not grey and its name is not
    // org.apache.struts...Cancel anymore, and the validate=true still
    // remains in ActionMapping, the call to bypass validation on clicking cancel image
    // has to be performed manually
    if (getCancel().isSelected()) {
      return errors;
    }

    MessageResources msgRes = (MessageResources) request.getAttribute(Globals.MESSAGES_KEY);

    // Firstname cannot be empty
    if (firstName == null || firstName.trim().equals("")) {
      String firstName = msgRes.getMessage("prompt.customer.firstname");
      String[] rplcmntValueArr = {firstName};
      ActionError err = new ActionError("error.required", rplcmntValueArr);
      errors.add("firstName", err);
    }

    // Lastname cannot be empty
    if (lastName == null || lastName.trim().equals("")) {
      String lastName = msgRes.getMessage("prompt.customer.lastname");
      String[] rplcmntValueArr = {lastName};
      ActionError err = new ActionError("error.required", rplcmntValueArr);
      errors.add("lastName", err);
    }

    return errors;
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    // User making this request
    User user = UserUtils.getUser(request);
    if (user == null) {
      ActionErrors errors = new ActionErrors();
      errors.add("username", new ActionMessage("error.login.notloggedin"));
      saveErrors(request, errors);
      return mapping.findForward("authenticate");
    }

    // form for filtering and display options
    IdPickerFilterForm filterForm = (IdPickerFilterForm) form;

    if (filterForm.isDoDownload()) {
      return mapping.findForward("Download");
    } else if (filterForm.isDoGoSlimAnalysis()) {
      return mapping.findForward("GOSlimAnalysis");
    } else if (filterForm.isDoGoEnrichAnalysis()) {
      return mapping.findForward("GOEnrichAnalysis");
    } else {
      if (request.getAttribute("newRequest") == null) {
        return mapping.findForward("Update");
      } else return mapping.findForward("ViewResults");
    }
  }
예제 #12
0
  @Override
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    logger.debug("BulkEntryActionForm.validate");
    request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
    ActionErrors errors = new ActionErrors();

    if (request
        .getParameter(CollectionSheetEntryConstants.METHOD)
        .equalsIgnoreCase(CollectionSheetEntryConstants.GETMETHOD)) {
      java.sql.Date meetingDate = null;
      try {
        Object lastMeetingDate = SessionUtils.getAttribute("LastMeetingDate", request);
        if (lastMeetingDate != null) {
          meetingDate = new java.sql.Date(((java.util.Date) lastMeetingDate).getTime());
        }

        short isCenterHierarchyExists =
            (Short)
                SessionUtils.getAttribute(
                    CollectionSheetEntryConstants.ISCENTERHIERARCHYEXISTS, request);
        return mandatoryCheck(meetingDate, getUserContext(request), isCenterHierarchyExists);
      } catch (PageExpiredException e) {
        errors.add(
            ExceptionConstants.PAGEEXPIREDEXCEPTION,
            new ActionMessage(ExceptionConstants.PAGEEXPIREDEXCEPTION));
      }
    }
    return errors;
  }
예제 #13
0
  /**
   * Excel出力時のバリデートを行います.
   *
   * @return 表示するメッセージ
   */
  public ActionErrors validate() {
    ActionErrors errors = new ActionErrors();
    String labelPeriodMonth = MessageResourcesUtil.getMessage("labels.periodMonth");
    String labelAllocatedQuantity = MessageResourcesUtil.getMessage("labels.allocatedQuantity");

    if (RadioCond2.VALUE_5.equals(radioCond2) && !StringUtil.hasLength(allocatedQuantity)) {
      errors.add(
          ActionMessages.GLOBAL_MESSAGE,
          new ActionMessage("errors.required", labelAllocatedQuantity));
    }

    if (StringUtil.hasLength(periodMonth)) {
      try {
        Integer.valueOf(periodMonth);
      } catch (NumberFormatException e) {
        errors.add(
            ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.integer", labelPeriodMonth));
      }
    }

    if (RadioCond2.VALUE_5.equals(radioCond2) && StringUtil.hasLength(allocatedQuantity)) {
      try {
        Integer.valueOf(allocatedQuantity);
      } catch (NumberFormatException e) {
        errors.add(
            ActionMessages.GLOBAL_MESSAGE,
            new ActionMessage("errors.integer", labelAllocatedQuantity));
      }
    }

    return errors;
  }
예제 #14
0
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();

    /*
    System.out.println("name: " + name);
    System.out.println("surname: " + surname);
    System.out.println("photo: " + photo);
    System.out.println("bornDate: " + bornDate);
    System.out.println("biography: " + biography);
    */

    // Check name
    if (name == null || name.isEmpty()) {
      errors.add("name", new ActionMessage("author.name.empty"));
    }

    // Check surname
    if (surname == null || surname.isEmpty()) {
      errors.add("surname", new ActionMessage("author.surname.empty"));
    }

    // Check born date
    if (bornDate != null && !bornDate.isEmpty()) {
      if (!Validator.isValidDate(bornDate)) {
        errors.add("bornDate", new ActionMessage("user.borndate.invalid"));
      }
    }

    return errors;
  }
  public ActionForward deleteClasses(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    DynaActionForm deleteClassesForm = (DynaActionForm) form;
    String[] selectedClasses = (String[]) deleteClassesForm.get("selectedItems");

    if (selectedClasses.length == 0) {
      ActionErrors actionErrors = new ActionErrors();
      actionErrors.add("errors.classes.notSelected", new ActionError("errors.classes.notSelected"));
      saveErrors(request, actionErrors);
      return mapping.getInputForward();
    }
    List<String> classOIDs = new ArrayList<String>();
    for (String selectedClasse : selectedClasses) {
      classOIDs.add(selectedClasse);
    }

    DeleteClasses.run(classOIDs);

    return listClasses(mapping, form, request, response);
  }
 /**
  * Realizar una consulta en la BD con el fin de imprimir TODOS los resultados. Las consultas
  * realizadas no se paginaran.
  *
  * @param mapping ActionMapping - Objeto de mapeo propio de Struts
  * @param form ActionForm - Objeto que encapsula los datos del Formulario JSP invocador
  * @param request HttpServletRequest - Objeto de Clase HttpServletRequest que actua sobre el
  *     formulario JSP Invocador
  * @param response HttpServletResponse - Objeto de Clase HttpServletResponse que actua sobre el
  *     formulario JSP Invocador
  * @throws IOException, ServletException - Excepciones de Tipo IO y de Servlet
  * @return ActionForward - Objeto que indica el forward o siguiente paso.
  */
 public ActionForward consultar(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws IOException, ServletException {
   String nextPage = "";
   UsuarioTO objetoTo = new UsuarioTO();
   UsuarioServicio servicio = new UsuarioServicio();
   servicio.objDataSession = DatosSession.poblarDatosSession(request);
   try {
     UsuarioForm objetoForm = (UsuarioForm) form;
     objetoTo = cargarInformacion(objetoForm);
     ArrayList<Object> results =
         servicio.servicioConsulta((Object) objetoTo, 1, filtrosAdicionales(0, request));
     objetoForm.setResults(results);
     objetoForm.setVar_Iniciopaginacion(String.valueOf(objetoForm.getVar_Iniciopaginacion()));
     objetoForm.setVar_Totalregistros(String.valueOf(objetoForm.getVar_Totalregistros()));
     nextPage = "consultar";
     if (results.equals(null)) {
       errors.add("error usuario", new ActionMessage("error.search.criteria.missing"));
       nextPage = "error";
     }
   } catch (Exception e) {
     errors.add("error usuario", new ActionMessage("error.search.criteria.missing"));
     System.out.println("Error en UsuarioDSP.consultar: " + e.toString());
     nextPage = "error";
   }
   return mapping.findForward(nextPage);
 }
예제 #17
0
  public ActionForward initEditEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward();

    try {

      EscalationForm escalationForm = (EscalationForm) form;
      EscalationDao escalationDaoImpl = new EscalationDaoImpl();
      EscalationDTO escalationDTO = new EscalationDTO();
      String requestNo = escalationForm.getWorkflow_escalation_id();

      populate(form, request);
      List escalation_template_list = escalationForm.getEscalation_template_list();
      escalationDTO = escalationDaoImpl.getEscalationdtls(requestNo);

      BeanUtils.copyProperties(escalationForm, escalationDTO);
      escalationForm.setEscalation_template_list(escalation_template_list);
    } catch (Exception exp) {
      exp.printStackTrace();
      errors.add("editEscalation", new ActionError(""));
      saveErrors(request, errors);
      return mapping.findForward("EditEscalation");
    }
    forward = mapping.findForward("EditEscalation");
    return (forward);
  }
예제 #18
0
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    log.info("Got request for clustering spectrum counts. Forwarding to wait page...");

    ProteinSetComparisonForm myForm = (ProteinSetComparisonForm) form;
    if (myForm == null) {
      ActionErrors errors = new ActionErrors();
      errors.add(
          ActionErrors.GLOBAL_ERROR,
          new ActionMessage("error.general.errorMessage", "Comparison form not found in request"));
      saveErrors(request, errors);
      return mapping.findForward("Failure");
    }

    String token;
    // Create a new token and put it in the form
    token = createToken();
    myForm.setClusteringToken(token);
    myForm.setNewToken(true); // this is new token

    List<ComparisonCommand> comparisonCommands = new ArrayList<ComparisonCommand>(1);
    comparisonCommands.add(ComparisonCommand.CLUSTER);
    request.setAttribute("comparisonCommands", comparisonCommands);
    request.setAttribute(
        HistoryTag.NO_HISTORY_ATTRIB, true); // We don't want this added to history.
    return mapping.findForward("Success");
  }
예제 #19
0
 @Override
 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
   ActionErrors errors = new ActionErrors();
   int z = 0;
   if ((month > 12) || (month <= 0)) {
     z = 1;
   }
   if ((day > 31) || (day <= 0)) {
     z = 1;
   }
   if ((day > 30) && ((month == 4) || (month == 6) || (month == 9) || (month == 11))) {
     z = 1;
   }
   if (month == 2) {
     if (day > 29) {
       z = 1;
     }
     if ((day == 29) && ((year % 4) != 0)) {
       z = 1;
     }
   }
   /*if ((year<1752)) { z=1; }*/
   /*Test Error500*/
   if (z != 0) {
     errors.add("forall", new ActionMessage("errors.forall"));
   }
   return errors;
 }
  /**
   * Method 'execute'
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @throws Exception
   * @return ActionForward
   */
  public ActionForward handle(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    try {
      // parse parameters
      // create the DAO class
      TelesalesCallSourceDao dao = TelesalesCallSourceDaoFactory.create();

      // execute the finder
      TelesalesCallSource dto[] = dao.findAll();

      // store the results
      request.setAttribute("result", dto);

      return mapping.findForward("success");
    } catch (Exception e) {
      ActionErrors _errors = new ActionErrors();
      _errors.add(
          ActionErrors.GLOBAL_ERROR,
          new ActionError("internal.error", e.getClass().getName() + ": " + e.getMessage()));
      saveErrors(request, _errors);
      return mapping.findForward("failure");
    }
  }
예제 #21
0
  /**
   * <br>
   * [機 能] 削除チェックを行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param con コネクション
   * @return エラー
   * @throws SQLException SQL例外発生
   */
  public ActionErrors deleteCheck(Connection con) throws SQLException {

    ActionErrors errors = new ActionErrors();
    ActionMessage msg = null;
    String fieldfix;

    CmnUsrmLabelDao dao = new CmnUsrmLabelDao(con);
    // ユーザ情報に付加されているラベルSID一覧取得
    ArrayList<CmnUsrmLabelModel> modelList = dao.getCountLabBelongCat(getUsr043EditSid());

    // ユーザ情報に付加ラベルなし
    if (modelList == null) {
      return errors;
    }

    CmnLabelUsrDao labDao = new CmnLabelUsrDao(con);
    for (CmnUsrmLabelModel model : modelList) {
      CmnLabelUsrModel labModel = labDao.selectOneLabel(model.getUsrSid());
      fieldfix = "labBelongCat" + ".";
      String msgKey = "error.user.duplication.label.incategory";
      msg =
          new ActionMessage(
              msgKey,
              StringUtilHtml.transToHTmlPlusAmparsant(getUsr045CategoryName()),
              StringUtilHtml.transToHTmlPlusAmparsant(labModel.getLabName()),
              model.getCount());
      errors.add(fieldfix, msg);
    }

    return errors;
  }
예제 #22
0
  public ActionForward executeAction(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    if (IS_DEBUG) log.debug("inside");

    ActionErrors errors = new ActionErrors();

    GridForm gridForm = (GridForm) form;
    String nextAction = gridForm.getNextAction();
    String[] id = gridForm.getId();

    if (nextAction == null) return new ActionForward("error");
    else if ((id == null) || (id.length == 0)) {
      if (IS_DEBUG) log.debug("No item selected on gridForm, forwarding to 'failure'");
      errors.add("error", new ActionError("errors.gridForm.music"));
      saveErrors(request, errors);
      return mapping.findForward("failure");
    } else {
      request.setAttribute("gridForm", gridForm);
      if (nextAction.equalsIgnoreCase("delete"))
        return new ActionForward("/phone/DeleteContact.do");
      else return new ActionForward("error");
    }
  }
 /*
  * (non-Javadoc)
  *
  * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping,
  *      javax.servlet.http.HttpServletRequest)
  */
 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
   if (isCommiting()) {
     ActionErrors errors = new ActionErrors();
     try {
       if (getPassphrase().length() == 0) {
         throw new FieldValidationException("noPassphrase");
       }
       if (getNewKey()) {
         if (!getPassphrase().equals(getConfirmPassphrase())) {
           throw new FieldValidationException("passphraseAndConfirmPassphraseDontMatch");
         }
       }
     } catch (FieldValidationException fve) {
       errors.add(
           Globals.ERROR_KEY,
           new ActionMessage("promptForPrivateKeyPassphrase.error." + fve.getResourceKey()));
     } catch (Exception e) {
       errors.add(
           Globals.ERROR_KEY,
           new ActionMessage(
               "promptForPrivateKeyPassphrase.error.validateFailed", e.getMessage()));
     }
     return errors;
   } else {
     return null;
   }
 }
 /**
  * Realizar una eliminacion de Informacion en la BD.
  *
  * @param mapping ActionMapping - Objeto de mapeo propio de Struts
  * @param form ActionForm - Objeto que encapsula los datos del Formulario JSP invocador
  * @param request HttpServletRequest - Objeto de Clase HttpServletRequest que actua sobre el
  *     formulario JSP Invocador
  * @param response HttpServletResponse - Objeto de Clase HttpServletResponse que actua sobre el
  *     formulario JSP Invocador
  * @throws IOException, ServletException - Excepciones de Tipo IO y de Servlet
  * @return ActionForward - Objeto que indica el forward o siguiente paso.
  */
 public ActionForward eliminar(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws IOException, ServletException {
   UsuarioTO objetoTo = new UsuarioTO();
   UsuarioServicio servicio = new UsuarioServicio();
   servicio.objDataSession = DatosSession.poblarDatosSession(request);
   UtilidadesDatos ud = new UtilidadesDatos();
   String nextPage = "";
   try {
     UsuarioForm objetoForm = (UsuarioForm) form;
     if (ud.verificarNivelAcceso(request, moduloPermiso, opcionPermiso, "Eliminar").compareTo("S")
         == 0) {
       objetoTo = cargarInformacion(objetoForm);
       String vresultado = servicio.servicioEliminar(objetoTo);
       nextPage = "eliminar";
       ud.cargarMensajeResultados(request, 0, 0, "");
       if (vresultado.compareTo("Ok") != 0) {
         errors.add("error usuario", new ActionMessage("error.search.criteria.missing"));
         nextPage = "error";
         ud.cargarMensajeResultados(request, 4, 1, vresultado);
       }
     } else {
       nextPage = "error";
       ud.cargarMensajeResultados(request, 1, 2, "");
     }
   } catch (Exception e) {
     errors.add("error usuario", new ActionMessage("error.search.criteria.missing"));
     System.out.println("Error en UsuarioDSP.eliminar: " + e.toString());
     nextPage = "error";
   }
   return mapping.findForward(nextPage);
 }
  /**
   * Gobal Action, this action prepares to show glAcctDefaultList.JSP. The form Allows the operator
   * to select the account to be modified or click add or delete.
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws javax.servlet.ServletException, java.io.IOException {
    // AppLog.trace("ShowGlAccountDefaultList action doPerfrom");
    ActionErrors errors = new ActionErrors();
    HttpSession session = request.getSession();
    DbUserSession sessionUser = SessionHelpers.getUserSession(request);
    if (sessionUser == null) {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.login.invalid"));
    }
    try {
      // Set collections in session
      SessionHelpers.setGlAccountDefaultListInSession(request);
    } catch (PersistenceException pe) {
      logger.error("Persistence Exception in ShowGlAccountDefaultList.doPerform. " + pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.PersistenceException", pe.getCause()));
    } catch (Exception pe) {
      logger.error("Exception in  ShowGlAccountDefaultList.doPerform. ", pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.GeneralException", pe.getMessage()));
    }
    // Check for any errors so far
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
    }

    return mapping.findForward("showGlAcctDefaultListJsp");
  }
 /**
  * Override to provide population of current form with request parameters when validation fails.
  *
  * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping,
  *     javax.servlet.http.HttpServletRequest)
  */
 public org.apache.struts.action.ActionErrors validate(
     org.apache.struts.action.ActionMapping mapping,
     javax.servlet.http.HttpServletRequest request) {
   final org.apache.struts.action.ActionErrors errors = super.validate(mapping, request);
   if (errors != null && !errors.isEmpty()) {
     // we populate the current form with only the request parameters
     Object currentForm = request.getSession().getAttribute("form");
     // if we can't get the 'form' from the session, try from the request
     if (currentForm == null) {
       currentForm = request.getAttribute("form");
     }
     if (currentForm != null) {
       final java.util.Map parameters = new java.util.HashMap();
       for (final java.util.Enumeration names = request.getParameterNames();
           names.hasMoreElements(); ) {
         final String name = String.valueOf(names.nextElement());
         parameters.put(name, request.getParameter(name));
       }
       try {
         org.apache.commons.beanutils.BeanUtils.populate(currentForm, parameters);
       } catch (java.lang.Exception populateException) {
         // ignore if we have an exception here (we just don't populate).
       }
     }
   }
   return errors;
 }
예제 #27
0
  /**
   * Overrides the validate method of ActionForm.
   *
   * @return error ActionErrors instance
   * @param mapping Actionmapping instance
   * @param request HttpServletRequest instance
   */
  @Override
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    final ActionErrors errors = super.validate(mapping, request);
    final Validator validator = new Validator();

    try {
      // checks the neoplasticCellularityPercentage
      if (!Validator.isEmpty(this.neoplasticCellularityPercentage)
          && !validator.isDouble(this.neoplasticCellularityPercentage, false)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.format",
                ApplicationProperties.getValue(
                    "cellspecimenreviewparameters.neoplasticcellularitypercentage")));
      }
      // checks the viableCellPercentage
      if (!Validator.isEmpty(this.viableCellPercentage)
          && !validator.isDouble(this.viableCellPercentage, false)) {
        errors.add(
            ActionErrors.GLOBAL_ERROR,
            new ActionError(
                "errors.item.format",
                ApplicationProperties.getValue(
                    "cellspecimenreviewparameters.viablecellpercentage")));
      }
    } catch (final Exception excp) {
      CellSpecimenReviewParametersForm.logger.error(excp.getMessage(), excp);
      excp.printStackTrace();
    }
    return errors;
  }
예제 #28
0
  public ActionForward list(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    CommonLogger.logDebug(log, "In PersonAction:list() ");

    // If user pressed 'Cancel' button,
    // return to home page

    if (isCancelled(request)) {
      return mapping.findForward("home");
    }

    try {
      PersonManager clientHandler = new PersonManager();

      CommonLogger.logDebug(
          log, "The person type is " + request.getParameter(BSIConstants.PERSON_TYPE));

      List personsList = clientHandler.listPersons(request.getParameter(BSIConstants.PERSON_TYPE));

      request.getSession().setAttribute(BSIConstants.OBJECTS_LIST, personsList);
      /*
       *
       * List supplierList = clientHandler.listSuppliers();
       *
       * request.getSession().setAttribute(BSIConstants.SUPPLIER_LIST,
       * supplierList);
       * request.getSession().setAttribute(BSIConstants.SORT_LIST_NAME
       * ,BSIConstants.SUPPLIER_LIST);
       *
       *
       * SortParams sortParams = new SortParams();
       * sortParams.setActionType("goto"); sortParams.setSortColumn("Id");
       * sortParams.setSortOrder("asc"); sortParams.setRowsPerPage(3);
       * sortParams.setGoToPage(2);
       *
       * request.getSession().setAttribute(BSIConstants.SORT_PARAMS,sortParams
       * );
       */

    } catch (BSIException ex1) {
      ActionErrors errors = new ActionErrors();
      CommonLogger.logDebug(
          log,
          "In PersonAction:list() \n exception occured. Exception message is " + ex1.getMessage());
      errors.add(
          ActionErrors.GLOBAL_MESSAGE, new ActionMessage(ex1.getErrorCode(), ex1.getMessage()));
      saveErrors(request, errors);
    } catch (Exception ex2) {
      throw ex2;
    }

    // Forward to result page
    return mapping.findForward("success");
  }
예제 #29
0
  public ActionForward searchEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward(); // return value

    try {

      EscalationForm escalationForm = (EscalationForm) form;
      EscalationDTO escalationDTO = new EscalationDTO();
      EscalationDao escalationDaoImpl = new EscalationDaoImpl();

      if (request.getAttribute("editSuccess") != null) {

        // String escalationType=request.getAttribute("escalationType").toString();
        String escalationID = request.getAttribute("escalationID").toString();
        escalationForm.setWorkflow_escalation_id(escalationID);
        populate(form, request);
        // escalationForm.setParamEscalationType(escalationType);
        System.out.println(
            "inside edit success---->show " + escalationForm.getWorkflow_escalation_id());
      }

      BeanUtils.copyProperties(escalationDTO, escalationForm);

      List escalationMasterList = escalationDaoImpl.searchEscalation(escalationDTO);

      if (request.getAttribute("editSuccess") != null) {
        String escalationType = request.getAttribute("escalationType").toString();
        escalationForm.setParamEscalationType(escalationType);
      }

      System.out.println("Escalation Master List------>" + escalationMasterList);

      escalationForm.setEscalationMasterList(escalationMasterList);

    } catch (BusinessException exp) {
      errors.add("searchEscalation", new ActionError(exp.getBusinessCode()));
      saveErrors(request, errors);
      return mapping.findForward("SearchEscalation");
    } catch (ApplicationException exp) {

      errors.add("searchEscalation", new ActionError(exp.getBusinessCode()));
      saveErrors(request, errors);
      return mapping.findForward("SearchEscalation");
    } catch (Exception exp) {

      errors.add("searchEscalation", new ActionError(""));
      saveErrors(request, errors);
      return mapping.findForward("SearchEscalation");
    }

    forward = mapping.findForward("SearchEscalation");
    return (forward);
  }
예제 #30
0
 /**
  * This is the action called from the Struts framework.
  *
  * @param mapping The ActionMapping used to select this instance.
  * @param request The HTTP Request we are processing.
  * @return
  */
 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
   ActionErrors errors = new ActionErrors();
   if (getName() == null || getName().length() < 1) {
     errors.add("name", new ActionMessage("error.name.required"));
     // TODO: add 'error.name.required' key to your resources
   }
   return errors;
 }