1 25 26 package com.j2biz.blogunity.web.actions.my; 27 28 import java.util.List ; 29 30 import javax.servlet.http.HttpServletRequest ; 31 import javax.servlet.http.HttpServletResponse ; 32 33 import org.apache.commons.logging.Log; 34 import org.apache.commons.logging.LogFactory; 35 36 import com.j2biz.blogunity.dao.EntryDAO; 37 import com.j2biz.blogunity.dao.TrackbackDAO; 38 import com.j2biz.blogunity.exception.BlogunityException; 39 import com.j2biz.blogunity.i18n.I18N; 40 import com.j2biz.blogunity.i18n.I18NStatusFactory; 41 import com.j2biz.blogunity.pojo.Entry; 42 import com.j2biz.blogunity.pojo.Trackback; 43 import com.j2biz.blogunity.web.ActionResultFactory; 44 import com.j2biz.blogunity.web.IActionResult; 45 import com.j2biz.blogunity.web.actions.AbstractAction; 46 47 51 public class ListTrackbacksAction extends AbstractAction { 52 53 56 private static final Log log = LogFactory.getLog(ListTrackbacksAction.class); 57 58 private static final IActionResult ENTRIES_LIST_FORWARD = ActionResultFactory 59 .buildForward("/jsp/my/listTrackbacks.jsp"); 60 61 67 public IActionResult execute(HttpServletRequest request, HttpServletResponse response) 68 throws BlogunityException { 69 70 String entryId = request.getParameter("id"); 71 if (entryId == null) { throw new BlogunityException(I18NStatusFactory.create( 72 I18N.ERRORS.ID_NOT_SETTED, "Entry")); } 73 74 if (log.isDebugEnabled()) { 75 log.debug("Get list of trackbacks for entry : " + entryId); 76 } 77 78 Entry e = (new EntryDAO()).getEntryByID(new Long (entryId)); 79 80 if (log.isDebugEnabled()) { 81 log.debug("Entry with ID='" + e.getId() + "' and TITLE='" + e.getTitle() + "' found"); 82 } 83 84 List trackbacks = (new TrackbackDAO()).getTrackbacksForEntryAndDirection(e.getId(), 85 Trackback.DIRECTION_INCOMING); 86 87 if (log.isDebugEnabled()) { 88 log.debug("Found " + trackbacks.size() + " trackbacks..."); 89 log.debug("Set attributes 'entry' and 'trackbacks' to request..."); 90 } 91 92 request.setAttribute("entry", e); 93 request.setAttribute("trackbacks", trackbacks); 94 95 navigationStack.push(ActionResultFactory.buildRedirect( 96 I18N.MESSAGES.NAVI_LIST_ENTRY_TRACKBACKS, currentActionPath)); 97 98 return ENTRIES_LIST_FORWARD; 99 } 100 101 } | Popular Tags |