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-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 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  
  * A Struts Action for compiling and displaying statistics about the KEW application.
 34  
  *
 35  
  * @see Stats
 36  
  * @see StatsService
 37  
  *
 38  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 39  
  */
 40  0
 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  0
         initForm(mapping, request, form);
 47  0
         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  0
             StatsForm statForm = (StatsForm) form;
 53  
 
 54  0
             statForm.determineBeginDate();
 55  0
             statForm.determineEndDate();
 56  
 
 57  0
             StatsService statsService = this.getStatsService();
 58  0
             statsService.NumUsersReport(statForm.getStats());
 59  0
             statsService.DocumentsRoutedReport(statForm.getStats(), statForm.getBeginningDate(), statForm.getEndingDate());
 60  0
             statsService.NumActiveItemsReport(statForm.getStats());
 61  0
             statsService.NumberOfDocTypesReport(statForm.getStats());
 62  0
             statsService.NumInitiatedDocsByDocTypeReport(statForm.getStats());
 63  
 
 64  0
             return mapping.findForward("basic");
 65  
 
 66  
     }
 67  
 
 68  
     public void initForm(ActionMapping mapping, HttpServletRequest request, ActionForm form) {
 69  0
         StatsForm statForm = (StatsForm) form;
 70  0
         Map dropDownMap = statForm.makePerUnitOfTimeDropDownMap();
 71  0
         request.setAttribute("timeUnitDropDown", dropDownMap);
 72  0
         statForm.validateDates();
 73  0
     }
 74  
 
 75  
     public StatsService getStatsService() {
 76  0
         return (StatsService) KEWServiceLocator.getService(KEWServiceLocator.STATS_SERVICE);
 77  
     }
 78  
 
 79  
 }