1 25 26 package com.j2biz.blogunity.web.actions.my; 27 28 import javax.servlet.http.HttpServletRequest ; 29 import javax.servlet.http.HttpServletResponse ; 30 31 import org.apache.commons.lang.StringUtils; 32 33 import com.j2biz.blogunity.dao.BlogDAO; 34 import com.j2biz.blogunity.exception.BlogunityException; 35 import com.j2biz.blogunity.i18n.I18N; 36 import com.j2biz.blogunity.i18n.I18NStatusFactory; 37 import com.j2biz.blogunity.pojo.Blog; 38 import com.j2biz.blogunity.web.ActionResultFactory; 39 import com.j2biz.blogunity.web.IActionResult; 40 41 49 public class OverwriteBlogThemeConfirmAction extends MyAbstractAction { 50 51 private static final IActionResult DELETE_CONFIRM_FORWARD = ActionResultFactory 52 .buildForward("/jsp/my/overwriteBlogThemeConfirm.jsp"); 53 54 60 public IActionResult execute(HttpServletRequest request, HttpServletResponse response) 61 throws BlogunityException { 62 63 String blogId = request.getParameter("blogId"); 64 65 if (StringUtils.isEmpty(blogId)) { throw new BlogunityException(I18NStatusFactory.create( 66 I18N.ERRORS.ID_NOT_SETTED, "blog")); } 67 68 String themeDir = request.getParameter("themeDir"); 69 if (StringUtils.isEmpty(themeDir)) { throw new BlogunityException(I18NStatusFactory.create( 70 I18N.ERRORS.NOT_FOUND, "theme")); } 71 72 Blog b = (new BlogDAO()).getBlogByID(Long.parseLong(blogId)); 73 74 if (user.getId().longValue() != b.getFounder().getId().longValue() 75 && !user.isAdministrator()) 76 throw new BlogunityException(I18NStatusFactory 77 .create(I18N.ERRORS.USER_NOT_AUTHORIZED_FOR_EXECUTION)); 78 79 request.setAttribute("requestedBlog", b); 80 request.setAttribute("themeDir", themeDir); 81 82 navigationStack.push(ActionResultFactory.buildRedirect( 83 I18N.MESSAGES.NAVI_OVERWRITE_BLOG_THEME, currentActionPath)); 84 85 return DELETE_CONFIRM_FORWARD; 86 } 87 88 } | Popular Tags |