本文整理汇总了Java中org.gbif.api.model.checklistbank.Distribution.setLocationId方法的典型用法代码示例。如果您正苦于以下问题:Java Distribution.setLocationId方法的具体用法?Java Distribution.setLocationId怎么用?Java Distribution.setLocationId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gbif.api.model.checklistbank.Distribution
的用法示例。
在下文中一共展示了Distribution.setLocationId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: interpretDistribution
import org.gbif.api.model.checklistbank.Distribution; //导入方法依赖的package包/类
private void interpretDistribution(NameUsage u, UsageExtensions e, VerbatimNameUsage v) {
if (v.hasExtension(Extension.DISTRIBUTION)) {
for (Map<Term, String> rec : v.getExtensions().get(Extension.DISTRIBUTION)) {
Distribution d = new Distribution();
// interpret rec
d.setLocality(value(rec, DwcTerm.locality));
d.setLocationId(value(rec, DwcTerm.locationID));
d.setCountry(enumify(rec, NameUsageIssue.DISTRIBUTION_INVALID, countryParser, u, DwcTerm.country, DwcTerm.countryCode));
// some location is required, otherwise its pointless
if (d.getLocality() == null && d.getLocationId() == null && d.getCountry() == null) {
u.addIssue(NameUsageIssue.DISTRIBUTION_INVALID);
continue;
}
d.setStatus(enumify(rec, NameUsageIssue.DISTRIBUTION_INVALID, occurrenceStatusParser, u, DwcTerm.occurrenceStatus));
d.setEstablishmentMeans(enumify(rec, NameUsageIssue.DISTRIBUTION_INVALID, establishmentMeansParser, u, DwcTerm.establishmentMeans));
d.setAppendixCites(enumify(rec, NameUsageIssue.DISTRIBUTION_INVALID, citesAppendixParser, u, GbifTerm.appendixCITES));
d.setThreatStatus(enumify(rec, NameUsageIssue.DISTRIBUTION_INVALID, threatStatusParser, u, IucnTerm.threatStatus));
d.setLifeStage(enumify(rec, NameUsageIssue.DISTRIBUTION_INVALID, lifeStageParser, u, DwcTerm.lifeStage));
d.setTemporal(value(rec, DwcTerm.eventDate, DcTerm.temporal));
d.setEndDayOfYear(integer(rec, NameUsageIssue.DISTRIBUTION_INVALID, u, DwcTerm.endDayOfYear));
d.setStartDayOfYear(integer(rec, NameUsageIssue.DISTRIBUTION_INVALID, u, DwcTerm.startDayOfYear));
d.setRemarks(value(rec, DwcTerm.occurrenceRemarks, DwcTerm.taxonRemarks));
d.setSource(value(rec, DcTerm.source));
e.distributions.add(d);
}
}
}
示例2: testMapper
import org.gbif.api.model.checklistbank.Distribution; //导入方法依赖的package包/类
@Test
public void testMapper() throws Exception {
assertTrue(mapper.listByChecklistUsage(usageKey, new PagingRequest()).isEmpty());
assertTrue(mapper.listByNubUsage(usageKey, new PagingRequest()).isEmpty());
Distribution obj = new Distribution();
obj.setAppendixCites(CitesAppendix.II);
obj.setCountry(Country.ALGERIA);
obj.setEndDayOfYear(1990);
obj.setEstablishmentMeans(EstablishmentMeans.NATIVE);
obj.setLifeStage(LifeStage.EMRYO);
obj.setLocality("location location location");
obj.setLocationId("locID");
obj.setRemarks("remarks");
obj.setStartDayOfYear(1989);
obj.setStatus(OccurrenceStatus.COMMON);
obj.setTemporal("aha");
obj.setThreatStatus(ThreatStatus.CRITICALLY_ENDANGERED);
// these should get ignored
obj.setSource("sourcy s");
obj.setSourceTaxonKey(123);
mapper.insert(usageKey, obj, citationKey1);
Distribution obj2 = mapper.listByChecklistUsage(usageKey, new PagingRequest()).get(0);
assertObject(obj, obj2, citation1, null);
obj2 = mapper.listByNubUsage(nubKey, new PagingRequest()).get(0);
// these are now nub source usage values
assertObject(obj, obj2, datasetTitle, usageKey);
}