当前位置: 首页>>代码示例>>Java>>正文


Java Dataset.getCitation方法代码示例

本文整理汇总了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;
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:19,代码来源:DwcaArchiveBuilder.java

示例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);
  }
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:24,代码来源:DwcaArchiveBuilder.java

示例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);
  }
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:25,代码来源:CitationsFileWriter.java

示例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;
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:19,代码来源:CitationsFileReader.java


注:本文中的org.gbif.api.model.registry.Dataset.getCitation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。