本文整理汇总了Java中org.gbif.api.model.checklistbank.Description类的典型用法代码示例。如果您正苦于以下问题:Java Description类的具体用法?Java Description怎么用?Java Description使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Description类属于org.gbif.api.model.checklistbank包,在下文中一共展示了Description类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDescripitons
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
@Override
public List<Description> getDescripitons(int usageKey) {
PagingResponse<Description> response = getDescripitons(usageKey, null);
if (response == null)
return null;
List<Description> result = Lists.newArrayList(response.getResults());
boolean isInitial = true;
int limit = -1;
while(!Pager.isEndOfRecords(response)) {
if(isInitial) {
limit = Pager.getMaxLimit(response);
}
response.setOffset(response.getOffset() + response.getLimit());
if(isInitial) {
response.setLimit(limit);
isInitial = false;
}
response = getDescripitons(usageKey, response);
result.addAll(response.getResults());
}
return result;
}
示例2: testEmptyModels
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
@Test
public void testEmptyModels() throws Exception {
assertSerde(new NameUsage());
assertSerde(new VerbatimNameUsage());
assertSerde(new NameUsageMetrics());
assertSerde(new UsageExtensions());
assertSerde(new ParsedName());
assertSerde(new Description());
assertSerde(new Distribution());
assertSerde(new Identifier());
assertSerde(new NameUsageMediaObject());
assertSerde(new Reference());
assertSerde(new SpeciesProfile());
assertSerde(new NameUsage());
assertSerde(new TypeSpecimen());
assertSerde(new VernacularName());
assertSerde(new DatasetMetrics());
}
示例3: testMapper
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
@Test
public void testMapper() throws Exception {
assertTrue(mapper.listByChecklistUsage(usageKey, new PagingRequest()).isEmpty());
assertTrue(mapper.listByNubUsage(usageKey, new PagingRequest()).isEmpty());
Description obj = new Description();
obj.setContributor("contribtr");
obj.setCreator("creatr");
obj.setDescription("description");
obj.setLanguage(Language.ABKHAZIAN);
obj.setLicense("license");
obj.setType("myType");
// these should get ignored
obj.setSource("sourcy s");
obj.setSourceTaxonKey(123);
mapper.insert(usageKey, obj, citationKey1);
Description 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);
}
示例4: getDescriptions
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
public List<Description> getDescriptions()
{
NameUsage<? extends NubNameUsage> n = getNameUsage();
if(n != this && n instanceof NubNameUsage) {
return ((NubNameUsage)n).getDescriptions();
}
if(nameUsageSearchResult != null) {
return nameUsageSearchResult.getDescriptions();
}
return null;
}
示例5: get
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
/**
* This retrieves a Description by its key from ChecklistBank.
*
* @return requested Description or null if none could be found
*/
@GET
@Path("{id}")
@NullToNotFound
public Description get(@PathParam("id") Integer key) {
return descriptionService.get(key);
}
示例6: testGet
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
@Test
public void testGet() {
final Integer KEY = 14;
Description d = wsClient.get(KEY);
assertEquals("introduction", d.getType());
assertEquals(Language.ENGLISH, d.getLanguage());
assertNull(wsClient.get(-2));
}
示例7: getMockObject
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
@Override
Description getMockObject() {
Description description = new Description();
description.setType("lifespan");
description.setDescription("12 days");
return description;
}
示例8: testDescriptionRange
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
@Test
public void testDescriptionRange() throws Exception {
int start = 100000000;
int end = 100000025;
Map<Integer, List<Description>> range = descriptionService.listRange(start, end);
assertEquals(3, range.size());
assertEquals(6, range.get(100000025).size());
}
示例9: assertObject
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
private void assertObject(Description obj, Description obj2, String source, Integer sourceTaxonKey) {
assertEquals(obj.getContributor(), obj2.getContributor());
assertEquals(obj.getCreator(), obj2.getCreator());
assertEquals(obj.getDescription(), obj2.getDescription());
assertEquals(obj.getLanguage(), obj2.getLanguage());
assertEquals(obj.getLicense(), obj2.getLicense());
assertEquals(obj.getType(), obj2.getType());
assertEquals(source, obj2.getSource());
assertEquals(sourceTaxonKey, obj2.getSourceTaxonKey());
}
示例10: testGet
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
@Test
public void testGet() {
Description description = service.get(26);
assertEquals((Integer) 100000040, description.getSourceTaxonKey());
assertEquals(
"The Caucasian squirrel (or Persian squirrel) is a tree squirrel in the genus Sciurus endemic to Armenia, Azerbaijan, Georgia, Greece, Iran, Iraq, Israel, Jordan, Lebanon, Syria, and Turkey. Its natural habitat is temperate broadleaf and mixed forests.[1]",
description.getDescription());
assertEquals(Language.ENGLISH, description.getLanguage());
assertEquals("general", description.getType());
assertNull(description.getSource());
assertNull(description.getContributor());
assertNull(description.getCreator());
}
示例11: DescriptionWsClient
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
@Inject
public DescriptionWsClient(@ChecklistBankWs WebResource resource) {
super(Description.class, new GenericType<PagingResponse<Description>>() {
}, resource, Constants.DESCRIPTIONS_PATH);
}
示例12: DescriptionWsClientTest
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
public DescriptionWsClientTest() {
super(Description.class);
}
示例13: getClient
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
@Override
NameUsageComponentBaseWsClient<Description> getClient(WebResource resource) {
return new DescriptionWsClient(resource);
}
示例14: serializeDescription
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
public static String serializeDescription(Description description) {
return stripHtml(description.getDescription());
}
示例15: call
import org.gbif.api.model.checklistbank.Description; //导入依赖的package包/类
/**
* Iterates over the assigned {@link org.gbif.api.model.checklistbank.NameUsage} objects to insert the corresponding {@link org.apache.solr.common.SolrInputDocument}
* objects.
*
* @return the total number of documents added by this Thread.
*/
@Override
public Integer call() throws Exception {
// Timing information initialization
stopWatch.start();
log.info("Adding usages from id {} to {}", startKey, endKey);
int docCount = 0;
// Get all usages
List<NameUsage> usages = nameUsageService.listRange(startKey, endKey);
// get all component maps into memory first
Map<Integer, List<VernacularName>> vernacularNameMap = vernacularNameService.listRange(startKey, endKey);
Map<Integer, List<Description>> descriptionMap = descriptionService.listRange(startKey, endKey);
Map<Integer, List<Distribution>> distributionMap = distributionService.listRange(startKey, endKey);
Map<Integer, List<SpeciesProfile>> speciesProfileMap = speciesProfileService.listRange(startKey, endKey);
File file = new File(startKey+ "-" + endKey + ".avro");
file.createNewFile();
log.info("Creating file " + file.getAbsolutePath());
ClassLoader classLoader = AvroExporter.class.getClassLoader();
Schema schema = new Schema.Parser().parse(classLoader.getResource("solr.avrsc").openStream());
DatumWriter<NameUsageAvro> datumWriter = new SpecificDatumWriter<>(NameUsageAvro.class);
try(DataFileWriter<NameUsageAvro> dataFileWriter = new DataFileWriter<NameUsageAvro>(datumWriter)) {
dataFileWriter.create(schema, file);
// now we're ready to build the solr indices quicky!
for (NameUsage usage : usages) {
if (usage == null) {
log.warn("Unexpected numm usage found in range {}-{}, docCount={}", startKey, endKey, docCount);
continue;
}
try {
UsageExtensions ext = new UsageExtensions();
ext.speciesProfiles = speciesProfileMap.get(usage.getKey());
ext.vernacularNames = vernacularNameMap.get(usage.getKey());
ext.descriptions = descriptionMap.get(usage.getKey());
ext.distributions = distributionMap.get(usage.getKey());
List<Integer> parents = nameUsageService.listParents(usage.getKey());
dataFileWriter.append(nameUsageAvroConverter.toObject(usage, parents, ext));
} catch (Exception e) {
log.error("Error exporting usage {} extension {} to avro", usage, e);
}
docCount++;
NameUsageBatchProcessor.counter.incrementAndGet();
}
}
moveToHdfs(file,nameNode);
log.info(file.getName() + " moved to hdfs");
// job finished notice
stopWatch.stop();
log.info("Finished indexing of usages in range {}-{}. Total time: {}",
new Object[] {startKey, endKey, stopWatch.toString()});
return docCount;
}