// 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");