01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.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.apache.struts.action.ActionMessages;
28:
29: import edu.iu.uis.eden.KEWServiceLocator;
30: import edu.iu.uis.eden.stats.Stats;
31: import edu.iu.uis.eden.stats.StatsService;
32: import edu.iu.uis.eden.web.WorkflowAction;
33:
34: /**
35: * A Struts Action for compiling and displaying statistics about the KEW application.
36: *
37: * @see Stats
38: * @see StatsService
39: *
40: * @author temay
41: */
42: public class StatsAction extends WorkflowAction {
43:
44: public ActionForward start(ActionMapping mapping, ActionForm form,
45: HttpServletRequest request, HttpServletResponse response)
46: throws Exception {
47:
48: StatsForm statForm = (StatsForm) form;
49:
50: statForm.determineBeginDate();
51: statForm.determineEndDate();
52:
53: this .getStatsService().NumUsersReport(statForm.getStats());
54: this .getStatsService()
55: .NumActiveItemsReport(statForm.getStats());
56: this .getStatsService().DocumentsRoutedReport(
57: statForm.getStats(), statForm.getBeginningDate(),
58: statForm.getEndingDate());
59: this .getStatsService().NumberOfDocTypesReport(
60: statForm.getStats());
61: this .getStatsService().ActionsTakenPerUnitOfTimeReport(
62: statForm.getStats(), statForm.getBeginningDate(),
63: statForm.getEndingDate(),
64: statForm.getAvgActionsPerTimeUnit());
65: this .getStatsService().NumInitiatedDocsByDocTypeReport(
66: statForm.getStats());
67:
68: return mapping.findForward("basic");
69:
70: }
71:
72: public ActionMessages establishRequiredState(
73: HttpServletRequest request, ActionForm form) {
74: StatsForm statForm = (StatsForm) form;
75:
76: Map dropDownMap = statForm.makePerUnitOfTimeDropDownMap();
77: request.setAttribute("timeUnitDropDown", dropDownMap);
78: return null;
79: }
80:
81: public StatsService getStatsService() {
82: return (StatsService) KEWServiceLocator
83: .getService(KEWServiceLocator.STATS_SERVICE);
84: }
85:
86: }
|