| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 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 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
@Controller |
| 40 | |
@RequestMapping(value = "/stats") |
| 41 | 0 | public class StatsController extends UifControllerBase { |
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
@Override |
| 49 | |
protected UifFormBase createInitialForm(HttpServletRequest request) { |
| 50 | 0 | return new StatsForm(); |
| 51 | |
} |
| 52 | |
|
| 53 | |
@Override |
| 54 | |
@RequestMapping(params = "methodToCall=start") |
| 55 | |
public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
| 56 | |
HttpServletRequest request, HttpServletResponse response) { |
| 57 | |
|
| 58 | 0 | StatsForm statForm = (StatsForm) form; |
| 59 | |
|
| 60 | |
try{ |
| 61 | 0 | statForm.determineBeginDate(); |
| 62 | 0 | statForm.determineEndDate(); |
| 63 | |
|
| 64 | 0 | StatsService statsService = this.getStatsService(); |
| 65 | 0 | statsService.NumUsersReport(statForm.getStats()); |
| 66 | 0 | statsService.DocumentsRoutedReport(statForm.getStats(), statForm.getBeginningDate(), statForm.getEndingDate()); |
| 67 | 0 | statsService.NumActiveItemsReport(statForm.getStats()); |
| 68 | 0 | statsService.NumberOfDocTypesReport(statForm.getStats()); |
| 69 | 0 | statsService.NumInitiatedDocsByDocTypeReport(statForm.getStats()); |
| 70 | |
|
| 71 | 0 | }catch (Exception e) { |
| 72 | 0 | throw new RuntimeException(e); |
| 73 | 0 | } |
| 74 | |
|
| 75 | 0 | return super.start(statForm, result, request, response); |
| 76 | |
} |
| 77 | |
|
| 78 | |
public StatsService getStatsService() { |
| 79 | 0 | return (StatsService) KEWServiceLocator.getService(KEWServiceLocator.STATS_SERVICE); |
| 80 | |
} |
| 81 | |
} |