View Javadoc
1   package org.kuali.ole.deliver.controller;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.kuali.ole.deliver.controller.checkin.CheckinItemController;
5   import org.kuali.ole.deliver.drools.DroolsExchange;
6   import org.kuali.ole.deliver.form.CheckinForm;
7   import org.kuali.ole.deliver.util.OleItemRecordForCirc;
8   import org.kuali.ole.deliver.util.printSlip.OlePrintSlipUtil;
9   import org.kuali.rice.krad.util.GlobalVariables;
10  import org.kuali.rice.krad.web.form.UifFormBase;
11  import org.springframework.stereotype.Controller;
12  import org.springframework.validation.BindingResult;
13  import org.springframework.web.bind.annotation.ModelAttribute;
14  import org.springframework.web.bind.annotation.RequestMapping;
15  
16  import javax.servlet.http.HttpServletRequest;
17  import javax.servlet.http.HttpServletResponse;
18  
19  /**
20   * Created by sheiksalahudeenm on 8/28/15.
21   */
22  @Controller
23  @RequestMapping(value = "/printBillcontroller")
24  public class PrintBillController extends CheckinItemController {
25  
26  
27      @RequestMapping(params = "methodToCall=printBill")
28      public void printBill(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
29                            HttpServletRequest request, HttpServletResponse response) {
30          String formKey = request.getParameter("checkinFormKey");
31          CheckinForm checkinForm = (CheckinForm) GlobalVariables.getUifFormManager().getSessionForm(formKey);
32          if (null != checkinForm) {
33              printSlip(checkinForm, response);
34          }
35      }
36  
37      public void printSlip(CheckinForm checkinForm, HttpServletResponse response) {
38          DroolsExchange droolsExchange = checkinForm.getDroolsExchange();
39          if(null != droolsExchange){
40              OleItemRecordForCirc oleItemRecordForCirc = (OleItemRecordForCirc) droolsExchange.getFromContext("oleItemRecordForCirc");
41              if(null != oleItemRecordForCirc){
42                  OlePrintSlipUtil oleRegularPrintSlipUtil = getCheckinUIController(checkinForm).getOlePrintSlipUtil(oleItemRecordForCirc);
43                  if (null != oleRegularPrintSlipUtil) {
44                      oleRegularPrintSlipUtil.createPdfForPrintingSlip(oleItemRecordForCirc, response);
45                  }
46              }
47          }
48      }
49  
50  }