本文整理汇总了Java中org.gbif.api.vocabulary.EndpointType类的典型用法代码示例。如果您正苦于以下问题:Java EndpointType类的具体用法?Java EndpointType怎么用?Java EndpointType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EndpointType类属于org.gbif.api.vocabulary包,在下文中一共展示了EndpointType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: CrawlJob
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
/**
* Creates a new crawl job.
*
* @param datasetKey of the dataset to crawl
* @param endpointType of the dataset
* @param targetUrl of the dataset
* @param attempt a monotonously increasing counter, increased every time we try to crawl a dataset whether that
* attempt is successful or not
* @param properties a way to provide protocol or crawl specific options
*/
@JsonCreator
public CrawlJob(
@JsonProperty("datasetKey") UUID datasetKey,
@JsonProperty("endpointType") EndpointType endpointType,
@JsonProperty("targetUrl") URI targetUrl,
@JsonProperty("attempt") int attempt,
@Nullable @JsonProperty("properties") Map<String, String> properties
) {
this.datasetKey = checkNotNull(datasetKey);
this.endpointType = checkNotNull(endpointType);
this.targetUrl = checkNotNull(targetUrl);
checkArgument(attempt > 0, "attempt has to be greater than 0");
this.attempt = attempt;
if (properties == null) {
this.properties = ImmutableMap.of();
} else {
this.properties = ImmutableMap.copyOf(properties);
}
}
开发者ID:gbif,项目名称:gbif-api,代码行数:31,代码来源:CrawlJob.java
示例2: testVerbatimConstructor
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testVerbatimConstructor() {
VerbatimOccurrence verb = new VerbatimOccurrence();
verb.setKey(123);
verb.setDatasetKey(UUID.randomUUID());
verb.setPublishingOrgKey(UUID.randomUUID());
verb.setPublishingCountry(Country.AFGHANISTAN);
verb.setLastCrawled(new Date());
verb.setProtocol(EndpointType.BIOCASE);
for (Term term : DwcTerm.values()) {
verb.setVerbatimField(term, "I am " + term);
}
Occurrence occ = new Occurrence(verb);
assertEquals(occ.getKey(), verb.getKey());
assertEquals(occ.getDatasetKey(), verb.getDatasetKey());
assertEquals(occ.getPublishingOrgKey(), verb.getPublishingOrgKey());
assertEquals(occ.getPublishingCountry(), verb.getPublishingCountry());
assertEquals(occ.getProtocol(), verb.getProtocol());
assertEquals(occ.getLastCrawled(), verb.getLastCrawled());
assertEquals(occ.getVerbatimFields().size(), verb.getVerbatimFields().size());
assertEquals(occ.getVerbatimField(DwcTerm.acceptedNameUsage), verb.getVerbatimField(DwcTerm.acceptedNameUsage));
}
开发者ID:gbif,项目名称:gbif-api,代码行数:24,代码来源:OccurrenceTest.java
示例3: testEquals
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testEquals() {
Map<String, String> m1 = Maps.newHashMap();
m1.put("foo", "bar");
CrawlJob c1 = new CrawlJob(UUID.randomUUID(), EndpointType.BIOCASE, URI.create("http://www.foo.com"), 1, m1);
Map<String, String> m2 = Maps.newHashMap();
m2.put("foo", "bar");
CrawlJob c2 = new CrawlJob(UUID.fromString(c1.getDatasetKey().toString()),
EndpointType.BIOCASE,
URI.create("http://www.foo.com"),
1,
m2);
assertEquals(c1, c2);
assertEquals(c1.hashCode(), c2.hashCode());
}
开发者ID:gbif,项目名称:gbif-api,代码行数:18,代码来源:CrawlJobTest.java
示例4: buildOccurrence
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
private static Occurrence buildOccurrence(UUID datasetKey, UUID ook) {
Occurrence occ1 = new Occurrence();
occ1.setKey(1);
occ1.setDatasetKey(datasetKey);
occ1.setPublishingOrgKey(ook);
occ1.setBasisOfRecord(BasisOfRecord.FOSSIL_SPECIMEN);
occ1.setKingdomKey(1);
occ1.setPhylumKey(1);
occ1.setClassKey(1);
occ1.setOrderKey(1);
occ1.setFamilyKey(1);
occ1.setGenusKey(1);
occ1.setSpeciesKey(1);
occ1.setScientificName("Ursus horribilis");
occ1.addIssue(OccurrenceIssue.COUNTRY_COORDINATE_MISMATCH);
occ1.setDecimalLatitude(1.234);
occ1.setDecimalLongitude(4.567);
occ1.setCountry(Country.AFGHANISTAN);
occ1.setPublishingCountry(Country.CANADA);
occ1.setProtocol(EndpointType.BIOCASE);
return occ1;
}
开发者ID:gbif,项目名称:metrics,代码行数:24,代码来源:OccurrenceComparisonUtilTest.java
示例5: readFields
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
kingdomKey = readInt(in);
phylumKey = readInt(in);
classKey = readInt(in);
orderKey = readInt(in);
familyKey = readInt(in);
subgenusKey = readInt(in);
genusKey = readInt(in);
speciesKey = readInt(in);
taxonKey = readInt(in);
issues = readIssueSet(in);
pubOrgKey = readUuid(in);
datasetKey = readUuid(in);
country = readEnum(in, Country.class);
publishingCountry = readEnum(in, Country.class);
latitude = readDouble(in);
longitude = readDouble(in);
year = readInt(in);
basisOfRecord = readEnum(in, BasisOfRecord.class);
count = readInt(in);
protocol = readEnum(in, EndpointType.class);
typeStatus = readEnum(in, TypeStatus.class);
}
开发者ID:gbif,项目名称:metrics,代码行数:25,代码来源:OccurrenceWritable.java
示例6: testSerDe
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testSerDe() {
OccurrenceWritable o = buildOcc();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutput out = new DataOutputStream(baos);
try {
o.write(out);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
o = new OccurrenceWritable();
o.readFields(new DataInputStream(bais));
assertEquals(new Integer(1), o.getKingdomKey());
assertEquals(new Integer(2012), o.getYear());
assertEquals(Country.UNITED_KINGDOM, o.getPublishingCountry());
assertNull(o.getPhylumKey());
assertEquals(0.89d, o.getLatitude().doubleValue(), 0.0001);
assertNull(o.getLongitude());
assertEquals(BasisOfRecord.FOSSIL_SPECIMEN, o.getBasisOfRecord());
assertEquals(EndpointType.DWC_ARCHIVE, o.getProtocol());
} catch (IOException e) {
fail(e.getMessage());
}
}
开发者ID:gbif,项目名称:metrics,代码行数:24,代码来源:OccurrenceWritableTest.java
示例7: testSubtraction
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testSubtraction() throws InterruptedException, AsyncException, IOException {
final UUID ds1 = UUID.randomUUID();
final Occurrence o1 =
occurrenceOf(123456, 1, 2, 3, 4, 5, 6, 7, 7, ds1, BasisOfRecord.OBSERVATION, Country.UKRAINE, 2012, 10.0, 11.0,
EndpointType.DWC_ARCHIVE);
cubeIo.writeAsync(OccurrenceAddressUtil.cubeMutation(o1, new LongOp(1)));
cubeIo.writeAsync(OccurrenceAddressUtil.cubeMutation(o1, new LongOp(1)));
cubeIo.flush();
Assert.assertEquals(2L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.TAXON_KEY, 1)));
Assert.assertEquals(2L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.DATASET_KEY, ds1)));
cubeIo.writeAsync(OccurrenceAddressUtil.cubeMutation(o1, new LongOp(-1)));
cubeIo.flush();
Assert.assertEquals(1L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.TAXON_KEY, 1)));
Assert.assertEquals(1L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.DATASET_KEY, ds1)));
}
开发者ID:gbif,项目名称:metrics,代码行数:19,代码来源:OccurrenceCubeTest.java
示例8: occurrenceOf
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
private Occurrence occurrenceOf(
Integer key, Integer kingdom, Integer phylum, Integer classs, Integer order, Integer family, Integer genus,
Integer species, Integer nub,
UUID dataset, BasisOfRecord bor, Country country, Integer year, Double latitude, Double longitude,
EndpointType protocol) {
Occurrence occ = new Occurrence();
occ.setKey(key);
occ.setKingdomKey(kingdom);
occ.setPhylumKey(phylum);
occ.setClassKey(classs);
occ.setOrderKey(order);
occ.setFamilyKey(family);
occ.setGenusKey(genus);
occ.setSpeciesKey(species);
occ.setTaxonKey(nub);
occ.setDatasetKey(dataset);
occ.setBasisOfRecord(bor);
occ.setCountry(country);
occ.setYear(year);
occ.setDecimalLatitude(latitude);
occ.setDecimalLongitude(longitude);
occ.setProtocol(protocol);
return occ;
}
开发者ID:gbif,项目名称:metrics,代码行数:26,代码来源:OccurrenceCubeTest.java
示例9: testUpdateVerbatimRemovingFields
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testUpdateVerbatimRemovingFields() {
VerbatimOccurrence orig = occurrenceService.getVerbatim(KEY);
orig.setPublishingCountry(Country.VENEZUELA);
orig.setPublishingOrgKey(UUID.randomUUID());
orig.setLastCrawled(new Date());
orig.setProtocol(EndpointType.DIGIR_MANIS);
addTerms(orig, "I was ");
Map<Term, String> fields = orig.getVerbatimFields();
fields.remove(DwcTerm.acceptedNameUsage);
fields.remove(DcTerm.accessRights);
fields.remove(IucnTerm.threatStatus);
orig.setVerbatimFields(fields);
occurrenceService.update(orig);
VerbatimOccurrence got = occurrenceService.getVerbatim(KEY);
assertNotNull(got);
assertEquivalence(orig, got);
assertNull(got.getVerbatimField(DwcTerm.acceptedNameUsage));
assertNull(got.getVerbatimField(DcTerm.accessRights));
assertNull(got.getVerbatimField(IucnTerm.threatStatus));
}
开发者ID:gbif,项目名称:occurrence,代码行数:23,代码来源:OccurrencePersistenceServiceImplTest.java
示例10: testNewAbcd206Single
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testNewAbcd206Single() {
UUID datasetKey = UUID.randomUUID();
OccurrenceSchemaType schemaType = OccurrenceSchemaType.ABCD_2_0_6;
EndpointType protocol = EndpointType.BIOCASE;
Integer crawlId = 1;
fragmentProcessor.buildFragments(datasetKey, abcd206Single.getBytes(), schemaType, protocol, crawlId, null);
Fragment got = fragmentPersistenceService.get(1);
assertTrue(got.getKey() > 0);
Calendar resultCal = Calendar.getInstance();
resultCal.setTime(got.getHarvestedDate());
Calendar cal = Calendar.getInstance();
assertEquals(cal.get(Calendar.DAY_OF_YEAR), resultCal.get(Calendar.DAY_OF_YEAR));
assertEquals(Fragment.FragmentType.XML, got.getFragmentType());
assertEquals(schemaType, got.getXmlSchema());
assertEquals(datasetKey, got.getDatasetKey());
assertEquals(protocol, got.getProtocol());
assertEquals(crawlId, got.getCrawlId());
assertTrue(Arrays.equals(abcd206Single.getBytes(), got.getData()));
assertTrue(Arrays.equals(DigestUtils.md5(abcd206Single), got.getDataHash()));
assertNull(got.getUnitQualifier());
}
开发者ID:gbif,项目名称:occurrence,代码行数:24,代码来源:FragmentProcessorTest.java
示例11: setUp
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
long now = new Date().getTime();
zkServer = new TestingServer();
curator = CuratorFrameworkFactory.builder().connectString(zkServer.getConnectString()).namespace("crawler")
.retryPolicy(new RetryNTimes(1, 1000)).build();
curator.start();
zookeeperConnector = new ZookeeperConnector(curator);
fragmentService = new FragmentPersistenceServiceMock(new OccurrenceKeyPersistenceServiceMock());
String json = Resources.toString(Resources.getResource("fragment.json"), org.apache.commons.io.Charsets.UTF_8);
Fragment fragment = new Fragment(DATASET_KEY, json.getBytes(Charsets.UTF_8), json.getBytes(Charsets.UTF_8),
Fragment.FragmentType.JSON, EndpointType.DWC_ARCHIVE, new Date(), 1, null, null, new Date().getTime());
Set<UniqueIdentifier> uniqueIds = Sets.newHashSet();
uniqueIds.add(new HolyTriplet(DATASET_KEY, "ic", "cc", "cn", null));
fragmentService.insert(fragment, uniqueIds);
occurrenceService = new OccurrencePersistenceServiceMock(fragmentService);
verbatimProcessor = new VerbatimProcessor(fragmentService, occurrenceService, messagePublisher, zookeeperConnector);
FragmentPersistedListener fragmentPersistedListener = new FragmentPersistedListener(verbatimProcessor);
MessageListener messageListener = new MessageListener(CONNECTION_PARAMETERS);
messageListener.listen("frag_persisted_test_" + now, 1, fragmentPersistedListener);
}
开发者ID:gbif,项目名称:occurrence,代码行数:23,代码来源:VerbatimProcessorTest.java
示例12: setUp
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
ApiClientConfiguration cfg = new ApiClientConfiguration();;
cfg.url = URI.create("http://api.gbif-dev.org/v1/");
FragmentPersistenceService fragmentPersister =
new FragmentPersistenceServiceMock(new OccurrenceKeyPersistenceServiceMock());
Fragment fragment = new Fragment(DATASET_KEY, "fake".getBytes(Charsets.UTF_8), "fake".getBytes(Charsets.UTF_8),
Fragment.FragmentType.JSON, EndpointType.DWC_ARCHIVE, new Date(), 1, null, null, new Date().getTime());
Set<UniqueIdentifier> uniqueIds = Sets.newHashSet();
uniqueIds.add(new HolyTriplet(DATASET_KEY, "ic", "cc", "cn", null));
fragmentPersister.insert(fragment, uniqueIds);
interpreter = new OccurrenceInterpreter(new DatasetInfoInterpreter(cfg.newApiClient()),
new TaxonomyInterpreter(cfg.newApiClient()),
new LocationInterpreter(new CoordinateInterpreter(cfg.newApiClient())));
verb = buildVerbatim(fragment.getKey());
verbMod = buildVerbatim(fragment.getKey());
verbMod.setVerbatimField(DwcTerm.scientificName, "Panthera onca goldmani");
}
开发者ID:gbif,项目名称:occurrence,代码行数:22,代码来源:OccurrenceInterpreterTest.java
示例13: DatasetServiceFileImpl
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
/**
* TAB delimited file with columns:
* key (UUID)
* title (String)
* dwca url (URL)
*/
public DatasetServiceFileImpl(File dataFile) {
datasets = Maps.newTreeMap();
try (InputStream in = new FileInputStream(dataFile)) {
CSVReader reader = CSVReaderFactory.buildUtf8TabReader(in);
int endKey = 1;
while (reader.hasNext()) {
String[] row = reader.next();
if (row != null && row.length >= 3 && !row[0].startsWith("#")) {
Dataset d = new Dataset();
d.setType(DatasetType.CHECKLIST);
d.setKey(UUID.fromString(row[0].trim()));
d.setTitle(row[1].trim());
Endpoint end = new Endpoint();
end.setKey(endKey++);
end.setType(EndpointType.DWC_ARCHIVE);
end.setUrl(URI.create(row[2].trim()));
d.getEndpoints().add(end);
datasets.put(d.getKey(), d);
}
}
} catch (IOException e) {
Throwables.propagate(e);
}
LOG.info("Loaded {} datasets into registry from {}", datasets.size(), dataFile.getAbsolutePath());
}
开发者ID:gbif,项目名称:checklistbank,代码行数:35,代码来源:DatasetServiceFileImpl.java
示例14: testProtocolAndPublishingCountry
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testProtocolAndPublishingCountry() {
Occurrence occ = new Occurrence();
occ.setKey(1);
occ.setDatasetKey(UUID.randomUUID());
occ.setProtocol(EndpointType.BIOCASE);
occ.setPublishingCountry(Country.AFGHANISTAN);
assertEquals(EndpointType.BIOCASE, occ.getProtocol());
assertEquals(Country.AFGHANISTAN, occ.getPublishingCountry());
}
开发者ID:gbif,项目名称:gbif-api,代码行数:12,代码来源:OccurrenceTest.java
示例15: buildOcc
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
private OccurrenceWritable buildOcc() {
OccurrenceWritable ow = new OccurrenceWritable();
ow.setTaxonKey(1);
ow.setKingdomKey(1);
ow.setDatasetKey(testUuid);
ow.setPublishingCountry(Country.UNITED_KINGDOM);
ow.setBasisOfRecord(BasisOfRecord.FOSSIL_SPECIMEN);
ow.setProtocol(EndpointType.DWC_ARCHIVE);
ow.setLatitude(0.89);
ow.setLongitude(null);
ow.setYear(2012);
ow.setCount(1);
return ow;
}
开发者ID:gbif,项目名称:metrics,代码行数:15,代码来源:OccurrenceWritableTest.java
示例16: testRollups
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testRollups() throws InterruptedException, AsyncException, IOException {
final UUID ds1 = UUID.randomUUID();
final UUID ds2 = UUID.randomUUID();
final Occurrence o1 =
occurrenceOf(123456, 1, 2, 3, 4, 5, 6, 7, 7, ds1, BasisOfRecord.OBSERVATION, Country.UKRAINE, 2012, 10.0, 11.0,
EndpointType.BIOCASE);
final Occurrence o2 =
occurrenceOf(123457, 1, 2, 3, 4, 5, 6, 7, 7, ds1, BasisOfRecord.PRESERVED_SPECIMEN, Country.UKRAINE, 2012, 10.0,
11.0, EndpointType.DWC_ARCHIVE);
final Occurrence o3 =
occurrenceOf(123458, 1, 2, 3, 4, 5, 6, 8, 9, ds2, BasisOfRecord.PRESERVED_SPECIMEN, Country.UKRAINE, 2012, 10.0,
11.0, EndpointType.DIGIR);
cubeIo.writeAsync(OccurrenceAddressUtil.cubeMutation(o1, new LongOp(1)));
cubeIo.writeAsync(OccurrenceAddressUtil.cubeMutation(o2, new LongOp(1)));
cubeIo.writeAsync(OccurrenceAddressUtil.cubeMutation(o3, new LongOp(1)));
cubeIo.flush();
// Tests that NUB KEY are correctly normalized
Assert.assertEquals(3L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.TAXON_KEY, 1)));
Assert.assertEquals(2L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.TAXON_KEY, 7)));
Assert.assertEquals(1L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.TAXON_KEY, 8)));
Assert.assertEquals(1L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.TAXON_KEY, 9)));
// Assertion that normalization of taxa don't incorrectly screw counts (http://dev.gbif.org/issues/browse/MET-11)
Assert.assertEquals(1L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.DATASET_KEY, ds2)));
// Random checking
Assert.assertEquals(1L, getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.DATASET_KEY, ds2)));
Assert.assertEquals(
0L,
getCount(new ReadBuilder(OccurrenceCube.INSTANCE).at(OccurrenceCube.BASIS_OF_RECORD,
BasisOfRecord.FOSSIL_SPECIMEN)
.at(OccurrenceCube.PUBLISHING_COUNTRY, Country.AFGHANISTAN)));
}
开发者ID:gbif,项目名称:metrics,代码行数:37,代码来源:OccurrenceCubeTest.java
示例17: Fragment
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
public Fragment(
UUID datasetKey,
@Nullable byte[] data,
@Nullable byte[] dataHash,
@Nullable FragmentType fragmentType,
@Nullable EndpointType protocol,
@Nullable Date harvestedDate,
@Nullable Integer crawlId,
@Nullable OccurrenceSchemaType xmlSchema,
@Nullable String unitQualifier,
@Nullable Long created)
{
this.datasetKey = checkNotNull(datasetKey, "datasetKey can't be null");
if (data != null) {
this.data = Arrays.copyOf(data, data.length);
}
if (dataHash != null) {
this.dataHash = Arrays.copyOf(dataHash, dataHash.length);
}
this.fragmentType = fragmentType;
this.harvestedDate = harvestedDate;
this.crawlId = crawlId;
this.xmlSchema = xmlSchema;
this.protocol = protocol;
this.unitQualifier = unitQualifier;
this.created = created;
}
开发者ID:gbif,项目名称:occurrence,代码行数:28,代码来源:Fragment.java
示例18: buildVerbatimOccurrence
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
/**
* Utility to build an API Occurrence from an HBase row.
*
* @param readExtensions if true reads verbatim extension data into extensions map
* @return A complete verbatim occurrence, or null
*/
private static VerbatimOccurrence buildVerbatimOccurrence(@Nullable Result row, boolean readExtensions) {
if (row == null || row.isEmpty()) {
return null;
}
VerbatimOccurrence verb = new VerbatimOccurrence();
verb.setKey(Bytes.toInt(row.getRow()));
verb.setDatasetKey(ExtResultReader.getUuid(row, GbifTerm.datasetKey));
verb.setPublishingOrgKey(ExtResultReader.getUuid(row, GbifInternalTerm.publishingOrgKey));
verb.setPublishingCountry(Country.fromIsoCode(ExtResultReader.getString(row, GbifTerm.publishingCountry)));
verb.setLastCrawled(ExtResultReader.getDate(row, GbifTerm.lastCrawled));
verb.setLastParsed(ExtResultReader.getDate(row, GbifTerm.lastParsed));
verb.setProtocol(EndpointType.fromString(ExtResultReader.getString(row, GbifTerm.protocol)));
verb.setCrawlId(ExtResultReader.getInteger(row, GbifInternalTerm.crawlId));
for (Cell cell : row.rawCells()) {
// all verbatim Term fields in row are prefixed. Columns without that prefix return null!
// extensions are also kept with a v_ prefix, so explicitly ignore them.
Term term = Columns.termFromVerbatimColumn(CellUtil.cloneQualifier(cell));
if (term != null && !TermUtils.isExtensionTerm(term)) {
verb.setVerbatimField(term, Bytes.toString(CellUtil.cloneValue(cell)));
}
}
if (readExtensions) {
verb.setExtensions(readVerbatimExtensions(row));
}
return verb;
}
开发者ID:gbif,项目名称:occurrence,代码行数:36,代码来源:OccurrenceBuilder.java
示例19: testUpdateVerbatim
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testUpdateVerbatim() {
VerbatimOccurrence orig = occurrenceService.getVerbatim(KEY);
orig.setPublishingCountry(Country.VENEZUELA);
orig.setPublishingOrgKey(UUID.randomUUID());
orig.setProtocol(EndpointType.DIGIR_MANIS);
orig.setLastParsed(new Date());
addTerms(orig, "I was ");
occurrenceService.update(orig);
VerbatimOccurrence got = occurrenceService.getVerbatim(KEY);
assertNotNull(got);
assertNotNull(got.getLastParsed());
assertEquivalence(orig, got);
}
开发者ID:gbif,项目名称:occurrence,代码行数:16,代码来源:OccurrencePersistenceServiceImplTest.java
示例20: testUpdateVerbatimMultimedia
import org.gbif.api.vocabulary.EndpointType; //导入依赖的package包/类
@Test
public void testUpdateVerbatimMultimedia() {
VerbatimOccurrence orig = occurrenceService.getVerbatim(KEY);
orig.setPublishingCountry(Country.VENEZUELA);
orig.setPublishingOrgKey(UUID.randomUUID());
orig.setProtocol(EndpointType.DIGIR_MANIS);
orig.setLastParsed(new Date());
Map<Extension, List<Map<Term, String>>> extensions = Maps.newHashMap();
List<Map<Term, String>> mediaExtensions = Lists.newArrayList();
Map<Term, String> verbatimRecord = new HashMap<Term, String>();
verbatimRecord.put(DcTerm.created, IsoDateFormat.FULL.getDateFormat().format(new Date()));
verbatimRecord.put(DcTerm.creator, "fede");
verbatimRecord.put(DcTerm.description, "testDescription");
verbatimRecord.put(DcTerm.format, "jpeg");
verbatimRecord.put(DcTerm.license, "licenseTest");
verbatimRecord.put(DcTerm.publisher, "publisherTest");
verbatimRecord.put(DcTerm.title, "titleTest");
verbatimRecord.put(DcTerm.identifier, "http://www.gbif.org/logo.jpg");
mediaExtensions.add(verbatimRecord);
extensions.put(Extension.MULTIMEDIA, mediaExtensions);
orig.setExtensions(extensions);
occurrenceService.update(orig);
VerbatimOccurrence got = occurrenceService.getVerbatim(KEY);
assertNotNull(got);
assertEquals(got.getExtensions(), orig.getExtensions());
}
开发者ID:gbif,项目名称:occurrence,代码行数:28,代码来源:OccurrencePersistenceServiceImplTest.java
注:本文中的org.gbif.api.vocabulary.EndpointType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论