本文整理汇总了Java中org.gbif.api.model.checklistbank.ParsedName.setType方法的典型用法代码示例。如果您正苦于以下问题:Java ParsedName.setType方法的具体用法?Java ParsedName.setType怎么用?Java ParsedName.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gbif.api.model.checklistbank.ParsedName
的用法示例。
在下文中一共展示了ParsedName.setType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
private ParsedName parse(String x) {
try {
return parser.parse(x, null);
} catch (UnparsableException e) {
ParsedName pn = new ParsedName();
pn.setScientificName(x);
pn.setType(e.type);
return pn;
}
}
示例2: createName
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
private int createName(String name, Rank rank) {
ParsedName pn = new ParsedName();
pn.setType(NameType.SCIENTIFIC);
pn.setScientificName(name);
pn.setRank(rank);
parsedNameMapper.create(pn);
return pn.getKey();
}
示例3: testGetMax
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testGetMax() {
assertNull(mapper.maxKey());
ParsedName pn = new ParsedName();
pn.setType(NameType.CULTIVAR);
for (int x = 0; x < 10; x++) {
pn.setKey(null);
pn.setScientificName(StringUtils.randomSpecies());
mapper.create(pn);
}
assertEquals((Integer) 10, mapper.maxKey());
}
示例4: roundtrip
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void roundtrip() throws Exception {
ParsedName pn = new ParsedName();
pn.setType(NameType.SCIENTIFIC);
pn.setParsedPartially(true);
pn.setGenusOrAbove("Abies");
pn.setSpecificEpithet("alba");
pn.setInfraSpecificEpithet("alpina");
pn.setRank(Rank.INFRASUBSPECIFIC_NAME);
pn.setBracketYear("123");
pn.setYear("1987");
pn.setAuthorship("Markus");
pn.setBracketAuthorship("Peter");
pn.setNotho(NamePart.SPECIFIC);
pn.setRemarks("no remarks");
pn.setNomStatus("nom.illeg.");
pn.setInfraGeneric("Pineta");
pn.setCultivarEpithet("Green Hell");
pn.setSensu("Berendsohn 1999");
pn.setStrain("train");
pn.setScientificName(pn.fullName());
mapper.create(pn);
ParsedName pn2 = mapper.getByName(pn.getScientificName(), pn.getRank());
assertEquals(pn, pn2);
}
示例5: scientificName
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void scientificName() throws Exception {
final String UNPARSED_NAME = "A real unparsed name X73a";
ParsedName n = new ParsedName();
n.setType(NameType.SCIENTIFIC);
n.setScientificName(UNPARSED_NAME);
n.setGenusOrAbove("Abies");
n.setAuthorship("L.");
n.setYear("1888");
n.setBracketAuthorship("Carl.");
n.setRank(Rank.GENUS);
assertAllButVirus("Abies (Carl.) L., 1888", n);
n.setRank(Rank.SPECIES);
assertAllButVirus("Abies spec.", n);
n.setSpecificEpithet("alba");
assertAllButVirus("Abies alba (Carl.) L., 1888", n);
n.setRank(Rank.SUBSPECIES);
assertAllButVirus("Abies alba subsp.", n);
n.setInfraSpecificEpithet("alpina");
final String expectedWithRank = "Abies alba subsp. alpina (Carl.) L., 1888";
assertAllAndZoo("Abies alba alpina (Carl.) L., 1888", expectedWithRank, n);
assertEquals("Abies alba alpina (Carl.) L., 1888", NameFormatter.scientificName(n, Kingdom.ANIMALIA));
assertEquals(expectedWithRank, NameFormatter.scientificName(n, Kingdom.PLANTAE));
n.setType(NameType.HYBRID);
assertEquals(expectedWithRank, NameFormatter.scientificName(n, NomenclaturalCode.BOTANICAL));
n.setType(NameType.VIRUS);
assertEquals(expectedWithRank, NameFormatter.scientificName(n, NomenclaturalCode.BOTANICAL));
n.setParsed(false);
assertEquals(UNPARSED_NAME, NameFormatter.scientificName(n, NomenclaturalCode.BOTANICAL));
n.setParsed(true);
n.setRank(Rank.INFRASPECIFIC_NAME);
assertAllButVirus("Abies alba alpina (Carl.) L., 1888", n);
assertEquals(UNPARSED_NAME, NameFormatter.scientificName(n, Kingdom.VIRUSES));
}
示例6: testCreateOrGet
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
@Test
public void testCreateOrGet() throws Exception {
ParsedName pn = new ParsedName();
pn.setScientificName("Abies alba Mill.");
pn.setGenusOrAbove("Abies");
pn.setAuthorship("Mill.");
pn.setSpecificEpithet("alba");
pn.setType(NameType.SCIENTIFIC);
assertNull(pn.getKey());
ParsedName pn2 = service.createOrGet(pn, true);
assertNotNull(pn2.getKey());
assertEquals("Abies alba Mill.", pn2.getScientificName());
assertEquals("Abies alba", pn2.canonicalName());
assertEquals("Abies", pn2.getGenusOrAbove());
assertEquals("alba", pn2.getSpecificEpithet());
assertEquals("Mill.", pn2.getAuthorship());
pn = service.createOrGet(parse("Abies alba Mill."), true);
assertEquals("Abies alba Mill.", pn.getScientificName());
assertEquals("Abies alba", pn.canonicalName());
assertEquals("Abies", pn.getGenusOrAbove());
assertEquals("alba", pn.getSpecificEpithet());
assertEquals("Mill.", pn.getAuthorship());
pn = service.createOrGet(parse("Abies sp."), true);
assertEquals("Abies sp.", pn.getScientificName());
assertEquals("Abies spec.", pn.canonicalName());
assertEquals("Abies", pn.getGenusOrAbove());
assertEquals(Rank.SPECIES, pn.getRank());
assertNull(pn.getSpecificEpithet());
pn = service.createOrGet(parse("×Abies Mill."), true);
assertEquals("×Abies Mill.", pn.getScientificName());
assertEquals("Abies", pn.canonicalName());
assertEquals("Abies", pn.getGenusOrAbove());
assertNull(pn.getRank());
assertNull(pn.getSpecificEpithet());
assertEquals(NamePart.GENERIC, pn.getNotho());
pn = service.createOrGet(parse("? hostilis Gravenhorst, 1829"), true);
assertEquals("? hostilis Gravenhorst, 1829", pn.getScientificName());
assertEquals("? hostilis", pn.canonicalName());
assertEquals("?", pn.getGenusOrAbove());
assertEquals(Rank.SPECIES, pn.getRank());
assertEquals("hostilis", pn.getSpecificEpithet());
}
示例7: testRegularImport
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
/**
* pro parte usages are synced differently and not tested here
*/
@Test
public void testRegularImport() throws ExecutionException, InterruptedException {
ParsedName pn = new ParsedName();
pn.setGenusOrAbove("Abies");
pn.setSpecificEpithet("alba");
pn.setAuthorship("Mill.");
pn.setScientificName(pn.fullName());
pn.setType(NameType.SCIENTIFIC);
NameUsage u = new NameUsage();
u.setKey(USAGE_ID);
u.setScientificName(pn.getScientificName());
u.setCanonicalName(pn.canonicalName());
u.setNameType(pn.getType());
u.setAuthorship(pn.getAuthorship());
u.setRank(Rank.SPECIES);
u.setDatasetKey(Constants.NUB_DATASET_KEY);
u.setOrigin(Origin.SOURCE);
u.getIssues().add(NameUsageIssue.CONFLICTING_BASIONYM_COMBINATION);
u.getIssues().add(NameUsageIssue.ACCEPTED_NAME_MISSING);
UsageExtensions ext = new UsageExtensions();
VerbatimNameUsage v = new VerbatimNameUsage();
NameUsageMetrics m = new NameUsageMetrics();
DummyData data = new DummyData(u, pn, ext, v, m);
Future<?> f = service.sync(u.getDatasetKey(), data, Lists.newArrayList(1));
f.get();
NameUsageService usageService = getInstance(NameUsageService.class);
NameUsage u2 = usageService.get(USAGE_ID, null);
u2.setLastInterpreted(null);
// name key is newly assigned
u.setNameKey(u2.getNameKey());
u.setNameKey(u2.getNameKey());
assertNotNull(u.getNameKey());
assertFalse(u2.getIssues().isEmpty());
assertEquals(u, u2);
}
示例8: initData
import org.gbif.api.model.checklistbank.ParsedName; //导入方法依赖的package包/类
private void initData() throws Exception {
parsedNameMapper = getInstance(ParsedNameMapper.class);
nameUsageMapper = getInstance(NameUsageMapper.class);
nubRelMapper = getInstance(NubRelMapper.class);
datasetMapper = getInstance(DatasetMapper.class);
citationMapper = getInstance(CitationMapper.class);
ParsedName pn = new ParsedName();
pn.setType(NameType.SCIENTIFIC);
pn.setScientificName(StringUtils.randomSpecies());
parsedNameMapper.create(pn);
final int nameKey = pn.getKey();
datasetKey = UUID.randomUUID();
DatasetCore d = new DatasetCore();
d.setKey(datasetKey);
d.setTitle(datasetTitle);
datasetMapper.insert(d);
NameUsageWritable uw = new NameUsageWritable();
uw.setNameKey(nameKey);
uw.setDatasetKey(datasetKey);
uw.setOrigin(Origin.SOURCE);
uw.setRank(Rank.SPECIES);
uw.setTaxonomicStatus(TaxonomicStatus.ACCEPTED);
nameUsageMapper.insert(uw);
usageKey = uw.getKey();
NameUsageWritable nub = new NameUsageWritable();
nub.setNameKey(nameKey);
nub.setDatasetKey(Constants.NUB_DATASET_KEY);
nub.setOrigin(Origin.SOURCE);
nub.setRank(Rank.SPECIES);
nub.setTaxonomicStatus(TaxonomicStatus.ACCEPTED);
nameUsageMapper.insert(nub);
nubKey = nub.getKey();
nubRelMapper.insert(datasetKey, usageKey, nubKey);
Citation c = new Citation(citation1);
citationMapper.insert(c);
citationKey1 = c.getKey();
c = new Citation(citation2);
c.setDoi(citation2doi);
c.setLink(citation2link);
citationMapper.insert(c);
citationKey2 = c.getKey();
}