Package com.google.gdata.data

Examples of com.google.gdata.data.Entry


    Feed resultFeed = myService.getFeed(feedUrl, Feed.class);

    // Print the results
    System.out.println(resultFeed.getTitle().getPlainText());
    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      Entry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" + entry.getTitle().getPlainText());
    }
    System.out.println();
  }
View Full Code Here


   */
  public static Entry createPost(BloggerService myService, String title,
      String content, String authorName, String userName, Boolean isDraft)
      throws ServiceException, IOException {
    // Create the entry to insert
    Entry myEntry = new Entry();
    myEntry.setTitle(new PlainTextConstruct(title));
    myEntry.setContent(new PlainTextConstruct(content));
    Person author = new Person(authorName, null, userName);
    myEntry.getAuthors().add(author);
    myEntry.setDraft(isDraft);

    // Ask the service to insert the new entry
    URL postUrl = new URL(feedUri + POSTS_FEED_URI_SUFFIX);
    return myService.insert(postUrl, myEntry);
  }
View Full Code Here

    Feed resultFeed = myService.getFeed(feedUrl, Feed.class);

    // Print the results
    System.out.println(resultFeed.getTitle().getPlainText());
    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      Entry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" + entry.getTitle().getPlainText());
    }
    System.out.println();
  }
View Full Code Here

    // Print the results
    System.out.println(resultFeed.getTitle().getPlainText() + " posts between "
        + startTime + " and " + endTime);
    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      Entry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" + entry.getTitle().getPlainText());
      System.out.println("\t" + entry.getUpdated().toStringRfc822());
    }
    System.out.println();
  }
View Full Code Here

    // Build the comment feed URI
    String commentsFeedUri = feedUri + "/" + postId + COMMENTS_FEED_URI_SUFFIX;
    URL feedUrl = new URL(commentsFeedUri);

    // Create a new entry for the comment and submit it to the GoogleService
    Entry myEntry = new Entry();
    myEntry.setContent(new PlainTextConstruct(commentText));
    return myService.insert(feedUrl, myEntry);
  }
View Full Code Here

    Feed resultFeed = myService.getFeed(feedUrl, Feed.class);

    // Display the results
    System.out.println(resultFeed.getTitle().getPlainText());
    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      Entry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" +
          ((TextContent) entry.getContent()).getContent().getPlainText());
      System.out.println("\t" + entry.getUpdated().toStringRfc822());
    }
    System.out.println();
  }
View Full Code Here

    // Demonstrate retrieving a list of the user's blogs.
    printUserBlogs(myService);

    // Demonstrate how to create a draft post.
    Entry draftPost = createPost(myService, "Snorkling in Aruba",
        "<p>We had so much fun snorkling in Aruba<p>", "Post author", userName,
        true);
    System.out.println("Successfully created draft post: "
        + draftPost.getTitle().getPlainText());

    // Demonstrate how to publish a public post.
    Entry publicPost = createPost(myService, "Back from vacation",
        "<p>I didn't want to leave Aruba, but I ran out of money :(<p>",
        "Post author", userName, false);
    System.out.println("Successfully created public post: "
        + publicPost.getTitle().getPlainText());

    // Demonstrate various feed queries.
    printAllPosts(myService);
    printDateRangeQueryResults(myService, DateTime.parseDate("2007-04-04"),
        DateTime.parseDate("2007-04-06"));

    // Demonstrate two ways of updating posts.
    draftPost.setTitle(new PlainTextConstruct("Swimming with the fish"));
    draftPost.update();
    System.out.println("Post's new title is \""
        + draftPost.getTitle().getPlainText() + "\".\n");
    publicPost = updatePostTitle(myService, publicPost, "The party's over");
    System.out.println("Post's new title is \""
        + publicPost.getTitle().getPlainText() + "\".\n");

    // Demonstrate how to add a comment on a post
    // Get the post ID and build the comments feed URI for the specified post
    System.out.println("Creating comment");
    String selfLinkHref = publicPost.getSelfLink().getHref();
    String[] tokens = selfLinkHref.split("/");
    String postId = tokens[tokens.length - 1];
    Entry comment = createComment(myService, postId, "Did you see any sharks?");

    // Demonstrate how to retrieve the comments for a post
    printAllComments(myService, postId);

    // Demonstrate how to delete a comment from a post
    System.out.println("Deleting comment");
    deleteComment(myService, comment.getEditLink().getHref());

    // Demonstrate two ways of deleting posts.
    System.out.println("Deleting draft post");
    draftPost.delete();
    System.out.println("Deleting published post");
View Full Code Here

   
   
    @Test
    public void testClientGetEntry() throws Exception {
        String entryID = "1c76lcl70jg9r0fm18rcbneea8";
        Entry blogEntry = testService.clientGetEntry(entryID);
        //System.out.println("Entry ID: " + blogEntry.getId());
        Assert.assertTrue(blogEntry.getId().endsWith(entryID));
        //System.out.println("------------------------------------------------------------\n\n");
    }
View Full Code Here

    public void testClientPut() throws Exception
        String entryID = "1c76lcl70jg9r0fm18rcbneea8";         
        String newBlogEntryTitle = "updatedTitleByGoogleContactsConsumerTestCase";
        testService.clientPut(entryID, newBlogEntryTitle);      //update the title
        Thread.sleep(Constants.SLEEP_INTERVAL);           
        Entry updatedEntry = testService.clientGetEntry(entryID);        
        Assert.assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
    }
View Full Code Here

    }
   
    @Test
    public void testClientPost() throws Exception {
        String blogEntryTitle = "titleByGoogleCalendarTestcase";
        Entry newEntry = new Entry();
        newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
        newEntry.setContent(new PlainTextConstruct("contentByGoogleCalendarTestCase"));
        Entry postedEntry = testService.clientPost(newEntry);       
        Assert.assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
    }
View Full Code Here

TOP

Related Classes of com.google.gdata.data.Entry

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.