}
return mapping.findForward("view");
}
public ActionForward addComment(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
BlogArticleCommentForm f = (BlogArticleCommentForm)form;
BlogManager blogMgr = new BlogManager(locale, session);
Article article = blogMgr.getArticle(f.getArticleId());
if (article == null) {
throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", f.getArticleId()));
}
Set<Long> permissions = getPermissions(article.getBlog(), webUser);
if (!permissions.contains(PermissionManager.ADD_COMMENT_PERMISSION)) {
throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
}
if (f.getContent() != null && f.getContent().trim().length() > 0) {
Comment comment = blogMgr.addComment(article, f.getContent(), webUser);
LOGGER.info("User "+UserManagerBase.toString(webUser)+" added comment #"+comment.getId()+" to article #"+article.getId()+" ("+article.getTitle()+") of blog #"+article.getBlog().getId()+" ("+article.getBlog().getName()+")");
}
ActionForward fwd = injectId(mapping.findForward("view"), f.getArticleId());
return fwd;
}