List of usage examples for org.springframework.ui Model asMap
Map<String, Object> asMap();
From source file:com.gisnet.cancelacion.web.controller.Utils.java
public static List<String> getMensajes(Model model) { List<String> messages; if (model.containsAttribute("mensajes")) { messages = (List<String>) model.asMap().get("mensajes"); } else {//from w ww . ja va 2s. com messages = new ArrayList<>(); model.addAttribute("mensajes", messages); } return messages; }
From source file:com.redhat.rhtracking.web.controller.Utils.java
public static List<String> getMessagesList(Model model) { List<String> messages; if (model.containsAttribute("messages")) { messages = (List<String>) model.asMap().get("messages"); } else {//from w w w . jav a2 s. c om messages = new ArrayList<>(); model.addAttribute("messages", messages); } return messages; }
From source file:com.epam.cme.storefront.controllers.util.GlobalMessages.java
protected static void addMessage(final Model model, final String messageHolder, final String messageKey) { if (model.containsAttribute(messageHolder)) { final Map<String, Object> modelMap = model.asMap(); final List<String> messageKeys = new ArrayList<String>((List<String>) modelMap.get(messageHolder)); messageKeys.add(messageKey);//w ww . j a va 2s . c om model.addAttribute(messageHolder, messageKeys); } else { model.addAttribute(messageHolder, Collections.singletonList(messageKey)); } }
From source file:net.shibboleth.idp.oidc.util.OIDCUtils.java
/** * Build oidc server configuration model for discovery map. * * @param model the model//from w w w .java 2 s .co m * @return the map */ public static Map<String, Object> buildOidcServerConfigurationModelForDiscovery(final Model model) { final Map<String, Object> m = Map.class.cast(model.asMap().get("entity")); final String baseUrl = m.get("issuer").toString(); m.put("authorization_endpoint", baseUrl + "profile" + AuthorizeEndpoint.URL); m.put("token_endpoint", baseUrl + "profile" + TokenEndpoint.URL); m.put("userinfo_endpoint", baseUrl + "profile" + UserInfoEndpoint.URL); m.put("jwks_uri", baseUrl + "profile" + JWKPublishingEndpoint.URL); m.put("revocation_endpoint", baseUrl + "profile" + RevocationEndpoint.URL); m.put("introspection_endpoint", baseUrl + "profile" + IntrospectionEndpoint.URL); m.put("registration_endpoint", baseUrl + "profile" + DynamicRegistrationEndpoint.URL); m.remove("service_documentation"); m.remove("op_policy_uri"); m.remove("op_tos_uri"); return m; }
From source file:alfio.manager.support.CustomMessageManager.java
private static String renderResource(String template, Model model, Locale locale, TemplateManager templateManager) { return templateManager.renderString(template, model.asMap(), locale, TemplateManager.TemplateOutput.TEXT); }
From source file:de.hybris.platform.acceleratorstorefrontcommons.controllers.util.GlobalMessages.java
public static void addMessage(final Model model, final String messageHolder, final String messageKey, final Object[] attributes) { final GlobalMessage message = new GlobalMessage(); message.setCode(messageKey);/* w w w.jav a 2 s . co m*/ message.setAttributes(attributes != null ? Arrays.asList(attributes) : Collections.emptyList()); final Map<String, Object> modelMap = model.asMap(); if (modelMap.containsKey(messageHolder)) { final List<GlobalMessage> messages = new ArrayList<>((List<GlobalMessage>) modelMap.get(messageHolder)); messages.add(message); model.addAttribute(messageHolder, messages); } else { model.addAttribute(messageHolder, Collections.singletonList(message)); } }
From source file:com.exxonmobile.ace.hybris.storefront.controllers.util.GlobalMessages.java
public static void addMessage(final Model model, final String messageHolder, final String messageKey, final Object[] attributes) { final GlobalMessage message = new GlobalMessage(); message.setCode(messageKey);/*from w w w. j av a2s . c o m*/ message.setAttributes(attributes != null ? Arrays.asList(attributes) : Collections.emptyList()); final Map<String, Object> modelMap = model.asMap(); if (modelMap.containsKey(messageHolder)) { final List<GlobalMessage> messages = new ArrayList<GlobalMessage>( (List<GlobalMessage>) modelMap.get(messageHolder)); messages.add(message); model.addAttribute(messageHolder, messages); } else { model.addAttribute(messageHolder, Collections.singletonList(message)); } }
From source file:com.qubit.solution.fenixedu.bennu.webservices.ui.WebservicesBaseController.java
protected void addInfoMessage(String message, Model m) { ((List<String>) m.asMap().get("infoMessages")).add(message); }
From source file:com.qubit.solution.fenixedu.bennu.webservices.ui.WebservicesBaseController.java
protected void addWarningMessage(String message, Model m) { ((List<String>) m.asMap().get("warningMessages")).add(message); }
From source file:com.qubit.solution.fenixedu.bennu.webservices.ui.WebservicesBaseController.java
protected void addErrorMessage(String message, Model m) { ((List<String>) m.asMap().get("errorMessages")).add(message); }