List of usage examples for org.springframework.ui ModelMap ModelMap
public ModelMap()
From source file:com.Voxce.Controllers.TrialsController.java
public ModelAndView DownloadDocumentFinancial(HttpServletRequest request, HttpServletResponse response) throws Exception { List<ApprovalStatusType> approvalstatustypelist; List<Users> userslist;//w w w . ja va2 s . c o m List<Sites> siteslist; List<FinancialDisc> financialdisclist; List<ProtocolVersion> versionlist; approvalstatustypelist = approvalstatustypedao.listapprovals(currentstudy.getStudy_id()); versionlist = traininguserdao.listprotocolversions(currentstudy.getStudy_id()); siteslist = sitedao.SitesList(CurrentUser); userslist = userdao.listusers(CurrentUser); FinancialDisc doc = new FinancialDisc(); int docid = Integer.parseInt(request.getParameter("docid")); doc = financialdiscdao.find(docid); response.setContentType(doc.getType()); response.setContentLength(doc.getData().length); response.setHeader("Content-Disposition", "attachment; filename=\"" + doc.getFilename() + "\""); FileCopyUtils.copy(doc.getData(), response.getOutputStream()); financialdisclist = financialdiscdao.listfinancialdisc(currentstudy.getStudy_id()); for (int i = 0; i < financialdisclist.size(); i++) financialdisclist.get(i).setData(null); ModelMap modelMap = new ModelMap(); modelMap.addAttribute("currentstudy", currentstudy); modelMap.addAttribute("CurrentFormFinancial", "View_Financial_Disclosure_div"); modelMap.addAttribute("approvalstatustypelist", approvalstatustypelist); modelMap.addAttribute("userslist", userslist); modelMap.addAttribute("siteslist", siteslist); modelMap.addAttribute("versionlist", versionlist); return new ModelAndView("financial_disc", modelMap); }
From source file:com.virtusa.akura.student.controller.StudentAcademicLifeController.java
/** * handle POST requests for Academic-details - student scholarship details save action. * //from www . j a v a 2 s . com * @param request - HttpServletRequest. * @param session - HttpSession object * @return the name of the view. * @throws AkuraAppException throws when exception occurs. */ @RequestMapping(value = ACTION_FOR_SAVE_SCHOLARSHIP, method = RequestMethod.POST) public ModelAndView saveScholarshipDetails(HttpServletRequest request, HttpSession session) throws AkuraAppException { String messageKey; String scholarshipTypeId = request.getParameter(SELECTED_SCHOLARSHIP_TYPE); String yearE = null; int studentClassInfoId = 0; studentClassInfoId = (Integer.parseInt(request.getParameter(SELECTED_GRADE))); StudentClassInfo studentClassInfo = studentService.findStudentClassInfoById(studentClassInfoId); yearE = DateUtil.getStringYear(studentClassInfo.getYear()); int intsTypeId = 0; if (!scholarshipTypeId.equals("")) { intsTypeId = Integer.parseInt(scholarshipTypeId); } int intStudentId = getStudentSessionId(session); Date date = DateUtil.getDateTypeYearValue(yearE); boolean vFlag = false; // validating the scholarship type is already exists vFlag = this.valiateScholarshipForStudent(intStudentId, intsTypeId, date); ModelMap modelMap = new ModelMap(); if (vFlag) { // error message if (intsTypeId == 0) { messageKey = ERROR_MSG_KEY_SCHOLARSHIP_REQUIRED; } else { messageKey = ERROR_MSG_KEY_DUPLICATE_SCHOLARSHIP_TYPE; } request.setAttribute(SELECTED_SCHOLARSHIP_TYPE, scholarshipTypeId); populateErrorMessages(modelMap, messageKey, SCHOLAR); } else { addStudentScholarshipDetails(intsTypeId, intStudentId, date); } modelMap.addAttribute(ATTR_NAME_YEAR, yearE); return showMarks(request, modelMap, session); // Returning to previous // action method }
From source file:com.Voxce.Controllers.TrialsController.java
public ModelAndView DownloadDocumentContract(HttpServletRequest request, HttpServletResponse response) throws Exception { List<ApprovalStatusType> approvalstatustypelist; List<Users> userslist;// w w w . jav a2 s . c om List<Sites> siteslist; List<Contracts> contractslist; List<ProtocolVersion> versionlist; approvalstatustypelist = approvalstatustypedao.listapprovals(currentstudy.getStudy_id()); versionlist = traininguserdao.listprotocolversions(currentstudy.getStudy_id()); siteslist = sitedao.SitesList(CurrentUser); userslist = userdao.listusers(CurrentUser); Contracts doc = new Contracts(); int docid = Integer.parseInt(request.getParameter("docid")); doc = contractsdao.find(docid); response.setContentType(doc.getType()); response.setContentLength(doc.getData().length); response.setHeader("Content-Disposition", "attachment; filename=\"" + doc.getFilename() + "\""); FileCopyUtils.copy(doc.getData(), response.getOutputStream()); contractslist = contractsdao.listcontracts(currentstudy.getStudy_id()); for (int i = 0; i < contractslist.size(); i++) contractslist.get(i).setData(null); ModelMap modelMap = new ModelMap(); modelMap.addAttribute("currentstudy", currentstudy); modelMap.addAttribute("CurrentFormContract", "View_Contract_div"); modelMap.addAttribute("approvalstatustypelist", approvalstatustypelist); modelMap.addAttribute("userslist", userslist); modelMap.addAttribute("siteslist", siteslist); modelMap.addAttribute("versionlist", versionlist); modelMap.addAttribute("contractslist", contractslist); return new ModelAndView("contracts", modelMap); }
From source file:com.virtusa.akura.student.controller.StudentAcademicLifeController.java
/** * handle POST requests for Academic-details - student prefect details save action. * //from w ww . j a v a 2 s .c om * @param request - HttpServletRequest. * @param session - HttpSession object * @return the name of the view. * @throws AkuraAppException throws when exception occurs. */ @RequestMapping(value = ACTION_FOR_EDIT_SCHOLARSHIP, method = RequestMethod.POST) public ModelAndView editScholarshipDetails(HttpServletRequest request, HttpSession session) throws AkuraAppException { String scholarshipTypeId = request.getParameter(SELECTED_SCHOLARSHIP_TYPE); String selectedStudScholId = request.getParameter("selectedStudentScholarshipId"); String yearF = null; int studentClassInfoId = 0; studentClassInfoId = (Integer.parseInt(request.getParameter(SELECTED_GRADE))); StudentClassInfo studentClassInfo = studentService.findStudentClassInfoById(studentClassInfoId); yearF = DateUtil.getStringYear(studentClassInfo.getYear()); int intStudentId = getStudentSessionId(session); int intsTypeId = Integer.parseInt(scholarshipTypeId); boolean vFlag; Date date = DateUtil.getDateTypeYearValue(yearF); // validating the scholarship type is already exists vFlag = this.valiateScholarshipForStudent(intStudentId, intsTypeId, date); ModelMap modelMap = new ModelMap(); if (vFlag) { // error message request.setAttribute(SELECTED_SCHOLARSHIP_TYPE, scholarshipTypeId); populateErrorMessages(modelMap, ERROR_MSG_KEY_DUPLICATE_PREFECT_TYPE, SCHOLAR); } else { int intselectedStudScholId = Integer.parseInt(selectedStudScholId); updateStudentScholarshipDetails(intsTypeId, intselectedStudScholId); } modelMap.addAttribute(ATTR_NAME_YEAR, yearF); return showMarks(request, modelMap, session);// Returning to previous // action method }
From source file:com.Voxce.Controllers.TrialsController.java
public ModelAndView DownloadDocumentMedical(HttpServletRequest request, HttpServletResponse response) throws Exception { List<ApprovalStatusType> approvalstatustypelist; List<Users> userslist;/* w w w. ja v a 2 s. co m*/ List<Sites> siteslist; List<MedicalLicense> medicallist; userslist = userdao.listusers(CurrentUser); approvalstatustypelist = approvalstatustypedao.listapprovals(currentstudy.getStudy_id()); siteslist = sitedao.SitesList(CurrentUser); MedicalLicense doc = new MedicalLicense(); int docid = Integer.parseInt(request.getParameter("docid")); doc = medicaldao.find(docid); response.setContentType(doc.getType()); response.setContentLength(doc.getData().length); response.setHeader("Content-Disposition", "attachment; filename=\"" + doc.getFilename() + "\""); FileCopyUtils.copy(doc.getData(), response.getOutputStream()); medicallist = medicaldao.listmedical(currentstudy.getStudy_id()); for (int i = 0; i < medicallist.size(); i++) medicallist.get(i).setData(null); response.flushBuffer(); ModelMap modelMap = new ModelMap(); modelMap.addAttribute("currentstudy", currentstudy); modelMap.addAttribute("CurrentFormMedical", "View_Medical_License_div"); modelMap.addAttribute("approvalstatustypelist", approvalstatustypelist); modelMap.addAttribute("userslist", userslist); modelMap.addAttribute("siteslist", siteslist); modelMap.addAttribute("medicallist", medicallist); return new ModelAndView("medical_license", modelMap); }
From source file:com.Voxce.Controllers.TrialsController.java
public ModelAndView DownloadDocumentTraining(HttpServletRequest request, HttpServletResponse response) throws Exception { List<ApprovalStatusType> approvalstatustypelist; List<Training> traininglist; List<TrainingUser> traininguserlist; List<Users> userslist;/*from w w w .j ava2 s.c o m*/ List<Sites> siteslist; userslist = userdao.listusers(CurrentUser); approvalstatustypelist = approvalstatustypedao.listapprovals(currentstudy.getStudy_id()); siteslist = sitedao.SitesList(CurrentUser); traininglist = trainingdao.listtrainings(currentstudy.getStudy_id()); TrainingUser doc = new TrainingUser(); int docid = Integer.parseInt(request.getParameter("docid")); doc = traininguserdao.find(docid); response.setContentType(doc.getType()); response.setContentLength(doc.getData().length); response.setHeader("Content-Disposition", "attachment; filename=\"" + doc.getFilename() + "\""); FileCopyUtils.copy(doc.getData(), response.getOutputStream()); traininguserlist = traininguserdao.listtraininguser(currentstudy.getStudy_id()); for (int i = 0; i < traininguserlist.size(); i++) traininguserlist.get(i).setData(null); ModelMap modelMap = new ModelMap(); modelMap.addAttribute("currentstudy", currentstudy); modelMap.addAttribute("approvalstatustypelist", approvalstatustypelist); modelMap.addAttribute("traininglist", traininglist); modelMap.addAttribute("traininguserlist", traininguserlist); modelMap.addAttribute("userslist", userslist); modelMap.addAttribute("siteslist", siteslist); return new ModelAndView("training_user", modelMap); }
From source file:com.virtusa.akura.student.controller.StudentAcademicLifeController.java
/** * handle POST requests for Academic-details - student achievement details delete action. * /*from ww w . j a va 2 s . c o m*/ * @param request - HttpServletRequest. * @param session - HttpSession. * @return the name of the view. * @throws AkuraAppException throws when exception occurs. */ @RequestMapping(value = ACTION_FOR_DELETE_SCHOLARSHIP, method = RequestMethod.POST) public ModelAndView deleteScholarshipDetails(HttpServletRequest request, HttpSession session) throws AkuraAppException { String selectedStudPrefectId = request.getParameter("selectedStudentScholarshipId"); String yearG = null; int studentClassInfoId = 0; studentClassInfoId = (Integer.parseInt(request.getParameter(SELECTED_GRADE))); StudentClassInfo studentClassInfo = studentService.findStudentClassInfoById(studentClassInfoId); yearG = DateUtil.getStringYear(studentClassInfo.getYear()); int intselectedStudScholarshipId = Integer.parseInt(selectedStudPrefectId); StudentScholarship studentScholarship = studentService .findStudentScholarshipDetailsById(intselectedStudScholarshipId); if (studentScholarship != null) { studentService.deleteStudentScholarshipDetails(studentScholarship); } ModelMap modelMap = new ModelMap(); modelMap.addAttribute(ATTR_NAME_YEAR, yearG); return showMarks(request, modelMap, session); }
From source file:com.citrix.cpbm.portal.fragment.controllers.AbstractSubscriptionController.java
@RequestMapping(value = ("/view_catalog"), method = RequestMethod.GET) public String previewCatalog(@RequestParam(value = "channelParam", required = false) String channelParam, ModelMap map, @RequestParam(value = "tenant", required = false) final String tenantParam, @RequestParam(value = "serviceInstanceUUID", required = false) final String serviceInstanceUUID, @RequestParam(value = "subscriptionId", required = false) String subscriptionId, @RequestParam(value = "revision", required = false) String revision, @RequestParam(value = "revisionDate", required = false) String revisionDate, @RequestParam(value = "dateFormat", required = false) String dateFormat, @RequestParam(value = "currencyCode", required = false) String currencyCode, @RequestParam(value = "resourceType", required = false) final String resourceType, final HttpServletRequest request) throws ConnectorManagementServiceException { logger.debug("### viewCatalog method starting...(GET)"); Channel channel = null;/*from w ww . ja v a2s .co m*/ String successView = "channels.catalog.view"; if (channelParam != null && !channelParam.equals("null") && channelParam != "") { channel = channelService.getChannelById(channelParam); } else { channel = channelService.getDefaultServiceProviderChannel(); } final Catalog catalog = channel.getCatalog(); List<CurrencyValue> currencies = catalog.getSupportedCurrencyValuesByOrder(); map.addAttribute("channel", channel); map.addAttribute("currencies", currencies); map.addAttribute("viewChannelCatalog", true); map.addAttribute("revision", revision); map.addAttribute("revisionDate", revisionDate); map.addAttribute("dateFormat", dateFormat); if (StringUtils.isNotBlank(currencyCode)) { CurrencyValue currency = currencyValueService.locateBYCurrencyCode(currencyCode); map.addAttribute("selectedCurrency", currency); } else { map.addAttribute("selectedCurrency", currencies.get(0)); } final Tenant tenant = tenantService.getSystemTenant(); final String finalView = successView; final Channel catalogChannel = channel; Map<String, Object> finalMap = privilegeService.runAsPortal(new PrivilegedAction<Map<String, Object>>() { @Override public Map<String, Object> run() { ModelMap modelMap = new ModelMap(); try { getResourceComponentsAndFilterData(tenant, tenantParam, serviceInstanceUUID, null, resourceType, modelMap, request, finalView, catalogChannel.getName()); } catch (ConnectorManagementServiceException e) { logger.debug("Error occured ", e); } return modelMap; } }); map.addAllAttributes(finalMap); // preview catalog will have default UI Because in cutom UI SSO happens which can leads to // security threats map.addAttribute("customEditorTag", null); map.addAttribute("customComponentSelector", null); return finalView; }
From source file:fragment.web.SupportControllerTest.java
@SuppressWarnings("unchecked") @Test//from www. j a v a 2 s . c o m public void testTicketFilterByTenant() { ModelMap map1 = new ModelMap(); Tenant tenant1 = tenantService.getTenantByParam("name", "1_retail2", false); TicketStatus ticketStatus[] = { TicketStatus.NEW, TicketStatus.ESCALATED, TicketStatus.WORKING, TicketStatus.CLOSED }; // Creates Tickets for (TicketStatus tStatus : ticketStatus) { asUser(tenant1.getOwner()); Ticket newTicket = createTicket(); TicketForm form = new TicketForm(newTicket); Assert.assertEquals(newTicket.getStatus(), TicketStatus.NEW); // Changes Status of tickets asRoot(); newTicket.setStatus(tStatus); controller.editTicket(tenant1, "", tenant1.getParam(), "", "", newTicket.getCaseNumber(), request, form, map1); Assert.assertEquals(newTicket.getStatus(), tStatus); } asUser(tenant1.getOwner()); // Check for ALL Filter controller.listTicketsPage(tenant, tenant.getParam(), "All", false, "", "", "", map1, request); List<Ticket> tickets = (List<Ticket>) map1.get("tickets"); Assert.assertNotNull(tickets); Assert.assertEquals(tickets.size(), 4); // Checks for NEW,ESCALTED,WORKING and CLOSED filters for (TicketStatus tStatus : ticketStatus) { controller.listTicketsPage(tenant, tenant.getParam(), tStatus.getName().toString(), false, "", "", "", map1, request); tickets = (List<Ticket>) map1.get("tickets"); Assert.assertNotNull(tickets); Assert.assertEquals(tickets.size(), 1); Assert.assertEquals(tickets.get(0).getStatus(), tStatus); } }
From source file:com.virtusa.akura.student.controller.StudentAcademicLifeController.java
/** * handle POST requests for Academic-details - student scholarship details save action. * /* ww w .jav a 2s. c o m*/ * @param request - HttpServletRequest. * @param session - HttpSession object. * @return the name of the view. * @throws AkuraAppException throws when exception occurs. */ @RequestMapping(value = ACTION_FOR_SAVE_ACHIEVEMENT, method = RequestMethod.POST) public ModelAndView saveAchievementDetails(HttpServletRequest request, HttpSession session) throws AkuraAppException { String description = request.getParameter(ACHIEVEMENT_TEXT_AREA).trim(); String yearH = null; int studentClassInfoId = 0; studentClassInfoId = (Integer.parseInt(request.getParameter(SELECTED_GRADE))); StudentClassInfo studentClassInfo = studentService.findStudentClassInfoById(studentClassInfoId); yearH = DateUtil.getStringYear(studentClassInfo.getYear()); ModelMap modelMap = new ModelMap(); if (!"".equals(description) && !"".equals(yearH)) { String studentAchievementDescription = description.replaceAll("( )+", " "); Date date = DateUtil.getDateTypeYearValue(yearH); int intStudentId = getStudentSessionId(session); if (!isExistsAchievement(intStudentId, studentAchievementDescription, date)) { addStudentAchievementDetails(intStudentId, studentAchievementDescription, date); } else { request.setAttribute(ACHIEVEMENT_TEXT_AREA, description); populateErrorMessages(modelMap, ERROR_MSG_KEY_DUPLICATE_ACHIEVEMENT_TYPE, ACHIEVEMENT); } } else { request.setAttribute(ACHIEVEMENT_TEXT_AREA, description); populateErrorMessages(modelMap, ERROR_MSG_KEY_MANDATORY_FIELDS, ACHIEVEMENT); } modelMap.addAttribute(ATTR_NAME_YEAR, yearH); return showMarks(request, modelMap, session); }