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

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

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

File.getWebViewLink介绍

[英]A link for opening the file in a relevant Google editor or viewer in a browser.
[中]用于在浏览器中的相关Google编辑器或查看器中打开文件的链接。

代码示例

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

if(StringUtils.isNotBlank(f.getWebViewLink())) {
  attributes.setLink(new DescriptiveUrl(URI.create(f.getWebViewLink()),
    DescriptiveUrl.Type.http,
    MessageFormat.format(LocaleFactory.localizedString("{0} URL"), "HTTP")));
  if(!DRIVE_FOLDER.equals(f.getMimeType()) && StringUtils.startsWith(f.getMimeType(), GOOGLE_APPS_PREFIX)) {
    attributes.setSize(UrlFileWriterFactory.get().write(new DescriptiveUrl(URI.create(f.getWebViewLink())))
      .getBytes(Charset.defaultCharset()).length);

代码示例来源: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;
}

代码示例来源:origin: io.github.aktoluna/slnarch-report

public void uploadDrive() throws MessagingException, IOException {
 File file = createZip();
 DriveHelper driveHelper = new DriveHelper();
 driveHelper.createDriver();
 com.google.api.services.drive.model.File uploadFile = driveHelper.uploadFile(file);
 for (String s : reportConfiguration.getTo().split(",")) {
  logger.debug("Share File To {}", s);
  driveHelper.shareFile(uploadFile, s);
 }
 if (reportConfiguration.isDeleteZipEachTestResult()) {
  FileHelper.deleteFile(file);
 }
 if (reportConfiguration.isAfterDeleteEachTestResult()) {
  FileHelper.deleteDirectory(getReportDirectory());
 }
 logger.info("Web View link {}", uploadFile.getWebViewLink());
 logger.info("Web Content link {}", uploadFile.getWebContentLink());
 boolean result = MailSenderCreator
   .createMailSender(MailSendType.valueOf(reportConfiguration.getMailType()),
     reportConfiguration.getHost(), reportConfiguration.getPort(),
     reportConfiguration.getUsername(),
     reportConfiguration.getPassword(), reportConfiguration.isAuth())
   .createMail(reportConfiguration.getFrom(), reportConfiguration.getTo(), "Test Result",
     reportConfiguration.getCc(), reportConfiguration.getBcc())
   .setMessage(uploadFile.getWebContentLink())
   .send();
 logger.info("Mail send {}", result);
}

相关文章