Example usage for org.springframework.ui Model asMap

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

Introduction

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

Prototype

Map<String, Object> asMap();

Source Link

Document

Return the current set of model attributes as a Map.

Usage

From source file:com.work.petclinic.web.VetController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView showVets(Model model) {
    return new ModelAndView("redirect:/vets/list.html", model.asMap());
}

From source file:whitelabel.cloud.webapp.impl.controller.AppController.java

@ModelAttribute
public MenuObserver getMenuObserver(Model model) {
    MenuObserver menuObserver = (MenuObserver) model.asMap().get(MenuObserver.SESSION_NAME);
    if (menuObserver == null) {
        menuObserver = new MenuObserver();
        model.addAttribute(MenuObserver.SESSION_NAME, menuObserver);
    }/*from  w  w w  . java  2 s  .co m*/
    menuObserver.setSelectedItem(getSelectedItem());
    return menuObserver;
}

From source file:com.qubit.solution.fenixedu.integration.cgd.ui.CgdBaseController.java

protected void addInfoMessage(String message, Model model) {
    ((List<String>) model.asMap().get(INFO_MESSAGES)).add(message);
}

From source file:com.qubit.solution.fenixedu.integration.cgd.ui.CgdBaseController.java

protected void addWarningMessage(String message, Model model) {
    ((List<String>) model.asMap().get(WARNING_MESSAGES)).add(message);
}

From source file:com.qubit.solution.fenixedu.integration.cgd.ui.CgdBaseController.java

protected void addErrorMessage(String message, Model model) {
    ((List<String>) model.asMap().get(ERROR_MESSAGES)).add(message);
}

From source file:org.ngrinder.operation.ScriptConsoleControllerTest.java

@Test
public void runScriptTest() {
    ScriptConsoleController scriptController = new ScriptConsoleController();

    Model model = new ExtendedModelMap();
    scriptController.run("", model);
    assertThat((String) model.asMap().get("result"), nullValue());
    String command = "print \'hello\'";
    scriptController.run(command, model);
    assertThat(model.containsAttribute("result"), is(true));
    assertThat((String) model.asMap().get("result"), containsString("hello"));

    scriptController.run("var a = 1", model);
    scriptController.run("print a", model);
    assertThat((String) model.asMap().get("result"), containsString("No such property"));

}

From source file:org.fenixedu.ulisboa.integration.sas.ui.spring.controller.manageScholarshipsConfiguration.SocialServicesConfigurationController.java

private SocialServicesConfiguration getSocialServicesConfiguration(Model model) {
    return (SocialServicesConfiguration) model.asMap().get("socialServicesConfiguration");
}

From source file:com.qubit.solution.fenixedu.integration.cgd.ui.cgdConfiguration.CgdIntegrationConfigurationController.java

private CgdIntegrationConfiguration getCgdIntegrationConfiguration(Model m) {
    return (CgdIntegrationConfiguration) m.asMap().get("cgdIntegrationConfiguration");
}

From source file:com.utbm.formation.controller.ValidInsertSessionController.java

/**
 * Ajout d'un client  une/des sessions slectionnes
 * @param itemid Les informations du client et les sessions slectionnes
 * @param model Le model des donnes//from ww  w  . j  av a  2 s. c  o  m
 * @return Retourne la validation de l'inscription
 */
@RequestMapping(value = "", method = POST)
public ModelAndView listCourse(@Valid BeanValidInsertSession itemid, Model model) {

    validInsertSessionService.saveClientFromValidSession(itemid);
    return new ModelAndView("validInsertSession", model.asMap());
}

From source file:org.apereo.lap.controllers.HomeControllerTest.java

@Test
public void testController() {
    assertNotNull(config);//  w ww . j a v  a  2s  . c  o  m
    assertNotNull(pms);
    HomeController controller = new HomeController();
    controller.configuration = config;
    controller.processingManagerService = pms;
    Model model = new ExtendedModelMap();
    Assert.assertEquals("home", controller.home(model));

    Object dev = model.asMap().get("dev");
    Assert.assertEquals("AZ", dev);
}