if (webUser == null){
throw new InputException(getResources(req).getMessage(locale, "blog.AnonymousEditingNotAllowed"));
}
BlogManager blogMgr = new BlogManager(locale, session);
String idParam = req.getParameter("id");
Comment comment = blogMgr.getComment(Long.parseLong(idParam));
if (comment == null) {
throw new InputException(getLocalizedMessage("BloggingWeb", "blog.CommentNotFound", idParam));
}
Set<Long> permissions = getPermissions(comment.getArticle().getBlog(), webUser);
if (!permissions.contains(PermissionManager.WRITE_PERMISSION)) {
throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
}
Long id = comment.getArticle().getId();
blogMgr.deleteComment(comment);
LOGGER.info("User "+UserManagerBase.toString(webUser)+" deleted comment #"+comment.getId()+" ("+comment.getContent()+") of article #"+comment.getArticle().getId()+" ("+comment.getArticle().getTitle()+") of blog #"+comment.getArticle().getBlog().getId()+" ("+comment.getArticle().getBlog().getName()+")");
return injectId(mapping.findForward("deleted"), id);
}