Coverage Report - edu.sampleu.kew.krad.controller.StatsController
 
Classes in this File Line Coverage Branch Coverage Complexity
StatsController
0%
0/17
N/A
1.667
 
 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 edu.sampleu.kew.krad.controller;
 17  
 
 18  
 import javax.servlet.http.HttpServletRequest;
 19  
 import javax.servlet.http.HttpServletResponse;
 20  
 
 21  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 22  
 import org.kuali.rice.kew.stats.service.StatsService;
 23  
 import org.kuali.rice.krad.web.controller.UifControllerBase;
 24  
 import org.kuali.rice.krad.web.form.UifFormBase;
 25  
 import org.springframework.stereotype.Controller;
 26  
 import org.springframework.validation.BindingResult;
 27  
 import org.springframework.web.bind.annotation.ModelAttribute;
 28  
 import org.springframework.web.bind.annotation.RequestMapping;
 29  
 import org.springframework.web.servlet.ModelAndView;
 30  
 
 31  
 import edu.sampleu.kew.krad.form.StatsForm;
 32  
 
 33  
 /**
 34  
  * This is a description of what this class does - Venkat don't forget to fill this in. 
 35  
  * 
 36  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 37  
  *
 38  
  */
 39  0
 @Controller
 40  
 @RequestMapping(value = "/stats")
 41  0
 public class StatsController extends UifControllerBase {
 42  
 
 43  
     /**
 44  
      * @see org.kuali.rice.krad.web.controller.UifControllerBase#createInitialForm(javax.servlet.http.HttpServletRequest)
 45  
      */
 46  
     @Override
 47  
     protected StatsForm createInitialForm(HttpServletRequest request) {
 48  0
         return new StatsForm();
 49  
     }
 50  
 
 51  
         @Override
 52  
         @RequestMapping(params = "methodToCall=start")
 53  
         public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
 54  
                         HttpServletRequest request, HttpServletResponse response) {
 55  
 
 56  0
                 StatsForm statForm = (StatsForm) form;
 57  
 
 58  
                 try{
 59  0
                 statForm.determineBeginDate();
 60  0
                 statForm.determineEndDate();
 61  
         
 62  0
                 StatsService statsService = this.getStatsService();
 63  0
                 statsService.NumUsersReport(statForm.getStats());
 64  0
                 statsService.DocumentsRoutedReport(statForm.getStats(), statForm.getBeginningDate(), statForm.getEndingDate());
 65  0
                 statsService.NumActiveItemsReport(statForm.getStats());
 66  0
                 statsService.NumberOfDocTypesReport(statForm.getStats());
 67  0
                 statsService.NumInitiatedDocsByDocTypeReport(statForm.getStats());
 68  
                 
 69  0
                 }catch (Exception e) {
 70  0
                         throw new RuntimeException(e);
 71  0
                 }
 72  
         
 73  0
                 return super.start(statForm, result, request, response);
 74  
         }
 75  
         
 76  
          public StatsService getStatsService() {
 77  0
         return (StatsService) KEWServiceLocator.getService(KEWServiceLocator.STATS_SERVICE);
 78  
     }
 79  
 }