Example usage for org.springframework.ui Model mergeAttributes

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

Introduction

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

Prototype

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

Source Link

Document

Copy all attributes in the supplied Map into this Map , with existing objects of the same name taking precedence (i.e.

Usage

From source file:net.shibboleth.idp.oidc.endpoints.DiscoveryEndpoint.java

@RequestMapping(method = RequestMethod.GET)
@Override//  ww  w  . ja  v  a2 s .co  m
public String providerConfiguration(final Model model) {
    final String view = super.providerConfiguration(model);
    model.mergeAttributes(OIDCUtils.buildOidcServerConfigurationModelForDiscovery(model));
    return view;
}

From source file:net.shibboleth.idp.oidc.endpoints.WellKnownEndpoint.java

/**
 * Default endpoint string./*w w  w.j  a v a2 s .  co  m*/
 *
 * @param model the model
 * @return the string
 */
@RequestMapping(method = RequestMethod.GET)
public String defaultEndpoint(final Model model) {
    final String view = super.providerConfiguration(model);
    model.mergeAttributes(OIDCUtils.buildOidcServerConfigurationModelForDiscovery(model));
    return view;
}

From source file:org.orcid.examples.jopmts.mvc.OrcidController.java

@RequestMapping("/orcid/info")
public String orcidInfo(Model model) throws Exception {
    Document orcidDocument = tier2Service.getOrcidDocument();
    model.addAttribute("full_orcid_profile", documentXml(orcidDocument));

    XPath xpath = createXPath();/*w  ww. j av  a 2  s  . co  m*/
    model.mergeAttributes(new OrcidProfile(orcidDocument, xpath));

    return "orcid";
}

From source file:org.orcid.examples.jopmts.mvc.OrcidController.java

@RequestMapping("/orcid/work")
public String workInfo(@RequestParam("workNum") int workNum, Model model) throws Exception {
    Document orcidDocument = tier2Service.getOrcidDocument();
    XPath xpath = createXPath();//from   w w w . j a  v  a 2 s.com
    List<Model> pubs = OrcidProfile.parsePublications(xpath, orcidDocument);
    model.mergeAttributes(pubs.get(workNum).asMap());
    return "work";
}

From source file:org.orcid.examples.jopmts.mvc.OrcidController.java

@RequestMapping("/orcid/record")
public String orcidRecord(@RequestParam("orcid") String orcid, Model model) throws Exception {
    Document orcidDocument = tier1Service.getOrcidDocument(orcid);
    model.addAttribute("full_orcid_profile", documentXml(orcidDocument));

    XPath xpath = createXPath();/*w w w .ja va2s. c o m*/
    model.mergeAttributes(new OrcidProfile(orcidDocument, xpath));

    return "record";
}

From source file:org.orcid.examples.jopmts.mvc.OrcidController.java

@RequestMapping("/orcid/record/work")
public String workForOrcid(@RequestParam("orcid") String orcid, @RequestParam("workNum") int workNum,
        Model model) throws Exception {
    Document orcidDocument = tier1Service.getOrcidDocument(orcid);
    XPath xpath = createXPath();//from  w w  w.j  a v  a  2s  .  c o m
    List<Model> pubs = OrcidProfile.parsePublications(xpath, orcidDocument);
    model.mergeAttributes(pubs.get(workNum).asMap());
    return "work";
}

From source file:org.orcid.examples.jopmts.mvc.OrcidController.java

@RequestMapping("/orcid/search")
public String orcidSearch(@RequestParam("text") String text, Model model) throws Exception {
    Map<String, String> searchTerms = new HashMap<String, String>();
    searchTerms.put("text", text);
    Document orcidDocument = tier1Service.searchOrcid(searchTerms);

    XPath xpath = createXPath();//from ww  w  .ja va2 s .  c om
    model.mergeAttributes(new OrcidSearchResults(orcidDocument, xpath));

    return "searchResults";
}

From source file:org.orcid.examples.jopmts.mvc.OrcidController.java

@RequestMapping("/orcid/author")
public String authorInfo(@RequestParam("workNum") int workNum, @RequestParam("authorNum") int authorNum,
        Model model) throws Exception {
    Document orcidDocument = tier2Service.getOrcidDocument();
    XPath xpath = createXPath();//w  w  w .  ja va 2  s.  c  o  m
    List<Model> pubs = OrcidProfile.parsePublications(xpath, orcidDocument);
    List<Model> authors = (List<Model>) pubs.get(workNum).asMap().get("authors");
    model.mergeAttributes(authors.get(authorNum).asMap());
    return "author";
}

From source file:org.orcid.examples.jopmts.mvc.OrcidController.java

@RequestMapping("/orcid/record/author")
public String authorForOrcid(@RequestParam("orcid") String orcid, @RequestParam("workNum") int workNum,
        @RequestParam("authorNum") int authorNum, Model model) throws Exception {
    Document orcidDocument = tier1Service.getOrcidDocument(orcid);
    XPath xpath = createXPath();/*  w w w  . j  a  v a 2s.co m*/
    List<Model> pubs = OrcidProfile.parsePublications(xpath, orcidDocument);
    List<Model> authors = (List<Model>) pubs.get(workNum).asMap().get("authors");
    model.mergeAttributes(authors.get(authorNum).asMap());
    return "author";
}

From source file:org.cleverbus.admin.web.log.LogController.java

@RequestMapping("/")
public String getLogSearch(@RequestParam(value = "fromDate", required = false) DateTime fromDate,
        @RequestParam MultiValueMap<String, String> params, Model model) throws UnsupportedEncodingException {
    if (fromDate != null) {
        params.remove("fromDate");
        // remove empty values:
        for (List<String> valueList : params.values()) {
            ListIterator<String> values = valueList.listIterator();
            while (values.hasNext()) {
                if (!StringUtils.hasText(values.next())) {
                    values.remove();//from  w w w.ja  v a 2 s .  c om
                }
            }
        }
        model.mergeAttributes(params);
        return "redirect:"
                + UriUtils.encodePath(LogParserConstants.LOGBACK_ISO8601_FORMAT.print(fromDate), "UTF-8");
    }

    model.addAttribute("fromDate", LogParserConstants.LOGBACK_ISO8601_FORMAT.print(
            DateTime.now().minusHours(2).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0)));

    LogParserConfig logParserConfig = new LogParserConfig();
    logParserConfig.setGroupBy(LogParserConstants.DEFAULT_GROUP_BY_PROPERTY);
    logParserConfig.setGroupLimit(LogParserConstants.DEFAULT_GROUP_SIZE);
    model.addAttribute("config", logParserConfig);

    return "logSearch";
}