Search in sources :

Example 31 with Publication

use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.

the class RdfPublicationController method findOnePublicationByMd5.

@ApiMethod(path = "/rdf/publication/{md5}", verb = ApiVerb.GET, description = "Exports one neXtProt publication.", produces = { "text/turtle" })
@RequestMapping("/rdf/publication/{md5}")
public String findOnePublicationByMd5(@ApiPathParam(name = "md5", description = "The md5 of the publication", allowedvalues = { "b240aea6411ebd3cc49099009359df1f" }) @PathVariable("md5") String md5, Model model) {
    Publication publication = publicationService.findPublicationByMD5(md5);
    model.addAttribute("publication", publication);
    model.addAttribute("prefix", true);
    model.addAttribute("StringUtils", StringUtils.class);
    model.addAttribute("isLargeScale", publicationService.getPublicationStatistics(publication.getPublicationId()).isLargeScale());
    return "publication";
}
Also used : Publication(org.nextprot.api.core.domain.Publication) ApiMethod(org.jsondoc.core.annotation.ApiMethod) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 32 with Publication

use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.

the class RdfPublicationController method findAllPublication.

// @ApiMethod(path = "/rdf/publication", verb = ApiVerb.GET, description = "Exports the whole neXtProt publication ordered by year and title.", produces = { "text/turtle"})
@RequestMapping("/rdf/publication")
public void findAllPublication(Map<String, Object> model, HttpServletResponse response, HttpServletRequest request) throws Exception {
    Boolean withPrefix = true;
    View v = viewResolver.resolveViewName("publication", Locale.ENGLISH);
    List<Long> publicationIds = this.publicationService.findAllPublicationIds();
    for (Long pubId : publicationIds) {
        Publication publication = this.publicationService.findPublicationById(pubId);
        model.put("prefix", withPrefix);
        model.put("StringUtils", StringUtils.class);
        model.put("publication", publication);
        model.put("isLargeScale", publicationService.getPublicationStatistics(publication.getPublicationId()).isLargeScale());
        v.render(model, request, response);
        withPrefix = false;
    }
}
Also used : Publication(org.nextprot.api.core.domain.Publication) View(org.springframework.web.servlet.View) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 33 with Publication

use of org.nextprot.api.core.domain.Publication in project nextprot-api by calipho-sib.

the class SeoTagsServiceImpl method getPublicationSeoTags.

@Override
public SeoTags getPublicationSeoTags(String url) {
    String[] urlElements = RelativeUrlUtils.getPathElements(url);
    int id = Integer.valueOf(urlElements[1]);
    // default subpage
    String subpage = "proteins";
    if (urlElements.length > 2)
        subpage = urlElements[2];
    String prettySubpage = getPrettyName(subpage);
    Publication pub = publicationService.findPublicationById(id);
    String title = pub.getTitle() + " - " + prettySubpage;
    String h1 = title;
    String descr = title;
    return new SeoTags(title, descr, h1);
}
Also used : SeoTags(org.nextprot.api.web.seo.domain.SeoTags) Publication(org.nextprot.api.core.domain.Publication)

Aggregations

Publication (org.nextprot.api.core.domain.Publication)33 Test (org.junit.Test)17 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)13 EntryPublication (org.nextprot.api.core.domain.publication.EntryPublication)6 Ignore (org.junit.Ignore)4 StatementSimpleWhereClauseQueryDSL (org.nextprot.api.core.dao.impl.StatementSimpleWhereClauseQueryDSL)4 ImmutableList (com.google.common.collect.ImmutableList)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Cacheable (org.springframework.cache.annotation.Cacheable)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 PublicationAuthor (org.nextprot.api.core.domain.PublicationAuthor)2 PublicationDbXref (org.nextprot.api.core.domain.PublicationDbXref)2 GlobalPublicationStatistics (org.nextprot.api.core.domain.publication.GlobalPublicationStatistics)2 Service (org.springframework.stereotype.Service)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Sets (com.google.common.collect.Sets)1 Argument (graphql.language.Argument)1 Field (graphql.language.Field)1