List of usage examples for com.google.gwt.gdata.client.blogger PostEntry getSelfLink
public final native com.google.gwt.gdata.client.Link getSelfLink() ;
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerDeleteBlogPostDemo.java
License:Apache License
/** * Retrieve the Blogger posts feed using the Blogger service and * the posts feed uri for a given blog./*ww w . ja v a 2 s. co m*/ * On success, identify the first post entry with a title starting * with "GWT-Blogger-Client", this will be the post that will be deleted. * If no post is found, display a message. * Otherwise call deletePost to delete the post. Alternatively * we could also have used targetPost.deleteEntry to * delete the post, but the effect is the same. * * @param postsFeedUri The posts feed uri for a given blog */ private void getPosts(String postsFeedUri) { showStatus("Loading posts feed...", false); service.getBlogPostFeed(postsFeedUri, new BlogPostFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Blogger Posts " + "feed: " + caught.getMessage(), true); } public void onSuccess(BlogPostFeed result) { PostEntry targetPost = null; for (PostEntry entry : result.getEntries()) { String title = entry.getTitle().getText(); if (title.startsWith("GWT-Blogger-Client")) { targetPost = entry; break; } } if (targetPost == null) { showStatus("Did not find a post entry whose title starts with " + "the prefix 'GWT-Blogger-Client'.", false); } else { deletePost(targetPost.getSelfLink().getHref()); } } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerRetrieveSpecificBlogPostDemo.java
License:Apache License
/** * Retrieve the Blogger posts feed using the Blogger service and * the posts feed uri for a given blog.//from w ww. java 2 s .c o m * On success, call getPost on the first post entry. This will * retrieve the same entry that we already have, the purpose * is to exemplify retrieving a specific post entry directly. * If no posts are available, display a message. * * @param postsFeedUri The posts feed uri for a given blog */ private void getPosts(String postsFeedUri) { showStatus("Loading posts feed...", false); service.getBlogPostFeed(postsFeedUri, new BlogPostFeedCallback() { public void onFailure(CallErrorException caught) { showStatus("An error occurred while retrieving the Blogger Posts " + "feed: " + caught.getMessage(), true); } public void onSuccess(BlogPostFeed result) { PostEntry[] entries = result.getEntries(); if (entries.length == 0) { showStatus("No post entries found for the current blog.", false); } else { PostEntry targetPost = entries[0]; String postEntryUri = targetPost.getSelfLink().getHref(); getPost(postEntryUri); } } }); }