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