View Javadoc
1   package org.kuali.ole.deliver.controller.checkin;
2   
3   import org.apache.commons.lang3.StringUtils;
4   import org.kuali.ole.OLEConstants;
5   import org.kuali.ole.deliver.bo.OleLoanDocument;
6   import org.kuali.ole.deliver.controller.OLEUifControllerBase;
7   import org.kuali.ole.deliver.drools.DroolsConstants;
8   import org.kuali.ole.deliver.form.CheckinForm;
9   import org.kuali.ole.deliver.keyvalue.CirculationDeskChangeKeyValue;
10  import org.kuali.ole.deliver.service.ParameterValueResolver;
11  import org.kuali.ole.deliver.util.DroolsResponse;
12  import org.kuali.ole.deliver.util.OleItemRecordForCirc;
13  import org.kuali.ole.docstore.engine.service.storage.rdbms.pojo.ItemRecord;
14  import org.kuali.rice.core.api.config.property.ConfigContext;
15  import org.kuali.rice.core.api.util.KeyValue;
16  import org.kuali.rice.kim.api.permission.PermissionService;
17  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
18  import org.kuali.rice.krad.exception.DocumentAuthorizationException;
19  import org.kuali.rice.krad.util.GlobalVariables;
20  import org.kuali.rice.krad.web.form.UifFormBase;
21  import org.springframework.stereotype.Controller;
22  import org.springframework.validation.BindingResult;
23  import org.springframework.web.bind.annotation.ModelAttribute;
24  import org.springframework.web.bind.annotation.RequestMapping;
25  import org.springframework.web.servlet.ModelAndView;
26  
27  import javax.servlet.http.HttpServletRequest;
28  import javax.servlet.http.HttpServletResponse;
29  import java.util.Date;
30  import java.util.HashMap;
31  import java.util.List;
32  import java.util.Map;
33  
34  /**
35   * Created by pvsubrah on 7/22/15.
36   */
37  @Controller
38  @RequestMapping(value = "/checkincontroller")
39  public class CheckinItemController extends OLEUifControllerBase {
40      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CheckinItemController.class);
41  
42      private Map<String, CheckinUIController> checkinUIControllerMap = new HashMap<>();
43  
44      @Override
45      protected UifFormBase createInitialForm(HttpServletRequest request) {
46          return new CheckinForm();
47      }
48  
49      @Override
50      public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, HttpServletRequest request, HttpServletResponse response) {
51          CheckinForm checkinForm = null;
52  
53  
54          if (form.getViewId().equalsIgnoreCase("checkinView")) {
55              String formKey = request.getParameter("formKey");
56  
57              if (null == formKey) {
58                  checkinForm = (CheckinForm) form;
59              } else {
60                  checkinForm = (CheckinForm) GlobalVariables.getUifFormManager().getSessionForm(formKey);
61                  /* OLE-8186 : Modified for fixing browser backward and forward button functionality.*/
62                  if(checkinForm.getView() == null) {
63                      checkinForm = (CheckinForm) form;
64                  }
65              }
66  
67              initCheckinForm(checkinForm);
68              setPrincipalInfo(checkinForm);
69  
70              List<KeyValue> keyValues = new CirculationDeskChangeKeyValue().getKeyValues();
71              if (keyValues.isEmpty()) {
72                  throw new DocumentAuthorizationException(GlobalVariables.getUserSession().getPrincipalId(), "not Authorized", form.getViewId());
73              } else {
74                  checkinForm.setSelectedCirculationDesk(keyValues.get(0).getValue());
75                  checkinForm.setPreviouslySelectedCirculationDesk(checkinForm.getSelectedCirculationDesk());
76              }
77          }
78          String maxTimeoutCount = ParameterValueResolver.getInstance().getParameter(OLEConstants
79                  .APPL_ID, OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT, OLEConstants.MAX_TIME_CHECK_IN);
80          checkinForm.setMaxSessionTime(maxTimeoutCount);
81          return super.start(checkinForm, result, request, response);
82      }
83  
84      private void initCheckinForm(CheckinForm checkinForm) {
85          checkinForm.setCustomDueDateMap(new Date());
86      }
87  
88      @Override
89      @RequestMapping(params = "methodToCall=refresh")
90      public ModelAndView refresh(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
91                                  HttpServletRequest request, HttpServletResponse response) throws Exception {
92          CheckinForm checkinForm = (CheckinForm) form;
93          checkinForm.setDroolsExchange(null);
94  
95          DroolsResponse droolsResponse = getCheckinUIController(checkinForm).checkin(checkinForm);
96  
97          if (null != droolsResponse && StringUtils.isBlank(droolsResponse.getErrorMessage().getErrorMessage())) {
98              postCheckinProcess(checkinForm, result, request, response);
99          } else if (droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.ITEM_DAMAGED)) {
100             handleDamagedItemProcess(request, response, checkinForm, droolsResponse);
101         } else if (droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.ITEM_CLAIMS_RETURNED)) {
102             handleClaimsReturnedProcess(request, response, checkinForm, droolsResponse);
103         } else if (droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.ITEM_MISSING_PIECE)) {
104             handleMissingPieceProcess(request, response, checkinForm, droolsResponse);
105         } else if (droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.CHECKIN_REQUEST_EXITS_FOR_THIS_ITEM)) {
106             handleCheckinRequestExistsProcess(request, response, checkinForm, droolsResponse);
107         } else {
108             checkinForm.setErrorMessage(droolsResponse.getErrorMessage());
109             showDialog("checkinGeneralInfoMessageDialog", checkinForm, request, response);
110         }
111         return getUIFModelAndView(checkinForm);
112     }
113 
114 
115     @RequestMapping(params = "methodToCall=processClaimReturned")
116     public ModelAndView processClaimReturned(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
117                                              HttpServletRequest request, HttpServletResponse response) throws Exception {
118 
119         CheckinForm checkinForm = (CheckinForm) form;
120         processItemInformationIfAvailable(request, checkinForm);
121 
122         DroolsResponse droolsResponse = getCheckinUIController(checkinForm).
123                 preValidationForClaimsReturned((ItemRecord) checkinForm.getDroolsExchange().getContext().get("itemRecord"), checkinForm);
124         if (null != droolsResponse && StringUtils.isBlank(droolsResponse.getErrorMessage().getErrorMessage())) {
125             postCheckinProcess(checkinForm, result, request, response);
126         } else if (null != droolsResponse.retriveErrorCode() && droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.ITEM_CLAIMS_RETURNED)) {
127             handleClaimsReturnedProcess(request, response, checkinForm, droolsResponse);
128         } else if (null != droolsResponse.retriveErrorCode() && droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.ITEM_MISSING_PIECE)) {
129             handleMissingPieceProcess(request, response, checkinForm, droolsResponse);
130         } else if (null != droolsResponse.retriveErrorCode() && droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.CHECKIN_REQUEST_EXITS_FOR_THIS_ITEM)) {
131             handleCheckinRequestExistsProcess(request, response, checkinForm, droolsResponse);
132         }
133         return getUIFModelAndView(checkinForm);
134     }
135 
136     @RequestMapping(params = "methodToCall=processMissingPiece")
137     public ModelAndView processMissingPiece(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
138                                             HttpServletRequest request, HttpServletResponse response) throws Exception {
139 
140         CheckinForm checkinForm = (CheckinForm) form;
141         processItemInformationIfAvailable(request, checkinForm);
142 
143         ItemRecord itemRecord = (ItemRecord) checkinForm.getDroolsExchange().getContext().get("itemRecord");
144         DroolsResponse droolsResponse = getCheckinUIController(checkinForm).
145                 preValidationForMissingPiece(itemRecord, checkinForm);
146         if (null != droolsResponse && StringUtils.isBlank(droolsResponse.getErrorMessage().getErrorMessage())) {
147             postCheckinProcess(checkinForm, result, request, response);
148         } else if (null != droolsResponse.retriveErrorCode() && droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.ITEM_MISSING_PIECE)) {
149             handleMissingPieceProcess(request, response, checkinForm, droolsResponse);
150         } else if (null != droolsResponse.retriveErrorCode() && droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.CHECKIN_REQUEST_EXITS_FOR_THIS_ITEM)) {
151             handleCheckinRequestExistsProcess(request, response, checkinForm, droolsResponse);
152         }
153         return getUIFModelAndView(checkinForm);
154     }
155 
156 
157     @RequestMapping(params = "methodToCall=processCheckinRequestExists")
158     public ModelAndView processCheckinRequestExists(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
159                                                     HttpServletRequest request, HttpServletResponse response) throws Exception {
160         CheckinForm checkinForm = (CheckinForm) form;
161         processItemInformationIfAvailable(request, checkinForm);
162 
163         ItemRecord itemRecord = (ItemRecord) checkinForm.getDroolsExchange().getContext().get("itemRecord");
164         DroolsResponse droolsResponse = getCheckinUIController(checkinForm).
165                 preValidationForCheckinRequestExists(itemRecord, checkinForm);
166         if (null != droolsResponse && StringUtils.isBlank(droolsResponse.getErrorMessage().getErrorMessage())) {
167             postCheckinProcess(checkinForm, result, request, response);
168         } else if (null != droolsResponse.retriveErrorCode() && droolsResponse.retriveErrorCode().equalsIgnoreCase(DroolsConstants.CHECKIN_REQUEST_EXITS_FOR_THIS_ITEM)) {
169             handleCheckinRequestExistsProcess(request, response, checkinForm, droolsResponse);
170         }
171         return getUIFModelAndView(checkinForm);
172     }
173 
174 
175     @RequestMapping(params = "methodToCall=processCheckinAfterPreValidation")
176     public ModelAndView processCheckinAfterPreValidation(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
177                                                          HttpServletRequest request, HttpServletResponse response) throws Exception {
178         CheckinForm checkinForm = (CheckinForm) form;
179         ItemRecord itemRecord = (ItemRecord) checkinForm.getDroolsExchange().getContext().get("itemRecord");
180         OleLoanDocument oleLoanDocument = (OleLoanDocument) checkinForm.getDroolsExchange().getContext().get("oleLoanDocument");
181         DroolsResponse droolsResponse = getCheckinUIController(checkinForm).
182                 processCheckinAfterPreValidation(itemRecord, checkinForm, oleLoanDocument);
183         if (null != droolsResponse && StringUtils.isBlank(droolsResponse.getErrorMessage().getErrorMessage())) {
184             postCheckinProcess(checkinForm, result, request, response);
185         }else {
186             checkinForm.setErrorMessage(droolsResponse.getErrorMessage());
187             showDialog("checkinGeneralInfoMessageDialog", checkinForm, request, response);
188         }
189         return getUIFModelAndView(checkinForm);
190     }
191 
192     @RequestMapping(params = "methodToCall=postCheckinProcess")
193     public ModelAndView postCheckinProcess(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
194                                            HttpServletRequest request, HttpServletResponse response) {
195         CheckinForm checkinForm = (CheckinForm) form;
196         Map<String, Object> droolsExchangeContext = checkinForm.getDroolsExchange().getContext();
197         boolean checkinNote = false;
198         if (null != droolsExchangeContext) {
199             if (null != droolsExchangeContext.get("checkinNote")) {
200                 checkinNote = (boolean) droolsExchangeContext.get("checkinNote");
201             }
202         }
203 
204         if (checkinNote) {
205             checkinForm.setPermissionToRemoveNote(checkPermissionForRemoveNote(GlobalVariables.getUserSession().getPrincipalId()));
206             showDialog("checkInNoteDialog", checkinForm, request, response);
207         } else {
208             postCheckInNoteProcess(checkinForm, result, request, response);
209         }
210         checkinForm.reset();
211         return getUIFModelAndView(checkinForm);
212     }
213 
214     @RequestMapping(params = "methodToCall=postCheckInNoteProcess")
215     public ModelAndView postCheckInNoteProcess(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
216                                                HttpServletRequest request, HttpServletResponse response) {
217         CheckinForm checkinForm = (CheckinForm) form;
218         Map<String, Object> droolsExchangeContext = checkinForm.getDroolsExchange().getContext();
219         if (null != droolsExchangeContext) {
220             if (null != droolsExchangeContext.get(DroolsConstants.ROUTE_TO_LOCATION_SELECTOR)) {
221                 routeToLocationProcess(checkinForm, result, request, response);
222             } else if (null != droolsExchangeContext.get(DroolsConstants.PRINT_SLIP_FLAG)) {
223                 printSlip(checkinForm, result, request, response);
224             } else if (null != droolsExchangeContext.get(DroolsConstants.AUTO_CHECKOUT)) {
225                 autoCheckout(checkinForm, result, request, response);
226             } else {
227                 checkinForm.setLightboxScript("jq('#checkIn-Item_control').focus();validateCheckInDate();");
228             }
229         }
230         checkinForm.reset();
231         return getUIFModelAndView(checkinForm);
232     }
233 
234     @RequestMapping(params = "methodToCall=routeToLocationProcess")
235     public ModelAndView routeToLocationProcess(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
236                                                HttpServletRequest request, HttpServletResponse response) {
237         CheckinForm checkinForm = (CheckinForm) form;
238         Map<String, Object> droolsExchangeContext = checkinForm.getDroolsExchange().getContext();
239         if (null != droolsExchangeContext) {
240             if (null != droolsExchangeContext.get(DroolsConstants.ROUTE_TO_LOCATION_SELECTOR)) {
241                 showDialog("checkinRouteToDialog", checkinForm, request, response);
242             }
243         }
244         return getUIFModelAndView(checkinForm);
245     }
246 
247     @RequestMapping(params = "methodToCall=postRouteToLocationProcess")
248     public ModelAndView postRouteToLocationProcess(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
249                                                    HttpServletRequest request, HttpServletResponse response) {
250         CheckinForm checkinForm = (CheckinForm) form;
251         String routeToLocationValue = request.getParameter("checkinRouteToLocation");
252         if (StringUtils.isNotBlank(routeToLocationValue)) {
253             checkinForm.setRouteToLocation(routeToLocationValue);
254             if (checkinForm.getCheckedInItemList().size() > 0) {
255                 checkinForm.getCheckedInItemList().get(0).setRouteToLocation(routeToLocationValue);
256             }
257             OleItemRecordForCirc oleItemRecordForCirc = (OleItemRecordForCirc) checkinForm.getDroolsExchange().getFromContext("oleItemRecordForCirc");
258             oleItemRecordForCirc.setRouteToLocation(routeToLocationValue);
259         }
260         getCheckinUIController(checkinForm).updateLoanInTransitRecordHistory(checkinForm);
261         printSlip(checkinForm, result, request, response);
262         return getUIFModelAndView(checkinForm);
263     }
264 
265 
266     @RequestMapping(params = "methodToCall=autoCheckout")
267     public ModelAndView autoCheckout(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
268                                      HttpServletRequest request, HttpServletResponse response) {
269         CheckinForm checkinForm = (CheckinForm) form;
270         String url = ConfigContext.getCurrentContextConfig().getProperty("ole.fs.url.base") + "/ole-kr-krad/autoCheckoutController?viewId=circView&methodToCall=backgroundCheckout&checkinFormKey=" + checkinForm.getFormKey();
271         showIFrameDialog(url, checkinForm, "jq('#checkIn-Item_control').focus();validateCheckInDate();");
272         return getUIFModelAndView(checkinForm);
273     }
274 
275 
276     @RequestMapping(params = "methodToCall=printSlip")
277     public ModelAndView printSlip(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
278                                   HttpServletRequest request, HttpServletResponse response) {
279         CheckinForm checkinForm = (CheckinForm) form;
280         Map<String, Object> droolsExchangeContext = checkinForm.getDroolsExchange().getContext();
281 
282         if (null != droolsExchangeContext) {
283             if (null != droolsExchangeContext.get(DroolsConstants.PRINT_SLIP_FLAG)) {
284                 String url = ConfigContext.getCurrentContextConfig().getProperty("ole.fs.url.base") + "/ole-kr-krad/printBillcontroller?viewId=circView&methodToCall=printBill&checkinFormKey=" + checkinForm.getFormKey();
285                 String customScript = "";
286                 if (null != droolsExchangeContext.get(DroolsConstants.AUTO_CHECKOUT)) {
287                     customScript = "submitForm('autoCheckout', null,null,null,null);";
288                 } else {
289                     customScript = "jq('#checkIn-Item_control').val('');jq('#checkIn-Item_control').focus();validateCheckInDate();";
290                 }
291                 return showIFrameDialog(url, checkinForm, customScript);
292             }
293         }
294         checkinForm.reset();
295         return getUIFModelAndView(checkinForm);
296     }
297 
298     @RequestMapping(params = "methodToCall=reset")
299     public ModelAndView reset(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
300                               HttpServletRequest request, HttpServletResponse response) throws Exception {
301         CheckinForm checkinForm = (CheckinForm) form;
302         checkinForm.reset();
303         return getUIFModelAndView(checkinForm);
304     }
305 
306     @RequestMapping(params = "methodToCall=refreshUI")
307     public ModelAndView refreshUI(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
308                                   HttpServletRequest request, HttpServletResponse response) throws Exception {
309         return super.refresh(form, result, request, response);
310     }
311 
312 
313     @RequestMapping(params = "methodToCall=deleteCheckinNote")
314     public ModelAndView deleteCheckinNote(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
315                                           HttpServletRequest request, HttpServletResponse response) throws Exception {
316 
317         CheckinForm checkinForm = (CheckinForm) form;
318 
319         deleteCheckinNote(checkinForm);
320         return getUIFModelAndView(form);
321 
322     }
323 
324     public void deleteCheckinNote(CheckinForm checkinForm) {
325         String itemId = checkinForm.getCheckedInItem().getItemUuid();
326         HashMap map = new HashMap();
327         map.put("checkinNote", null);
328         getCheckinUIController(checkinForm).deleteItemInfoInSolr(map, itemId);
329     }
330 
331 
332     @RequestMapping(params = "methodToCall=changeCirculationDeskLocation")
333     public ModelAndView changeCirculationDeskLocation(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
334                                                       HttpServletRequest request, HttpServletResponse response) {
335         return showDialog("circDeskChangeDialog", form, request, response);
336     }
337 
338     @RequestMapping(params = "methodToCall=setPreviousCircDeskToCurrentlySelectedValue")
339     public ModelAndView setPreviousCircDeskToCurrentlySelectedValue(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
340                                                                     HttpServletRequest request, HttpServletResponse response) {
341         CheckinForm checkinForm = (CheckinForm) form;
342         checkinForm.setPreviouslySelectedCirculationDesk(checkinForm.getSelectedCirculationDesk());
343         clearUI(form, result, request, response);
344         return getUIFModelAndView(form, "checkinViewPage");
345     }
346 
347     @RequestMapping(params = "methodToCall=revertCircDeskLocationSelection")
348     public ModelAndView revertCircDeskLocationSelection(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
349                                                         HttpServletRequest request, HttpServletResponse response) {
350         CheckinForm checkinForm = (CheckinForm) form;
351         checkinForm.setSelectedCirculationDesk(checkinForm.getPreviouslySelectedCirculationDesk());
352         return getUIFModelAndView(form, "checkinViewPage");
353     }
354 
355     @RequestMapping(params = "methodToCall=clearUI")
356     public ModelAndView clearUI(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
357                                 HttpServletRequest request, HttpServletResponse response) {
358         CheckinForm checkinForm = (CheckinForm) form;
359         checkinForm.resetAll();
360         checkinForm.setLightboxScript("jq('#checkIn-Item_control').focus();validateCheckInDate();");
361         return getUIFModelAndView(form, "checkinViewPage");
362     }
363 
364     private void setPrincipalInfo(CheckinForm checkinForm) {
365         if (StringUtils.isBlank(checkinForm.getLoggedInUser()))
366             checkinForm.setLoggedInUser(GlobalVariables.getUserSession().getPrincipalId());
367     }
368 
369     public CheckinBaseController getCheckinUIController(CheckinForm checkinForm) {
370         if (!getCheckinUIControllerMap().containsKey(checkinForm.getFormKey())) {
371             CheckinUIController checkinUIController = new CheckinUIController();
372             getCheckinUIControllerMap().put(checkinForm.getFormKey(), checkinUIController);
373             return checkinUIController;
374         } else {
375             return getCheckinUIControllerMap().get(checkinForm.getFormKey());
376         }
377     }
378 
379     public boolean checkPermissionForRemoveNote(String principalId) {
380         PermissionService service = KimApiServiceLocator.getPermissionService();
381         return service.hasPermission(principalId, OLEConstants.DLVR_NMSPC, OLEConstants.CAN_REMOVE_NOTE);
382     }
383 
384     public Map<String, CheckinUIController> getCheckinUIControllerMap() {
385         return checkinUIControllerMap;
386     }
387 
388     public void setCheckinUIControllerMap(Map<String, CheckinUIController> checkinUIControllerMap) {
389         this.checkinUIControllerMap = checkinUIControllerMap;
390     }
391 
392     @RequestMapping(params = "methodToCall=clearSession")
393     public ModelAndView clearSession(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
394                                      HttpServletRequest request, HttpServletResponse response) throws Exception {
395         CheckinForm checkinForm = (CheckinForm) form;
396         checkinForm.resetAll();
397         checkinUIControllerMap.remove(checkinForm.getFormKey());
398         return getUIFModelAndView(checkinForm);
399     }
400 
401     private void handleMissingPieceProcess(HttpServletRequest request, HttpServletResponse response, CheckinForm checkinForm, DroolsResponse droolsResponse) {
402         checkinForm.setErrorMessage(droolsResponse.getErrorMessage());
403         checkinForm.setRecordNoteForMissingPiece(true);
404         showDialog("checkinMissingPieceDialog", checkinForm, request, response);
405     }
406 
407     private void handleCheckinRequestExistsProcess(HttpServletRequest request, HttpServletResponse response, CheckinForm checkinForm, DroolsResponse droolsResponse) {
408         checkinForm.setErrorMessage(droolsResponse.getErrorMessage());
409         showDialog("checkinRequestExistDialog", checkinForm, request, response);
410     }
411 
412     private void handleClaimsReturnedProcess(HttpServletRequest request, HttpServletResponse response, CheckinForm checkinForm, DroolsResponse droolsResponse) {
413         checkinForm.setErrorMessage(droolsResponse.getErrorMessage());
414         checkinForm.setRecordNoteForClaimsReturn(true);
415         showDialog("checkinClaimsReturnDialog", checkinForm, request, response);
416     }
417 
418     private void handleDamagedItemProcess(HttpServletRequest request, HttpServletResponse response, CheckinForm checkinForm, DroolsResponse droolsResponse) {
419         checkinForm.setErrorMessage(droolsResponse.getErrorMessage());
420         checkinForm.setRecordNoteForDamagedItem(true);
421         showDialog("checkinDamagedItemDialog", checkinForm, request, response);
422     }
423 
424     private void processItemInformationIfAvailable(HttpServletRequest request, CheckinForm checkinForm) {
425         claimsCheck(request, checkinForm);
426 
427 
428         damagedCheck(request, checkinForm);
429 
430 
431         missingPieceCheck(request, checkinForm);
432 
433     }
434 
435     private void missingPieceCheck(HttpServletRequest request, CheckinForm checkinForm) {
436         String recordNoteForMissingPieceChecked = request.getParameter("recordNoteForMissingPieceCheck");
437         if (StringUtils.isNotBlank(recordNoteForMissingPieceChecked)) {
438             checkinForm.setRecordNoteForMissingPiece(Boolean.valueOf(recordNoteForMissingPieceChecked));
439 
440             String missingPieceCheck = request.getParameter("missingPieceValueCheck");
441             checkinForm.setMissingPieceMatchCheck(missingPieceCheck);
442             String missingPieceCount = request.getParameter("missingPieceCount");
443             checkinForm.setMissingPieceCount(missingPieceCount);
444             String missingPieceNote = request.getParameter("missingPieceNote");
445             checkinForm.setMissingPieceNote(missingPieceNote);
446         }
447     }
448 
449     private void damagedCheck(HttpServletRequest request, CheckinForm checkinForm) {
450         String recordNoteForDamageChecked = request.getParameter("recordNoteForDamageChecked");
451         if (StringUtils.isNotBlank(recordNoteForDamageChecked)) {
452             checkinForm.setRecordNoteForDamagedItem(Boolean.valueOf(recordNoteForDamageChecked));
453         }
454     }
455 
456     private void claimsCheck(HttpServletRequest request, CheckinForm checkinForm) {
457         String recordNoteForClaimChecked = request.getParameter("recordNoteForClaimChecked");
458         if (StringUtils.isNotBlank(recordNoteForClaimChecked)) {
459             checkinForm.setRecordNoteForClaimsReturn(Boolean.valueOf(recordNoteForClaimChecked));
460         }
461     }
462 
463 
464 }