com.google.api.services.drive.model.File.getTrashed()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(148)

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

File.getTrashed介绍

[英]Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash.
[中]

代码示例

代码示例来源:origin: andresoviedo/google-drive-ftp-adapter

public boolean trashFile(GFile file) {
  String fileId = file.getId();
  LOG.info("Trashing file " + file.getId() + "...");
  if (googleDrive.trashFile(fileId).getTrashed()) {
    cache.deleteFile(fileId);
    return true;
  }
  return false;
}

代码示例来源:origin: andresoviedo/google-drive-ftp-adapter

private GFile create(File file) {
  GFile newFile = new GFile(file.getName() != null ? file.getName() : file.getOriginalFilename());
  newFile.setId(file.getId());
  newFile.setLastModified(file.getModifiedTime() != null ? file.getModifiedTime().getValue() : 0);
  newFile.setDirectory(GFile.MIME_TYPE.GOOGLE_FOLDER.getValue().equals(file.getMimeType()));
  newFile.setSize(file.getSize() != null ? file.getSize() : 0); // null for directories
  newFile.setMimeType(file.getMimeType());
  newFile.setMd5Checksum(file.getMd5Checksum());
  if (file.getParents() != null) {
    Set<String> newParents = new HashSet<>();
    for (String newParent : file.getParents()) {
      newParents.add(newParent.equals(ROOT_FOLDER_ID) ? "root" : newParent);
    }
    newFile.setParents(newParents);
  } else {
    // does this happen?
    newFile.setParents(Collections.singleton("root"));
  }
  newFile.setTrashed(file.getTrashed() != null && file.getTrashed());
  return newFile;
}

代码示例来源:origin: Talend/components

private IndexedRecord convertSearchResultToIndexedRecord(File file) {
  // Main record
  IndexedRecord main = new GenericData.Record(schema);
  main.put(0, file.getId());
  main.put(1, file.getName());
  main.put(2, file.getMimeType());
  main.put(3, file.getModifiedTime().getValue());
  main.put(4, file.getSize());
  main.put(5, file.getKind());
  main.put(6, file.getTrashed());
  main.put(7, file.getParents().toString()); // TODO This should be a List<String>
  main.put(8, file.getWebViewLink());
  return main;
}

代码示例来源:origin: org.talend.components/components-googledrive-runtime

private IndexedRecord convertSearchResultToIndexedRecord(File file) {
  // Main record
  IndexedRecord main = new GenericData.Record(schema);
  main.put(0, file.getId());
  main.put(1, file.getName());
  main.put(2, file.getMimeType());
  main.put(3, file.getModifiedTime().getValue());
  main.put(4, file.getSize());
  main.put(5, file.getKind());
  main.put(6, file.getTrashed());
  main.put(7, file.getParents().toString()); // TODO This should be a List<String>
  main.put(8, file.getWebViewLink());
  return main;
}

相关文章