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

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

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

File.setTrashed介绍

[英]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 File trashFile(String fileId) {
  File patch = new File();
  patch.setTrashed(true);
  return patchFile(fileId, patch, 3);
}

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

private String removeResource(String resourceId, boolean useTrash) throws IOException {
  if (useTrash) {
    drive.files().update(resourceId, new File().setTrashed(true)).execute();
  } else {
    drive.files().delete(resourceId).execute();
  }
  return resourceId;
}

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

private String removeResource(String resourceId, boolean useTrash) throws IOException {
  if (useTrash) {
    drive.files().update(resourceId, new File().setTrashed(true)).execute();
  } else {
    drive.files().delete(resourceId).execute();
  }
  return resourceId;
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
  for(Path file : files) {
    if(file.getType().contains(Path.Type.placeholder)) {
      continue;
    }
    callback.delete(file);
    try {
      if(DriveHomeFinderService.TEAM_DRIVES_NAME.equals(file.getParent())) {
        session.getClient().teamdrives().delete(fileid.getFileid(file, new DisabledListProgressListener())).execute();
      }
      else {
        if(PreferencesFactory.get().getBoolean("googledrive.delete.trash")) {
          final File properties = new File();
          properties.setTrashed(true);
          session.getClient().files().update(fileid.getFileid(file, new DisabledListProgressListener()), properties)
            .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
        }
        else {
          session.getClient().files().delete(fileid.getFileid(file, new DisabledListProgressListener()))
            .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
        }
      }
    }
    catch(IOException e) {
      throw new DriveExceptionMappingService().map("Cannot delete {0}", e, file);
    }
  }
}

代码示例来源:origin: iterate-ch/cyberduck

if(PreferencesFactory.get().getBoolean("googledrive.delete.trash")) {
  final File properties = new File();
  properties.setTrashed(true);
  session.getClient().files().update(fileid.getFileid(file, new DisabledListProgressListener()), properties)
    .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable"))

相关文章