Coverage Report - org.kuali.rice.kew.stats.web.StatsAction
 
Classes in this File Line Coverage Branch Coverage Complexity
StatsAction
0%
0/19
N/A
1
 
 1  
 /*
 2  
  * Copyright 2005-2008 The Kuali Foundation
 3  
  *
 4  
  *
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  * http://www.opensource.org/licenses/ecl2.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 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  
  * A Struts Action for compiling and displaying statistics about the KEW application.
 35  
  *
 36  
  * @see Stats
 37  
  * @see StatsService
 38  
  *
 39  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 40  
  */
 41  0
 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  0
         initForm(mapping, request, form);
 48  0
         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  0
             StatsForm statForm = (StatsForm) form;
 54  
 
 55  0
             statForm.determineBeginDate();
 56  0
             statForm.determineEndDate();
 57  
 
 58  0
             StatsService statsService = this.getStatsService();
 59  0
             statsService.NumUsersReport(statForm.getStats());
 60  0
             statsService.DocumentsRoutedReport(statForm.getStats(), statForm.getBeginningDate(), statForm.getEndingDate());
 61  0
             statsService.NumActiveItemsReport(statForm.getStats());
 62  0
             statsService.NumberOfDocTypesReport(statForm.getStats());
 63  0
             statsService.NumInitiatedDocsByDocTypeReport(statForm.getStats());
 64  
 
 65  0
             return mapping.findForward("basic");
 66  
 
 67  
     }
 68  
 
 69  
     public void initForm(ActionMapping mapping, HttpServletRequest request, ActionForm form) {
 70  0
         StatsForm statForm = (StatsForm) form;
 71  0
         Map dropDownMap = statForm.makePerUnitOfTimeDropDownMap();
 72  0
         request.setAttribute("timeUnitDropDown", dropDownMap);
 73  0
         statForm.validateDates();
 74  0
     }
 75  
 
 76  
     public StatsService getStatsService() {
 77  0
         return (StatsService) KEWServiceLocator.getService(KEWServiceLocator.STATS_SERVICE);
 78  
     }
 79  
 
 80  
 }