@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"; }
@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"; }