use of org.nextprot.api.web.seo.domain.SeoTags in project nextprot-api by calipho-sib.
the class SeoServiceIntegrationTest method testSeoTagsForTerm.
@Test
public void testSeoTagsForTerm() throws Exception {
String baseTitle = "GO:0042802 - Identical protein binding - ";
SeoTags tags;
tags = seoTagsService.getTermSeoTags("/term/GO:0042802");
Assert.assertTrue(tags != null);
Assert.assertEquals(baseTitle + "Proteins", tags.getTitle());
tags = seoTagsService.getTermSeoTags("/term/GO:0042802/");
Assert.assertTrue(tags != null);
Assert.assertEquals(baseTitle + "Proteins", tags.getTitle());
tags = seoTagsService.getTermSeoTags("/term/GO:0042802/proteins");
Assert.assertTrue(tags != null);
Assert.assertEquals(baseTitle + "Proteins", tags.getTitle());
tags = seoTagsService.getTermSeoTags("/term/GO:0042802/ancestors");
Assert.assertTrue(tags != null);
Assert.assertEquals(baseTitle + "Ancestors", tags.getTitle());
tags = seoTagsService.getTermSeoTags("/term/GO:0042802/tree");
Assert.assertTrue(tags != null);
Assert.assertEquals(baseTitle + "Tree", tags.getTitle());
}
use of org.nextprot.api.web.seo.domain.SeoTags in project nextprot-api by calipho-sib.
the class SeoServiceIntegrationTest method testSomeDefaultSeoTags.
@Test
public void testSomeDefaultSeoTags() throws Exception {
SeoTags tags;
tags = seoTagsService.getDefaultSeoTags("/toto");
Assert.assertTrue(tags != null);
Assert.assertEquals("Toto", tags.getTitle());
tags = seoTagsService.getDefaultSeoTags("/toto/");
Assert.assertTrue(tags != null);
Assert.assertEquals("Toto", tags.getTitle());
tags = seoTagsService.getDefaultSeoTags("/toto/tutu");
Assert.assertTrue(tags != null);
Assert.assertEquals("Toto - Tutu", tags.getTitle());
tags = seoTagsService.getDefaultSeoTags("/toto/tutu?titi=content");
Assert.assertTrue(tags != null);
Assert.assertEquals("Toto - Tutu", tags.getTitle());
}
use of org.nextprot.api.web.seo.domain.SeoTags 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);
}
use of org.nextprot.api.web.seo.domain.SeoTags in project nextprot-api by calipho-sib.
the class SeoTagsServiceImpl method getEntrySeoTags.
@Override
public SeoTags getEntrySeoTags(String url) {
String[] urlElements = RelativeUrlUtils.getPathElements(url);
String ac = urlElements[1];
// default subpage
String subpage = "function";
if (urlElements.length > 2)
subpage = urlElements[2];
String prettySubpage = getPrettyName(subpage);
Entry entry = entryBuilderService.build(EntryConfig.newConfig(ac).withOverview().with("function-info"));
String protName = entry.getOverview().getMainProteinName();
String geneName = entry.getOverview().getMainGeneName();
// decision QC 18.08.2016
if (geneName == null || geneName.isEmpty())
geneName = ac;
// decision NPC 15.08.2016
String title = geneName + " - " + protName + " - " + prettySubpage;
// decision NPC 15.08.2016
String h1 = geneName + " - " + prettySubpage;
// TODO: send something different for each subpage... see with amos
String descr = ac + " - " + title + ". " + getFirstFunctionInfo(entry);
return new SeoTags(title, descr, h1);
}
use of org.nextprot.api.web.seo.domain.SeoTags in project nextprot-api by calipho-sib.
the class SeoTagsServiceImpl method getTermSeoTags.
@Override
public SeoTags getTermSeoTags(String url) {
String[] urlElements = RelativeUrlUtils.getPathElements(url);
String ac = urlElements[1];
// default subpage
String subpage = "proteins";
if (urlElements.length > 2)
subpage = urlElements[2];
String prettySubpage = getPrettyName(subpage);
CvTerm term = terminologyService.findCvTermByAccession(ac);
String title = term.getAccession() + " - " + getPrettyName(term.getName()) + " - " + prettySubpage;
String h1 = title;
// TODO: NullPointerException below
String descr = term.getOntology() + " " + term.getAccession() + " - " + term.getName() + " - " + prettySubpage;
return new SeoTags(title, descr, h1);
}
Aggregations