View Javadoc
1   package org.itracker.web.actions.admin.report;
2   
3   import org.apache.struts.action.ActionForm;
4   import org.apache.struts.action.ActionForward;
5   import org.apache.struts.action.ActionMapping;
6   import org.itracker.model.Report;
7   import org.itracker.services.ProjectService;
8   import org.itracker.services.ReportService;
9   import org.itracker.web.actions.base.ItrackerBaseAction;
10  import org.itracker.web.util.ServletContextUtils;
11  
12  import javax.servlet.http.HttpServletRequest;
13  import javax.servlet.http.HttpServletResponse;
14  import java.util.List;
15  
16  
17  public class ListReportsAction extends ItrackerBaseAction {
18  
19      public ActionForward execute(ActionMapping mapping, ActionForm form,
20                                   HttpServletRequest request, HttpServletResponse response)
21              throws Exception {
22  
23          ProjectService projectService = ServletContextUtils.getItrackerServices().getProjectService();
24          ReportService reportService = ServletContextUtils.getItrackerServices().getReportService();
25          request.setAttribute("ph", projectService);
26          request.setAttribute("rh", reportService);
27  
28          List<Report> reports = reportService.getAllReports();
29          request.setAttribute("reports", reports);
30  
31          return mapping.findForward("listreportsadmin");
32      }
33  
34      public ListReportsAction() {
35          super();
36      }
37  
38  }