Example usage for org.springframework.ui Model addAllAttributes

List of usage examples for org.springframework.ui Model addAllAttributes

Introduction

In this page you can find the example usage for org.springframework.ui Model addAllAttributes.

Prototype

Model addAllAttributes(Map<String, ?> attributes);

Source Link

Document

Copy all attributes in the supplied Map into this Map .

Usage

From source file:com.gerrydevstory.myxie.master.MasterControllerAdvice.java

/**
 * Populate all {@link Config} object of type {@link SITE}
 *//*from www.j  av a2s.c  o  m*/
@ModelAttribute
public void populateConfigs(Model model) {
    Map<String, String> configs = configService.getAllConfigOfType(ConfigType.WEB_COMMON);
    model.addAllAttributes(configs);
}

From source file:kievreclama.task.controllers.EmployeeController.java

@RequestMapping(value = "/")
public String getPageTasks(Model model) {
    model.addAttribute("employees", employeeService.getList("employees"));
    model.addAllAttributes(employeeService.allCompnents());
    return "employees";
}

From source file:com.yuga.ygplatform.modules.sys.web.LogController.java

@RequestMapping(value = { "list", "" })
public String list(@RequestParam Map<String, Object> paramMap, HttpServletRequest request,
        HttpServletResponse response, Model model) {
    Page<Log> page = logService.find(new Page<Log>(request, response), paramMap);
    model.addAttribute("page", page);
    model.addAllAttributes(paramMap);
    return "modules/sys/logList";
}

From source file:ru.javaops.web.ErrorController.java

@RequestMapping(ERROR_PATH)
String error(HttpServletRequest request, Model model) {
    Map<String, Object> errorMap = errorAttributes.getErrorAttributes(new ServletRequestAttributes(request),
            false);/*  ww w  .  j  ava2 s. c  o  m*/
    model.addAllAttributes(errorMap);
    return "exception";
}

From source file:com.healthcit.analytics.servlet.admin.AdminController.java

@RequestMapping(value = "/admin/edit_user", method = RequestMethod.POST)
public String editUser(@ModelAttribute("user") @Valid UserModel user, BindingResult res, Model model) {
    this.userValidator.validate(user, res);
    if (res.hasErrors()) {
        model.addAllAttributes(res.getAllErrors());
        return "/admin/user";
    }//from   w  w  w. j  av a  2  s .  c o  m
    this.userManager.updateUser(this.buildUser(user, this.userManager.getRoles()));
    return "redirect:/admin";
}

From source file:com.healthcit.analytics.servlet.admin.AdminController.java

@RequestMapping(value = "/admin/add_user", method = RequestMethod.POST)
public String addUser(@ModelAttribute("user") @Valid UserModel user, BindingResult res, Model model) {
    this.userValidator.validate(user, res);
    if (res.hasErrors()) {
        model.addAllAttributes(res.getAllErrors());
        return "/admin/user";
    }//from  w ww .j  av  a 2 s  .  co m
    this.userManager.createUser(this.buildUser(user, this.userManager.getRoles()));
    return "redirect:/admin";
}

From source file:gxu.software_engineering.shen10.market.controller.CategoryController.java

@RequestMapping(value = "/categories/q", method = GET)
public String query(Model model, @RequestParam("count") int count, @RequestParam("name") String name) {
    Map<String, Object> result = categoryService.search(name, count);
    model.addAllAttributes(result);
    return BAD_REQUEST;
}

From source file:org.appverse.web.framework.backend.frontfacade.mvc.swagger.controller.SwaggerOAuth2Controller.java

@RequestMapping(value = "/swaggeroauth2login", method = RequestMethod.GET)
public String showSwaggerOAuth2LoginForm(Model model, HttpServletRequest req) throws MalformedURLException {
    String contextPath = req.getContextPath();
    model.addAttribute("response_type", "token");
    Map<String, String[]> map = req.getParameterMap();

    model.addAllAttributes(convertParameters(map));
    model.addAttribute("redirect_uri", req.getParameter("redirect_uri"));
    if (oauthAuthServerBaseUrl != null && !oauthAuthServerBaseUrl.isEmpty()) {
        // Is an external OAuth2 provider, not in the same webapplication as the resource server
        model.addAttribute("swaggerLoginFormAction", oauthAuthServerBaseUrl + oauth2LoginEndpoint);
    } else {/*from w w  w.j a  v  a 2 s.  com*/
        // The OAuth2 provider and the resource server reside in the same web application
        model.addAttribute("swaggerLoginFormAction", convertToRelativePath(contextPath, oauth2LoginEndpoint));
    }
    model.addAttribute("swaggerClientId", swaggerClientId);

    return "oauth2loginform";
}

From source file:com.redhat.rhtracking.web.controller.CustomerController.java

@RequestMapping(value = "/customer/", 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);
    Map<String, Object> response = customerService.listAllCustomers(request);
    model.addAllAttributes(response);

    return "/customer/list";
}

From source file:com.redhat.rhtracking.web.controller.PartnerController.java

@RequestMapping(value = "/partner/{id}/details", method = RequestMethod.GET)
public String show(@PathVariable long id, RedirectAttributes redirectAttributes, Model model) {
    List<String> messages = getMessagesList(model);
    Map<String, Object> request = new HashMap<>();
    request.put("id", id);
    Map<String, Object> response = partnerService.getPartnerById(request);

    model.addAllAttributes(response);

    return "/partner/details";
}