1 package org.itracker.web.actions.admin.attachment;
2
3 import javax.servlet.http.HttpServletRequest;
4 import javax.servlet.http.HttpServletResponse;
5
6 import org.apache.log4j.Logger;
7 import org.apache.struts.action.ActionForm;
8 import org.apache.struts.action.ActionForward;
9 import org.apache.struts.action.ActionMapping;
10 import org.itracker.services.IssueService;
11 import org.itracker.web.actions.base.ItrackerBaseAction;
12 import org.itracker.web.ptos.ListAttachmentsPTO;
13
14
15 public class ListAttachmentsAction extends ItrackerBaseAction {
16 private static final String TITLE_KEY = "itracker.web.admin.listattachments.title";
17 private static final String LIST_ATTACHMENTS_PAGE = "listattachments";
18 private static final Logger log = Logger.getLogger(ListAttachmentsAction.class);
19
20 public ActionForward execute(ActionMapping mapping,
21 ActionForm form,
22 HttpServletRequest request,
23 HttpServletResponse response)
24 throws Exception {
25
26 IssueService issueService = this.getITrackerServices().getIssueService();
27 ListAttachmentsPTO pto = new ListAttachmentsPTO();
28 try {
29 pto.setAttachments(issueService.getAllIssueAttachments());
30 } catch (Exception e) {
31 log.error("execute: failed to get all attachments", e);
32 throw e;
33 }
34 request.setAttribute("pageTitleKey", TITLE_KEY);
35 request.setAttribute("pageTitleArg", "");
36 request.setAttribute("pto", pto);
37 return mapping.findForward(LIST_ATTACHMENTS_PAGE);
38 }
39 }