1 package org.kuali.ole.deliver.controller;
2
3 import org.kuali.ole.deliver.bo.OleDeliverRequestBo;
4 import org.kuali.ole.deliver.drools.DroolsExchange;
5 import org.kuali.ole.deliver.form.CheckinForm;
6 import org.kuali.ole.deliver.form.CircForm;
7 import org.kuali.rice.krad.util.GlobalVariables;
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 import java.util.HashMap;
18 import java.util.Map;
19
20
21
22
23
24 @Controller
25 @RequestMapping(value = "/autoCheckoutController")
26 public class AutoCheckoutController extends CircController {
27
28 @RequestMapping(params = "methodToCall=backgroundCheckout")
29 public ModelAndView backgroundCheckout(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
30 HttpServletRequest request, HttpServletResponse response) throws Exception {
31 CircForm circForm = (CircForm) form;
32 String formKey = request.getParameter("checkinFormKey");
33 CheckinForm checkinForm = (CheckinForm) GlobalVariables.getUifFormManager().getSessionForm(formKey);
34 if (null != checkinForm) {
35 circForm.setSelectedCirculationDesk(checkinForm.getSelectedCirculationDesk());
36 circForm.setAutoCheckout(true);
37 DroolsExchange droolsExchange = checkinForm.getDroolsExchange();
38 if (null != droolsExchange) {
39 OleDeliverRequestBo requestBo = (OleDeliverRequestBo) droolsExchange.getFromContext("requestBo");
40 if (null != requestBo) {
41 circForm.setPatronBarcode(requestBo.getBorrowerBarcode());
42 circForm.setItemBarcode(requestBo.getItemId());
43
44 }
45 }
46 }
47 ModelAndView modelAndView = searchPatron(circForm, result, request, response);
48 return modelAndView;
49 }
50
51 }