本文整理汇总了Java中org.gbif.api.model.registry.Dataset.getCitation方法的典型用法代码示例。如果您正苦于以下问题:Java Dataset.getCitation方法的具体用法?Java Dataset.getCitation怎么用?Java Dataset.getCitation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gbif.api.model.registry.Dataset
的用法示例。
在下文中一共展示了Dataset.getCitation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeCitation
import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
private static String writeCitation(Writer citationWriter, Dataset dataset, UUID constituentId)
throws IOException {
// citation
String citationLink = null;
if (dataset.getCitation() != null && !Strings.isNullOrEmpty(dataset.getCitation().getText())) {
citationWriter.write('\n' + dataset.getCitation().getText());
if (!Strings.isNullOrEmpty(dataset.getCitation().getIdentifier())) {
citationLink = ", " + dataset.getCitation().getIdentifier();
citationWriter.write(citationLink);
}
} else {
LOG.error(String.format("Constituent dataset misses mandatory citation for id: %s", constituentId));
}
if (dataset.getDoi() != null) {
citationWriter.write(" " + dataset.getDoi());
}
return citationLink;
}
示例2: persistDatasetUsage
import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
/**
* Persists the dataset usage information and swallows any exception to avoid an error during the file building.
*/
private void persistDatasetUsage(Integer count, String downloadKey, UUID datasetKey) {
try {
Dataset dataset = datasetService.get(datasetKey);
if (dataset != null) { //the dataset still exists
DatasetOccurrenceDownloadUsage datasetUsage = new DatasetOccurrenceDownloadUsage();
datasetUsage.setDatasetKey(datasetKey);
datasetUsage.setNumberRecords(count);
datasetUsage.setDownloadKey(downloadKey);
datasetUsage.setDatasetDOI(dataset.getDoi());
if (dataset.getCitation() != null && dataset.getCitation().getText() != null) {
datasetUsage.setDatasetCitation(dataset.getCitation().getText());
}
datasetUsage.setDatasetTitle(dataset.getTitle());
datasetUsageService.create(datasetUsage);
}
} catch (Exception e) {
LOG.error("Error persisting dataset usage information, downloadKey: {}, datasetKey: {}", downloadKey,
datasetKey, e);
}
}
示例3: persistDatasetUsage
import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
/**
* Persists the dataset usage information and swallows any exception to avoid an error during the file building.
*/
private static void persistDatasetUsage(Entry<UUID, Long> usage, String downloadKey,
DatasetOccurrenceDownloadUsageService datasetOccUsageService,
DatasetService datasetService) {
try {
Dataset dataset = datasetService.get(usage.getKey());
if (dataset != null) { //the dataset still exists
DatasetOccurrenceDownloadUsage datasetUsage = new DatasetOccurrenceDownloadUsage();
datasetUsage.setDatasetKey(dataset.getKey());
datasetUsage.setNumberRecords(usage.getValue());
datasetUsage.setDownloadKey(downloadKey);
datasetUsage.setDatasetDOI(dataset.getDoi());
if (dataset.getCitation() != null && dataset.getCitation().getText() != null) {
datasetUsage.setDatasetCitation(dataset.getCitation().getText());
}
datasetUsage.setDatasetTitle(dataset.getTitle());
datasetOccUsageService.create(datasetUsage);
}
} catch (Exception e) {
LOG.error("Error persisting dataset usage information", e);
}
}
示例4: apply
import org.gbif.api.model.registry.Dataset; //导入方法依赖的package包/类
@Override
public boolean apply(@Nullable DatasetOccurrenceDownloadUsage input) {
try {
Dataset dataset = datasetService.get(input.getDatasetKey());
if (dataset != null) { //the dataset still exists
input.setDatasetDOI(dataset.getDoi());
if (dataset.getCitation() != null && dataset.getCitation().getText() != null) {
input.setDatasetCitation(dataset.getCitation().getText());
}
input.setDatasetTitle(dataset.getTitle());
datasetUsageService.create(input);
}
} catch (Exception e) {
LOG.error("Error persisting dataset usage information {}", input, e);
return false;
}
return true;
}