gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-15 16:06:40 28 4
gpt4 key购买 nike

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

YContentDirectory.getEntries介绍

暂无

代码示例

代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct

@Override
  public Iterable<YContentFile> apply(YContentEntry input) {
    if (input instanceof YContentFile) {
      return Arrays.asList((YContentFile) input);
    }
    YContentDirectory directory = (YContentDirectory) input;
    return createIterable(directory.getEntries());
  }
};

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

private List<ContentInfo> getContentInfo(YContentDirectory directory){
  return getContentInfo(directory.getEntries());
}

代码示例来源:origin: pl.edu.icm.synat/synat-process-common

@SuppressWarnings("rawtypes")
  private static void processYContents(List<YContentEntry> entries, Predicate<YContentEntry<?>> shouldDeletePredicate) {
    Iterator<YContentEntry> entryIt = entries.iterator();
    while (entryIt.hasNext()) {
      YContentEntry entry = entryIt.next();
      if (entry instanceof YContentDirectory) {
        YContentDirectory directory = (YContentDirectory) entry;
        processYContents(directory.getEntries(), shouldDeletePredicate);
      }
      if (shouldDeletePredicate.test(entry)) {
        entryIt.remove();
      }
    }
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

private boolean hasChapteredContent(List<YContentEntry> contentList) {
  for (YContentEntry<?> content : contentList) {    
    if (content instanceof YContentDirectory) {
      YContentDirectory dir = (YContentDirectory) content;
      if ((ContentTypes.CONTENT_PAGED.equals(dir.getType()) && findIfContentExists(dir.getEntries(), null)) || hasChapteredContent(dir.getEntries())) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

private List<YContentDirectory> findChapters(List<YContentEntry> contentList, Locale locale) {
  List<YContentDirectory> result = new ArrayList<YContentDirectory>();
  
  for (YContentEntry<?> content : contentList) {
    if (content instanceof YContentDirectory) {
      YContentDirectory dir = (YContentDirectory) content;
      if (ContentTypes.CONTENT_PAGED.equals(dir.getType())) {
        result.add(dir);
      } else {
        result.addAll(findChapters(dir.getEntries(), locale));
      }
    }
  }
  
  return result;
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

private List<Page> resolveChapter(YContentDirectory dir) {
  List<Page> result = new LinkedList<Page>();
  for (YContentEntry e : dir.getEntries()) {
    if (e.isFile()) {
      result.add(resolveFile((YContentFile) e));
    } else {
      result.add(resolveMultiFile((YContentDirectory) e));
    }
  }
  return result;
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

private List<ContentChapterData> transformChaptersContent(List<YContentDirectory> chapters, Locale locale, String mainLevel) {
  List<ContentChapterData> chaptersData = new ArrayList<ContentChapterData>();
  for (YContentDirectory chapter : chapters) {
    final List<ContentFileData> pages = findChapterPages(chapter.getEntries(), locale, mainLevel);
    if(!pages.isEmpty()){
      chaptersData.add(new ContentChapterData(chapter.getId(), getDirectoryName(chapter), pages));
    }
  }
  return chaptersData;
}

代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct

@SuppressWarnings("rawtypes")
private YContentFile findYContentFileById(Iterable<YContentEntry> contents, String id) {
  for (YContentEntry<?> contentEntry : contents) {
    if (contentEntry instanceof YContentFile) {
      YContentFile contentFile = (YContentFile) contentEntry;
      if (contentFile.getId().equals(id)) {
        return contentFile;
      }
    } else {
      YContentDirectory directory = (YContentDirectory) contentEntry;
      return findYContentFileById(directory.getEntries(), id);
    }
  }
  return null;
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-content

private List<YContentFile> processPlainTextEntry(final YContentEntry<?> yEntry) {
  final List<YContentFile> result = new ArrayList<YContentFile>();
  if (yEntry.isDirectory()) {
    final YContentDirectory yDirectory = (YContentDirectory) yEntry;
    for (final YContentEntry<?> yChild : yDirectory.getEntries()) {
      result.addAll(processPlainTextEntry(yChild));
    }
  } else if (yEntry.isFile() && YConstants.FT_PLAIN_TEXT.equals(((YContentFile) yEntry).getType())) {
    result.add((YContentFile) yEntry);
  }
  return result;
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

private boolean findIfContentExists(List<YContentEntry> chapterEntries, String mainLevel) {
  for (YContentEntry<?> content : chapterEntries) {
    if (content instanceof YContentFile && yModelPropertyExtractor.isFileAccepted((YContentFile) content, mainLevel)) {
      return true;
    } else if (content instanceof YContentDirectory) {
      if (findIfContentExists(((YContentDirectory) content).getEntries(), mainLevel)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import

public void convertContentLocations(YContentEntry<?> entry) {
  if (entry instanceof YContentDirectory) {
    YContentDirectory dir = (YContentDirectory) entry;
    for (YContentEntry<?> e : dir.getEntries()) {
      convertContentLocations(e);
    }
    return;
  }
  YContentFile file = (YContentFile) entry;
  List<String> newLocations = new ArrayList<String>();
  for (String location : file.getLocations()) {
    newLocations.add(location.replaceAll("^" + YConstants.MISC_PACK_RELATIVE_CONTENT_PREFIX + "archive/",
        YConstants.MISC_LOCAL_CONTENT_ADDRESS_PREFIX));
  }
  file.setLocations(newLocations);
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

protected YContentFile findCover(YContentEntry<?> entry) {
  if (entry instanceof YContentDirectory) {
    YContentDirectory directory = (YContentDirectory) entry;
    for (YContentEntry<?> child : directory.getEntries()) {
      YContentFile cover = findCover(child);
      if (cover != null) {
        return cover;
      }
    }
  } else if (entry instanceof YContentFile) {
    YContentFile file = (YContentFile) entry;
    if (FileTypes.FT_COVER.equals(file.getType()) || FileTypes.FT_THUMBNAIL.equals(file.getType())) {
      return file;
    }
  }
  return null;
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

@SuppressWarnings("rawtypes")
private Map<String, YContentFile> scanForFulltextFiles(Collection<YContentEntry> contentEntries, Set<String> formats) {
  Map<String, YContentFile> result = new HashMap<String, YContentFile>();
  for (YContentEntry contentEntry : contentEntries) {
    if (contentEntry instanceof YContentFile) {
      YContentFile contentFile = (YContentFile) contentEntry;
      if (StringUtils.equals(contentFile.getType(), "full-text") && formats.contains(contentFile.getFormat())) {
        result.put(contentFile.getFormat(), contentFile);
      }
    } else if (contentEntry instanceof YContentDirectory) {
      YContentDirectory contentDirectory = (YContentDirectory) contentEntry;
      Map<String, YContentFile> subResult = scanForFulltextFiles(contentDirectory.getEntries(), formats);
      subResult.putAll(result);
      result = subResult;
    }
  }
  return result;
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

@Override
public List<String> extractContentLocation(@SuppressWarnings("rawtypes") List<YContentEntry> contentList, String mainLevel) {
  List<String> result = new ArrayList<String>();
  for (YContentEntry<?> content : contentList) {
    if (content instanceof YContentFile) {
      YContentFile file = (YContentFile) content;
      if (yModelPropertyExtractor.isFileAccepted(file, mainLevel)) {
        result.add(yModelPropertyExtractor.prepareLocation(file.getLocations()));
      }
    } else if (content instanceof YContentDirectory) {
      YContentDirectory dir = (YContentDirectory) content;
      result.addAll(extractContentLocation(dir.getEntries(), mainLevel));
    }
  }
  return result;
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

@SuppressWarnings("rawtypes")
private boolean checkContentAvailable(List<YContentEntry> contentList, String mainLevel) {
  for (YContentEntry<?> content : contentList) {
    if (content instanceof YContentFile) {
      if (isFileAccepted((YContentFile) content, mainLevel)) {
        return true;
      }
    } else if (content instanceof YContentDirectory) {
      YContentDirectory dir = (YContentDirectory) content;
      if (acceptedDirectoryTypes.contains(dir.getType()) && checkContentAvailable(dir.getEntries(), mainLevel)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

@SuppressWarnings("rawtypes")
private List<FilteredContentEntry<?>> filter(FilteredContentDirectory parent, List<YContentEntry> contentEntries, ContentFilter filter) {
  List<FilteredContentEntry<?>> filtered = new ArrayList<>();
  for(YContentEntry<?> entry:contentEntries) {
    if(filter.accept(entry)) {
      final FilteredContentEntry<?> currentEntry;
      if (entry instanceof YContentFile) {
        currentEntry = new FilteredContentFile(parent, (YContentFile) entry);
      } else {
        YContentDirectory cDirectory = (YContentDirectory) entry;
        FilteredContentDirectory directory = new FilteredContentDirectory(parent, cDirectory);
        filter(directory, cDirectory.getEntries(), filter);
        currentEntry = directory;
      }
      filtered.add(currentEntry);
    }
  }
  return filtered;
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

private Page resolveMultiFile(YContentDirectory dir) {
  Page result = new Page();
  if (dir.getType().equals(YConstants.CONTENT_MULTI_TYPE)) {
    for (YContentEntry e : dir.getEntries()) {
      if (e.isFile()) {
        YContentFile file = (YContentFile) e;
        if (!file.getLocations().isEmpty()) {
          String location = file.getLocations().get(0)
              .replace("yar://", "");
          if (file.getType().equals(YConstants.FT_PLAIN_TEXT)) {
            result.setText(location);
          } else {
            result.setScan(location);
          }
        }
      }
    }
  }
  return result;
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

private List<ContentFileData> findChapterPages(List<YContentEntry> chapterEntries, Locale locale, String mainLevel) {
  List<ContentFileData> result = new ArrayList<ContentFileData>();
  for (YContentEntry<?> content : chapterEntries) {
    if (content instanceof YContentFile) {
      YContentFile file = (YContentFile) content;
      if (yModelPropertyExtractor.isFileAccepted(file, mainLevel)) {
        result.add(new ContentFileData(file.getId(), YModelUtils.getDefaultName(file), fetchName(file.getFormat(), locale), yModelPropertyExtractor.prepareLocation(file.getLocations())));
      }
    } else if (content instanceof YContentDirectory) {
      YContentDirectory dir = (YContentDirectory) content;
      if (ContentTypes.CONTENT_MULTI_TYPE.equals(dir.getType())) {
        result.addAll(findChapterPages(dir.getEntries(), locale, mainLevel));
      }
    }
  }
  return result;
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl

@SuppressWarnings("rawtypes")
private void extractContents(String elementId, List<YContentEntry> contents, FileGrp currentFileGrp) {
  for (YContentEntry yContentEntry : contents) {
    
    if (yContentEntry instanceof YContentDirectory) {
      YContentDirectory directory = (YContentDirectory) yContentEntry;
      FileGrp fileGrp = new FileGrp();
      fileGrp.setID(directory.getId());
      currentFileGrp.getFileGrps().add(fileGrp);
      extractContents(elementId, directory.getEntries(), fileGrp);
    } else {
      YContentFile yfile = (YContentFile) yContentEntry;
      if (isFileAcceptable(yfile)) {
        FileType fileType = createFileType(elementId, yfile);
        currentFileGrp.getFiles().add(fileType);
      }
    }
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

private List<ContentEntryData> translateContent(List<YContentEntry> contentList, Locale locale, String mainLevel) {
  List<ContentEntryData> result = new ArrayList<ContentEntryData>();
  for (YContentEntry<?> content : contentList) {
    if (content instanceof YContentFile) {
      YContentFile file = (YContentFile) content;
      if (yModelPropertyExtractor.isFileAccepted(file, mainLevel)) {
        result.add(new ContentFileData(file.getId(), YModelUtils.getDefaultName(file), fetchName(file.getFormat(), locale), yModelPropertyExtractor.prepareLocation(file.getLocations())));
      }
    } else if (content instanceof YContentDirectory) {
      YContentDirectory dir = (YContentDirectory) content;
      if (ContentTypes.CONTENT_PAGED.equals(dir.getType()) && findIfContentExists(dir.getEntries(), mainLevel)) {
        result.add(new ContentDirectoryData(dir.getId(), getDirectoryName(dir), dir.getType(), fetchName(dir.getType(), locale)));
      } else if(findIfContentExists(dir.getEntries(), mainLevel)) {
        result.add(new ContentDirectoryData(dir.getId(), getDirectoryName(dir), dir.getType(), fetchName(dir.getType(), locale), translateContent(dir.getEntries(), locale, mainLevel)));
      }
    }
  }
  return result;
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com