List of usage examples for org.springframework.ui Model addAllAttributes
Model addAllAttributes(Map<String, ?> attributes);
From source file:edu.teilar.jcrop.service.client.controller.KObjectsClientController.java
@RequestMapping(value = "/kobjects/{kobject}", method = RequestMethod.GET) public String getKObject(@PathVariable String kobject, Model model) { RestTemplate restTemplate = new RestTemplate(); String url = ClientUrls.SERVERADDRESS + ApiUrls.KOBJECT_XMODELS_XGRAPH_SVG_URL; Map<String, Object> svgDocument = restTemplate.getForObject(url, Map.class, kobject, "default"); model.addAllAttributes(svgDocument); url = ClientUrls.SERVERADDRESS + ApiUrls.KOBJECT_URL; KObject kobj = restTemplate.getForObject(url, KObject.class, kobject); model.addAttribute("kobject", kobj); return "kobject"; }
From source file:com.redhat.rhtracking.web.controller.ConsultantController.java
@RequestMapping(value = "/consultant/add", method = RequestMethod.GET) public String saveView(Model model) { Map<String, Object> partners = partnerService.listAllPartnersSimple(new HashMap<String, Object>()); model.addAllAttributes(partners); return "/consultant/add"; }
From source file:com.redhat.rhtracking.web.controller.DeliveryMatrixController.java
@RequestMapping(value = "/matrix/", method = RequestMethod.GET) public String list(@RequestParam(required = false, defaultValue = "1") int page, Model model) { Map<String, Object> request = new HashMap<>(); request.put("pageNumber", page - 1); request.put("pageSize", 20); Map<String, Object> listAllConsultantsPaged = deliveryMatrixService.listAllDeliveryMatrixPaged(request); model.addAllAttributes(listAllConsultantsPaged); return "/matrix/list"; }
From source file:com.redhat.rhtracking.web.controller.ConsultantController.java
@RequestMapping(value = "/consultant/{id}/details", method = RequestMethod.GET) public String show(@PathVariable long id, Model model) { Map<String, Object> request = new HashMap<>(); request.put("id", id); Map<String, Object> consultant = consultantService.getConsultant(request); model.addAllAttributes(consultant); Map<String, Object> listAllConsultorAsignations = deliveryService.listAllConsultorAsignations(request); model.addAttribute("assignations", listAllConsultorAsignations.get("list")); return "/consultant/details"; }
From source file:com.redhat.rhtracking.web.controller.PartnerController.java
@RequestMapping(value = "/partner/", 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> response = partnerService.listAllPartnersPaged(request); if (response.get("status") == EventStatus.SUCCESS) { model.addAttribute("pageNumber", page - 1); model.addAllAttributes(response); } else {// www . j av a 2 s. co m getMessagesList(model).add("error::Ocurrio un error al obtener al procesar la solicitud"); model.addAttribute("page", new HashMap<String, Object>()); } return "/partner/list"; }
From source file:com.redhat.rhtracking.web.controller.CustomerController.java
@RequestMapping(value = "/customer/{id}/details", method = RequestMethod.GET) public String show(@PathVariable long id, Model model, RedirectAttributes redirectAttributes) { List<String> messages = Utils.getFlashMessagesList(model, redirectAttributes); Map<String, Object> request = new HashMap<>(); request.put("id", id); Map<String, Object> response = customerService.findCustomer(request); if ((EventStatus) response.get("status") == EventStatus.SUCCESS) { model.addAllAttributes(response); } else {/*w w w .j a v a 2 s . c om*/ messages.add("error::Cliente no encontrado."); return "redirect:/customer/"; } return "/customer/details"; }
From source file:com.redhat.rhtracking.web.controller.InvoiceController.java
@RequestMapping(value = "/invoice/", 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 = invoiceService.listAllInvoices(request);//paged if ((EventStatus) listAllConsultantsPaged.get("status") == EventStatus.SUCCESS) { model.addAttribute("pageNumber", page - 1); model.addAllAttributes(listAllConsultantsPaged); } else//from w w w. j a v a2 s.c o m getMessagesList(model).add("error::Ocurrio un error al obtener al procesar la solicitud"); return "/invoice/list"; }
From source file:gxu.software_engineering.shen10.market.controller.ItemController.java
@RequestMapping(value = "/items/q", method = GET) public String query(Model model, @RequestParam(value = "name", required = false) String name, @RequestParam(value = "price1", defaultValue = "0") float minPrice, @RequestParam(value = "price2", defaultValue = "-1") float maxPrice, @RequestParam(value = "last_id", defaultValue = "0") long lastId, @RequestParam(value = "count") int count) { Map<String, Object> result = itemService.search(name, minPrice, maxPrice, lastId, count); model.addAllAttributes(result); return BAD_REQUEST; }
From source file:com.fengduo.bee.web.controller.order.OrderController.java
/** * /*from w ww . j a va 2 s .com*/ */ @SuppressWarnings("unchecked") @RequestMapping(value = "/order/offline") public String gotoOffline(Long itemId, Long orderId, Long subId, Model model) { Result result = orderInfos(itemId, orderId, subId); if (result.isFailed()) { return "redirect:/"; } model.addAllAttributes((Map<String, Object>) result.getData()); return "order/offline"; }
From source file:com.redhat.rhtracking.web.controller.ConsultantController.java
@RequestMapping(value = "/consultant/assignation", method = RequestMethod.GET) public String assignationView(@RequestParam(required = true) String id, @RequestParam(required = true) String type, Model model) { Map<String, Object> consultants = consultantService.listAllConsultants(new HashMap<String, Object>()); model.addAttribute("consultants", (List<Map<String, Object>>) consultants.get("list")); Map<String, Object> request = new HashMap<>(); request.put("identifier", id); Map<String, Object> opportunity = deliveryMatrixService.findOpportunityBy(request); model.addAllAttributes(opportunity); Map<String, Object> hours = deliveryMatrixService.findOpportunityHours(request); int hour = -1; BigDecimal maxPay = BigDecimal.ZERO; for (Map<String, Object> h : (List<Map<String, Object>>) hours.get("list")) { String ht = (String) h.get("hourType"); if (ht.equals(type.toUpperCase())) { logger.debug("found" + h); hour = (int) h.get("quantity") - (int) h.get("hoursToAccrued"); maxPay = (BigDecimal) h.get("unitPrice"); break; }/* w w w. j av a2s. c o m*/ } model.addAttribute("hour", hour); model.addAttribute("maxPay", maxPay); model.addAttribute("hourType", type); return "/consultant/assignation"; }