String ids[] = request.getParameterValues("entry");
String submit = request.getParameter("submit");
if (ids != null) {
for (String id : ids) {
BlogService service = new BlogService();
BlogEntry blogEntry = null;
try {
blogEntry = service.getBlogEntry(blog, id);
} catch (BlogServiceException e) {
throw new ServletException(e);
}
if (blogEntry != null) {
if (submit.equalsIgnoreCase("Remove")) {
try {
service.removeBlogEntry(blogEntry);
blog.info("Blog entry \"" + StringUtils.transformHTML(blogEntry.getTitle()) + "\" removed.");
} catch (BlogServiceException be) {
throw new ServletException(be);
}
} else if (submit.equals("Publish")) {
// this publishes the entry as-is (i.e. with the same
// date/time it already has)
try {
blogEntry.setPublished(true);
service.putBlogEntry(blogEntry);
blog.info("Blog entry <a href=\"" + blogEntry.getLocalPermalink() + "\">" + blogEntry.getTitle() + "</a> published.");
} catch (BlogServiceException be) {
throw new ServletException(be);
}
}