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