List of usage examples for org.springframework.ui Model addAllAttributes
Model addAllAttributes(Map<String, ?> attributes);
From source file:com.redhat.rhtracking.web.controller.ConsultantController.java
@RequestMapping(value = "/consultant/", method = RequestMethod.GET) public String list(@RequestParam(required = false, defaultValue = "1") int page, @RequestParam(required = false, defaultValue = "20") int size, Model model) { Map<String, Object> request = new HashMap<>(); request.put("pageNumber", page - 1); request.put("pageSize", size > 10 ? size : 20); Map<String, Object> listAllConsultantsPaged = consultantService.listAllConsultantsPaged(request); if ((EventStatus) listAllConsultantsPaged.get("status") == EventStatus.SUCCESS) { model.addAttribute("pageNumber", page - 1); model.addAllAttributes(listAllConsultantsPaged); } else {//from w w w .j av a2 s .co m getMessagesList(model).add("error::Ocurrio un error al obtener al procesar la solicitud"); model.addAttribute("page", new HashMap<String, Object>()); } return "/consultant/list"; }
From source file:com.redhat.rhtracking.web.controller.InvoiceController.java
@RequestMapping(value = "/invoice/{id}/details", method = RequestMethod.GET) public String show(@PathVariable long id, RedirectAttributes redirectAttributes, Model model) { List<String> messages = getFlashMessagesList(model, redirectAttributes); Map<String, Object> request = new HashMap<>(); request.put("id", id); Map<String, Object> response = invoiceService.findInvoice(request); if ((EventStatus) response.get("status") != EventStatus.SUCCESS) { messages.add("error::Factura desconocida"); return "redirect:/invoice/"; }//from w w w . ja va 2s .c o m messages.add("info::" + response); model.addAllAttributes(response); return "/invoice/details"; }
From source file:com.fengduo.bee.web.controller.order.OrderController.java
/** * ?// w w w .j a v a 2 s. c o m * * @param itemId id * @param orderId ?id * @param subId id */ @SuppressWarnings({ "unchecked", "deprecation" }) @RequestMapping(value = "/order/index") public String gotoOrder(Long itemId, Long orderId, Long subId, Model model) { Result result = orderInfos(itemId, orderId, subId); if (result.isFailed()) { return "redirect:/?errMsg=" + URLEncoder.encode(result.getMessage()); } model.addAllAttributes((Map<String, Object>) result.getData()); return "order/index"; }
From source file:com.redhat.rhtracking.web.controller.OpportunityController.java
@RequestMapping(value = "/opportunity/show", method = RequestMethod.GET) public String show(@RequestParam(required = false, defaultValue = "1") String id, RedirectAttributes redirectAttributes, Model model) { List<String> messages = getFlashMessagesList(model, redirectAttributes); Map<String, Object> request = new HashMap<>(); request.put("identifier", id); Map<String, Object> opportunity = deliveryMatrixService.findOpportunityBy(request); if ((EventStatus) opportunity.get("status") != EventStatus.SUCCESS) { messages.add("error::Oportunidad no encontrada"); return "redirect:/opportunity/"; }//w ww . ja va 2 s . c o m model.addAllAttributes(opportunity); request.put("id", (long) opportunity.get("id")); Map<String, Object> hours = deliveryMatrixService.findOpportunityHours(request); model.addAttribute("hours", hours.get("list")); if (!opportunity.containsKey("deliveryMatrix")) return "/opportunity/details"; Map<String, Object> deliveryMatrix = (Map<String, Object>) opportunity.get("deliveryMatrix"); model.addAttribute("delivery", deliveryMatrix); DeliveryMatrixStatusInfo dmsi = deliveryMatrixStatusInfo(); dmsi.setDeliveryStatus((String) deliveryMatrix.get("deliveryStatus")); dmsi.setDeliverySubStatus((String) deliveryMatrix.get("deliverySubStatus")); dmsi.setDeliveryProbability((String) deliveryMatrix.get("deliveryProbability")); model.addAttribute("deliveryMatrixStatusInfo", dmsi); request.put("deliveryMatrixId", (long) deliveryMatrix.get("id")); Map<String, Object> list = invoiceService.listInvoicesFromDeliveryMatrix(request); model.addAttribute("invoices", list.get("list")); Map<String, Object> assigned = deliveryService.listAssignedConsultantsOfOpportunity(request); model.addAttribute("assignations", assigned.get("list")); return "/opportunity/details"; }
From source file:mx.edu.um.mateo.activos.web.ActivoController.java
@RequestMapping("/dia") public String dia(Model modelo, @RequestParam(required = false) Integer anio) throws ParseException { log.debug("Reporte DIA para el anio {}", anio); NumberFormat nf = NumberFormat.getInstance(); nf.setGroupingUsed(false);/*from w w w .j a va 2 s. c o m*/ if (anio != null) { Map<String, Object> params = activoDao.reporteDIA(anio, ambiente.obtieneUsuario()); modelo.addAllAttributes(params); modelo.addAttribute("anio", anio); modelo.addAttribute("year", nf.format(anio)); } else { Calendar cal = Calendar.getInstance(); cal.add(Calendar.YEAR, -1); int year = cal.get(Calendar.YEAR); modelo.addAttribute("anio", year); modelo.addAttribute("year", nf.format(year)); } return "activoFijo/activo/dia"; }
From source file:ru.mystamps.web.controller.SeriesController.java
@GetMapping(Url.INFO_SERIES_PAGE) public String showInfo(@PathVariable("id") Integer seriesId, Model model, @CurrentUser Integer currentUserId, Locale userLocale, HttpServletResponse response) throws IOException { if (seriesId == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return null; }//from ww w. j av a 2 s . c o m String lang = LocaleUtils.getLanguageOrNull(userLocale); SeriesDto series = seriesService.findFullInfoById(seriesId, lang); if (series == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return null; } Map<String, ?> commonAttrs = prepareCommonAttrsForSeriesInfo(series, currentUserId); model.addAllAttributes(commonAttrs); addSeriesSalesFormToModel(model); addImageFormToModel(model); model.addAttribute("maxQuantityOfImagesExceeded", false); return "series/info"; }
From source file:mx.edu.um.mateo.activos.web.ActivoController.java
@RequestMapping("/depreciacionAcumuladaPorGrupo/{tipoActivoId}/{fecha}") public String depreciacionAcumuladaPorGrupoDetalle(@PathVariable String tipoActivoId, @PathVariable String fecha, Model modelo) throws ParseException { log.debug("Detalle de Depreciacion Acumulada por TipoDeActivo {} y fecha {}", tipoActivoId, fecha); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); if (fecha != null) { Map<String, Object> params = new HashMap<>(); params.put("usuario", ambiente.obtieneUsuario()); params.put("tipoActivoId", tipoActivoId); params.put("fecha", sdf.parse(fecha)); params = activoDao.depreciacionAcumuladaPorTipoActivoDetalle(params); modelo.addAllAttributes(params); modelo.addAttribute("fecha", fecha); } else {/* w ww .j av a 2s . c o m*/ modelo.addAttribute("fecha", sdf.format(new Date())); } return "activoFijo/activo/depreciacionAcumuladaPorGrupoDetalle"; }
From source file:mx.edu.um.mateo.activos.web.ActivoController.java
@RequestMapping("/depreciacionMensualPorCentroDeCosto/{centroCostoId}/{fecha}") public String depreciacionMensualPorCentroDeCostoDetalle(@PathVariable String centroCostoId, @PathVariable String fecha, Model modelo) throws ParseException { log.debug("Detalle de Depreciacion Mensual por Centro de Costo {} y fecha {}", centroCostoId, fecha); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); if (fecha != null) { Map<String, Object> params = new HashMap<>(); params.put("usuario", ambiente.obtieneUsuario()); params.put("centroCostoId", centroCostoId); params.put("fecha", sdf.parse(fecha)); params = activoDao.depreciacionMensualPorCentroDeCostoDetalle(params); modelo.addAllAttributes(params); modelo.addAttribute("fecha", fecha); } else {/*from w ww.j av a 2 s .co m*/ modelo.addAttribute("fecha", sdf.format(new Date())); } return "activoFijo/activo/depreciacionMensualPorCentroDeCostoDetalle"; }
From source file:mx.edu.um.mateo.activos.web.ActivoController.java
@RequestMapping("/depreciacionAcumuladaPorCentroDeCosto/{centroCostoId}/{fecha}") public String depreciacionAcumuladaPorCentroDeCostoDetalle(@PathVariable String centroCostoId, @PathVariable String fecha, Model modelo) throws ParseException { log.debug("Detalle de Depreciacion Acumulada por Centro de Costo {} y fecha {}", centroCostoId, fecha); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); if (fecha != null) { Map<String, Object> params = new HashMap<>(); params.put("usuario", ambiente.obtieneUsuario()); params.put("centroCostoId", centroCostoId); params.put("fecha", sdf.parse(fecha)); params = activoDao.depreciacionAcumuladaPorCentroDeCostoDetalle(params); modelo.addAllAttributes(params); modelo.addAttribute("fecha", fecha); } else {//from www . j a v a 2s. c o m modelo.addAttribute("fecha", sdf.format(new Date())); } return "activoFijo/activo/depreciacionAcumuladaPorCentroDeCostoDetalle"; }
From source file:ru.mystamps.web.controller.SeriesController.java
@PostMapping(Url.ADD_SERIES_ASK_PAGE) public String processAskForm(@Valid AddSeriesSalesForm form, BindingResult result, @PathVariable("id") Integer seriesId, Model model, @CurrentUser Integer currentUserId, Locale userLocale, HttpServletResponse response) throws IOException { if (seriesId == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return null; }//from w w w .j a va 2 s .c o m String lang = LocaleUtils.getLanguageOrNull(userLocale); SeriesDto series = seriesService.findFullInfoById(seriesId, lang); if (series == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return null; } boolean maxQuantityOfImagesExceeded = !isAdmin() && !isAllowedToAddingImages(series); model.addAttribute("maxQuantityOfImagesExceeded", maxQuantityOfImagesExceeded); if (result.hasErrors() || maxQuantityOfImagesExceeded) { Map<String, ?> commonAttrs = prepareCommonAttrsForSeriesInfo(series, currentUserId); model.addAllAttributes(commonAttrs); addSeriesSalesFormToModel(model); addImageFormToModel(model); return "series/info"; } seriesSalesService.add(form, series.getId(), currentUserId); return redirectTo(Url.INFO_SERIES_PAGE, series.getId()); }