List of usage examples for org.springframework.ui ModelMap ModelMap
public ModelMap()
From source file:com.pkrete.locationservice.admin.controller.mvc.EditShelfController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("shelf") Shelf shelf, BindingResult result) throws Exception { shelf.setAreas(parseAreas(request, shelf)); super.parseSubjectMatters(request, shelf); validator.validate(shelf, result);/*from w ww . j a va 2 s .c o m*/ if (result.hasErrors()) { ModelMap model = new ModelMap(); this.setReferenceData(request, model); return new ModelAndView("edit_shelf", model); } String libraryId = request.getParameter("select_library"); String collectionId = request.getParameter("select_collection"); String shelfId = request.getParameter("select_shelf"); shelf.setUpdater(getUser(request).getUsername()); if (!locationsService.update(shelf)) { throw new Exception("Updating shelf failed."); } return new ModelAndView("redirect:locations.htm?" + "select_library=" + libraryId + "&select_collection=" + collectionId + "&select_shelf=" + shelfId); }
From source file:com.trenako.web.controllers.admin.AdminOptionsControllerTests.java
@Test public void shouldShowTheOptionsList() { ModelMap model = new ModelMap(); String viewName = controller.list(model); assertEquals("option/list", viewName); assertTrue("Coupler options not found", model.containsAttribute("couplerOptions")); assertTrue("DCC options not found", model.containsAttribute("dccOptions")); assertTrue("Headlight options not found", model.containsAttribute("headlightsOptions")); assertTrue("Transmission options not found", model.containsAttribute("transmissionOptions")); }
From source file:org.energyos.espi.thirdparty.web.ScopeSelectionControllerTests.java
@Test public void get_scopeSelection_displaysScopeSelectionView() throws Exception { ScopeSelectionController controller = new ScopeSelectionController(); assertEquals("/RetailCustomer/ScopeSelection", controller.scopeSelection(new String[] {}, new ModelMap())); }
From source file:fragment.web.AbstractCampaignPromotionsControllerTest.java
@Before public void init() throws Exception { map = new ModelMap(); response = new MockHttpServletResponse(); }
From source file:org.openmrs.module.patientflags.web.ManageFlagsController.java
/** * Handles a request to filter the results * /*from w ww.ja v a 2 s .co m*/ * @param filterTags * @param result * @param status * @return */ @RequestMapping(method = RequestMethod.POST) public ModelAndView processFilter(@ModelAttribute("filter") Filter filter, BindingResult result, SessionStatus status) { ModelMap model = new ModelMap(); List<Flag> flags = Context.getService(FlagService.class).getFlagsByFilter(filter); if (flags != null) model.addAttribute("flags", flags); // add the command object for the filter form model.addAttribute("filter", new Filter()); return new ModelAndView("/module/patientflags/manageFlags", model); }
From source file:com.pkrete.locationservice.admin.controller.mvc.EditCollectionController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("collection") LibraryCollection collection, BindingResult result) throws Exception { collection.setAreas(parseAreas(request, collection)); super.parseSubjectMatters(request, collection); validator.validate(collection, result); if (result.hasErrors()) { ModelMap model = new ModelMap(); this.setReferenceData(request, model); return new ModelAndView("edit_collection", model); }/* w w w . j a v a2 s . co m*/ String libraryId = request.getParameter("select_library"); String collectionId = request.getParameter("select_collection"); collection.setUpdater(getUser(request).getUsername()); if (!locationsService.update(collection)) { throw new Exception("Updating collection failed."); } return new ModelAndView( "redirect:locations.htm?select_library=" + libraryId + "&select_collection=" + collectionId); }
From source file:org.esco.portlet.accueil.portlet.PortletController.java
@RequestMapping(value = { "VIEW" }, params = { "action=browserError" }) public ModelAndView browserError(RenderRequest request, RenderResponse response) { return new ModelAndView("error", new ModelMap()); }
From source file:org.energyos.espi.thirdparty.web.AuthorizationControllerTests.java
@Test @Ignore// w w w. j av a 2s. c o m public void authorization_fetchesToken() throws Exception { String url = String.format("%s?redirect_uri=%s&code=%s&grant_type=authorization_code", applicationInformation.getAuthorizationServerTokenEndpoint(), applicationInformation.getRedirectUri(), CODE); controller.authorization(CODE, authorization.getState(), new ModelMap(), principal, url, url, url); verify(restTemplate).getForObject(eq(url), eq(AccessToken.class)); }
From source file:org.openmrs.web.patient.PatientDashboardGraphControllerTest.java
/** * Test the path of the form for rendering the json data * //from w ww . j a v a 2 s .c om * @see PatientDashboardGraphController#showGraphData(Integer, Integer, ModelMap) */ @Test @Verifies(value = "return form for rendering the json data", method = "showGraphData(Integer, Integer, ModelMap)") public void shouldDisplayPatientDashboardGraphForm() throws Exception { executeDataSet("org/openmrs/api/include/ObsServiceTest-initial.xml"); Assert.assertEquals("module/legacyui/patientGraphJsonForm", new PatientDashboardGraphController().showGraphData(2, 1, new ModelMap())); }
From source file:com.pkrete.locationservice.admin.controller.mvc.EditUserController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("userInfo") UserInfo userInfo, BindingResult result) throws Exception { validator.validate(userInfo, result); if (result.hasErrors()) { ModelMap model = new ModelMap(); this.setReferenceData(request, model); return new ModelAndView("edit_user", model); }/* w w w. ja va 2 s.co m*/ String userId = request.getParameter("select_user"); userInfo.getUser().setUpdater(getUser(request).getUsername()); // Updates only User if (!usersService.update(userInfo.getUser())) { throw new Exception("Updating user failed."); } // Updates only UserInfor if (!usersService.update(userInfo)) { throw new Exception("Updating user info failed."); } HttpSession session = request.getSession(); session.removeAttribute("user"); session.setAttribute("user", usersService.getUser(request.getRemoteUser())); return new ModelAndView("redirect:userowner.htm?select_user=" + userId); }