Search in sources :

Example 1 with Bibliography

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());
}
Also used : Reference(org.powo.model.Reference) Bibliography(org.powo.portal.view.Bibliography) Test(org.junit.Test)

Example 2 with Bibliography

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());
}
Also used : Reference(org.powo.model.Reference) Bibliography(org.powo.portal.view.Bibliography) Test(org.junit.Test)

Example 3 with Bibliography

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);
}
Also used : Organisation(org.powo.model.registry.Organisation) Reference(org.powo.model.Reference) Taxon(org.powo.model.Taxon) Sources(org.powo.portal.view.Sources) Bibliography(org.powo.portal.view.Bibliography) Before(org.junit.Before)

Example 4 with Bibliography

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");
}
Also used : Descriptions(org.powo.portal.view.Descriptions) VernacularNames(org.powo.portal.view.VernacularNames) MeasurementOrFacts(org.powo.portal.view.MeasurementOrFacts) Images(org.powo.portal.view.Images) ScientificNames(org.powo.portal.view.ScientificNames) Identifications(org.powo.portal.view.Identifications) Summary(org.powo.portal.view.Summary) Sources(org.powo.portal.view.Sources) Bibliography(org.powo.portal.view.Bibliography) Distributions(org.powo.portal.view.Distributions)

Example 5 with Bibliography

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()));
}
Also used : Description(org.powo.model.Description) Reference(org.powo.model.Reference) Taxon(org.powo.model.Taxon) Bibliography(org.powo.portal.view.Bibliography) Test(org.junit.Test)

Aggregations

Bibliography (org.powo.portal.view.Bibliography)6 Reference (org.powo.model.Reference)5 Test (org.junit.Test)4 Description (org.powo.model.Description)2 Taxon (org.powo.model.Taxon)2 Sources (org.powo.portal.view.Sources)2 Before (org.junit.Before)1 Organisation (org.powo.model.registry.Organisation)1 Descriptions (org.powo.portal.view.Descriptions)1 Distributions (org.powo.portal.view.Distributions)1 Identifications (org.powo.portal.view.Identifications)1 Images (org.powo.portal.view.Images)1 MeasurementOrFacts (org.powo.portal.view.MeasurementOrFacts)1 ScientificNames (org.powo.portal.view.ScientificNames)1 Summary (org.powo.portal.view.Summary)1 VernacularNames (org.powo.portal.view.VernacularNames)1