use of org.powo.portal.view.Bibliography in project powop by RBGKew.
the class BibliographyTest method testAcceptedFilter.
@Test
public void testAcceptedFilter() {
Reference acceptedIn = new Reference();
acceptedIn.setSubject("Accepted");
taxon.setReferences(ImmutableSet.<Reference>of(acceptedIn));
Bibliography bib = new Bibliography(taxon);
assertEquals(1, bib.getAccepted().size());
assertEquals(null, bib.getLiturature());
}
use of org.powo.portal.view.Bibliography in project powop by RBGKew.
the class BibliographyTest method testSynonymFilter.
@Test
public void testSynonymFilter() {
Reference acceptedIn = new Reference();
acceptedIn.setSubject("Synonym");
taxon.setReferences(ImmutableSet.<Reference>of(acceptedIn));
Bibliography bib = new Bibliography(taxon);
assertEquals(1, bib.getNotAccepted().size());
assertEquals(null, bib.getLiturature());
}
use of org.powo.portal.view.Bibliography in project powop by RBGKew.
the class BibliographyHelperTest method setUp.
@Before
public void setUp() {
taxon = new Taxon();
org = new Organisation();
Reference ref = new Reference();
org.setIdentifier("1");
org.setAbbreviation("BI");
org.setTitle("Blarg Inc.");
ref.setIdentifier("ref1");
taxon.setLicense("blarg");
taxon.setRights("none");
taxon.setAuthority(org);
taxon.setReferences(ImmutableSet.<Reference>of(ref));
bibliography = new Bibliography(taxon);
sources = new Sources(taxon);
}
use of org.powo.portal.view.Bibliography in project powop by RBGKew.
the class PowoSite method populateTaxonModel.
@Override
public void populateTaxonModel(Taxon taxon, Model model) {
model.addAttribute(taxon);
model.addAttribute(new Sources(taxon));
Bibliography bibliography = new Bibliography(taxon);
Descriptions descriptions = new Descriptions(taxon);
Descriptions uses = new Descriptions(taxon, true);
Images images = new Images(taxon, imageService);
Identifications identifications = new Identifications(taxon);
VernacularNames vernacularNames = new VernacularNames(taxon);
if (!descriptions.getBySource().isEmpty()) {
model.addAttribute("descriptions", descriptions);
}
if (!bibliography.isEmpty()) {
model.addAttribute(bibliography);
}
if (!uses.getBySource().isEmpty()) {
model.addAttribute("uses", uses);
}
if (!taxon.getSynonymNameUsages().isEmpty()) {
model.addAttribute("synonyms", new ScientificNames(taxon.getSynonymNameUsages()));
}
if (!taxon.getChildNameUsages().isEmpty()) {
model.addAttribute("children", new ScientificNames(taxon.getChildNameUsages()));
}
if (!taxon.getMeasurementsOrFacts().isEmpty()) {
model.addAttribute(new MeasurementOrFacts(taxon));
}
if (!taxon.getDistribution().isEmpty()) {
model.addAttribute(new Distributions(taxon));
}
if (!vernacularNames.getNames().isEmpty()) {
model.addAttribute(vernacularNames);
}
if (!identifications.getIdentifications().isEmpty()) {
model.addAttribute(identifications);
}
if (!images.getAll().isEmpty()) {
model.addAttribute(images);
}
model.addAttribute("color-theme", bodyClass(taxon));
model.addAttribute("title", pageTitle(taxon));
model.addAttribute("summary", new Summary(taxon, messageSource).build());
model.addAttribute("site-logo", "partials/logo/powo");
model.addAttribute("site-logo-svg", "svg/powo-logo.svg");
}
use of org.powo.portal.view.Bibliography in project powop by RBGKew.
the class BibliographyTest method testCollectingReferencesFromSynonyms.
@Test
public void testCollectingReferencesFromSynonyms() {
Reference nameReference = new Reference();
Reference descriptionReference = new Reference();
Description description = new Description();
Taxon synonym = new Taxon();
description.setReferences(ImmutableSet.<Reference>of(descriptionReference));
synonym.setTaxonomicStatus(TaxonomicStatus.Synonym);
synonym.setReferences(ImmutableSet.<Reference>of(nameReference));
synonym.setDescriptions(ImmutableSet.<Description>of(description));
taxon.setSynonymNameUsages(ImmutableSet.<Taxon>of(synonym));
Bibliography bib = new Bibliography(taxon);
assertEquals("accepted name should have description reference from synonym", 1, bib.getLiturature().size());
assertEquals(descriptionReference, Iterators.getOnlyElement(bib.getLiturature().get("Literature").iterator()));
}
Aggregations