Package com.google.gdata.data.docs

Examples of com.google.gdata.data.docs.DocumentListFeed


  /**
   * Execute 'list' command.
   */
  private void executeList(String[] args) throws IOException,
      ServiceException, DocumentListException {
    DocumentListFeed feed = null;
    String msg = "";

    switch (args.length) {
      case 1:
        msg = "List of docs: ";
        feed = docs.getDocsListFeed("all");
        break;
      case 2:
        msg = "List of all " + args[1] + ": ";
        feed = docs.getDocsListFeed(args[1]);
        break;
      case 3:
        if (args[1].equals("folder")) {
          msg = "Contents of folder_id '" + args[2] + "': ";
          feed = docs.getFolderDocsListFeed(args[2]);
        }
        break;
    }

    if (feed != null) {
      output.println(msg);
      for (DocumentListEntry entry : feed.getEntries()) {
        printDocumentEntry(entry);
      }
    } else {
      printMessage(COMMAND_HELP_MESSAGE);
    }
View Full Code Here


   *         service.
   * @throws DocumentListException
   */
  private void executeList(String[] args) throws IOException,
      ServiceException, DocumentListException {
    DocumentListFeed feed = null;
    String msg = "";

    switch (args.length) {
    case 1:
      msg = "List of docs: ";
      feed = documentList.getDocsListFeed("all");
      break;
    case 2:
      msg = "List of all " + args[1] + ": ";
      feed = documentList.getDocsListFeed(args[1]);
      break;
    case 3:
      if (args[1].equals("folder")) {
        msg = "Contents of folder_id '" + args[2] + "': ";
        feed = documentList.getFolderDocsListFeed(args[2]);
      }
      break;
    }

    if (feed != null) {
      out.println(msg);
      for (DocumentListEntry entry : feed.getEntries()) {
        printDocumentEntry(entry);
      }
    } else {
      printMessage(COMMAND_HELP_LIST);
    }
View Full Code Here

      ServiceException, DocumentListException {
    if (args.length == 2) {
      HashMap<String, String> searchParameters = new HashMap<String, String>();
      searchParameters.put("q", args[1]);

      DocumentListFeed feed = documentList.search(searchParameters);
      out.println("Results for [" + args[1] + "]");
      for (DocumentListEntry entry : feed.getEntries()) {
        printDocumentEntry(entry);
      }
    } else {
      printMessage(COMMAND_HELP_SEARCH);
    }
View Full Code Here

    for (int i = 1; i < args.length; ++i) {
      searchParameters.put(args[i].substring(0, args[i].indexOf("=")), args[i]
          .substring(args[i].indexOf("=") + 1));
    }

    DocumentListFeed feed = documentList.search(searchParameters);
    out.println("Results for advanced search:");
    for (DocumentListEntry entry : feed.getEntries()) {
      printDocumentEntry(entry);
    }
  }
View Full Code Here

   * @param counters the counters
   *
   * @return the number of uploaded documents
   */
  protected int uploadFolder(File folder, DocumentListEntry remoteFolder, int[] counters) {
    DocumentListFeed remoteSubFolders = getSubFolders(remoteFolder);
    DocumentListFeed remoteDocs = getDocsFromFolder(remoteFolder);
    int uploaded = 0;
    for (File file : folder.listFiles()) {
      if (!file.isDirectory()) { 
        counters[0]++;
        printLine("[" + counters[0] + "/" + counters[1] + "] " + file.getAbsolutePath());
View Full Code Here

   * Gets the root folders.
   *
   * @return the root folders
   */
  public DocumentListFeed getRootFolders() {   
    DocumentListFeed results = new DocumentListFeed();
    try {
      DocumentListFeed docs = getDocumentList().getDocsListFeed("folders");
      List<DocumentListEntry> list = new ArrayList<DocumentListEntry>();
      for (DocumentListEntry doc : docs.getEntries()) {
        if (doc.getParentLinks().isEmpty()) {
          list.add(doc);
        }     
      }
      results.setEntries(list);     
View Full Code Here

   * @param folder the folder
   *
   * @return the sub folders
   */
  public DocumentListFeed getSubFolders(DocumentListEntry folder) {
    DocumentListFeed results = null;
    if (folder == null) {
      return getRootFolders();
    }
    try {
      results = getDocumentList().getSubFolders(folder.getResourceId());
View Full Code Here

   * @param folder the folder
   *
   * @return the docs
   */
  public DocumentListFeed getDocsFromFolder(DocumentListEntry folder) {
    DocumentListFeed results = new DocumentListFeed();
    DocumentListFeed docs = null;
    List<DocumentListEntry> list = new ArrayList<DocumentListEntry>();
   
    if (folder == null) {     
      try {
        docs = getDocumentList().getDocsListFeed("all");
      } catch (Exception e) {
        e.printStackTrace();
      }

      while (true) {
        if (docs != null && docs.getEntries().size() > 0) { // docs.getTotalResults() != -1 &&
          for (DocumentListEntry doc : docs.getEntries()) {
            if (doc.getParentLinks().isEmpty() && !doc.getType().equals("folder")) {
              list.add(doc);
            }     
          }
         
          try {
            docs = getDocumentList().getDocsListFeed(docs.getNextLink());
          } catch (Exception e) {
            e.printStackTrace();
            break;
          }
        } else {
          break;       
        }
      }
    } else {
      try {
        docs = getDocumentList().getFolderDocsListFeed(folder.getResourceId());
      } catch (Exception e) {
        e.printStackTrace();
      }
     
      while (true) {
        if (docs != null && docs.getEntries().size() > 0) {
          for (DocumentListEntry doc : docs.getEntries()) {
            if (!doc.getType().equals("folder")) {
              list.add(doc);
            }     
          }
         
          try {
            docs = getDocumentList().getDocsListFeed(docs.getNextLink());
          } catch (Exception e) {
            e.printStackTrace();
            break;
          }
        } else {
View Full Code Here

  public DocumentListEntry getRemoteFolderByPath(String path) {
    if (path == null || path.length() < 1) {
      return null;
    }
    String[] pathArray = path.split("/");
    DocumentListFeed remoteSubFolders = getRootFolders();
    DocumentListEntry parentRemoteFolder = null;
    DocumentListEntry currentRemoteFolder = null;
    for (String folder : pathArray) {
      if (folder.isEmpty()) {
        continue;
View Full Code Here

                    "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) {
            throw new Exception("Incorrect resource ID");
        } catch (IOException e) {
            throw new RuntimeException(
View Full Code Here

TOP

Related Classes of com.google.gdata.data.docs.DocumentListFeed

Copyright © 2018 www.massapicom. 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.