Examples of DocumentQuery


Examples of com.google.gdata.client.DocumentQuery

            throw new IOException(e);
        }
    }

    private String exportURL(String title) throws IOException, ServiceException, MalformedURLException {
        DocumentQuery query = documentQuery(title);
        List<DocumentListEntry> entries = service.getFeed(query, DocumentListFeed.class).getEntries();
        if (entries.isEmpty()) {
            throw new GoogleDocumentNotFound(title);
        }
        return ((MediaContent) entries.get(0).getContent()).getUri() + "&exportFormat=odt";
View Full Code Here

Examples of com.google.gdata.client.DocumentQuery

        }
        return ((MediaContent) entries.get(0).getContent()).getUri() + "&exportFormat=odt";
    }

    DocumentQuery documentQuery(String title) throws MalformedURLException {
        DocumentQuery query = new DocumentQuery(new URL(feedURI));
        query.setTitleQuery(title);
        query.setTitleExact(true);
        query.setMaxResults(1);
        return query;
    }
View Full Code Here

Examples of com.google.gdata.client.DocumentQuery

        DocumentListFeed feed = mock(DocumentListFeed.class);
        DocumentListEntry entry = mock(DocumentListEntry.class);
        MediaSource mediaSource = mock(MediaSource.class);
        InputStream inputStream = mock(InputStream.class);
        final MediaContent content = mock(MediaContent.class);
        final DocumentQuery query = mock(DocumentQuery.class);
        when(service.getFeed(query, DocumentListFeed.class)).thenReturn(feed);
        when(service.getMedia(content)).thenReturn(mediaSource);
        when(feed.getEntries()).thenReturn(asList(entry));
        when(entry.getContent()).thenReturn(content);
        when(content.getUri()).thenReturn("http://docs.google.com");
View Full Code Here

Examples of com.google.gdata.client.DocumentQuery

    return entry.updateMedia(true);
  }

  public DocumentListEntry findDocumentEntry(String title) throws IOException, ServiceException {
    DocumentListEntry entry = null;
    DocumentQuery query = new DocumentQuery(documentsFeedUri);
    query.setTitleQuery(title);
    query.setTitleExact(true);
    query.setMaxResults(1);
    DocumentListFeed feed = documentsService.getFeed(query, DocumentListFeed.class);
    if (feed != null && feed.getEntries().size() > 0) {
      entry = feed.getEntries().get(0);
    }
    return entry;
View Full Code Here

Examples of com.google.gdata.client.DocumentQuery

      url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + URL_CATEGORY_TRASHED);
    } else {
      return null;
    }

    DocumentQuery query = new DocumentQuery(url);
    // if (!category.equals("folders")) {
    // query.setMaxResults(101);
    // }

    return service.getFeed(query, DocumentListFeed.class);
View Full Code Here

Examples of com.google.gdata.client.DocumentQuery

     */
    public DocumentListEntry getFolder() throws Exception {
        try {
            URL feedUri = new URL(
                    "https://docs.google.com/feeds/default/private/full/-/folder");
            DocumentQuery query = new DocumentQuery(feedUri);
            query.setTitleQuery("netmus-libraries");
            query.setTitleExact(true);
            query.setMaxResults(1);
            DocumentListFeed feed = client().getFeed(query,
                    DocumentListFeed.class);
            List<DocumentListEntry> entry = feed.getEntries();
            return entry.get(0);
        } catch (MalformedURLException e) {
View Full Code Here

Examples of com.google.gdata.client.gtt.DocumentQuery

  private ListDocumentsCommand() {
  }

  public void execute(GttService service, String[] args)
      throws IOException, ServiceException {
    DocumentQuery query = createQueryFromArgs(args);

    System.out.print("Fetching documents....");
    System.out.flush();

    DocumentFeed resultFeed = service.getFeed(query, DocumentFeed.class);
View Full Code Here

Examples of com.google.gdata.client.gtt.DocumentQuery

    SimpleCommandLineParser parser = new SimpleCommandLineParser(args);

    System.out.println("You asked to list documents....");

    URL feedUrl = FeedUris.getDocumentsFeedUrl();
    DocumentQuery query = new DocumentQuery(feedUrl);

    if (parser.containsKey("onlydeleted")) {
      System.out.println("...that are deleted");
      query.setOnlydeleted(true);
    }

    if (parser.containsKey("onlyhidden")) {
      System.out.println("...that are hidden");
      Query.CategoryFilter filter = new Query.CategoryFilter();
      filter.addCategory(new HiddenCategory());
      query.addCategoryFilter(filter);
    }

    if (parser.containsKey("excludehidden")) {
      System.out.println("...that are not hidden");
      Query.CategoryFilter filter = new Query.CategoryFilter();
      filter.addExcludeCategory(new HiddenCategory());
      query.addCategoryFilter(filter);
    }

    String sharedWithEmail = parser.getValue("sharedwith");
    if (sharedWithEmail != null) {
      System.out.println("...that are shared with " + sharedWithEmail);
      query.setSharedWithEmailId(sharedWithEmail);
    }

    String startIndex = parser.getValue("start-index");
    if (startIndex != null) {
      System.out.println("...that start from position " + startIndex);
      query.setStartIndex(Integer.parseInt(startIndex));
    }

    String maxResults = parser.getValue("max-results");
    if (maxResults != null) {
      System.out.println("...and you don't want more than " + maxResults
          + " results");
      query.setMaxResults(Integer.parseInt(maxResults));
    }

    return query;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.