本文整理汇总了Java中org.gbif.api.model.registry.Dataset.setType方法的典型用法代码示例。如果您正苦于以下问题:Java Dataset.setType方法的具体用法?Java Dataset.setType怎么用?Java Dataset.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gbif.api.model.registry.Dataset
的用法示例。
在下文中一共展示了Dataset.setType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DatasetServiceFileImpl
import org.gbif.api.model.registry.Dataset; //导入方法依赖的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());
}
示例2: init
import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
@Before
public void init() {
ds = Mockito.mock(DatasetService.class);
Dataset squirrel = new Dataset();
squirrel.setKey(CHECKLIST_KEY);
squirrel.setTitle("Squirrels");
squirrel.setType(DatasetType.CHECKLIST);
when(ds.get(eq(CHECKLIST_KEY))).thenReturn(squirrel);
os = Mockito.mock(OrganizationService.class);
Organization org1 = new Organization();
org1.setKey(ORG_KEY);
org1.setTitle("Org1");
when(os.get(eq(ORG_KEY))).thenReturn(org1);
oldDKey = UUID.randomUUID();
final Date now = new Date();
PagingResponse<Dataset> resp3 = new PagingResponse<Dataset>();
PagingResponse<Dataset> respEmpty = new PagingResponse<Dataset>();
respEmpty.setCount(0l);
respEmpty.setEndOfRecords(true);
Dataset orgD = new Dataset();
orgD.setKey(oldDKey);
orgD.setTitle("orgD");
orgD.setCreated(now);
orgD.setType(DatasetType.CHECKLIST);
Dataset orgD2 = new Dataset();
orgD2.setKey(UUID.randomUUID());
orgD2.setTitle("orgD2");
orgD2.setCreated(new Date(now.getTime() - 100000));
orgD2.setType(DatasetType.CHECKLIST);
resp3.setCount(2l);
resp3.getResults().add(orgD);
resp3.getResults().add(orgD2);
when(os.publishedDatasets(Matchers.<UUID>any(), any(PagingRequest.class))).thenReturn(respEmpty);
when(os.publishedDatasets(AdditionalMatchers.not(eq(org1.getKey())), any(PagingRequest.class))).thenReturn(resp3);
is = Mockito.mock(InstallationService.class);
Installation ins1 = new Installation();
org1.setKey(INS_KEY);
org1.setTitle("Ins1");
when(is.get(eq(INS_KEY))).thenReturn(ins1);
when(is.getHostedDatasets(Matchers.<UUID>any(), any(PagingRequest.class))).thenReturn(respEmpty);
when(is.getHostedDatasets(AdditionalMatchers.not(eq(ins1.getKey())), any(PagingRequest.class))).thenReturn(resp3);
// use default prod API
Properties props = dbSetup.getProperties();
cfg.clb.databaseName = props.getProperty("checklistbank.db.dataSource.databaseName");
cfg.clb.serverName = props.getProperty("checklistbank.db.dataSource.serverName");
cfg.clb.user = props.getProperty("checklistbank.db.dataSource.user");
cfg.clb.password = props.getProperty("checklistbank.db.dataSource.password");
cfg.sourceList = URI.create("nub-test-sources.txt");
src = new ClbSourceList(ds, os, is, cfg);
}