コード例 #1
0
  @RequestMapping(value = "/wfstepUpdate", method = RequestMethod.POST)
  @RequestScoped
  public String updateWFStep(
      @ModelAttribute("wfstepAdd") WFStep wfstep,
      HttpServletRequest request,
      Model model,
      HttpServletResponse response) {
    response.setCharacterEncoding("UTF-8");
    Long duplicateId = 0l;
    try {
      duplicateId =
          wfstepService.updateDuplicateCheck(
              wfstep.getWfstepNameEdit(),
              wfstep.getWfstepidEdit(),
              wfstep.getWfstepStageGUIDEdit());

      if (duplicateId == 0) {
        wfstep.setWfstepid(wfstep.getWfstepidEdit());
        wfstep.setWfstepStageGUID(wfstep.getWfstepStageGUIDEdit());
        wfstep.setWfstepStatus(wfstep.getWfstepStatusEdit());
        wfstep.setWfstepStep(wfstep.getWfstepStepEdit());
        wfstep.setWfstepAssignedTo(wfstep.getWfstepAssignedToEdit());
        wfstep.setWfstepName(wfstep.getWfstepNameEdit());
        wfstep.setWfstepType(wfstep.getWfstepTypeEdit());
        wfstep.setWfstepCreatedBy(wfstep.getWfstepCreatedByEdit());
        wfstep.setWfstepCreatedDate(wfstep.getWfstepCreatedDateEdit());
        HttpSession sess = request.getSession();

        Calendar currentDate = Calendar.getInstance();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        String updatedDate = formatter.format(currentDate.getTime());

        wfstep.setWfstepUpdatedBy(sess.getAttribute("userId").toString());

        wfstep.setWfstepUpdatedDate(updatedDate);

        String msg = wfstepService.updateWFStep(wfstep);

        if (msg.equals("S")) {
          request.setAttribute(
              "wfstepUpadteSuccess", "Work Flow Step has been updated Successfully");
        } else {
          request.setAttribute("wfstepUpadteFail", "Work Flow Step has not been updated");
        }
      } else {
        request.setAttribute("wfstepEditDuplicate", "Name Already Exists");
        request.setAttribute("wfstepValues", "wfstepValues");
        return "wfstepHome";
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    model.addAttribute("wfstepAdd", new WFStep());
    /* return new ModelAndView("Home","materialAdd",new Material()); */
    return "wfstepHome";
  }
コード例 #2
0
  @RequestMapping(value = "/wfstepAdvanceSearchOperations", method = RequestMethod.POST)
  public String wfstepAdvanceSearchOperations(
      @ModelAttribute WFStep wfstep,
      HttpServletRequest request,
      HttpServletResponse response,
      Model model) {
    wfstep1 = new ArrayList<WFStep>();
    String columns = wfstep.getFirstLabel();
    String operations = wfstep.getOperations1();
    String advanceSearchText = wfstep.getAdvanceSearchText();
    // System.out.println("advanceSearchText"+advanceSearchText);
    // System.out.println("First Labels "+name);
    // System.out.println("kiran u selected"+name);
    if (advanceSearchText.length() != 0) {
      // System.out.println("came to advance"+advanceSearchText.length());
      objectsArray = wfstepService.getWFStepAdvance(columns, operations, advanceSearchText);
    } else {
      objectsArray = wfstepService.searchWFStep();
    }
    iterator = objectsArray.iterator();
    while (iterator.hasNext()) {
      mm = new com.mnt.erp.bean.WFStep();
      objects2 = (Object[]) iterator.next();
      mm.setWfstepid((String) objects2[0]);
      mm.setWfstepStageGUID((String) objects2[1]);
      mm.setWfstepStep((String) objects2[2]);
      mm.setWfstepName((String) objects2[3]);
      mm.setWfstepType((String) objects2[4]);
      mm.setWfstepStatus((String) objects2[5]);
      mm.setWfstepAssignedTo((String) objects2[6]);
      mm.setWfstageName((String) objects2[7]);
      mm.setRole((String) objects2[8]);

      /*
       * String blocked=(String)objects2[13]; if(blocked.equals("0")) {
       * blocked="YES"; } else { blocked="NO"; }
       */

      wfstep1.add(mm);
      // System.out.println((String)objects2[0]);
    }

    /*
     * ModelAndView model=new ModelAndView();
     * model.setViewName("BomCategorySearch");
     * model.addObject("searchBom",BomCategory); return model;
     */

    // return new ModelAndView("MaterialCategorySearch");

    request.setAttribute("wfstepSearch", wfstep1);
    model.addAttribute("wfstepAdd", new WFStep());

    return "wfstepHome";
  }
コード例 #3
0
  @RequestMapping(value = "/wfstepSearch", method = RequestMethod.GET)
  @Scope("request")
  @RequestScoped
  public String searchWFStep(
      @ModelAttribute WFStep wfstepSearch,
      BindingResult bindingResult,
      HttpServletRequest request,
      HttpServletResponse response,
      Model model) {
    response.setCharacterEncoding("UTF-8");

    List<Object[]> list = null;

    List<WFStep> wfstepBean = new ArrayList<WFStep>();

    try {

      String dbField = wfstepSearch.getXmlLabel();
      String operation = wfstepSearch.getOperations();
      String basicSearchId = wfstepSearch.getBasicSearchId();

      if (operation.equals("_%")) {
        operation = " like ";
        basicSearchId = basicSearchId + "%";

      } else if (operation.equals("%_")) {
        operation = " like ";
        basicSearchId = "%" + basicSearchId;

      } else if (operation.equals("%_%")) {
        operation = " like ";
        basicSearchId = "%" + basicSearchId + "%";
      }
      if (basicSearchId == "") {
        list = wfstepService.searchWFStep();
        Iterator<Object[]> iterator = list.iterator();
        while (iterator.hasNext()) {
          WFStep r = new WFStep();
          Object[] object = (Object[]) iterator.next();
          r.setWfstepid((String) object[0]);
          r.setWfstepStageGUID((String) object[1]);
          r.setWfstepStep((String) object[2]);
          r.setWfstepName((String) object[3]);
          r.setWfstepType((String) object[4]);
          r.setWfstepStatus((String) object[5]);
          r.setWfstepAssignedTo((String) object[6]);
          r.setWfstageName((String) object[7]);
          r.setRole((String) object[8]);

          wfstepBean.add(r);
        }
      } else {
        list = wfstepService.basicSearchWFStep(dbField, operation, basicSearchId);
        // list = assertService.searchAssertTypeWithId(id);
        Iterator<Object[]> iterator = list.iterator();
        while (iterator.hasNext()) {
          WFStep r = new WFStep();
          Object[] object = (Object[]) iterator.next();
          r.setWfstepid((String) object[0]);
          r.setWfstepStageGUID((String) object[1]);
          r.setWfstepStep((String) object[2]);
          r.setWfstepName((String) object[3]);
          r.setWfstepType((String) object[4]);
          r.setWfstepStatus((String) object[5]);
          r.setWfstepAssignedTo((String) object[6]);
          r.setWfstageName((String) object[7]);
          r.setRole((String) object[8]);

          wfstepBean.add(r);
        }
      }
      request.setCharacterEncoding("UTF-8");
      request.setAttribute("wfstepSearch", wfstepBean);

    } catch (Exception e) {
      e.printStackTrace();
    }
    model.addAttribute("wfstepAdd", wfstepSearch);

    return "wfstepHome";
  }