List of usage examples for org.springframework.web.servlet ModelAndView getModel
public Map<String, Object> getModel()
From source file:gov.nih.nci.cabig.caaers.web.admin.OrganizationController.java
@SuppressWarnings("unchecked") @Override/*from ww w . jav a2s . c o m*/ protected ModelAndView processFinish(final HttpServletRequest request, final HttpServletResponse response, final Object command, final BindException errors) throws Exception { ModelAndView modelAndView = new ModelAndView("admin/organization_confirmation"); if (!errors.hasErrors()) { Organization organization = (Organization) command; if ("saveRemoteOrg".equals(request.getParameter("_action"))) { Organization remoteOrgToSave = organization.getExternalOrganizations() .get(Integer.parseInt(request.getParameter("_selected"))); organizationRepository.createOrUpdate(remoteOrgToSave); organization.setName(remoteOrgToSave.getName()); organization.setNciInstituteCode(remoteOrgToSave.getNciInstituteCode()); organization.setDescriptionText(remoteOrgToSave.getDescriptionText()); modelAndView.getModel().put("flashMessage", "Successfully created the Organization"); modelAndView.addAllObjects(errors.getModel()); return modelAndView; } organizationRepository.createOrUpdate(organization); modelAndView.getModel().put("flashMessage", "Successfully created the Organization"); modelAndView.addAllObjects(errors.getModel()); } return modelAndView; }
From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java
public ModelAndView addRadiation(HttpServletRequest request, Object command, Errors errors) { ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command; RadiationIntervention ri = new RadiationIntervention(); List<RadiationIntervention> radiations = cmd.getAeReport().getRadiationInterventions(); cmd.getAeReport().addRadiationIntervention(ri); ri.setReport(cmd.getAeReport());/*from ww w . j av a2 s .c om*/ ModelAndView modelAndView = new ModelAndView("ae/ajax/radiationInterventionFormSection"); modelAndView.getModel().put("radiations", radiations); modelAndView.getModel().put("indexes", new Integer[] { radiations.size() - 1 }); return modelAndView; }
From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java
public ModelAndView addBehavioral(HttpServletRequest request, Object command, Errors errors) { ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command; BehavioralIntervention si = new BehavioralIntervention(); List<BehavioralIntervention> behaviorals = cmd.getAeReport().getBehavioralInterventions(); cmd.getAeReport().addBehavioralIntervention(si); si.setReport(cmd.getAeReport());// ww w . j a v a2 s.co m ModelAndView modelAndView = new ModelAndView("ae/ajax/behavioralInterventionFormSection"); modelAndView.getModel().put("behaviorals", behaviorals); modelAndView.getModel().put("indexes", new Integer[] { behaviorals.size() - 1 }); return modelAndView; }
From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java
public ModelAndView addBiological(HttpServletRequest request, Object command, Errors errors) { ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command; BiologicalIntervention si = new BiologicalIntervention(); List<BiologicalIntervention> biologicals = cmd.getAeReport().getBiologicalInterventions(); cmd.getAeReport().addBilogicalIntervention(si); si.setReport(cmd.getAeReport());/* www.jav a 2s . co m*/ ModelAndView modelAndView = new ModelAndView("ae/ajax/biologicalInterventionFormSection"); modelAndView.getModel().put("biologicals", biologicals); modelAndView.getModel().put("indexes", new Integer[] { biologicals.size() - 1 }); return modelAndView; }
From source file:jetbrains.buildServer.agentsDiff.BuildAgentsDiffViewController.java
@Override protected ModelAndView doGet(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response) { final ModelAndView view = new ModelAndView(myPluginDescriptor.getPluginResourcesPath("agentsDiffView.jsp")); BuildAgentsDiffBean diff = BuildAgentsDiffBean.empty(); final String agentAIdString = request.getParameter("agentA"); final String agentBIdString = request.getParameter("agentB"); if (!agentAIdString.isEmpty() && !agentBIdString.isEmpty()) { int agentAId = Integer.parseInt(agentAIdString); int agentBId = Integer.parseInt(agentBIdString); final BuildAgentEx agentA = myBuildAgentManager.findAgentById(agentAId, true); final BuildAgentEx agentB = myBuildAgentManager.findAgentById(agentBId, true); if (agentA != null && agentB != null) { diff = myDiffCalculator.calculateDiff(agentA, agentB); }// w ww . j a v a2s . c o m } view.getModel().put("diff", diff); return view; }
From source file:com.thoughtworks.go.server.controller.ArtifactsControllerIntegrationTest.java
@Test public void rawConsoleOutShouldReturnTempFileWhenJobIsInProgress() throws Exception { Stage firstStage = pipeline.getFirstStage(); JobInstance firstJob = firstStage.getFirstJob(); firstJob.setState(JobState.Building); prepareTempConsoleOut(/*from w w w .j a v a2 s . c o m*/ new JobIdentifier(pipeline.getName(), pipeline.getCounter(), pipeline.getLabel(), firstStage.getName(), String.valueOf(firstStage.getCounter()), firstJob.getName()), "fantastic curly coated retriever"); ModelAndView view = getFileAsHtml("cruise-output/console.log"); assertThat(view.getViewName(), is("fileView")); File targetFile = (File) (view.getModel().get("targetFile")); String separator = FileUtil.fileseparator(); assertThat(targetFile.getPath(), is(String.format("data%sconsole%s%s.log", separator, separator, DigestUtils.md5Hex(firstJob.buildLocator())))); }
From source file:com.zb.app.web.controller.account.AccountCustomerController.java
@RequestMapping(value = "/newslist.htm") public ModelAndView news(ModelAndView mav, TravelNewsQuery query, Integer page) { query.setNowPageIndex(Argument.isNotPositive(page) ? 0 : page - 1); query.setPageSize(20);/* ww w . ja va 2 s . com*/ query.setcId(WebUserTools.getCid()); query.setnType(TravelNewsTypeEnum.TRAVEL_NEWS.value); PaginationList<TravelNewsDO> list = cmsService.showNewsPagination(query, new DefaultIpageUrl()); mav.getModel().put(CustomVelocityLayoutView.USE_LAYOUT, "false"); mav.addObject("newsList", list); mav.addObject("pagination", list.getQuery()); mav.setViewName("account/customer/newslist"); return mav; }
From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java
public ModelAndView removeAgent(HttpServletRequest request, Object command, Errors errors) { AbstractExpeditedAdverseEventInputCommand cmd = (AbstractExpeditedAdverseEventInputCommand) command; List<CourseAgent> agents = cmd.getAeReport().getTreatmentInformation().getCourseAgents(); int index;/*from w w w. j av a 2 s . c o m*/ try { index = Integer.parseInt(request.getParameter("index")); } catch (NumberFormatException e) { index = -1; log.debug("Wrong <index> for <agents> list: " + e.getMessage()); } if (agents.size() - 1 < index) { log.debug("Wrong <index> for <agents> list."); } else if (index >= 0) { cmd.deleteAttribution(agents.get(index)); agents.remove(agents.get(index)); } ; int size = agents.size(); Integer[] indexes = new Integer[size]; for (int i = 0; i < size; i++) { indexes[i] = size - (i + 1); } ModelAndView modelAndView = new ModelAndView("ae/ajax/courseAgentFormSection"); modelAndView.getModel().put("agents", agents); modelAndView.getModel().put("indexes", indexes); return modelAndView; }
From source file:gov.nih.nci.cabig.caaers.web.ae.StudyInterventionsTab.java
public ModelAndView removeDevice(HttpServletRequest request, Object command, Errors errors) { ExpeditedAdverseEventInputCommand cmd = (ExpeditedAdverseEventInputCommand) command; List<MedicalDevice> devices = cmd.getAeReport().getMedicalDevices(); int index;/*from www. j a v a2s . c o m*/ try { index = Integer.parseInt(request.getParameter("index")); } catch (NumberFormatException e) { index = -1; log.debug("Wrong <index> for <devices> list: " + e.getMessage()); } if (devices.size() - 1 < index) { log.debug("Wrong <index> for <devices> list."); } else if (index >= 0) { MedicalDevice object = (MedicalDevice) devices.get(index); devices.remove(object); deleteAttributions(object, (ExpeditedAdverseEventInputCommand) command); } int size = devices.size(); Integer[] indexes = new Integer[size]; for (int i = 0; i < size; i++) { indexes[i] = size - (i + 1); } ModelAndView modelAndView = new ModelAndView("ae/ajax/medicalDeviceFormSection"); modelAndView.getModel().put("devices", devices); modelAndView.getModel().put("indexes", indexes); return modelAndView; }
From source file:gov.nih.nci.cabig.caaers.web.ae.PatientDetailsTab.java
public ModelAndView addMetastaticDiseaseSite(HttpServletRequest request, Object cmd, Errors errors) { AbstractExpeditedAdverseEventInputCommand command = (AbstractExpeditedAdverseEventInputCommand) cmd; ModelAndView modelAndView = new ModelAndView("ae/ajax/metastaticDiseaseSiteFormSection"); List<MetastaticDiseaseSite> sites = command.getAeReport().getDiseaseHistory().getMetastaticDiseaseSites(); modelAndView.getModel().put("metastaticDiseaseSites", sites); int size = sites.size(); Integer[] indexes = new Integer[] { size }; modelAndView.getModel().put("indexes", indexes); // AnatomicSite site = command.getMetastaticDiseaseSite(); MetastaticDiseaseSite metastaticSite = new MetastaticDiseaseSite(); // metastaticSite.setCodedSite(site); command.getAeReport().getDiseaseHistory().addMetastaticDiseaseSite(metastaticSite); // command.setMetastaticDiseaseSite(null); return modelAndView; }