1 package org.kuali.ole.deliver.controller;
2
3 import org.apache.log4j.Logger;
4 import org.kuali.ole.deliver.form.OleNoticeForm;
5 import org.kuali.ole.deliver.service.OLEDeliverNoticeHelperService;
6 import org.kuali.ole.deliver.service.impl.OLEDeliverNoticeHelperServiceImpl;
7 import org.kuali.rice.krad.web.controller.UifControllerBase;
8 import org.kuali.rice.krad.web.form.UifFormBase;
9 import org.springframework.stereotype.Controller;
10 import org.springframework.validation.BindingResult;
11 import org.springframework.web.bind.annotation.ModelAttribute;
12 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.servlet.ModelAndView;
14
15 import javax.servlet.http.HttpServletRequest;
16 import javax.servlet.http.HttpServletResponse;
17
18
19
20
21 @Controller
22 @RequestMapping(value = "/oleNoticeController")
23 public class OleNoticeController extends UifControllerBase {
24 private static final Logger LOG = Logger.getLogger(OleNoticeController.class);
25
26 private OLEDeliverNoticeHelperService oleDeliverNoticeHelperService;
27
28 public OLEDeliverNoticeHelperService getOleDeliverNoticeHelperService() {
29 if(oleDeliverNoticeHelperService == null){
30 oleDeliverNoticeHelperService = new OLEDeliverNoticeHelperServiceImpl();
31 }
32 return oleDeliverNoticeHelperService;
33 }
34
35 public void setOleDeliverNoticeHelperService(OLEDeliverNoticeHelperService oleDeliverNoticeHelperService) {
36 this.oleDeliverNoticeHelperService = oleDeliverNoticeHelperService;
37 }
38
39
40 @Override
41 protected OleNoticeForm createInitialForm(HttpServletRequest request) {
42 return new OleNoticeForm();
43 }
44
45 @Override
46 @RequestMapping(params = "methodToCall=start")
47 public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
48 HttpServletRequest request, HttpServletResponse response) {
49 return getUIFModelAndView(form);
50 }
51
52 @RequestMapping(params = "methodToCall=run")
53 public ModelAndView run(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
54 HttpServletRequest request, HttpServletResponse response) {
55 try{
56 getOleDeliverNoticeHelperService().updateDeliverNoticeForUnprocessedLoans();
57 }catch (Exception e){
58 LOG.info("Exception occured while running the job" + e.getMessage());
59 }
60 return getUIFModelAndView(form);
61 }
62 }