1 package org.kuali.ole.deliver.controller;
2
3 import org.apache.commons.collections.CollectionUtils;
4 import org.apache.commons.lang3.StringUtils;
5 import org.apache.log4j.Logger;
6 import org.codehaus.jettison.json.JSONArray;
7 import org.codehaus.jettison.json.JSONException;
8 import org.codehaus.jettison.json.JSONObject;
9 import org.kuali.ole.OLEConstants;
10 import org.kuali.ole.OLEParameterConstants;
11 import org.kuali.ole.deliver.OleLoanDocumentsFromSolrBuilder;
12 import org.kuali.ole.deliver.bo.OleLoanDocument;
13 import org.kuali.ole.deliver.calendar.service.DateUtil;
14 import org.kuali.ole.deliver.controller.checkout.CheckoutValidationController;
15 import org.kuali.ole.deliver.controller.checkout.CircUtilController;
16 import org.kuali.ole.deliver.controller.renew.RenewController;
17 import org.kuali.ole.deliver.form.CircForm;
18 import org.kuali.ole.deliver.service.OleLoanDocumentPlatformAwareDao;
19 import org.kuali.ole.deliver.service.ParameterValueResolver;
20 import org.kuali.ole.deliver.util.*;
21 import org.kuali.ole.docstore.common.document.DocstoreDocument;
22 import org.kuali.ole.docstore.common.document.Item;
23 import org.kuali.ole.docstore.engine.service.storage.rdbms.pojo.ItemRecord;
24 import org.kuali.ole.sys.context.SpringContext;
25 import org.kuali.ole.utility.OleStopWatch;
26 import org.kuali.rice.core.api.config.property.ConfigContext;
27 import org.kuali.rice.core.api.datetime.DateTimeService;
28 import org.kuali.rice.krad.service.BusinessObjectService;
29 import org.kuali.rice.krad.web.form.UifFormBase;
30 import org.springframework.stereotype.Controller;
31 import org.springframework.validation.BindingResult;
32 import org.springframework.web.bind.annotation.ModelAttribute;
33 import org.springframework.web.bind.annotation.RequestMapping;
34 import org.springframework.web.servlet.ModelAndView;
35
36 import javax.servlet.http.HttpServletRequest;
37 import javax.servlet.http.HttpServletResponse;
38 import java.sql.Timestamp;
39 import java.text.ParseException;
40 import java.text.SimpleDateFormat;
41 import java.util.*;
42
43
44
45
46
47 @Controller
48 @RequestMapping(value = "/circcontroller")
49 public class CircController extends CheckoutValidationController {
50
51 private static final Logger LOG = Logger.getLogger(CircController.class);
52 private OleLoanDocumentsFromSolrBuilder oleLoanDocumentsFromSolrBuilder;
53 private OleLoanDocumentPlatformAwareDao oleLoanDocumentPlatformAwareDao;
54 private BulkItemUpdateUtil bulkItemUpdateUtil;
55 private RenewController renewController;
56 private DateTimeService dateTimeService;
57
58 @Override
59 @RequestMapping(params = "methodToCall=refresh")
60 public ModelAndView refresh(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
61 HttpServletRequest request, HttpServletResponse response) throws Exception {
62 CircForm circForm = (CircForm) form;
63
64 if (!circForm.getPatronBarcode().equals(circForm.getPatronDocument().getBarcode())) {
65 resetUI(circForm, result, request, response);
66 }
67
68 if (!circForm.isProceedWithCheckout()) {
69 circForm.setPatronDocument(new OlePatronRecordUtil().getPatronRecordByBarcode(circForm.getPatronBarcode()));
70 return searchPatron(form, result, request, response);
71 } else {
72 if(Boolean.valueOf(getParameter(OLEParameterConstants.LOAN_WHILE_FASTADD))){
73 lookupItemAndSaveLoan(circForm, result, request, response);
74 }
75 }
76 return getUIFModelAndView(circForm);
77 }
78
79 @RequestMapping(params = "methodToCall=resetErrorMessages")
80 public ModelAndView resetErrorMessages(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
81 HttpServletRequest request, HttpServletResponse response) {
82
83 return getUIFModelAndView(form);
84 }
85
86 @RequestMapping(params = "methodToCall=showExistingLoan")
87 public ModelAndView showExistingLoan(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
88 HttpServletRequest request, HttpServletResponse response) {
89 try {
90 CircForm circForm = (CircForm) form;
91 int defaultPageSize = getDefaultPageSize();
92 circForm.setPageSize(String.valueOf(defaultPageSize));
93 circForm.setPageNumber("1");
94 circForm.setShowExistingLoan(true);
95 if (circForm.getPatronDocument().getOleLoanDocuments().size() > 0) {
96 circForm.setExistingLoanList(getOleLoanDocumentsFromSolrBuilder().getPatronLoanedItemBySolr
97 (circForm.getPatronDocument().getOlePatronId(), null));
98 }
99 circForm.setLightboxScript("jq('#existingLoanItemTable_length').val(" + defaultPageSize + ").attr('selected', 'selected');enableDataTableForExistingLoanedItem();");
100 } catch (Exception e) {
101 e.printStackTrace();
102 }
103 return getUIFModelAndView(form);
104 }
105
106 public int getDefaultPageSize() {
107 String defaultPageSizeFromParameter = ParameterValueResolver.getInstance().getParameter(OLEConstants
108 .APPL_ID_OLE, OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT, OLEConstants.DEFAULT_PAGE_SIZE_LOANED_ITEMS);
109 int defaultPageSize = 10;
110 if(StringUtils.isNotBlank(defaultPageSizeFromParameter)){
111 try{
112 int searchLimit = Integer.parseInt(defaultPageSizeFromParameter);
113 if(searchLimit > 0){
114 defaultPageSize = searchLimit;
115 }else{
116 LOG.error("Invalid page size from the system parameter. So taking the default page size : " + defaultPageSize);
117 }
118 }catch(Exception exception){
119 LOG.error("Invalid page size from the system parameter. So taking the default page size : " + defaultPageSize);
120 }
121 }else{
122 LOG.error("Invalid page size from the system parameter. So taking the default page size : " + defaultPageSize);
123 }
124 return defaultPageSize;
125 }
126
127 @RequestMapping(params = "methodToCall=hideExistingLoan")
128 public ModelAndView hideExistingLoan(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
129 HttpServletRequest request, HttpServletResponse response) {
130 CircForm circForm = (CircForm) form;
131 circForm.setShowExistingLoan(false);
132 circForm.setExistingLoanList(new ArrayList<OleLoanDocument>());
133 return getUIFModelAndView(form);
134 }
135
136
137 @RequestMapping(params = "methodToCall=changeCirculationDeskLocation")
138 public ModelAndView changeCirculationDeskLocation(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
139 HttpServletRequest request, HttpServletResponse response) {
140 return showDialog("circDeskChangeDialog", form, request, response);
141 }
142
143 @RequestMapping(params = "methodToCall=revertCircDeskLocationSelection")
144 public ModelAndView revertCircDeskLocationSelection(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
145 HttpServletRequest request, HttpServletResponse response) {
146 CircForm circForm = (CircForm) form;
147 circForm.setSelectedCirculationDesk(circForm.getPreviouslySelectedCirculationDesk());
148 return getUIFModelAndView(form, "circViewPage");
149 }
150
151 @RequestMapping(params = "methodToCall=setPreviousCircDeskToCurrentlySelectedValue")
152 public ModelAndView setPreviousCircDeskToCurrentlySelectedValue(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
153 HttpServletRequest request, HttpServletResponse response) {
154 CircForm circForm = (CircForm) form;
155 circForm.setPreviouslySelectedCirculationDesk(circForm.getSelectedCirculationDesk());
156 clearUI(form, result, request, response);
157 return getUIFModelAndView(form, "circViewPage");
158 }
159
160 @RequestMapping(params = "methodToCall=openClaimsReturnDialog")
161 public ModelAndView openClaimsReturnDialog(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
162 HttpServletRequest request, HttpServletResponse response) {
163 CircForm circForm = (CircForm) form;
164 List<OleLoanDocument> selectedLoanDocumentList = getSelectedLoanDocumentList(circForm);
165 if (CollectionUtils.isNotEmpty(selectedLoanDocumentList)) {
166 showDialog("claimsReturnDialog", circForm, request, response);
167 ItemRecord itemRecord = getCheckoutUIController(circForm.getFormKey()).getItemRecordByBarcode(selectedLoanDocumentList.get(0).getItemId());
168 circForm.setClaimsReturnNote((itemRecord != null) ? itemRecord.getClaimsReturnedNote() : "");
169 circForm.setClaimsReturnFlag((itemRecord != null) ? (itemRecord.getClaimsReturnedFlag() != null) ?
170 itemRecord.getClaimsReturnedFlag().booleanValue() : false : false);
171
172 } else {
173 ErrorMessage errorMessage = new ErrorMessage();
174 errorMessage.setErrorMessage("Please select any one of loaned item to claim.");
175 circForm.setErrorMessage(errorMessage);
176 showDialog("generalInfoDialog", circForm, request, response);
177 }
178 return getUIFModelAndView(form);
179 }
180
181
182 @RequestMapping(params = "methodToCall=openDamagedItemDialog")
183 public ModelAndView openDamagedItemDialog(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
184 HttpServletRequest request, HttpServletResponse response) {
185 CircForm circForm = (CircForm) form;
186 List<OleLoanDocument> selectedLoanDocumentList = getSelectedLoanDocumentList(circForm);
187 if (CollectionUtils.isNotEmpty(selectedLoanDocumentList)) {
188 showDialog("damagedItemDialog", circForm, request, response);
189 ItemRecord itemRecord = getCheckoutUIController(circForm.getFormKey()).getItemRecordByBarcode(selectedLoanDocumentList.get(0).getItemId());
190 circForm.setDamagedItemNote((itemRecord != null) ? itemRecord.getDamagedItemNote() : "");
191 circForm.setDamagedItemFlag((itemRecord != null) ? itemRecord.isItemDamagedStatus() : false);
192 } else {
193 ErrorMessage errorMessage = new ErrorMessage();
194 errorMessage.setErrorMessage("Please select any one of loaned item to damaged.");
195 circForm.setErrorMessage(errorMessage);
196 showDialog("generalInfoDialog", circForm, request, response);
197 }
198 return getUIFModelAndView(form);
199 }
200
201
202 @RequestMapping(params = "methodToCall=openMissingPieceItemDialog")
203 public ModelAndView openMissingPieceItemDialog(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
204 HttpServletRequest request, HttpServletResponse response) {
205 CircForm circForm = (CircForm) form;
206 List<OleLoanDocument> selectedLoanDocumentList = getSelectedLoanDocumentList(circForm);
207 if (CollectionUtils.isNotEmpty(selectedLoanDocumentList)) {
208 showDialog("missingPieceDialog", circForm, request, response);
209 ItemRecord itemRecord = getCheckoutUIController(circForm.getFormKey()).getItemRecordByBarcode(selectedLoanDocumentList.get(0).getItemId());
210 circForm.setMissingPieceFlag((itemRecord != null) ? itemRecord.isMissingPieceFlag() : false);
211 circForm.setMissingPieceNote(circForm.isMissingPieceFlag() ? (itemRecord != null) ? itemRecord.getMissingPieceFlagNote() : "" : "");
212 circForm.setMissingPieceCount(circForm.isMissingPieceFlag() ? (itemRecord != null) ? itemRecord.getMissingPiecesCount() : "" : "");
213 circForm.setNumberOfPiece((itemRecord != null) ? itemRecord.getNumberOfPieces() : "");
214 } else {
215 ErrorMessage errorMessage = new ErrorMessage();
216 errorMessage.setErrorMessage("Please select any one of loaned item to apply missing piece.");
217 circForm.setErrorMessage(errorMessage);
218 showDialog("generalInfoDialog", circForm, request, response);
219 }
220 return getUIFModelAndView(form);
221 }
222
223 @RequestMapping(params = "methodToCall=applyClaimsReturn")
224 public ModelAndView applyClaimsReturn(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
225 HttpServletRequest request, HttpServletResponse response) throws Exception {
226 CircForm circForm = (CircForm) form;
227 String claimsDescription = request.getParameter("claimDescription");
228 List<OleLoanDocument> selectedLoanDocumentList = getSelectedLoanDocumentList(circForm);
229 for (Iterator<OleLoanDocument> iterator = selectedLoanDocumentList.iterator(); iterator.hasNext(); ) {
230 OleLoanDocument oleLoanDocument = iterator.next();
231 oleLoanDocument.setClaimsReturnNote(claimsDescription);
232 oleLoanDocument.setClaimsReturnedIndicator(true);
233 oleLoanDocument.setClaimsReturnedDate(new Timestamp(new Date().getTime()));
234 }
235 createClaimsReturnForItem(circForm, selectedLoanDocumentList, circForm.getPatronDocument());
236 return getUIFModelAndView(form);
237 }
238
239 @RequestMapping(params = "methodToCall=removeClaimsReturn")
240 public ModelAndView removeClaimsReturn(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
241 HttpServletRequest request, HttpServletResponse response) throws Exception {
242 CircForm circForm = (CircForm) form;
243 List<OleLoanDocument> selectedLoanDocumentList = getSelectedLoanDocumentList(circForm);
244 deleteClaimsReturnForItem(circForm, selectedLoanDocumentList);
245 return getUIFModelAndView(form);
246 }
247
248 @RequestMapping(params = "methodToCall=openAlterDueDateDialog")
249 public ModelAndView openAlterDueDateDialog(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
250 HttpServletRequest request, HttpServletResponse response) throws JSONException {
251 CircForm circForm = (CircForm) form;
252 circForm.setErrorMessage(new ErrorMessage());
253 List<OleLoanDocument> selectedLoanDocumentList = getSelectedLoanDocumentList(circForm);
254 if (CollectionUtils.isNotEmpty(selectedLoanDocumentList)) {
255 circForm.setLoanDocumentsForAlterDueDate(selectedLoanDocumentList);
256 String jsonStringForAlterDueDate = getJsonStringForAlterDueDate(selectedLoanDocumentList);
257 showDialogAndRunCustomScript("alterDueDateDialog", circForm,"populateDueDateForAlterDueDateDialog(" + jsonStringForAlterDueDate + ")");
258 } else {
259 ErrorMessage errorMessage = new ErrorMessage();
260 errorMessage.setErrorMessage("Please select any one of loaned item to alter due date.");
261 circForm.setErrorMessage(errorMessage);
262 showDialog("generalInfoDialog", circForm, request, response);
263 }
264 return getUIFModelAndView(form);
265 }
266
267 private String getJsonStringForAlterDueDate(List<OleLoanDocument> selectedLoanDocumentList) throws JSONException {
268 JSONArray finalJsonArray = new JSONArray();
269 for (Iterator<OleLoanDocument> iterator = selectedLoanDocumentList.iterator(); iterator.hasNext(); ) {
270 OleLoanDocument oleLoanDocument = iterator.next();
271 JSONObject valueObject = new JSONObject();
272 valueObject.put("itemBarcode",oleLoanDocument.getItemId());
273 valueObject.put("date", getDateString(oleLoanDocument.getLoanDueDate()));
274 valueObject.put("dateTime", getTimeString(oleLoanDocument.getLoanDueDate()));
275 finalJsonArray.put(valueObject);
276 }
277 return finalJsonArray.toString();
278 }
279
280 private String getTimeString(Timestamp loanDueDate) {
281 if (null != loanDueDate) {
282 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
283 return simpleDateFormat.format(loanDueDate);
284 }
285 return "";
286 }
287
288 private String getDateString(Timestamp loanDueDate) {
289 if (null != loanDueDate) {
290 SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ConfigContext.getCurrentContextConfig().getProperty("DATE_TO_STRING_FORMAT_FOR_USER_INTERFACE"));
291 return simpleDateFormat.format(loanDueDate);
292 }
293 return "";
294 }
295
296 @RequestMapping(params = "methodToCall=alterDueDate")
297 public ModelAndView alterDueDate(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
298 HttpServletRequest request, HttpServletResponse response) {
299 CircForm circForm = (CircForm) form;
300 String jsonString = request.getParameter("alterDueDateObjectValues");
301
302 AlterDueDateAndRenewResponse alterDueDateAndRenewResponse = processJsonString(jsonString);
303
304 String failureResponseMessage = prepareFailureResponseForInvalidDueDate(alterDueDateAndRenewResponse.getInvalidItemIdsMap(), "Invalid time format selected.");
305
306 if(StringUtils.isNotBlank(failureResponseMessage)){
307 circForm.getErrorMessage().setErrorMessage(failureResponseMessage);
308 }
309
310 try {
311 AlterDueDateAndRenewResponse alterDueDateAndRenewResponseAfterSave = updateDueDate(alterDueDateAndRenewResponse.getValidItemIdsMap(), circForm);
312 String failureResponseForRenew = prepareFailureResponseForInvalidDueDate(alterDueDateAndRenewResponseAfterSave.getInvalidItemIdsMap(), "");
313
314 if(StringUtils.isNotBlank(failureResponseForRenew)){
315 circForm.getErrorMessage().setErrorMessage(failureResponseForRenew);
316 }
317
318
319 } catch (Exception e) {
320
321 circForm.getErrorMessage().setErrorMessage("Alter due date was failed ");
322 e.printStackTrace();
323 }
324
325 if(null != circForm.getErrorMessage() && StringUtils.isNotBlank(circForm.getErrorMessage().getErrorMessage())){
326 showDialogAndRunCustomScript("generalInfoDialog", circForm, "jq('.loanedItemCBClass').removeAttr('checked');jq('.loaningItemCBClass').removeAttr('checked');");
327 }else{
328 circForm.setLightboxScript("jq('.loanedItemCBClass').removeAttr('checked');jq('.loaningItemCBClass').removeAttr('checked');");
329 }
330 return getUIFModelAndView(circForm);
331 }
332
333 private String prepareFailureResponseForInvalidDueDate(Map<String, String[]> invalidItemIdsMap, String customMsg) {
334 CircUtilController circUtilController = new CircUtilController();
335 StringBuilder stringBuilder = new StringBuilder();
336 if(invalidItemIdsMap.size() > 0 ){
337 for (Iterator<String> iterator = invalidItemIdsMap.keySet().iterator(); iterator.hasNext(); ) {
338 String itemBarcode = iterator.next();
339 circUtilController.addToFormattedContent(stringBuilder, "Alter due date was not successful for item (" + itemBarcode + " )." + customMsg);
340 }
341 }
342 return stringBuilder.toString();
343 }
344
345 private AlterDueDateAndRenewResponse processJsonString(String jsonString) {
346 HashMap<String, String[]> validItemIdsMap = new HashMap();
347 HashMap<String, String[]> invalidItemIdsMap = new HashMap();
348 CircUtilController circUtilController = new CircUtilController();
349
350 JSONArray alterDueDateObjectValues = null;
351 try {
352 alterDueDateObjectValues = new JSONArray(jsonString);
353 for (int index = 0; index < alterDueDateObjectValues.length(); index++) {
354 JSONObject jsonObject = (JSONObject) alterDueDateObjectValues.get(index);
355 String itemBarcode = getStringValueFromJsonObject(jsonObject, "itemBarcode");
356 String[] alterDueDateTime = new String[2];
357 alterDueDateTime[0] = getStringValueFromJsonObject(jsonObject, "date");
358 alterDueDateTime[1] = getStringValueFromJsonObject(jsonObject, "dateTime");
359 if (circUtilController.validateTime(alterDueDateTime[1])) {
360 validItemIdsMap.put(itemBarcode, alterDueDateTime);
361 } else {
362 invalidItemIdsMap.put(itemBarcode, alterDueDateTime);
363 }
364 }
365 } catch (JSONException e) {
366 e.printStackTrace();
367 }
368
369 AlterDueDateAndRenewResponse alterDueDateAndRenewResponse = new AlterDueDateAndRenewResponse();
370 alterDueDateAndRenewResponse.setValidItemIdsMap(validItemIdsMap);
371 alterDueDateAndRenewResponse.setInvalidItemIdsMap(invalidItemIdsMap);
372 return alterDueDateAndRenewResponse;
373 }
374
375
376 public String getStringValueFromJsonObject(JSONObject jsonObject, String key) {
377 String returnValue = null;
378 try {
379 returnValue = jsonObject.getString(key);
380 } catch (JSONException e) {
381 e.printStackTrace();
382 }
383 return returnValue;
384 }
385
386 private AlterDueDateAndRenewResponse updateDueDate(Map<String, String[]> itemBarcodeMap, CircForm circForm) throws Exception {
387 HashMap<String, String[]> validItemIdsMap = new HashMap();
388 HashMap<String, String[]> invalidItemIdsMap = new HashMap();
389
390 List<OleLoanDocument> selectedLoanDocumentList = filterListForInvalidDueDateItems(itemBarcodeMap, getSelectedLoanDocumentList(circForm));
391 List<OleLoanDocument> loanDocumentsToBeUpdatedInDb = filterListForInvalidDueDateItems(itemBarcodeMap, getSelectedLoanDocumentList(circForm));
392 CircUtilController circUtilController = new CircUtilController();
393
394 Map<String, Map> docstoreResultMap = alterDueDateInDocstore(circForm, itemBarcodeMap, selectedLoanDocumentList);
395 for (Iterator<String> iterator = docstoreResultMap.keySet().iterator(); iterator.hasNext(); ) {
396 String itemUuid = iterator.next();
397 Map result = docstoreResultMap.get(itemUuid);
398 DocstoreDocument.ResultType resultType = (DocstoreDocument.ResultType) result.get("result");
399 OleLoanDocument loanDocument = getCheckoutUIController(circForm.getFormKey()).getLoanDocumentFromListBasedOnItemUuid(itemUuid, selectedLoanDocumentList);
400 if (resultType.equals(DocstoreDocument.ResultType.SUCCESS)) {
401 if (null != loanDocument) {
402 String[] dueDateAndTime = itemBarcodeMap.get(loanDocument.getItemId());
403 String dateString = dueDateAndTime[0];
404 Timestamp newDueDate = null;
405 if (StringUtils.isNotBlank(dateString)) {
406 if(StringUtils.isBlank(dueDateAndTime[1])) {
407 dueDateAndTime[1] =ParameterValueResolver.getInstance().getParameter(OLEConstants
408 .APPL_ID_OLE, OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT, OLEConstants.DEFAULT_TIME_FOR_DUE_DATE);
409 }
410 newDueDate = getCheckoutUIController(circForm.getFormKey()).processDateAndTimeForAlterDueDate(getDateFromString(dateString), dueDateAndTime[1]);
411 }
412 loanDocument.setLoanDueDate(newDueDate);
413 circUtilController.updateNoticesForLoanDocument(loanDocument);
414 validItemIdsMap.put(loanDocument.getItemId(), dueDateAndTime);
415 }
416 } else {
417 loanDocumentsToBeUpdatedInDb.remove(loanDocument);
418 invalidItemIdsMap.put(loanDocument.getItemId(), null);
419 LOG.error("Alter due date was not successful for itemUUID : " + itemUuid);
420 }
421 }
422 saveLoanDocumentsToDb(loanDocumentsToBeUpdatedInDb);
423
424
425 AlterDueDateAndRenewResponse alterDueDateAndRenewResponse = new AlterDueDateAndRenewResponse();
426 alterDueDateAndRenewResponse.setValidItemIdsMap(validItemIdsMap);
427 alterDueDateAndRenewResponse.setInvalidItemIdsMap(invalidItemIdsMap);
428
429 return alterDueDateAndRenewResponse;
430 }
431
432 private void saveLoanDocumentsToDb(List<OleLoanDocument> loanDocumentsToBeUpdatedInDb) {
433 BusinessObjectService oleBusinessObjectService = (BusinessObjectService) SpringContext.getService("oleBusinessObjectService");
434 oleBusinessObjectService.save(loanDocumentsToBeUpdatedInDb);
435 }
436
437 private Date getDateFromString(String dateString) throws ParseException {
438 return getDateTimeService().convertToDate(dateString);
439 }
440
441
442 private List<OleLoanDocument> filterListForInvalidDueDateItems(Map<String, String[]> itemBarcodeMap, List<OleLoanDocument> selectedLoanDocumentList) {
443 ArrayList<OleLoanDocument> filteredDocuments = new ArrayList<>();
444 for (Iterator<OleLoanDocument> iterator = selectedLoanDocumentList.iterator(); iterator.hasNext(); ) {
445 OleLoanDocument oleLoanDocument = iterator.next();
446 if (itemBarcodeMap.containsKey(oleLoanDocument.getItemId())) {
447 filteredDocuments.add(oleLoanDocument);
448 }
449 }
450
451 return filteredDocuments;
452 }
453
454 private Map<String, Map> alterDueDateInDocstore(CircForm circForm, Map<String, String[]> itemIdMap, List<OleLoanDocument> selectedLoanDocumentList) throws Exception {
455 List<Item> itemList = new ArrayList<>();
456 for (Iterator<OleLoanDocument> iterator = selectedLoanDocumentList.iterator(); iterator.hasNext(); ) {
457 Map<String, Object> valueMap = new HashMap<>();
458 OleLoanDocument oleLoanDocument = iterator.next();
459 String[] dueDateAndTime = itemIdMap.get(oleLoanDocument.getItemId());
460 String dateString = dueDateAndTime[0];
461 Timestamp newDueDate = null;
462 if (StringUtils.isNotBlank(dateString)) {
463 if(StringUtils.isBlank(dueDateAndTime[1])) {
464 dueDateAndTime[1] = ParameterValueResolver.getInstance().getParameter(OLEConstants
465 .APPL_ID_OLE, OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT, OLEConstants.DEFAULT_TIME_FOR_DUE_DATE);
466 }
467 newDueDate = getCheckoutUIController(circForm.getFormKey()).processDateAndTimeForAlterDueDate(getDateFromString(dateString), dueDateAndTime[1]);
468 }
469 valueMap.put("loanDueDate", newDueDate);
470 valueMap.put("itemUUID", oleLoanDocument.getItemUuid());
471 Item itemForUpdate = getCheckoutUIController(circForm.getFormKey()).getItemForUpdate(valueMap);
472 if (null != itemForUpdate) {
473 itemList.add(itemForUpdate);
474 }
475
476 }
477 OleStopWatch oleStopWatch = new OleStopWatch();
478 oleStopWatch.start();
479 Map<String, Map> docstoreResultMap = getBulkItemUpdateUtil().updateItemsToDocstore(itemList);
480 oleStopWatch.end();
481 System.out.println("Time taken to batch update item loan due dates in solr : " + oleStopWatch.getTotalTime());
482 return docstoreResultMap;
483 }
484
485 private void alterDueDateForLoanInDB(List<OleLoanDocument> oleLoanDocuments) {
486 List<BulkUpdateDataObject> bulkUpdateDataObjects = new ArrayList<>();
487 for (Iterator<OleLoanDocument> iterator = oleLoanDocuments.iterator(); iterator.hasNext(); ) {
488 OleLoanDocument oleLoanDocument = iterator.next();
489 BulkUpdateDataObject bulkUpdateDataObject = new BulkUpdateDataObject();
490 HashMap setClauseMap = new HashMap();
491 setClauseMap.put("CURR_DUE_DT_TIME", oleLoanDocument.getLoanDueDate());
492 bulkUpdateDataObject.setSetClauseMap(setClauseMap);
493 HashMap whereClauseMap = new HashMap();
494 whereClauseMap.put("ITM_ID", oleLoanDocument.getItemId());
495 bulkUpdateDataObject.setWhereClauseMap(whereClauseMap);
496 bulkUpdateDataObjects.add(bulkUpdateDataObject);
497 }
498
499 OleStopWatch oleStopWatch = new OleStopWatch();
500 oleStopWatch.start();
501 int[] updatedCount = getOleLoanDocumentPlatformAwareDao().updateLoanDocument(bulkUpdateDataObjects);
502 oleStopWatch.end();
503 System.out.println("Time taken to batch update loan documents in DB : " + oleStopWatch.getTotalTime());
504 System.out.println(Arrays.toString(updatedCount));
505 }
506
507 public List<OleLoanDocument> getSelectedLoanDocumentList(CircForm circForm) {
508 List<OleLoanDocument> selectedLoanList = new ArrayList<>();
509 List<OleLoanDocument> loanList = new ArrayList<>();
510 if (CollectionUtils.isNotEmpty(circForm.getExistingLoanList()))
511 loanList.addAll(circForm.getExistingLoanList());
512 if (CollectionUtils.isNotEmpty(circForm.getLoanDocumentListForCurrentSession()))
513 loanList.addAll(circForm.getLoanDocumentListForCurrentSession());
514 if (CollectionUtils.isNotEmpty(loanList)) {
515 for (Iterator<OleLoanDocument> iterator = loanList.iterator(); iterator.hasNext(); ) {
516 OleLoanDocument oleLoanDocument = iterator.next();
517 if (oleLoanDocument.isCheckNo() && !selectedLoanList.contains(oleLoanDocument)) {
518 selectedLoanList.add(oleLoanDocument);
519 }
520 }
521 }
522 return selectedLoanList;
523 }
524
525 @RequestMapping(params = "methodToCall=applyDamagedItem")
526 public ModelAndView applyDamagedItem(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
527 HttpServletRequest request, HttpServletResponse response) throws Exception {
528 CircForm circForm = (CircForm) form;
529 String damageItemDescription = request.getParameter("damageItemDescription");
530 List<OleLoanDocument> loanDocumentList = getSelectedLoanDocumentList(circForm);
531 if (CollectionUtils.isNotEmpty(loanDocumentList)) {
532 for (Iterator<OleLoanDocument> iterator = loanDocumentList.iterator(); iterator.hasNext(); ) {
533 OleLoanDocument oleLoanDocument = iterator.next();
534 oleLoanDocument.setItemDamagedNote(damageItemDescription);
535 oleLoanDocument.setDamagedItemIndicator(true);
536 oleLoanDocument.setDamagedItemDate(new Timestamp(new Date().getTime()));
537 }
538 createDamagedItem(circForm, loanDocumentList, circForm.getPatronDocument());
539 }
540 return getUIFModelAndView(form);
541 }
542
543
544 @RequestMapping(params = "methodToCall=removeDamagedItem")
545 public ModelAndView removeDamagedItem(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
546 HttpServletRequest request, HttpServletResponse response) throws Exception {
547 CircForm circForm = (CircForm) form;
548 List<OleLoanDocument> selectedLoanDocumentList = getSelectedLoanDocumentList(circForm);
549 deleteDamagedItem(circForm, selectedLoanDocumentList);
550 return getUIFModelAndView(form);
551 }
552
553 @RequestMapping(params = "methodToCall=removeMissingPieceItem")
554 public ModelAndView removeMissingPieceItem(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
555 HttpServletRequest request, HttpServletResponse response) throws Exception {
556 CircForm circForm = (CircForm) form;
557 List<OleLoanDocument> selectedLoanDocumentList = getSelectedLoanDocumentList(circForm);
558 deleteMissingPieceItem(circForm, selectedLoanDocumentList);
559 return getUIFModelAndView(form);
560 }
561
562
563 @RequestMapping(params = "methodToCall=applyMissingPieceItem")
564 public ModelAndView applyMissingPieceItem(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
565 HttpServletRequest request, HttpServletResponse response) throws Exception {
566 CircForm circForm = (CircForm) form;
567 String missingPieceCnt = request.getParameter("missingPieceCnt");
568 String noOfPieces = request.getParameter("noOfPieces");
569 String missingPieceNote = request.getParameter("missingPieceNte");
570 List<OleLoanDocument> loanDocumentList = getSelectedLoanDocumentList(circForm);
571 if (CollectionUtils.isNotEmpty(loanDocumentList)) {
572 for (Iterator<OleLoanDocument> iterator = loanDocumentList.iterator(); iterator.hasNext(); ) {
573 OleLoanDocument oleLoanDocument = iterator.next();
574 oleLoanDocument.setMissingPiecesCount(missingPieceCnt);
575 oleLoanDocument.setMissingPieceFlag(true);
576 oleLoanDocument.setMissingPieceNote(missingPieceNote);
577 oleLoanDocument.setNoOfMissingPiece(noOfPieces);
578 oleLoanDocument.setMissingPieceItemDate(new Timestamp(new Date().getTime()));
579 }
580 createMissingPieceItem(circForm, loanDocumentList, circForm.getPatronDocument());
581 }
582 return getUIFModelAndView(form);
583 }
584
585 @RequestMapping(params = "methodToCall=renew")
586 public ModelAndView renew(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
587 HttpServletRequest request, HttpServletResponse response) throws Exception {
588
589 CircForm circForm = (CircForm) form;
590
591 if (null != circForm.getLoanDocumentsForRenew()) {
592 circForm.setLoanDocumentsForRenew(new ArrayList<OleLoanDocument>());
593 }
594 circForm.setErrorMessage(new ErrorMessage());
595 List<OleLoanDocument> selectedLoanDocumentList = getSelectedLoanDocumentList(circForm);
596 if (CollectionUtils.isNotEmpty(selectedLoanDocumentList)) {
597 DroolsResponse droolsResponse = getRenewController().renewItems(selectedLoanDocumentList, circForm.getPatronDocument());
598
599 String messageContentForRenew = getRenewController().analyzeRenewedLoanDocuments(circForm, droolsResponse);
600
601 ErrorMessage errorMessage = new ErrorMessage();
602 errorMessage.setErrorMessage(messageContentForRenew);
603 circForm.setErrorMessage(errorMessage);
604
605 if (CollectionUtils.isNotEmpty(circForm.getLoanDocumentsForRenew())) {
606 showDialogAndRunCustomScript("renewOverrideDialog", circForm, "jq('.renewItemCBClass').removeAttr('checked');jq('.renewItemCBClass').removeAttr('checked');");
607 } else if (StringUtils.isNotBlank(messageContentForRenew)) {
608 showDialogAndRunCustomScript("generalInfoWithRefreshDialog", circForm, "jq('.loanedItemCBClass').removeAttr('checked');jq('.loaningItemCBClass').removeAttr('checked');");
609 circForm.setLoanDocumentsForRenew(new ArrayList<OleLoanDocument>());
610 }
611 } else {
612 ErrorMessage errorMessage = new ErrorMessage();
613 errorMessage.setErrorMessage("Please select any one of loaned item to renew.");
614 circForm.setErrorMessage(errorMessage);
615 showDialog("generalInfoDialog", circForm, request, response);
616 }
617
618 return getUIFModelAndView(form);
619 }
620
621 private void processJsonStringForRenew(CircForm circForm, String jsonString, List<OleLoanDocument> selectedLoanDocumentForRenewOverride) {
622 JSONArray renewObjectValues = null;
623 try {
624 renewObjectValues = new JSONArray(jsonString);
625 for (int index = 0; index < renewObjectValues.length(); index++) {
626 JSONObject jsonObject = (JSONObject) renewObjectValues.get(index);
627 String itemBarcode = getStringValueFromJsonObject(jsonObject, "itemBarcode");
628 OleLoanDocument loanDocument = getCheckoutUIController(circForm.getFormKey()).getLoanDocumentFromListBasedOnItemBarcode(itemBarcode, selectedLoanDocumentForRenewOverride);
629 if (null != loanDocument) {
630 loanDocument.setRenewCheckNo(true);
631 if (loanDocument.isNonCirculatingItem()) {
632 String dateString = getStringValueFromJsonObject(jsonObject, "date");
633 String dateTimeString = getStringValueFromJsonObject(jsonObject, "dateTime");
634 Timestamp timestamp = null;
635 try {
636 timestamp = getCheckoutUIController(circForm.getFormKey()).processDateAndTimeForAlterDueDate(new DateUtil().getDate(dateString), dateTimeString);
637 } catch (Exception e) {
638 e.printStackTrace();
639 }
640 loanDocument.setLoanDueDate(timestamp);
641 }
642 }
643 }
644 } catch (JSONException e) {
645 e.printStackTrace();
646 }
647 }
648
649
650 @RequestMapping(params = "methodToCall=overrideRenewItems")
651 public ModelAndView overrideRenewItems(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
652 HttpServletRequest request, HttpServletResponse response) throws Exception {
653 CircForm circForm = (CircForm) form;
654
655 String jsonString = request.getParameter("renewObjectValues");
656 processJsonStringForRenew(circForm, jsonString, circForm.getLoanDocumentsForRenew());
657
658 List<OleLoanDocument> circulatingLoanDocumentsForRenew = new ArrayList<>();
659 List<OleLoanDocument> nonCirculatingLoanDocumentsForRenew = new ArrayList<>();
660 if (CollectionUtils.isNotEmpty(circForm.getLoanDocumentsForRenew())) {
661 for (Iterator<OleLoanDocument> iterator = circForm.getLoanDocumentsForRenew().iterator(); iterator.hasNext(); ) {
662 OleLoanDocument oleLoanDocument = iterator.next();
663 if (oleLoanDocument.isRenewCheckNo()) {
664 if (oleLoanDocument.isNonCirculatingItem()) {
665 nonCirculatingLoanDocumentsForRenew.add(oleLoanDocument);
666 } else {
667 circulatingLoanDocumentsForRenew.add(oleLoanDocument);
668 }
669 }
670 }
671 String responseForNonCirculatingItem = null;
672 if (CollectionUtils.isNotEmpty(nonCirculatingLoanDocumentsForRenew)) {
673 DroolsResponse droolsResponseForNonCirculatingItem = getRenewController().proceedToSaveLoanDocuments(nonCirculatingLoanDocumentsForRenew);
674 responseForNonCirculatingItem = getRenewController().prepareResponseForRenewedLoanDocuments(droolsResponseForNonCirculatingItem);
675 }
676
677 String responseForCirculatingItem = null;
678 if (CollectionUtils.isNotEmpty(circulatingLoanDocumentsForRenew)) {
679 DroolsResponse droolsResponseForCirculatingItem = getRenewController().proceedToSaveLoanDocuments(circulatingLoanDocumentsForRenew);
680 responseForCirculatingItem = getRenewController().prepareResponseForRenewedLoanDocuments(droolsResponseForCirculatingItem);
681 }
682
683 if (StringUtils.isNotBlank(responseForNonCirculatingItem)) {
684 getRenewController().prepareResponeMessage(circForm, responseForNonCirculatingItem);
685 }
686 if (StringUtils.isNotBlank(responseForCirculatingItem)) {
687 getRenewController().prepareResponeMessage(circForm, responseForCirculatingItem);
688 }
689 }
690
691 if (CollectionUtils.isNotEmpty(nonCirculatingLoanDocumentsForRenew) && CollectionUtils.isNotEmpty(circulatingLoanDocumentsForRenew)) {
692 circForm.getLoanDocumentsForRenew().clear();
693 }
694
695 if (null != circForm.getErrorMessage() && StringUtils.isNotBlank(circForm.getErrorMessage().getErrorMessage())) {
696 showDialog("generalInfoDialog", circForm, request, response);
697 }
698
699 return getUIFModelAndView(form);
700 }
701
702
703 @RequestMapping(params = "methodToCall=doNotRenewalItem")
704 public ModelAndView doNotRenewalItem(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
705 HttpServletRequest request, HttpServletResponse response) throws Exception {
706 CircForm circForm = (CircForm) form;
707 if (null != circForm.getErrorMessage() && StringUtils.isNotBlank(circForm.getErrorMessage().getErrorMessage())) {
708 showDialog("generalInfoDialog", circForm, request, response);
709 } else {
710 executeCustomScriptAfterClosingLightBox(circForm, "jq.fancybox.close();");
711 }
712 circForm.getLoanDocumentsForRenew().clear();
713 return getUIFModelAndView(circForm);
714 }
715
716 @RequestMapping(params = "methodToCall=newPage")
717 public ModelAndView showNewPage(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
718 HttpServletRequest request, HttpServletResponse response) {
719 CircForm circForm = (CircForm) form;
720 circForm.setPageNumber(request.getParameter("pageNumber"));
721 return getUIFModelAndView(form);
722 }
723
724 @RequestMapping(params = "methodToCall=newPageCheckoutDialog")
725 public ModelAndView showNewPageCheckoutDialog(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
726 HttpServletRequest request, HttpServletResponse response) {
727 CircForm circForm = (CircForm) form;
728 circForm.setPageNumber(request.getParameter("pageNumber"));
729 String overrideParameters = "{closeBtn:false,autoSize : false}";
730 return showDialogWithOverrideParameters("proxyListCheckoutDialog", circForm,overrideParameters);
731 }
732
733
734 @RequestMapping(params = "methodToCall=newSizeCheckoutDialog")
735 public ModelAndView showNewPageSizeCheckoutDialog(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
736 HttpServletRequest request, HttpServletResponse response) {
737 CircForm circForm = (CircForm) form;
738 circForm.setPageSize(request.getParameter("pageSize"));
739 String overrideParameters = "{closeBtn:false,autoSize : false}";
740 return showDialogWithOverrideParameters("proxyListCheckoutDialog", circForm, overrideParameters);
741 }
742
743
744 @RequestMapping(params = "methodToCall=newSize")
745 public ModelAndView showNewPageSize(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
746 HttpServletRequest request, HttpServletResponse response) {
747 CircForm circForm = (CircForm) form;
748 circForm.setPageSize(request.getParameter("pageSize"));
749 return getUIFModelAndView(form);
750 }
751
752
753 @RequestMapping(params = "methodToCall=selectAll")
754 public ModelAndView selectAll(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
755 HttpServletRequest request, HttpServletResponse response) {
756 CircForm circForm = (CircForm) form;
757 for (OleLoanDocument oleLoanDocument : circForm.getExistingLoanList()) {
758 oleLoanDocument.setCheckNo(true);
759 }
760
761 return getUIFModelAndView(form);
762 }
763
764
765 @RequestMapping(params = "methodToCall=deselectAll")
766 public ModelAndView deselectAll(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
767 HttpServletRequest request, HttpServletResponse response) {
768 CircForm circForm = (CircForm) form;
769 for (OleLoanDocument oleLoanDocument : circForm.getExistingLoanList()) {
770 oleLoanDocument.setCheckNo(false);
771 }
772
773 return getUIFModelAndView(form);
774 }
775
776 @RequestMapping(params = "methodToCall=proceedForRenew")
777 public ModelAndView proceedForRenew(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
778 HttpServletRequest request, HttpServletResponse response) {
779 CircForm circForm = (CircForm) form;
780 if (null != circForm.getLoanDocumentsForRenew()) {
781 circForm.setLoanDocumentsForRenew(new ArrayList<OleLoanDocument>());
782 }
783 circForm.setErrorMessage(new ErrorMessage());
784 OleLoanDocument currentLoanDocument = getCheckoutUIController(circForm.getFormKey()).getCurrentLoanDocument(circForm.getItemBarcode());
785 List<OleLoanDocument> selectedLoanDocumentList = new ArrayList<>();
786 if (null != currentLoanDocument) {
787 selectedLoanDocumentList.add(currentLoanDocument);
788 }
789 if (CollectionUtils.isNotEmpty(selectedLoanDocumentList)) {
790 DroolsResponse droolsResponse = getRenewController().renewItems(selectedLoanDocumentList, circForm.getPatronDocument());
791
792 String messageContentForRenew = getRenewController().analyzeRenewedLoanDocuments(circForm, droolsResponse);
793
794 ErrorMessage errorMessage = new ErrorMessage();
795
796 if (CollectionUtils.isNotEmpty(circForm.getLoanDocumentsForRenew())) {
797 errorMessage.setErrorMessage(circForm.getLoanDocumentsForRenew().get(0).getErrorMessage());
798 circForm.setErrorMessage(errorMessage);
799 showDialog("checkoutRenewCustomDueDateConfirmationDialog", circForm, request, response);
800 } else if (StringUtils.isNotBlank(messageContentForRenew)) {
801 errorMessage.setErrorMessage(messageContentForRenew);
802 circForm.setErrorMessage(errorMessage);
803 showDialog("generalInfoWithRefreshDialog", circForm, request, response);
804 circForm.setLoanDocumentsForRenew(new ArrayList<OleLoanDocument>());
805 }
806 }
807 return getUIFModelAndView(form);
808 }
809
810 @RequestMapping(params = "methodToCall=overrideCheckoutRenewItems")
811 public ModelAndView overrideCheckoutRenewItems(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
812 HttpServletRequest request, HttpServletResponse response) throws Exception {
813 CircForm circForm = (CircForm) form;
814 circForm.getErrorMessage().setErrorMessage(null);
815 String customDate = request.getParameter("renewCustomDueDateMap");
816 String customDateTime = request.getParameter("renewCustomDueDateTime");
817 if (StringUtils.isNotBlank(customDate)) {
818 circForm.setCustomDueDateMapForRenew(new DateUtil().getDate(customDate));
819 }
820 circForm.setCustomDueDateTimeForRenew(customDateTime);
821 if (CollectionUtils.isNotEmpty(circForm.getLoanDocumentsForRenew())) {
822 String responseForRenewItem = null;
823 Timestamp timestamp = getCheckoutUIController(circForm.getFormKey
824 ()).processDateAndTimeForAlterDueDate(circForm.getCustomDueDateMapForRenew(), circForm.getCustomDueDateTimeForRenew());
825 circForm.getLoanDocumentsForRenew().get(0).setLoanDueDate(timestamp);
826 DroolsResponse droolsResponseForRenewItem = getRenewController().proceedToSaveLoanDocuments(circForm.getLoanDocumentsForRenew());
827 responseForRenewItem = getRenewController().prepareResponseForRenewedLoanDocuments(droolsResponseForRenewItem);
828 getRenewController().prepareResponeMessage(circForm, responseForRenewItem);
829 }
830 circForm.getLoanDocumentsForRenew().clear();
831 if (null != circForm.getErrorMessage() && StringUtils.isNotBlank(circForm.getErrorMessage().getErrorMessage())) {
832 showDialog("generalInfoDialog", circForm, request, response);
833 }
834 return getUIFModelAndView(form);
835 }
836
837 @RequestMapping(params = "methodToCall=cancelOverrideCheckoutRenewItems")
838 public ModelAndView cancelOverrideCheckoutRenewItems(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
839 HttpServletRequest request, HttpServletResponse response) throws Exception {
840 CircForm circForm = (CircForm) form;
841 circForm.getErrorMessage().setErrorMessage(null);
842 circForm.getLoanDocumentsForRenew().clear();
843 circForm.getCustomDueDateMapForRenew();
844 circForm.getCustomDueDateTimeForRenew();
845 circForm.getCustomDueDateTimeMessageForRenew();
846 return getUIFModelAndView(form);
847 }
848
849 public OleLoanDocumentsFromSolrBuilder getOleLoanDocumentsFromSolrBuilder() {
850 if (null == oleLoanDocumentsFromSolrBuilder) {
851 oleLoanDocumentsFromSolrBuilder = new OleLoanDocumentsFromSolrBuilder();
852
853 }
854 return oleLoanDocumentsFromSolrBuilder;
855 }
856
857 public OleLoanDocumentPlatformAwareDao getOleLoanDocumentPlatformAwareDao() {
858 if (null == oleLoanDocumentPlatformAwareDao) {
859 oleLoanDocumentPlatformAwareDao = (OleLoanDocumentPlatformAwareDao) SpringContext.getService("OleLoanDocumentPlatformAwareDao");
860 }
861 return oleLoanDocumentPlatformAwareDao;
862 }
863
864 public void setOleLoanDocumentPlatformAwareDao(OleLoanDocumentPlatformAwareDao oleLoanDocumentPlatformAwareDao) {
865 this.oleLoanDocumentPlatformAwareDao = oleLoanDocumentPlatformAwareDao;
866 }
867
868 public BulkItemUpdateUtil getBulkItemUpdateUtil() {
869 if (null == bulkItemUpdateUtil) {
870 bulkItemUpdateUtil = new BulkItemUpdateUtil();
871 }
872 return bulkItemUpdateUtil;
873 }
874
875 public void setBulkItemUpdateUtil(BulkItemUpdateUtil bulkItemUpdateUtil) {
876 this.bulkItemUpdateUtil = bulkItemUpdateUtil;
877 }
878
879 public RenewController getRenewController() {
880 if (null == renewController) {
881 renewController = new RenewController();
882 }
883 return renewController;
884 }
885
886
887
888 public DateTimeService getDateTimeService() {
889 if(dateTimeService == null){
890 dateTimeService = (DateTimeService) SpringContext.getService("dateTimeService");
891 }
892 return dateTimeService;
893 }
894
895 public void setDateTimeService(DateTimeService dateTimeService) {
896 this.dateTimeService = dateTimeService;
897 }
898
899 public void setRenewController(RenewController renewController) {
900 this.renewController = renewController;
901 }
902
903 private String getParameter(String parameterName) {
904 String parameter = ParameterValueResolver.getInstance().getParameter(OLEConstants.APPL_ID_OLE, OLEConstants.DLVR_NMSPC, OLEConstants
905 .DLVR_CMPNT, parameterName);
906 return parameter;
907 }
908 }