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

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

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

YContentFile.getType介绍

暂无

代码示例

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

@Override
public boolean accept(YContentEntry<?> contentEntry) {
  if (contentEntry instanceof YContentDirectory) {
    return true;
  }
  YContentFile file = (YContentFile) contentEntry;
  boolean result = FileTypes.FT_PLAIN_TEXT.equals(file.getType());
  hasFiles = hasFiles || result;
  return result;
}

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

@Override
public boolean isFileAccepted(YContentFile content, String mainLevel) {
  // XXX fallback fix
  if (YaddaIdConstants.ID_LEVEL_JOURNAL_ARTICLE.equals(mainLevel) && StringUtils.isBlank(content.getType())) {
    return true;
  }
  if (acceptedFileTypes.contains(content.getType()) && !SKIPPABLE_FILE_FORMATS.contains(content.getFormat())) {
    return true;
  }
  return false;
}

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

public List<YContentFile> findAllThumbnailLocations(AbstractElementInfo<?> element) {
  final List<YContentFile> contentFiles = new ArrayList<>();
  contentBrowser.browse(element, file -> {
    switch (file.getType()) {
      case FileTypes.FT_COVER:
      case FileTypes.FT_THUMBNAIL:
        contentFiles.add(file);
      default:
    }
  });
  return contentFiles;
}

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

@Override
public void doWithFile(YContentFile file) {
  String type = file.getType();
  String format = file.getFormat();
  if ("application/pdf".equals(format)) {
    exist.set(true);
  }
}

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

private boolean isFileAcceptable(YContentFile yfile) {
  
  String type = yfile.getType();
  if (StringUtils.isBlank(type) || ACCEPTED_FILE_TYPES.contains(type)) {
    String format = yfile.getFormat();
    if (format != null) {
      format = format.toLowerCase();
      return ACCEPTED_FILE_FORMATS.contains(format);
    }
  }
  return false;
}

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

@SuppressWarnings("rawtypes")
private String prepareVideoId(List<YContentEntry> contents){
  for (YContentEntry<?> yContentEntry : contents) {
    if(yContentEntry instanceof YContentFile){
      YContentFile file = (YContentFile) yContentEntry;
      if(VideoConstants.VIDEO_URL_FILE_TYPE.equals(file.getType())){
        return file.getLocations().get(0);
      }
    }
  }
  return null;
}

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

@SuppressWarnings("rawtypes")
private String prepareVideoFormat(List<YContentEntry> contents){
  for (YContentEntry<?> yContentEntry : contents) {
    if(yContentEntry instanceof YContentFile){
      YContentFile file = (YContentFile) yContentEntry;
      if(VideoConstants.VIDEO_URL_FILE_TYPE.equals(file.getType())){
        return file.getFormat();
      }
    }
  }
  return null;
}

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

protected String findLocationOfContentLink(List<YContentEntry> contents, String expectedType) {
  for (YContentEntry content : contents) {
    if (content instanceof YContentFile) {
      YContentFile contentFile = (YContentFile) content;
      if (expectedType.equals(contentFile.getType())) {
        List<String> locations = contentFile.getLocations();
        if (locations != null && locations.size() > 0) {
          return locations.get(0).trim();
        }
      }
    }
  }
  return null;
}

代码示例来源: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-sdk-sample-services

@Override
public void doWithFile(YContentFile file) {
  String type = file.getType();
  String format = file.getFormat();
  if ("application/pdf".equals(format) && type==null) {
    fixed.set(true);
    file.setType(FileTypes.FT_FULL_TEXT);
  }
}

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

protected String resolveCoverUrl(YElement element) {
   for (YContentEntry e : element.getContents()) {
     if (e.isFile()) {
       YContentFile cFile = (YContentFile) e;
       String location = cFile.getLocations().get(0);
       if (location != null && ((cFile.getType() != null &&
cFile.getType().equals("cover") || anyContentAsCover))) {
         return "download/" + location.replace("yar://", "");
       }
     }
   }
   return null;
 }

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

@Override
      public void doWithFile(YContentFile file) {
        String type = file.getType();
        String format = file.getFormat();
        if ("application/pdf".equals(format) && StringUtils.isBlank(type)) {
//                if ("application/pdf".equals(format) && "content".equals(type)) {
          fixed.set(true);
          file.setType(FileTypes.FT_FULL_TEXT);
        }
      }

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

@Override
public boolean accept(YContentEntry<?> contentEntry) {
  if (contentEntry instanceof YContentDirectory) {
    return true;
  }
  YContentFile file = (YContentFile) contentEntry;
  boolean result = ACCEPTED_FILE_TYPES.contains(file.getType()) && MediaType.PDF.toString().equals(file.getFormat());
  hasFiles = hasFiles || result;
  return result;
}

代码示例来源:origin: pl.edu.icm.ceon/ceon-converters-commons

public static String getFullArchiveFileName(String elementId, YContentFile file) {
  String fileName = "archive/" + elementId + "/content/" + file.getType() + "/" +( file.getOneName(YConstants.NM_FILE_NAME).getText().replaceAll("[^-a-zA-Z0-9+&@#/%=~_|\\.]","_" ));
  return fileName;
}

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

public static String getFullArchiveFileName(String elementId, YContentFile file) {
  String fileName = "archive/" + elementId + "/content/" + file.getType() + "/" +( file.getOneName(YConstants.NM_FILE_NAME).getText().replaceAll("[^-a-zA-Z0-9+&@#/%=~_|\\.]","_" ));
  return fileName;
}

代码示例来源: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-sdk-sample-services

@Override
public void doWithFile(YContentFile file) {
  String type = file.getType();
  if (FileTypes.FT_PLAIN_TEXT.equals(type)) {
    String location = file.getLocations().get(0);
    // System.out.println("adding..."+location);
    if (location != null) {
      Attachment<?> part = document.getAttachments().get(location);
      String text = "";
      if (part instanceof BinaryAttachment) {
        byte[] content = ((BinaryAttachment) part).getContent();
        text = new String(content);
      }
      textBuilder.append(text);
    }
  }
}

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

private Page resolveFile(YContentFile file) {
  Page result = new Page();
  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-portal-core

private boolean isLicensedContent(ElementMetadata elementMetadata, String contentPath) {
  YElement yElement = (YElement) elementMetadata.getContent();
  for (YContentEntry<?> entry : yElement.getContents()) {
    if (entry.isFile()) {
      YContentFile contentFile = (YContentFile) entry;
      if (contentFile.getLocations().contains(contentPath) && notLicensedContentTypes != null
          && notLicensedContentTypes.contains(contentFile.getType())) {
        return false;
      }
    }
  }
  return true;
}

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

private List<ContentInfo> getContentInfo(YContentFile file){
  Collection<String> names = convertNames(file.getNames());
  
  ContentInfo contentInfo = new ContentInfo.Builder(file.getFormat(), file.getId())
                        .locations(file.getLocations())
                        .names(names)
                        .type(file.getType())
                        .build();
  
  return Arrays.asList(contentInfo);
}

相关文章