pl.edu.icm.model.bwmeta.y.YElement.setCategoryRefs()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.setCategoryRefs()方法的一些代码示例,展示了YElement.setCategoryRefs()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.setCategoryRefs()方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:setCategoryRefs

YElement.setCategoryRefs介绍

暂无

代码示例

代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core

public JournalBuilder setDiscipline(String discipline) {
  if (StringUtils.isBlank(discipline))
    return this;
  Iterable<String> iterable = DESC_SPLITTER.split(discipline);
  List<String> splitedDesc = Lists.newArrayList(iterable);
  List<YCategoryRef> categoryRefs = Lists.newArrayList();
  if (splitedDesc.size() == 2) {
    String classificationId = splitedDesc.get(0);
    String code = splitedDesc.get(1);
    YCategoryRef categoryRef = categoryRef(classificationId, code);
    if(categoryRef != null){
      categoryRefs.add(categoryRef);
      journal.setCategoryRefs(categoryRefs);
    }
  }
  return this;
}

代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core

public ArticleBuilder setCategory(String category) {
  if (StringUtils.isBlank(category))
    return this;
  Iterable<String> iterable = DESC_SPLITTER.split(category);
  List<String> splitedDesc = Lists.newArrayList(iterable);
  List<YCategoryRef> categoryRefs = Lists.newArrayList();
  if (splitedDesc.size() == 2) {
    String classificationId = splitedDesc.get(0);
    String code = splitedDesc.get(1);
    YCategoryRef categoryRef = categoryRef(classificationId, code);
    if(categoryRef != null){
      categoryRefs.add(categoryRef);
      article.setCategoryRefs(categoryRefs);
    }
  }
  return this;
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

public static boolean sanitizeCategoryRefs(YElement article) {
  if (article == null || article.getCategoryRefs().isEmpty())
    return false;
  
  boolean warning = false;
  List<YCategoryRef> cleanRefs = new ArrayList<YCategoryRef>();
  for (YCategoryRef ref : article.getCategoryRefs()) {
    if (ref == null || ref.getCode() == null || ref.getCode().trim().isEmpty())
      continue;
    ref.setCode(ref.getCode().trim());
    List<YCategoryRef> refs = sanitizeCategoryRef(ref);
    warning = warning || isChanged(ref, refs);
    cleanRefs.addAll(refs);
  }
  article.setCategoryRefs(cleanRefs);
  
  if (!warning)
    return false;
  YAttribute attr = article.getOneAttribute(Warnings.WARNINGS);
  if (attr == null) {
    attr = new YAttribute(Warnings.WARNINGS, (String) null);
    article.addAttribute(attr);
  }
  if (attr.getOneAttribute(Warnings.WARNINGS_CHECK_CATEGORY_REFS) == null)
    attr.addAttribute(Warnings.WARNINGS_CHECK_CATEGORY_REFS, "");
  
  return true;
}

相关文章