1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.stats.web;
18
19 import java.util.Map;
20
21 import javax.servlet.http.HttpServletRequest;
22 import javax.servlet.http.HttpServletResponse;
23
24 import org.apache.struts.action.ActionForm;
25 import org.apache.struts.action.ActionForward;
26 import org.apache.struts.action.ActionMapping;
27 import org.kuali.rice.kew.service.KEWServiceLocator;
28 import org.kuali.rice.kew.stats.Stats;
29 import org.kuali.rice.kew.stats.service.StatsService;
30 import org.kuali.rice.kew.web.KewKualiAction;
31
32
33
34
35
36
37
38
39
40
41 public class StatsAction extends KewKualiAction {
42
43 @Override
44 public ActionForward execute(ActionMapping mapping, ActionForm form,
45 HttpServletRequest request, HttpServletResponse response)
46 throws Exception {
47 initForm(mapping, request, form);
48 return super.execute(mapping, form, request, response);
49 }
50
51 public ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
52
53 StatsForm statForm = (StatsForm) form;
54
55 statForm.determineBeginDate();
56 statForm.determineEndDate();
57
58 StatsService statsService = this.getStatsService();
59 statsService.NumUsersReport(statForm.getStats());
60 statsService.DocumentsRoutedReport(statForm.getStats(), statForm.getBeginningDate(), statForm.getEndingDate());
61 statsService.NumActiveItemsReport(statForm.getStats());
62 statsService.NumberOfDocTypesReport(statForm.getStats());
63 statsService.NumInitiatedDocsByDocTypeReport(statForm.getStats());
64
65 return mapping.findForward("basic");
66
67 }
68
69 public void initForm(ActionMapping mapping, HttpServletRequest request, ActionForm form) {
70 StatsForm statForm = (StatsForm) form;
71 Map dropDownMap = statForm.makePerUnitOfTimeDropDownMap();
72 request.setAttribute("timeUnitDropDown", dropDownMap);
73 statForm.validateDates();
74 }
75
76 public StatsService getStatsService() {
77 return (StatsService) KEWServiceLocator.getService(KEWServiceLocator.STATS_SERVICE);
78 }
79
80 }