View Javadoc
1   /**
2    * Copyright 2005-2015 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 org.kuali.rice.krad.lookup;
17  
18  import org.kuali.rice.krad.util.KRADConstants;
19  import org.kuali.rice.krad.web.controller.UifControllerBase;
20  import org.kuali.rice.krad.web.form.UifFormBase;
21  import org.kuali.rice.krad.web.service.CollectionControllerService;
22  import org.kuali.rice.krad.web.service.ControllerService;
23  import org.springframework.beans.factory.annotation.Autowired;
24  import org.springframework.beans.factory.annotation.Qualifier;
25  import org.springframework.stereotype.Controller;
26  import org.springframework.web.bind.annotation.RequestMapping;
27  import org.springframework.web.bind.annotation.RequestMethod;
28  import org.springframework.web.servlet.ModelAndView;
29  import org.springframework.web.servlet.mvc.support.RedirectAttributes;
30  
31  /**
32   * Controller that handles requests for a {@link LookupView}.
33   *
34   * @author Kuali Rice Team (rice.collab@kuali.org)
35   */
36  @Controller
37  @RequestMapping(value = KRADConstants.ControllerMappings.LOOKUP)
38  public class LookupController extends UifControllerBase {
39  
40      /**
41       * {@inheritDoc}
42       */
43      @Override
44      protected LookupForm createInitialForm() {
45          return new LookupForm();
46      }
47  
48      /**
49       * @see LookupControllerService#search(org.kuali.rice.krad.lookup.LookupForm)
50       */
51      @RequestMapping(params = "methodToCall=search")
52      public ModelAndView search(LookupForm lookupForm) {
53          return getControllerService().search(lookupForm);
54      }
55  
56      /**
57       * @see LookupControllerService#clearValues(org.kuali.rice.krad.lookup.LookupForm)
58       */
59      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=clearValues")
60      public ModelAndView clearValues(LookupForm lookupForm) {
61          return getControllerService().clearValues(lookupForm);
62      }
63  
64      /**
65       * @see LookupControllerService#selectAllPages(org.kuali.rice.krad.lookup.LookupForm)
66       */
67      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=selectAllPages")
68      public ModelAndView selectAllPages(LookupForm lookupForm) {
69          return getControllerService().selectAllPages(lookupForm);
70      }
71  
72      /**
73       * @see LookupControllerService#deselectAllPages(org.kuali.rice.krad.lookup.LookupForm)
74       */
75      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deselectAllPages")
76      public ModelAndView deselectAllPages(LookupForm lookupForm) {
77          return getControllerService().deselectAllPages(lookupForm);
78      }
79  
80      /**
81       * {@inheritDoc}
82       */
83      @Override
84      @RequestMapping(params = "methodToCall=retrieveCollectionPage")
85      public ModelAndView retrieveCollectionPage(UifFormBase form) {
86          return getCollectionControllerService().retrieveCollectionPage(form);
87      }
88  
89      /**
90       * {@inheritDoc}
91       */
92      @Override
93      @RequestMapping(method = RequestMethod.GET, params = "methodToCall=tableJsonRetrieval")
94      public ModelAndView tableJsonRetrieval(UifFormBase form) {
95          return getCollectionControllerService().tableJsonRetrieval(form);
96      }
97  
98      /**
99       * @see LookupControllerService#returnSelected(org.kuali.rice.krad.lookup.LookupForm,
100      * org.springframework.web.servlet.mvc.support.RedirectAttributes)
101      */
102     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=returnSelected")
103     public String returnSelected(LookupForm lookupForm, final RedirectAttributes redirectAttributes) {
104         return getControllerService().returnSelected(lookupForm, redirectAttributes);
105     }
106 
107     @Override
108     protected LookupControllerService getControllerService() {
109         return (LookupControllerService) super.getControllerService();
110     }
111 
112     @Override
113     @Autowired
114     @Qualifier("lookupControllerService")
115     public void setControllerService(ControllerService controllerService) {
116         super.setControllerService(controllerService);
117     }
118 
119     @Override
120     @Autowired
121     @Qualifier("lookupCollectionControllerService")
122     public void setCollectionControllerService(CollectionControllerService collectionControllerService) {
123         super.setCollectionControllerService(collectionControllerService);
124     }
125 
126 }