View Javadoc
1   package org.kuali.ole.deliver.controller.checkin;
2   
3   import org.kuali.ole.deliver.bo.OleLoanDocument;
4   import org.kuali.ole.deliver.drools.CheckedInItem;
5   import org.kuali.ole.deliver.drools.DroolsExchange;
6   import org.kuali.ole.deliver.form.CheckinForm;
7   import org.kuali.ole.deliver.form.OLEForm;
8   import org.kuali.ole.docstore.engine.service.storage.rdbms.pojo.ItemRecord;
9   import org.kuali.rice.krad.util.GlobalVariables;
10  
11  import java.util.Date;
12  
13  /**
14   * Created by chenchulakshmig on 8/21/15.
15   */
16  public class CheckinUIController extends CheckinBaseController {
17  
18      @Override
19      protected void setDataElements(OLEForm oleForm, ItemRecord itemRecord, OleLoanDocument loanDocument) {
20          CheckinForm checkinForm = getCheckinForm(oleForm);
21          checkinForm.getDroolsExchange().addToContext("itemRecord", itemRecord);
22          checkinForm.getDroolsExchange().addToContext("oleLoanDocument", loanDocument);
23          if (loanDocument != null) {
24              checkinForm.getDroolsExchange().addToContext("olePatronDocument", loanDocument.getOlePatron());
25          }
26      }
27  
28      public CheckinForm getCheckinForm(OLEForm oleForm) {
29          return (CheckinForm) oleForm;
30      }
31  
32      @Override
33      public String getItemBarcode(OLEForm oleForm) {
34          return getCheckinForm(oleForm).getItemBarcode();
35      }
36  
37      @Override
38      public String getSelectedCirculationDesk(OLEForm oleForm) {
39          return getCheckinForm(oleForm).getSelectedCirculationDesk();
40      }
41  
42      @Override
43      public Date getCustomDueDateMap(OLEForm oleForm) {
44          return getCheckinForm(oleForm).getCustomDueDateMap();
45      }
46  
47      @Override
48      public String getCustomDueDateTime(OLEForm oleForm) {
49          return getCheckinForm(oleForm).getCustomDueDateTime();
50      }
51  
52      @Override
53      public void setCheckedInItem(CheckedInItem checkedInItem, OLEForm oleForm) {
54          getCheckinForm(oleForm).setCheckedInItem(checkedInItem);
55      }
56  
57      @Override
58      public CheckedInItem getCheckedInItem(OLEForm oleForm) {
59          return getCheckinForm(oleForm).getCheckedInItem();
60      }
61  
62      @Override
63      public void addCheckedInItemToCheckedInItemList(CheckedInItem checkedInItem, OLEForm oleForm) {
64          getCheckinForm(oleForm).getCheckedInItemList().add(0, checkedInItem);
65      }
66  
67      @Override
68      public boolean isRecordNoteForDamagedItem(OLEForm oleForm) {
69          return getCheckinForm(oleForm).isRecordNoteForDamagedItem();
70      }
71  
72      @Override
73      public boolean isRecordNoteForClaimsReturn(OLEForm oleForm) {
74          return getCheckinForm(oleForm).isRecordNoteForClaimsReturn();
75      }
76  
77      @Override
78      public boolean isRecordNoteForMissingPiece(OLEForm oleForm) {
79          return getCheckinForm(oleForm).isRecordNoteForMissingPiece();
80      }
81  
82      @Override
83      public String getMissingPieceMatchCheck(OLEForm oleForm) {
84          return getCheckinForm(oleForm).getMissingPieceMatchCheck();
85      }
86  
87      @Override
88      public void setNoOfPieces(OLEForm oleForm, String numberOfPieces) {
89          getCheckinForm(oleForm).setNoOfPieces(numberOfPieces);
90      }
91  
92      @Override
93      public OleLoanDocument getOleLoanDocument(OLEForm oleForm) {
94          return (OleLoanDocument) oleForm.getDroolsExchange().getContext().get("oleLoanDocument");
95      }
96  
97      @Override
98      public DroolsExchange getDroolsExchange(OLEForm oleForm) {
99          return getCheckinForm(oleForm).getDroolsExchange();
100     }
101 
102     @Override
103     public String getOperatorId(OLEForm oleForm) {
104         return GlobalVariables.getUserSession().getPrincipalId();
105     }
106 }