//File upload in google drive DocumentListEntry uploadFile = new DocumentListEntry(); uploadFile.setTitle(new PlainTextConstruct("FILE_NAME_DISPLAY_IN_DRIVE")); uploadFile.setFile(new File("FILE_PATH"), "MIME_TYPE_OF_FILE"); uploadFile = docsService.insert(GOOGLE_DRIVE_FEED_URL, uploadFile);
/** * Sets the amount of quota consumed by the document. * * @param lastModifiedBy the quota used */ public void setLastModifiedBy(LastModifiedBy lastModifiedBy) { if (lastModifiedBy == null) { removeExtension(LastModifiedBy.class); } else { setExtension(lastModifiedBy); } }
/** * Sets the trashed status of this document for the user this feed request * has been authenticated under. * * @param trashed true if the document should be trashed */ public void setTrashed(boolean trashed) { if (trashed) { this.getCategories().add(Labels.TRASHED); this.setExtension(new Deleted()); } else { this.getCategories().remove(Labels.TRASHED); this.removeExtension(Deleted.class); } }
/** * @return true if the document represented by this entry has been starred * by the user this feed request has been authenticated under. */ public boolean isStarred() { return this.getCategories().contains(Labels.STARRED); }
/** * Returns the user who last modified the document. * * @return the user who last modified the document */ public LastModifiedBy getLastModifiedBy() { LastModifiedBy lastModifiedBy = getExtension(LastModifiedBy.class); return lastModifiedBy == null ? null : lastModifiedBy; }
/** * Associate a File with this entry, implicitly determining the mime type * from the file's extension. * * @deprecated use setFile(File, String) instead. */ @Deprecated public void setFile(File file) { setFile(file, getMimeTypeFromFileName(file.getName())); }
/** * @return true if the document represented by this entry has been trashed * by the user this feed request has been authenticated under. */ public boolean isTrashed() { return this.getCategories().contains(Labels.TRASHED) || this.hasExtension(Deleted.class); }
/** * Returns the type document entry from the resource id. If the resource id * id "document:12345", then "document" is returned. * * @return the document type * . */ public String getType() { String result = getResourceId(); if (result != null) { int position = result.lastIndexOf(":"); if (position > 0) { return result.substring(0, position); } } return result; }
public void shareFile(DocumentListEntry documentListEntry, AclScope.Type type, String value, String role) throws MalformedURLException, IOException, ServiceException { // Instantiate a AclEntry object to update sharing permissions. AclEntry acl = new AclEntry(); // Set the ACL scope. acl.setScope(new AclScope(type, value)); // Set the ACL role. acl.setRole(new AclRole(role)); // Insert the new role into the ACL feed. service.insert(new URL(documentListEntry.getAclFeedLink().getHref()), acl); }
Logger.info("got feed"); for (DocumentListEntry entry : dfeed.getEntries()) { Logger.info(entry.getTitle().getPlainText()); if(entry.getTitle().getPlainText().equalsIgnoreCase(sourceName)) resourceId = entry.getResourceId(); Logger.info("Resource id %s", resourceID); DocumentListEntry newEntry = new DocumentListEntry(); newEntry.setId(resourceID); newEntry.setTitle(new PlainTextConstruct(destination)); this.dService.insert(entryUrl, newEntry);
public DocumentListAclFeedLink getAclFeedLink() { List<DocumentListAclFeedLink> links = getRepeatingExtension(DocumentListAclFeedLink.class); for (DocumentListAclFeedLink feedLink : links) { if (AclNamespace.LINK_REL_ACCESS_CONTROL_LIST.equals(feedLink.getRel())) { return feedLink; } } return null; }
public List<Link> getParentLinks() { return getLinks(PARENT_NAMESPACE, Link.Type.ATOM); }
/** * Sets the amount of quota consumed by the document. * * @param lastModifiedBy the quota used */ public void setLastModifiedBy(LastModifiedBy lastModifiedBy) { if (lastModifiedBy == null) { removeExtension(LastModifiedBy.class); } else { setExtension(lastModifiedBy); } }
/** * Sets the trashed status of this document for the user this feed request * has been authenticated under. * * @param trashed true if the document should be trashed */ public void setTrashed(boolean trashed) { if (trashed) { this.getCategories().add(Labels.TRASHED); this.setExtension(new Deleted()); } else { this.getCategories().remove(Labels.TRASHED); this.removeExtension(Deleted.class); } }
/** * @return true if the document represented by this entry has been starred * by the user this feed request has been authenticated under. */ public boolean isStarred() { return this.getCategories().contains(Labels.STARRED); }
/** * Returns the user who last modified the document. * * @return the user who last modified the document */ public LastModifiedBy getLastModifiedBy() { LastModifiedBy lastModifiedBy = getExtension(LastModifiedBy.class); return lastModifiedBy == null ? null : lastModifiedBy; }
/** * Associate a File with this entry, implicitly determining the mime type * from the file's extension. * * @deprecated use setFile(File, String) instead. */ @Deprecated public void setFile(File file) { setFile(file, getMimeTypeFromFileName(file.getName())); }
/** * @return true if the document represented by this entry has been trashed * by the user this feed request has been authenticated under. */ public boolean isTrashed() { return this.getCategories().contains(Labels.TRASHED) || this.hasExtension(Deleted.class); }
/** * Returns the type document entry from the resource id. If the resource id * id "document:12345", then "document" is returned. * * @return the document type * . */ public String getType() { String result = getResourceId(); if (result != null) { int position = result.lastIndexOf(":"); if (position > 0) { return result.substring(0, position); } } return result; }
public AclFeed getAclFeed() { DocumentListAclFeedLink feedLink = getAclFeedLink(); return (feedLink != null) ? feedLink.getFeed() : null; }