View Javadoc
1   package org.kuali.ole.deliver.service.impl;
2   
3   import org.apache.log4j.Logger;
4   import org.kuali.ole.OLEConstants;
5   import org.kuali.ole.deliver.bo.*;
6   import org.kuali.ole.bo.OLECheckedOutItem;
7   import org.kuali.ole.bo.OLEHold;
8   import org.kuali.ole.bo.OLEItemFine;
9   import org.kuali.rice.core.framework.persistence.jdbc.dao.PlatformAwareDaoBaseJdbc;
10  import org.kuali.rice.coreservice.api.CoreServiceApiServiceLocator;
11  import org.kuali.rice.coreservice.api.parameter.Parameter;
12  import org.kuali.rice.coreservice.api.parameter.ParameterKey;
13  import org.kuali.rice.krad.service.BusinessObjectService;
14  import org.kuali.rice.krad.service.KRADServiceLocator;
15  
16  import java.sql.Timestamp;
17  import java.text.SimpleDateFormat;
18  import java.util.*;
19  
20  /**
21   * Created by maheswarang on 10/20/14.
22   */
23  public class OleDeliverDaoJdbc extends PlatformAwareDaoBaseJdbc {
24      private static final Logger LOG = Logger.getLogger(OleDeliverDaoJdbc.class);
25      private BusinessObjectService businessObjectService = KRADServiceLocator.getBusinessObjectService();
26      private Map<String, OleCirculationDesk> oleCirculationDeskMap;
27      private Map<String, OleDeliverRequestType> oleDeliverRequestTypeMap;
28  
29      public Map<String, OleCirculationDesk> getOleCirculationDeskMap() {
30          return oleCirculationDeskMap;
31      }
32  
33      public void setOleCirculationDeskMap(Map<String, OleCirculationDesk> oleCirculationDeskMap) {
34          this.oleCirculationDeskMap = oleCirculationDeskMap;
35      }
36  
37      public Map<String, OleDeliverRequestType> getOleDeliverRequestTypeMap() {
38          return oleDeliverRequestTypeMap;
39      }
40  
41      public void setOleDeliverRequestTypeMap(Map<String, OleDeliverRequestType> oleDeliverRequestTypeMap) {
42          this.oleDeliverRequestTypeMap = oleDeliverRequestTypeMap;
43      }
44  
45      /**
46       * @return
47       */
48      public Map<String, OleCirculationDesk> getAvailableCirculationDesks() {
49          if (this.oleCirculationDeskMap == null) {
50              Map<String, OleCirculationDesk> circulationDeskMap = new HashMap<String, OleCirculationDesk>();
51              List<OleCirculationDesk> oleCirculationDeskList = (List<OleCirculationDesk>) businessObjectService.findAll(OleCirculationDesk.class);
52              if (oleCirculationDeskList != null && oleCirculationDeskList.size() > 0) {
53                  for (OleCirculationDesk oleCirculationDesk : oleCirculationDeskList) {
54                      circulationDeskMap.put(oleCirculationDesk.getCirculationDeskId(), oleCirculationDesk);
55  
56                  }
57              }
58              this.setOleCirculationDeskMap(circulationDeskMap);
59          }
60          return oleCirculationDeskMap;
61      }
62  
63      public Map<String, OleDeliverRequestType> getAvailableRequestTypes() {
64          if (this.oleDeliverRequestTypeMap == null) {
65              Map<String, OleDeliverRequestType> requestTypeMap = new HashMap<String, OleDeliverRequestType>();
66              List<OleDeliverRequestType> oleDeliverRequestTypeList = (List<OleDeliverRequestType>) businessObjectService.findAll(OleDeliverRequestType.class);
67              if (oleDeliverRequestTypeList != null && oleDeliverRequestTypeList.size() > 0) {
68                  for (OleDeliverRequestType oleDeliverRequestType : oleDeliverRequestTypeList) {
69                      requestTypeMap.put(oleDeliverRequestType.getRequestTypeId(), oleDeliverRequestType);
70                  }
71              }
72              this.setOleDeliverRequestTypeMap(requestTypeMap);
73          }
74          return oleDeliverRequestTypeMap;
75      }
76  
77  
78      /**
79       * This method is used to get the loan information to the response object
80       *
81       * @param oleLoanDocuments
82       * @return
83       */
84      public List<OLECheckedOutItem> getCheckedOutItemsList(List<OleLoanDocument> oleLoanDocuments) {
85          LOG.info("inside the getCheckedOutItemsList for processing ");
86          SimpleDateFormat fmt = new SimpleDateFormat(OLEConstants.OleDeliverRequest.DATE_FORMAT);
87          List<OLECheckedOutItem> oleCheckedOutItemList = new ArrayList<OLECheckedOutItem>();
88  
89          if (oleLoanDocuments != null && oleLoanDocuments.size() > 0) {
90              OLECheckedOutItem oleCheckedOutItem = null;
91              for (OleLoanDocument oleLoanDocument : oleLoanDocuments) {
92                  oleCheckedOutItem = new OLECheckedOutItem();
93                  try {
94                      oleCheckedOutItem.setAcquiredFine("");
95                      oleCheckedOutItem.setDateRecalled("");
96                      try {
97                          if (oleLoanDocument.getLoanDueDate() != null) {
98                              oleCheckedOutItem.setDueDate(oleLoanDocument.getLoanDueDate().toString());
99                              if ((fmt.format(oleLoanDocument.getLoanDueDate())).compareTo(fmt.format(new Date(System.currentTimeMillis()))) > 0) {
100                                 oleCheckedOutItem.setOverDue(false);
101                             } else {
102                                 oleCheckedOutItem.setOverDue(true);
103                             }
104                         } else {
105                             oleCheckedOutItem.setDueDate((new Timestamp(new Date(2025, 1, 1).getTime()).toString()));
106                         }
107                     } catch (Exception e) {
108                         LOG.info("Exception occured while setting the due date " + oleLoanDocument.getLoanDueDate() + "Reason : " + e.getMessage());
109                         LOG.error(e, e);
110                     }
111                     if (oleLoanDocument.getRenewalLoanDueDate() != null) {
112                         oleCheckedOutItem.setDateRenewed(oleLoanDocument.getRenewalLoanDueDate().toString());
113                     } else {
114                         oleCheckedOutItem.setDateRenewed("");
115                     }
116                     if (null != oleLoanDocument.getCreateDate()) {
117                         oleCheckedOutItem.setLoanDate(new Timestamp(oleLoanDocument.getCreateDate().getTime()).toString());
118                     }
119                     oleCheckedOutItem.setItemId(oleLoanDocument.getItemId());
120                     if (oleLoanDocument.getNoOfOverdueNoticesSentForBorrower() != null) {
121                         oleCheckedOutItem.setNumberOfOverdueSent(oleLoanDocument.getNoOfOverdueNoticesSentForBorrower());
122                     } else {
123                         oleCheckedOutItem.setNumberOfOverdueSent("1");
124                     }
125 
126                     oleCheckedOutItem = setBibItemInformation(oleCheckedOutItem, oleLoanDocument.getItemId());
127                     oleCheckedOutItemList.add(oleCheckedOutItem);
128                 } catch (Exception e) {
129                     LOG.info("Exception occured while processing the loan document .Patron Barcode " + oleLoanDocument.getPatronBarcode() + "Item Barcode : " + oleLoanDocument.getItemId() + "Reason : " + e.getMessage());
130                     LOG.error(e, e);
131                 }
132             }
133         }
134 
135         return oleCheckedOutItemList;
136     }
137 
138     public String getParameter(String name) {
139         ParameterKey parameterKey = ParameterKey.create(OLEConstants.APPL_ID, OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT, name);
140         Parameter parameter = CoreServiceApiServiceLocator.getParameterRepositoryService().getParameter(parameterKey);
141         if (parameter == null) {
142             parameterKey = ParameterKey.create(OLEConstants.APPL_ID_OLE, OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT, name);
143             parameter = CoreServiceApiServiceLocator.getParameterRepositoryService().getParameter(parameterKey);
144         }
145         return parameter != null ? parameter.getValue() : null;
146     }
147 
148     /**
149      * This method is used the item and bib information to the check out response object
150      *
151      * @param oleCheckedOutItem
152      * @param itemBarcode
153      * @return
154      */
155     public OLECheckedOutItem setBibItemInformation(OLECheckedOutItem oleCheckedOutItem, String itemBarcode) {
156         LOG.info("Inside setBibItemInformation method for setting the item information to the loan document for the barcode : " + itemBarcode);
157         try {
158             if (itemBarcode != null) {
159                 String query = getParameter("NCIP_BIB_ITEM_INFORMATION");
160                 List<Map<String, Object>> itemData = null;
161                 LOG.info(query);
162                 try {
163                     itemData = getSimpleJdbcTemplate().queryForList(query, itemBarcode);
164                 } catch (Exception e) {
165                     LOG.info("Exception occured while executing the query ...... " + query);
166                 }
167                 if (itemData != null && itemData.size() > 0) {
168                     for (Map<String, Object> dataMap : itemData) {
169                         if (dataMap.get("ITEM_CALL_NUMBER") != null) {
170                             oleCheckedOutItem.setCallNumber(dataMap.get("ITEM_CALL_NUMBER").toString());
171                         } else if (dataMap.get("HOLDINGS_CALL_NUMBER") != null) {
172                             oleCheckedOutItem.setCallNumber(dataMap.get("HOLDINGS_CALL_NUMBER").toString());
173                         }
174 
175 
176                         if (dataMap.get("ITEM_COPY_NUMBER") != null) {
177                             oleCheckedOutItem.setCopyNumber(dataMap.get("ITEM_COPY_NUMBER").toString());
178                         } else if (dataMap.get("HOLDINGS_COPY_NUMBER") != null) {
179                             oleCheckedOutItem.setCopyNumber(dataMap.get("HOLDINGS_COPY_NUMBER").toString());
180                         }
181 
182 
183                         if (dataMap.get("ITEM_LOCATION") != null) {
184                             oleCheckedOutItem.setLocation(dataMap.get("ITEM_LOCATION").toString());
185                         } else if (dataMap.get("HOLDINGS_LOCATION") != null) {
186                             oleCheckedOutItem.setLocation(dataMap.get("HOLDINGS_LOCATION").toString());
187                         }
188 
189                         if (dataMap.get("TITLE") != null) {
190                             oleCheckedOutItem.setTitle(dataMap.get("TITLE").toString());
191                         }
192                         if (dataMap.get("AUTHOR") != null) {
193                             oleCheckedOutItem.setAuthor(dataMap.get("AUTHOR").toString());
194                         }
195 
196                         if (dataMap.get("ITEM_VOLUME_NUMBER") != null) {
197                             oleCheckedOutItem.setVolumeNumber(dataMap.get("ITEM_VOLUME_NUMBER").toString());
198                         }
199 
200                         if (dataMap.get("ITEM_TYPE_ID") != null) {
201                             oleCheckedOutItem.setItemType(dataMap.get("ITEM_TYPE_ID").toString());
202                         }
203 
204                     }
205                 }
206             }
207         } catch (Exception e) {
208             LOG.info("Exception occured while setting the item info to the loan documents " + e.getMessage());
209             LOG.error(e, e);
210         }
211 
212         return oleCheckedOutItem;
213 
214 
215     }
216 
217 
218     /**
219      * This method is used to set the hold response object with the request object list
220      *
221      * @param oleDeliverRequestBoList
222      * @return
223      * @throws Exception
224      */
225     public List<OLEHold> getHoldRecordsList(List<OleDeliverRequestBo> oleDeliverRequestBoList) throws Exception {
226         List<OLEHold> oleHoldList = new ArrayList<OLEHold>();
227         LOG.info("Inside the getHoldRecordsList ");
228         String[] availableDates;
229         try {
230             if (oleDeliverRequestBoList != null && oleDeliverRequestBoList.size() > 0) {
231                 for (OleDeliverRequestBo oleDeliverRequestBo : oleDeliverRequestBoList) {
232                     OLEHold oleHold = new OLEHold();
233                     oleHold.setItemId(oleDeliverRequestBo.getItemId());
234                     if (oleDeliverRequestBo.getRequestTypeId() != null && !oleDeliverRequestBo.getRequestTypeId().isEmpty()) {
235                         if (oleDeliverRequestBo.getRequestTypeId().equals("1") || oleDeliverRequestBo.getRequestTypeId().equals("2")) {
236                             oleHold.setRecallStatus(OLEConstants.YES);
237                         } else {
238                             oleHold.setRecallStatus(OLEConstants.NO);
239                         }
240                     }
241                     if (oleDeliverRequestBo.getRequestExpiryDate() != null) {
242                         oleHold.setExpiryDate(oleDeliverRequestBo.getRequestExpiryDate().toString());
243                     }
244                     if (oleDeliverRequestBo.getCreateDate() != null) {
245                         oleHold.setCreateDate(oleDeliverRequestBo.getCreateDate().toString());
246                     }
247                     if (oleDeliverRequestBo.getBorrowerQueuePosition() != null) {
248                         oleHold.setPriority(oleDeliverRequestBo.getBorrowerQueuePosition().toString());
249                     }
250 
251                     if (oleDeliverRequestBo.getRecallDueDate() != null) {
252                         oleHold.setDateRecalled(oleDeliverRequestBo.getRecallDueDate().toString());
253                     }
254                     if (oleDeliverRequestBo.getRecallDueDate() != null) {
255                         oleHold.setDateRecalled(oleDeliverRequestBo.getRecallDueDate().toString());
256                     }
257                     if (getAvailableRequestTypes() != null && getAvailableRequestTypes().size() > 0) {
258                         if (getAvailableRequestTypes().get(oleDeliverRequestBo.getRequestTypeId()) != null) {
259                             oleHold.setRequestType(getAvailableRequestTypes().get(oleDeliverRequestBo.getRequestTypeId()).getRequestTypeCode());
260                         }
261                     }
262                     Map<String, String> loanMap = new HashMap<String, String>();
263                     loanMap.put(OLEConstants.OleDeliverRequest.ITEM_ID, oleDeliverRequestBo.getItemId());
264                     List<OleLoanDocument> oleLoanDocumentList = (List<OleLoanDocument>) KRADServiceLocator.getBusinessObjectService().findMatching(OleLoanDocument.class, loanMap);
265                     if (oleLoanDocumentList.size() > 0) {
266                         if (oleLoanDocumentList.get(0).getLoanDueDate() != null) {
267                             availableDates = oleLoanDocumentList.get(0).getLoanDueDate().toString().split(" ");
268                             if (availableDates != null && availableDates.length > 0) {
269                                 oleHold.setAvailableDate(availableDates[0]);
270                             } else {
271                                 oleHold.setAvailableDate(oleLoanDocumentList.get(0).getLoanDueDate().toString());
272                             }
273                             if (oleDeliverRequestBo.getPickUpLocationId() != null) {
274                                 if (getAvailableCirculationDesks().size() > 0 && getAvailableCirculationDesks().get(oleDeliverRequestBo.getPickUpLocationId()) != null) {
275                                     oleHold.setDateAvailableExpires(addDate(new java.sql.Date(oleLoanDocumentList.get(0).getLoanDueDate().getTime()), Integer.parseInt(getAvailableCirculationDesks().get(oleDeliverRequestBo.getPickUpLocationId()).getOnHoldDays())).toString());
276                                     oleHold.setPickupLocation(getAvailableCirculationDesks().get(oleDeliverRequestBo.getPickUpLocationId()).getCirculationDeskCode());
277                                 }
278                             }
279                         } else {
280                             oleHold.setAvailableDate(OLEConstants.INDEFINITE);
281                             oleHold.setDateAvailableExpires(OLEConstants.INDEFINITE);
282                         }
283                     }
284                     if (oleDeliverRequestBo.getRequestTypeId().equals("2") || oleDeliverRequestBo.getRequestTypeId().equals("4") || oleDeliverRequestBo.getRequestTypeId().equals("6")) {
285                         oleHold.setReserve(true);
286                     } else {
287                         oleHold.setReserve(false);
288                     }
289                     oleHold = setBibItemInformation(oleHold, oleDeliverRequestBo.getItemId());
290                     oleHoldList.add(oleHold);
291                 }
292             }
293         } catch (Exception e) {
294             LOG.info("Exception occured while setting the bib and item info to the holds . Reason" + e.getMessage());
295             LOG.error(e, e);
296         }
297 
298         return oleHoldList;
299     }
300 
301 
302     /**
303      * This method is used to set the the bib and item informations to the response hold object
304      *
305      * @param oleHold
306      * @param itemBarcode
307      * @return
308      */
309     public OLEHold setBibItemInformation(OLEHold oleHold, String itemBarcode) {
310         LOG.info("Inside setBibItemInformation for the hold records for the item Barcode :" + itemBarcode);
311         try {
312             if (itemBarcode != null) {
313                 String query = getParameter("NCIP_BIB_ITEM_INFORMATION_HOLD");
314                 List<Map<String, Object>> itemData = null;
315                 try {
316 
317                     itemData = getSimpleJdbcTemplate().queryForList(query, itemBarcode);
318                 } catch (Exception e) {
319                     LOG.info("Exception occured while executing the query ........" + query);
320                 }
321                 if (itemData != null && itemData.size() > 0) {
322                     for (Map<String, Object> dateMap : itemData) {
323                         if (dateMap.get("ITEM_CALL_NUMBER") != null) {
324                             oleHold.setCallNumber(dateMap.get("ITEM_CALL_NUMBER").toString());
325                         } else if (dateMap.get("HOLDINGS_CALL_NUMBER") != null) {
326                             oleHold.setCallNumber(dateMap.get("HOLDINGS_CALL_NUMBER").toString());
327                         }
328 
329                         if (dateMap.get("ITEM_COPY_NUMBER") != null) {
330                             oleHold.setCopyNumber(dateMap.get("ITEM_COPY_NUMBER").toString());
331                         } else if (dateMap.get("HOLDINGS_COPY_NUMBER") != null) {
332                             oleHold.setCopyNumber(dateMap.get("HOLDINGS_COPY_NUMBER").toString());
333                         }
334 
335                         if (dateMap.get("TITLE") != null) {
336                             oleHold.setTitle(dateMap.get("TITLE").toString());
337                         }
338                         if (dateMap.get("AUTHOR") != null) {
339                             oleHold.setAuthor(dateMap.get("AUTHOR").toString());
340                         }
341 
342                         if (dateMap.get("ITEM_VOLUME_NUMBER") != null) {
343                             oleHold.setVolumeNumber(dateMap.get("ITEM_VOLUME_NUMBER").toString());
344                         }
345 
346                         if (dateMap.get("ITEM_TYPE_ID") != null) {
347                             oleHold.setItemType(dateMap.get("ITEM_TYPE_ID").toString());
348                         }
349                         if (dateMap.get("ITEM_STATUS_ID") != null) {
350                             oleHold.setAvailableStatus(dateMap.get("ITEM_STATUS_ID").toString());
351                         }
352 
353                     }
354                 }
355             }
356         } catch (Exception e) {
357             LOG.info("Exception occured while setting the setting the item information to the hold records " + e.getMessage());
358             LOG.error(e, e);
359         }
360         return oleHold;
361 
362     }
363 
364 
365     /**
366      * This method is used to set the fine information to the fine response object
367      *
368      * @param olePatronBillDocumentList
369      * @return
370      * @throws Exception
371      */
372     public List<OLEItemFine> getFineItemLists(List<PatronBillPayment> olePatronBillDocumentList) throws Exception {
373         List<OLEItemFine> oleItemFineList = new ArrayList<OLEItemFine>();
374         //Fee
375         try {
376             for (PatronBillPayment olePatronBillPayment : olePatronBillDocumentList) {
377                 //to do
378                 List<FeeType> feeTypeList = olePatronBillPayment.getFeeType();
379                 for (FeeType feeType : feeTypeList) {
380                     OLEItemFine oleItemFine = new OLEItemFine();
381                     oleItemFine.setAmount((feeType.getFeeAmount() != null ? feeType.getFeeAmount().bigDecimalValue() : OLEConstants.BIGDECIMAL_DEF_VALUE));
382                     oleItemFine.setBalance((feeType.getBalFeeAmount() != null ? feeType.getBalFeeAmount().bigDecimalValue() : OLEConstants.BIGDECIMAL_DEF_VALUE));
383                     oleItemFine.setBillDate(feeType.getBillDate().toString());
384                     int noOfPayment = feeType.getItemLevelBillPaymentList().size();
385                     oleItemFine.setNoOfPayments(new Integer(noOfPayment).toString());
386                     if (feeType.getOleFeeType() != null) {
387                         oleItemFine.setReason(feeType.getOleFeeType().getFeeTypeName());
388                         oleItemFine.setFeeType(feeType.getOleFeeType().getFeeTypeCode());
389                     } else {
390                         oleItemFine.setReason(feeType.getFeeType());
391                         oleItemFine.setFeeType(feeType.getFeeType());
392                     }
393                     oleItemFine.setDateCharged(feeType.getBillDate().toString());
394                     oleItemFine = setBibItemInformation(oleItemFine, feeType.getItemBarcode());
395                     oleItemFineList.add(oleItemFine);
396                 }
397             }
398         } catch (Exception e) {
399             LOG.info("Exception occured while setting the item information to the fine records Reason : " + e.getMessage());
400             LOG.error(e, e);
401         }
402 
403         return oleItemFineList;
404     }
405 
406     /**
407      * This method is used to set the title informations to the item response object
408      *
409      * @param oleItemFine
410      * @param itemBarcode
411      * @return
412      */
413     public OLEItemFine setBibItemInformation(OLEItemFine oleItemFine, String itemBarcode) {
414         LOG.info("Inside the setBibItemInformation fro setting the bib information for the fine record . Item Barcode :  " + itemBarcode);
415         try {
416             if (itemBarcode != null) {
417                 List<Map<String, Object>> itemData = null;
418                 String query = getParameter("NCIP_BIB_ITEM_INFORMATION_FINE");
419                 itemData = getSimpleJdbcTemplate().queryForList(query, itemBarcode);
420 
421                 if (itemData != null && itemData.size() > 0) {
422                     for (Map<String, Object> dateMap : itemData) {
423 
424                         if (dateMap.get("TITLE") != null) {
425                             oleItemFine.setTitle(dateMap.get("TITLE").toString());
426                         }
427                         if (dateMap.get("AUTHOR") != null) {
428                             oleItemFine.setAuthor(dateMap.get("AUTHOR").toString());
429                         }
430                     }
431                 }
432             }
433         } catch (Exception e) {
434             LOG.info("Exception occured while setting the information to the Fine record for the item barcode : " + itemBarcode + "Reason : " + e.getMessage());
435             LOG.error(e, e);
436 
437         }
438         return oleItemFine;
439 
440     }
441 
442 
443     private java.sql.Date addDate(java.sql.Date in, int daysToAdd) {
444         if (in == null) {
445             return null;
446         }
447         GregorianCalendar cal = new GregorianCalendar();
448         cal.setTime(in);
449         cal.add(Calendar.DAY_OF_MONTH, daysToAdd);
450         return new java.sql.Date(cal.getTime().getTime());
451     }
452 
453 
454     /**
455      * This method is used to get the patron record based on the input patron barcode
456      *
457      * @param patronBarcode
458      * @return
459      */
460     public OlePatronDocument getPatronDocument(String patronBarcode) {
461         LOG.info("Inside the getPatronDocument for getting the patron informations for the patron barcode " + patronBarcode);
462 
463         List<Map<String, Object>> patronData = null;
464         OlePatronDocument olePatronDocument = new OlePatronDocument();
465         try {
466             StringBuffer stringBuffer = new StringBuffer();
467             stringBuffer.append("select OLE_PTRN_ID , GENERAL_BLOCK, PAGING_PRIVILEGE,COURTESY_NOTICE,DELIVERY_PRIVILEGE, BORR_TYP,ACTV_IND,ACTIVATION_DATE,EXPIRATION_DATE from OLE_PTRN_T where BARCODE='" + patronBarcode + "'");
468             try {
469                 patronData = getSimpleJdbcTemplate().queryForList(stringBuffer.toString());
470 
471             } catch (Exception e) {
472                 LOG.info("Exception occured while executing the query ...." + stringBuffer.toString());
473             }
474             if (patronData != null && patronData.size() > 0) {
475                 for (Map<String, Object> dateMap : patronData) {
476 
477                     if (dateMap.get("OLE_PTRN_ID") != null) {
478                         olePatronDocument.setOlePatronId(dateMap.get("OLE_PTRN_ID").toString());
479                     }
480                     if (dateMap.get("GENERAL_BLOCK") != null) {
481                         if (dateMap.get("GENERAL_BLOCK").toString().equalsIgnoreCase("Y")) {
482                             olePatronDocument.setGeneralBlock(true);
483                         }
484                     }
485 
486                     if (dateMap.get("PAGING_PRIVILEGE") != null) {
487 
488                         if (dateMap.get("PAGING_PRIVILEGE").toString().equalsIgnoreCase("Y")) {
489                             olePatronDocument.setPagingPrivilege(true);
490                         }
491 
492                     }
493 
494                     if (dateMap.get("COURTESY_NOTICE") != null) {
495                         if (dateMap.get("COURTESY_NOTICE").toString().equalsIgnoreCase("Y")) {
496                             olePatronDocument.setCourtesyNotice(true);
497                         }
498                     }
499 
500 
501                     if (dateMap.get("DELIVERY_PRIVILEGE") != null) {
502                         if (dateMap.get("DELIVERY_PRIVILEGE").toString().equalsIgnoreCase("Y")) {
503                             olePatronDocument.setDeliveryPrivilege(true);
504                         }
505                     }
506 
507                     if (dateMap.get("ACTV_IND") != null) {
508                         if (dateMap.get("ACTV_IND").toString().equalsIgnoreCase("Y")) {
509                             olePatronDocument.setActiveIndicator(true);
510                         }
511                     }
512 
513 
514                     if (dateMap.get("ACTIVATION_DATE") != null) {
515                         olePatronDocument.setActivationDate((Timestamp) dateMap.get("ACTIVATION_DATE"));
516                     }
517 
518                     if (dateMap.get("EXPIRATION_DATE") != null) {
519                         olePatronDocument.setExpirationDate((Timestamp) dateMap.get("EXPIRATION_DATE"));
520                     }
521 
522 
523                     if (dateMap.get("BORR_TYP") != null) {
524                         olePatronDocument.setBorrowerType(dateMap.get("BORR_TYP").toString());
525                     }
526 
527                 }
528             }
529         } catch (Exception e) {
530             LOG.info("Exception occured while getting the patron information for the patron barcode : " + patronBarcode + "Reason :" + e.getMessage());
531             LOG.error(e, e);
532         }
533         return olePatronDocument;
534 
535     }
536 
537 
538 }