use of org.powo.model.Distribution in project powop by RBGKew.
the class TaxonResponseTest method testTaxonWithDistributions.
@Test
public void testTaxonWithDistributions() {
Taxon t = baseTaxon();
List<Distribution> distributions = ImmutableList.of(buildDistribution(Location.GRB, EstablishmentMeans.Native), buildDistribution(Location.IRE, EstablishmentMeans.Introduced));
t.setDistribution(ImmutableSet.copyOf(distributions));
TaxonResponse tw = new TaxonResponse(t, ImmutableList.of(TaxonField.distribution));
Distributions distr = (Distributions) tw.getOutput().get("distribution");
assertEquals(distributions.get(0), distr.getNatives().get(0));
assertEquals(distributions.get(1), distr.getIntroduced().get(0));
}
use of org.powo.model.Distribution in project powop by RBGKew.
the class SummaryTest method createDist.
private Distribution createDist(Location location) {
Distribution dist = new Distribution();
dist.setLocation(location);
return dist;
}
use of org.powo.model.Distribution in project powop by RBGKew.
the class DistributionComparatorTest method setUp.
@Before
public void setUp() {
distributionComparator = new DistributionComparator();
distributions = new ArrayList<Distribution>();
locationComparator = new LocationComparator();
locations = new ArrayList<Location>();
distributions.add(createDistribution("distribution1", Location.EUROPE, null));
distributions.add(createDistribution("distribution2", Location.ABT, null));
distributions.add(createDistribution("distribution3", Location.EUROPE, "Europe"));
distributions.add(createDistribution("distribution4", Location.ABT, "Alberta"));
locations.add(Location.SUD);
locations.add(Location.SUL);
locations.add(Location.SUD);
locations.add(Location.SUL);
}
use of org.powo.model.Distribution in project powop by RBGKew.
the class DistributionComparatorTest method createDistribution.
private Distribution createDistribution(String identifier, Location location, String locality) {
Distribution d = new Distribution();
d.setIdentifier(identifier);
d.setLocation(location);
d.setLocality(locality);
return d;
}
use of org.powo.model.Distribution in project powop by RBGKew.
the class TaxonSolrInputDocument method indexDistributions.
private void indexDistributions() {
sid.addField("taxon.distribution_not_empty_b", !taxon.getDistribution().isEmpty());
TreeSet<String> locationNames = new TreeSet<>();
TreeSet<String> locationCodes = new TreeSet<>();
for (Distribution d : taxon.getDistribution()) {
locationNames.add(d.getLocation().getName());
locationCodes.add(d.getLocation().getCode());
indexChildLocations(locationNames, locationCodes, d.getLocation().getChildren());
indexParentLocations(locationNames, locationCodes, d.getLocation().getParent());
addSource(d);
}
for (String name : locationNames) {
sid.addField("taxon.distribution_ss_lower", name);
}
}
Aggregations