View Javadoc
1   package org.kuali.ole.deliver.controller;
2   
3   import org.kuali.ole.deliver.bo.OlePatronDocument;
4   import org.kuali.rice.krad.web.controller.InquiryController;
5   import org.kuali.rice.krad.web.form.InquiryForm;
6   import org.kuali.rice.krad.web.form.MaintenanceDocumentForm;
7   import org.kuali.rice.krad.web.form.UifFormBase;
8   import org.springframework.stereotype.Controller;
9   import org.springframework.validation.BindingResult;
10  import org.springframework.web.bind.annotation.ModelAttribute;
11  import org.springframework.web.bind.annotation.RequestMapping;
12  import org.springframework.web.bind.annotation.RequestMethod;
13  import org.springframework.web.servlet.ModelAndView;
14  
15  import javax.servlet.http.HttpServletRequest;
16  import javax.servlet.http.HttpServletResponse;
17  
18  /**
19   * Created with IntelliJ IDEA.
20   * User: aurojyotit
21   * Date: 10/27/14
22   * Time: 5:07 PM
23   * To change this template use File | Settings | File Templates.
24   */
25  @Controller
26  @RequestMapping(value = "/olePatronInquiry")
27  public class OlePatronDocumentInquiryController extends InquiryController {
28  
29      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=hidePatronLoanedItem")
30      public ModelAndView hidePatronLoanedItem(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
31                                               HttpServletRequest request, HttpServletResponse response) {
32  
33          InquiryForm form = (InquiryForm) uifForm;
34          OlePatronDocument olePatronDocument=(OlePatronDocument)form.getDataObject();
35          olePatronDocument.setShowLoanedRecords(false);
36          return getUIFModelAndView(form);
37      }
38  
39      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=showPatronLoanedItem")
40      public ModelAndView showPatronLoanedItem(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
41                                               HttpServletRequest request, HttpServletResponse response) {
42          InquiryForm form = (InquiryForm) uifForm;
43          OlePatronDocument olePatronDocument=(OlePatronDocument)form.getDataObject();
44          olePatronDocument.setShowLoanedRecords(true);
45          return getUIFModelAndView(form);
46      }
47  
48      @Override
49      public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, HttpServletRequest request, HttpServletResponse response) {
50          return super.start(form, result, request, response);    //To change body of overridden methods use File | Settings | File Templates.
51      }
52  }