001package org.kuali.ole.deliver.controller; 002 003import org.apache.log4j.Logger; 004import org.kuali.ole.deliver.form.OleNoticeForm; 005import org.kuali.ole.deliver.service.OLEDeliverNoticeHelperService; 006import org.kuali.ole.deliver.service.impl.OLEDeliverNoticeHelperServiceImpl; 007import org.kuali.rice.krad.web.controller.UifControllerBase; 008import org.kuali.rice.krad.web.form.UifFormBase; 009import org.springframework.stereotype.Controller; 010import org.springframework.validation.BindingResult; 011import org.springframework.web.bind.annotation.ModelAttribute; 012import org.springframework.web.bind.annotation.RequestMapping; 013import org.springframework.web.servlet.ModelAndView; 014 015import javax.servlet.http.HttpServletRequest; 016import javax.servlet.http.HttpServletResponse; 017 018/** 019 * Created by maheswarang on 9/18/14. 020 */ 021@Controller 022@RequestMapping(value = "/oleNoticeController") 023public class OleNoticeController extends UifControllerBase { 024 private static final Logger LOG = Logger.getLogger(OleNoticeController.class); 025 026 private OLEDeliverNoticeHelperService oleDeliverNoticeHelperService; 027 028 public OLEDeliverNoticeHelperService getOleDeliverNoticeHelperService() { 029 if(oleDeliverNoticeHelperService == null){ 030 oleDeliverNoticeHelperService = new OLEDeliverNoticeHelperServiceImpl(); 031 } 032 return oleDeliverNoticeHelperService; 033 } 034 035 public void setOleDeliverNoticeHelperService(OLEDeliverNoticeHelperService oleDeliverNoticeHelperService) { 036 this.oleDeliverNoticeHelperService = oleDeliverNoticeHelperService; 037 } 038 039 040 @Override 041 protected OleNoticeForm createInitialForm(HttpServletRequest request) { 042 return new OleNoticeForm(); 043 } 044 045 @Override 046 @RequestMapping(params = "methodToCall=start") 047 public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, 048 HttpServletRequest request, HttpServletResponse response) { 049 return getUIFModelAndView(form); 050 } 051 052 @RequestMapping(params = "methodToCall=run") 053 public ModelAndView run(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, 054 HttpServletRequest request, HttpServletResponse response) { 055 try{ 056 getOleDeliverNoticeHelperService().updateDeliverNoticeForUnprocessedLoans(); 057 }catch (Exception e){ 058 LOG.info("Exception occured while running the job" + e.getMessage()); 059 } 060 return getUIFModelAndView(form); 061 } 062}