@RequestMapping(value = "findEmployees.htm", params = "!searchType") public ModelAndView onInitialSearchFormState() { List<Project> projectList = searchService.listAllProjects(); log.info("Entering search form in its initial state"); ModelAndView mav = new ModelAndView(); mav.addObject("projectList", projectList); mav.setViewName("find/employeeSearchForm"); return mav; }
@RequestMapping(value = "findEmployees.htm", params = "searchType=findByProject") public ModelAndView onSubmitSearchByProject(@RequestParam("projectID") long projectID) { log.info("Finding by project ID: " + projectID); List<Project> projectList = searchService.listAllProjects(); List<Employee> employeeList = searchService.findEmployeesByProject(projectID); ModelAndView mav = new ModelAndView(); mav.addObject("projectList", projectList); mav.addObject("employeeList", employeeList); mav.setViewName("find/employeeSearchForm"); return mav; }
@RequestMapping(value = "findEmployees.htm", params = "searchType=findByName") public ModelAndView onSubmitSearchByName( @RequestParam("firstName") String firstName, @RequestParam("lastName") String lastName, @RequestParam("projectID") long projectID) { log.info("Searching by first name: " + firstName + " last name: " + lastName); List<Employee> employeeList = searchService.findEmployeesByName(firstName, lastName); List<Project> projectList = searchService.listAllProjects(); ModelAndView mav = new ModelAndView(); mav.addObject("projectList", projectList); mav.addObject("employeeList", employeeList); mav.setViewName("find/employeeSearchForm"); return mav; }
public void testListAllProjects() { List<Project> result = service.listAllProjects(); assertNotNull(result); assertEquals(result.size(), 8); }