use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSS method extractDatasets.
private static List<Dataset> extractDatasets(Dataset datasetOrig, SyndFeed feed) {
List<Dataset> datasets = new ArrayList<>();
final List entries = feed.getEntries();
for (Object entry : entries) {
if (entry instanceof SyndEntry) {
String title = StringUtils.trim(((SyndEntry) entry).getTitle());
if (shouldIncludeTitleInDatasetCollection(title, datasetOrig)) {
Dataset e = datasetFor(datasetOrig, (SyndEntry) entry);
LOG.info("including [" + title + "].");
if (e != null) {
datasets.add(e);
}
} else {
LOG.info("skipping [" + title + "] : was not included or excluded.");
}
}
}
return datasets;
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSS method datasetForIPT.
private static Dataset datasetForIPT(Dataset datasetOrig, SyndEntry entry) {
Dataset dataset = null;
Map<String, String> foreignEntries = parseForeignEntriesAndCategories(entry);
if (foreignEntries.containsKey("dwca")) {
dataset = datasetFor(datasetOrig, entry, foreignEntries);
}
return dataset;
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRegistry method importData.
private void importData(String namespace) throws StudyImporterException {
try {
LOG.info("[" + namespace + "] checking status...");
Dataset dataset = new DatasetFactory(getRegistry()).datasetFor(namespace);
if (datasetFilter.test(dataset)) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
LOG.info("[" + namespace + "] is active, importing...");
getNodeFactory().getOrCreateDataset(dataset);
importData(dataset);
stopWatch.stop();
LOG.info("[" + namespace + "] imported in " + stopWatch.getTime(TimeUnit.SECONDS) + "s");
} else {
LOG.info("[" + namespace + "] is deprecated, not importing.");
}
} catch (StudyImporterException | DatasetRegistryException ex) {
String msg = "failed to import data from repo [" + namespace + "]";
LOG.error(msg, ex);
throw new StudyImporterException(msg, ex);
}
}
Aggregations