View Javadoc
1   package org.kuali.ole.ncip.service.impl;
2   
3   import org.apache.commons.collections.CollectionUtils;
4   import org.apache.commons.lang.StringUtils;
5   import org.apache.log4j.Logger;
6   import org.extensiblecatalog.ncip.v2.service.*;
7   import org.kuali.ole.OLEConstants;
8   import org.kuali.ole.bo.*;
9   import org.kuali.ole.ncip.bo.*;
10  import org.kuali.ole.converter.OLELookupUserConverter;
11  import org.kuali.ole.ncip.service.NCIPLookupUserResponseBuilder;
12  import org.kuali.ole.ncip.service.OLELookupUserService;
13  import org.kuali.ole.ncip.util.OLENCIPUtil;
14  import org.kuali.ole.select.document.service.OleSelectDocumentService;
15  import org.kuali.ole.sys.context.SpringContext;
16  import org.kuali.ole.utility.OleStopWatch;
17  import org.kuali.rice.core.api.config.property.ConfigContext;
18  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
19  
20  import java.math.BigDecimal;
21  import java.util.ArrayList;
22  import java.util.HashMap;
23  import java.util.List;
24  import java.util.Map;
25  
26  /**
27   * Created by pvsubrah on 8/5/15.
28   */
29  public class OLENCIPLookupUserServiceImpl extends NonSip2LookupUserServiceImpl implements OLELookupUserService {
30  
31      private static final Logger LOG = Logger.getLogger(OLENCIPLookupUserServiceImpl.class);
32  
33      private OleSelectDocumentService oleSelectDocumentService;
34      private LookupUserInitiationData lookupUserInitiationData;
35      private OLELookupUserConverter oleLookupUserConverter;
36  
37      public NCIPLookupUserResponseBuilder getNcipLookupUserResponseBuilder() {
38          return new NCIPLookupUserResponseBuilder();
39      }
40  
41      public OleSelectDocumentService getOleSelectDocumentService() {
42          if (oleSelectDocumentService == null) {
43              oleSelectDocumentService = SpringContext.getBean(OleSelectDocumentService.class);
44          }
45          return oleSelectDocumentService;
46      }
47  
48      public void setOleSelectDocumentService(OleSelectDocumentService oleSelectDocumentService) {
49          this.oleSelectDocumentService = oleSelectDocumentService;
50      }
51  
52      public LookupUserInitiationData getLookupUserInitiationData() {
53          return lookupUserInitiationData;
54      }
55  
56      public void setLookupUserInitiationData(LookupUserInitiationData lookupUserInitiationData) {
57          this.lookupUserInitiationData = lookupUserInitiationData;
58      }
59  
60      public OLELookupUserConverter getOleLookupUserConverter() {
61          if (null == oleLookupUserConverter) {
62              oleLookupUserConverter = GlobalResourceLoader.getService(OLENCIPConstants.LOOKUP_USER_CONVERTER);
63          }
64          return oleLookupUserConverter;
65      }
66  
67      public void setOleLookupUserConverter(OLELookupUserConverter oleLookupUserConverter) {
68          this.oleLookupUserConverter = oleLookupUserConverter;
69      }
70  
71      @Override
72      public LookupUserResponseData performService(LookupUserInitiationData lookupUserInitiationData, ServiceContext serviceContext, RemoteServiceManager remoteServiceManager) throws ServiceException {
73          OleStopWatch oleStopWatch = new OleStopWatch();
74          oleStopWatch.start();
75  
76          OLENCIPUtil oleNcipUtil = new OLENCIPUtil();
77          setLookupUserInitiationData(lookupUserInitiationData);
78          NCIPLookupUserResponseBuilder ncipLookupUserResponseBuilder = getNcipLookupUserResponseBuilder();
79          LookupUserResponseData lookupUserResponseData = new LookupUserResponseData();
80  
81          AgencyId agencyId = oleNcipUtil.validateAgency(getLookupUserInitiationData().getInitiationHeader(), lookupUserResponseData);
82          if (null == agencyId) return lookupUserResponseData;
83  
84          UserId userId = getLookupUserInitiationData().getUserId();
85          boolean userValid = oleNcipUtil.validateUser(userId, lookupUserResponseData);
86          if (!userValid) return lookupUserResponseData;
87  
88          String patronBarcode = userId.getUserIdentifierValue();
89          if (StringUtils.isBlank(patronBarcode)) {
90              oleNcipUtil.processProblems(lookupUserResponseData, "", ConfigContext.getCurrentContextConfig().getProperty(OLENCIPConstants.USER_IDENTIFIER_VALUE_DOES_NOT_EXIST), OLENCIPConstants.USER);
91              return lookupUserResponseData;
92          }
93          String operatorId = oleNcipUtil.agencyPropertyMap.get(OLENCIPConstants.OPERATOR_ID);
94          LOG.info("User Id : " + userId.getUserIdentifierValue() + " Operator Id : " + operatorId + " Agency Id " + agencyId.getValue());
95  
96          Map lookupUserParameters = new HashMap();
97          lookupUserParameters.put("patronBarcode", patronBarcode);
98          lookupUserParameters.put("operatorId", operatorId);
99          String lookUpUserResponseXml = lookupUser(lookupUserParameters);
100         OLELookupUser oleLookupUser = getOleLookupUserConverter().getLookupUser(lookUpUserResponseXml);
101         if (oleLookupUser != null && StringUtils.isNotBlank(oleLookupUser.getMessage())) {
102             if (oleLookupUser.getMessage().equalsIgnoreCase(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.RTRVD_SUCCESS))) {
103                 generateResponseDataFromLookupUser(ncipLookupUserResponseBuilder, lookupUserResponseData, agencyId, userId, oleLookupUser);
104             } else if (oleLookupUser.getMessage().equalsIgnoreCase(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.NO_PATRON_INFO))) {
105                 oleNcipUtil.processProblems(lookupUserResponseData, patronBarcode, ConfigContext.getCurrentContextConfig().getProperty(OLENCIPConstants.USER_UN_AVAILABLE), OLENCIPConstants.USER);
106                 return lookupUserResponseData;
107             } else if (oleLookupUser.getMessage().equalsIgnoreCase(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.CIRCULATION_DESK_NOT_MAPPED_OPERATOR))) {
108                 oleNcipUtil.processProblems(lookupUserResponseData, operatorId, oleLookupUser.getMessage(), OLENCIPConstants.OPERATOR);
109                 return lookupUserResponseData;
110             }
111         }
112 
113         oleStopWatch.end();
114         LOG.info("Time taken to perform lookup user service : " + oleStopWatch.getTotalTime());
115         return lookupUserResponseData;
116     }
117 
118     private void generateResponseDataFromLookupUser(NCIPLookupUserResponseBuilder ncipLookupUserResponseBuilder, LookupUserResponseData lookupUserResponseData, AgencyId agencyId, UserId userId, OLELookupUser oleLookupUser) {
119         UserOptionalFields userOptionalFields = new UserOptionalFields();
120 
121         setNameInformation(oleLookupUser.getPatronName(), userOptionalFields);
122 
123         setUserAddressInformation(oleLookupUser, userOptionalFields);
124 
125         setUserPrivileges(oleLookupUser, userOptionalFields, agencyId);
126 
127         List<LoanedItem> loanedItems = getLoanedItems(oleLookupUser.getOleCheckedOutItems(), agencyId);
128         ncipLookupUserResponseBuilder.setLoanedItems(lookupUserResponseData, loanedItems);
129 
130         List<RequestedItem> requestedItems = getRequestedItems(oleLookupUser.getOleHolds(), agencyId);
131         ncipLookupUserResponseBuilder.setRequestedItems(lookupUserResponseData, requestedItems);
132 
133         List<UserFiscalAccount> userFiscalAccounts = getUserFiscalAccounts(oleLookupUser.getOleItemFines(), agencyId);
134         ncipLookupUserResponseBuilder.setUserFiscalAccounts(lookupUserResponseData, userFiscalAccounts);
135 
136         ncipLookupUserResponseBuilder.addOptionalFields(lookupUserResponseData, userOptionalFields);
137         ncipLookupUserResponseBuilder.setUserId(lookupUserResponseData, userId);
138     }
139 
140     private void setNameInformation(OlePatronNameBo olePatronNameBo, UserOptionalFields userOptionalFields) {
141         try {
142             if (olePatronNameBo != null) {
143                 NameInformation ni = new NameInformation();
144                 PersonalNameInformation pni = new PersonalNameInformation();
145                 StructuredPersonalUserName structuredPersonalUserName = new StructuredPersonalUserName();
146 
147                 String firstName = olePatronNameBo.getFirstName();
148                 String middleName = olePatronNameBo.getMiddleName();
149                 String lastName = olePatronNameBo.getLastName();
150                 StringBuffer patronName = new StringBuffer();
151 
152                 if (StringUtils.isNotBlank(firstName)) {
153                     structuredPersonalUserName.setGivenName(firstName);
154                     patronName.append(firstName);
155                     patronName.append(OLEConstants.SPACE);
156                 }
157                 if (StringUtils.isNotBlank(middleName)) {
158                     patronName.append(middleName);
159                     patronName.append(OLEConstants.SPACE);
160                 }
161                 if (StringUtils.isNotBlank(lastName)) {
162                     structuredPersonalUserName.setSurname(lastName);
163                     patronName.append(lastName);
164                     patronName.append(OLEConstants.SPACE);
165                 }
166                 pni.setStructuredPersonalUserName(structuredPersonalUserName);
167                 if (patronName.length() > 0) {
168                     patronName.deleteCharAt(patronName.length() - 1);
169                     pni.setUnstructuredPersonalUserName(patronName.toString());
170                 }
171                 ni.setPersonalNameInformation(pni);
172                 userOptionalFields.setNameInformation(ni);
173             }
174 
175         } catch (Exception e) {
176             LOG.error("Exception while getting user information" + e);
177         }
178     }
179 
180     private void setUserAddressInformation(OLELookupUser oleLookupUser, UserOptionalFields userOptionalFields) {
181         try {
182             ArrayList<UserAddressInformation> userAddressInformationList = new ArrayList<>();
183             OlePatronAddressBo olePatronAddressBo = oleLookupUser.getPatronAddress();
184             if (olePatronAddressBo != null) {
185                 userAddressInformationList.add(retrievePhysicalAddress(olePatronAddressBo));
186             }
187             OlePatronEmailBo olePatronEmailBo = oleLookupUser.getPatronEmail();
188             if (olePatronEmailBo != null) {
189                 userAddressInformationList.add(retrieveElectronicAddress(olePatronEmailBo));
190             }
191             OlePatronPhoneBo olePatronPhoneBo = oleLookupUser.getPatronPhone();
192             if (olePatronPhoneBo != null) {
193                 userAddressInformationList.add(retrieveTelephoneNumber(olePatronPhoneBo));
194             }
195             userOptionalFields.setUserAddressInformations(userAddressInformationList);
196 
197         } catch (Exception e) {
198             LOG.error("Exception while getting address information" + e);
199         }
200     }
201 
202     private void setUserPrivileges(OLELookupUser oleLookupUser, UserOptionalFields userOptionalFields, AgencyId agencyId) {
203         try {
204             List<OLEUserPrivilege> oleUserPrivilegeList = oleLookupUser.getOleUserPrivileges();
205             List<UserPrivilege> userPrivilegeList = new ArrayList<>();
206             for (OLEUserPrivilege oleUserPrivilege : oleUserPrivilegeList) {
207                 UserPrivilege userPrivilege = getPrivilege(oleUserPrivilege.getUserPrivilegeStatus(), oleUserPrivilege.getUserPrivilegeType(), oleUserPrivilege.getUserPrivilegeDescription(), agencyId);
208                 userPrivilegeList.add(userPrivilege);
209             }
210             userOptionalFields.setUserPrivileges(userPrivilegeList);
211         } catch (Exception e) {
212             LOG.error("Exception while getting user privileges" + e);
213         }
214     }
215 
216     private UserAddressInformation retrievePhysicalAddress(OlePatronAddressBo olePatronAddressBo) {
217         UserAddressInformation userAddressInformation = new UserAddressInformation();
218         PhysicalAddress physicalAddress = new PhysicalAddress();
219         StructuredAddress structuredAddress = new StructuredAddress();
220         structuredAddress.setLine1(olePatronAddressBo.getLine1());
221         structuredAddress.setLine2(olePatronAddressBo.getLine2());
222         structuredAddress.setPostalCode(olePatronAddressBo.getPostalCode());
223         structuredAddress.setCountry(olePatronAddressBo.getCountryCode());
224         structuredAddress.setRegion(olePatronAddressBo.getStateProvinceCode());
225         structuredAddress.setLocality(olePatronAddressBo.getCity());
226         physicalAddress.setStructuredAddress(structuredAddress);
227         UserAddressRoleType userAddressRoleType = new UserAddressRoleType(olePatronAddressBo.getAddressTypeCode());
228         userAddressInformation.setUserAddressRoleType(userAddressRoleType);
229         PhysicalAddressType physicalAddressType = new PhysicalAddressType(OLENCIPConstants.ADDRESS_TYPE_SCHEME, olePatronAddressBo.getAddressTypeCode());
230         physicalAddress.setPhysicalAddressType(physicalAddressType);
231         userAddressInformation.setPhysicalAddress(physicalAddress);
232         return userAddressInformation;
233     }
234 
235     private UserAddressInformation retrieveElectronicAddress(OlePatronEmailBo olePatronEmailBo) {
236         ElectronicAddress electronicAddress = new ElectronicAddress();
237         electronicAddress.setElectronicAddressData(olePatronEmailBo.getEmailAddress());
238         ElectronicAddressType electronicAddressType = new ElectronicAddressType(getOleSelectDocumentService().getSelectParameterValue(OLENCIPConstants.EMAIL));
239         electronicAddress.setElectronicAddressType(electronicAddressType);
240         UserAddressInformation userAddressInformation = new UserAddressInformation();
241         UserAddressRoleType userAddressRoleType = new UserAddressRoleType(olePatronEmailBo.getEmailTypeCode());
242         userAddressInformation.setUserAddressRoleType(userAddressRoleType);
243         userAddressInformation.setElectronicAddress(electronicAddress);
244         return userAddressInformation;
245     }
246 
247     private UserAddressInformation retrieveTelephoneNumber(OlePatronPhoneBo olePatronPhoneBo) {
248         ElectronicAddress phone = new ElectronicAddress();
249         phone.setElectronicAddressData(olePatronPhoneBo.getPhoneNumber());
250         phone.setElectronicAddressType(new ElectronicAddressType(OLENCIPConstants.TELEPHONE_CODE));
251         UserAddressInformation uai = new UserAddressInformation();
252         uai.setUserAddressRoleType(new UserAddressRoleType(olePatronPhoneBo.getPhoneTypeCode()));
253         uai.setElectronicAddress(phone);
254         return uai;
255     }
256 
257     private UserPrivilege getPrivilege(String privilegeStatus, String privilegeType, String privilegeDesc, AgencyId agencyId) {
258         UserPrivilege userPrivilege = new UserPrivilege();
259         UserPrivilegeStatus userPrivilegeStatus = new UserPrivilegeStatus();
260         AgencyUserPrivilegeType agencyUserPrivilegeType = new AgencyUserPrivilegeType("", privilegeType);
261         UserPrivilegeStatusType userPrivilegeStatusType = new UserPrivilegeStatusType("", privilegeStatus);
262         userPrivilegeStatus.setUserPrivilegeStatusType(userPrivilegeStatusType);
263         userPrivilege.setAgencyUserPrivilegeType(agencyUserPrivilegeType);
264         userPrivilege.setUserPrivilegeDescription(privilegeDesc);
265         userPrivilege.setAgencyId(agencyId);
266         userPrivilege.setUserPrivilegeStatus(userPrivilegeStatus);
267         return userPrivilege;
268     }
269 
270     private List<LoanedItem> getLoanedItems(OLECheckedOutItems oleCheckedOutItems, AgencyId agencyId) {
271         List<LoanedItem> loanedItems = new ArrayList<>();
272         try {
273             if (oleCheckedOutItems != null && CollectionUtils.isNotEmpty(oleCheckedOutItems.getCheckedOutItems())) {
274                 for (OLECheckedOutItem oleCheckedOutItem : oleCheckedOutItems.getCheckedOutItems()) {
275                     LoanedItem loanedItem = new LoanedItem();
276 
277                     ItemId itemId = new ItemId();
278                     ItemIdentifierType itemIdentifierType = new ItemIdentifierType(OLENCIPConstants.IDENTIFIER_TYPE, oleCheckedOutItem.getItemType());
279                     itemId.setAgencyId(agencyId);
280                     itemId.setItemIdentifierType(itemIdentifierType);
281                     itemId.setItemIdentifierValue(oleCheckedOutItem.getItemId());
282                     loanedItem.setItemId(itemId);
283 
284                     loanedItem.setReminderLevel(new BigDecimal(oleCheckedOutItem.getNumberOfOverdueSent()));
285 
286                     Amount amount = new Amount();
287                     CurrencyCode currencyCode = new CurrencyCode(OLENCIPConstants.USD, 1);
288                     amount.setCurrencyCode(currencyCode);
289                     amount.setMonetaryValue(new BigDecimal(0));
290                     loanedItem.setAmount(amount);
291 
292                     List<BibliographicId> bibliographicIds = new ArrayList<BibliographicId>();
293                     BibliographicId bibliographicId = new BibliographicId();
294                     BibliographicItemId bibliographicItemId = new BibliographicItemId();
295                     bibliographicItemId.setBibliographicItemIdentifier(oleCheckedOutItem.getItemId());
296                     BibliographicRecordId bibliographicRecordId = new BibliographicRecordId();
297                     bibliographicRecordId.setAgencyId(agencyId);
298                     bibliographicRecordId.setBibliographicRecordIdentifier(oleCheckedOutItem.getCatalogueId());
299                     bibliographicId.setBibliographicRecordId(bibliographicRecordId);
300                     bibliographicId.setBibliographicItemId(bibliographicItemId);
301                     bibliographicIds.add(bibliographicId);
302                     loanedItem.setBibliographicIds(bibliographicIds);
303 
304                     loanedItem.setDateDue(getOleCirculationHelperService().getGregorianCalendarDate(oleCheckedOutItem.getDueDate()));
305                     loanedItem.setTitle(oleCheckedOutItem.getTitle());
306                     MediumType mediumType = new MediumType(OLENCIPConstants.MEDIUM_TYPE, oleCheckedOutItem.getItemType());
307                     loanedItem.setMediumType(mediumType);
308                     loanedItem.setDateCheckedOut(getOleCirculationHelperService().getGregorianCalendarDate(oleCheckedOutItem.getLoanDate()));
309                     loanedItems.add(loanedItem);
310                 }
311             }
312         } catch (Exception e) {
313             LOG.error("Exception while getting loaned items " + e);
314         }
315         return loanedItems;
316     }
317 
318     private List<RequestedItem> getRequestedItems(OLEHolds oleHolds, AgencyId agencyId) {
319         List<RequestedItem> requestedItems = new ArrayList<>();
320         try {
321             if (oleHolds != null && CollectionUtils.isNotEmpty(oleHolds.getOleHoldList())) {
322                 for (OLEHold oleHold : oleHolds.getOleHoldList()) {
323                     RequestedItem requestedItem = new RequestedItem();
324                     requestedItem.setHoldQueuePosition(new BigDecimal(oleHold.getPriority()));
325                     ItemId itemId = new ItemId();
326                     itemId.setItemIdentifierValue(oleHold.getItemId());
327                     ItemIdentifierType itemIdentifierType = new ItemIdentifierType(OLENCIPConstants.IDENTIFIER_TYPE, oleHold.getItemType());
328                     itemId.setItemIdentifierType(itemIdentifierType);
329                     requestedItem.setItemId(itemId);
330                     RequestId requestId = new RequestId();
331                     requestId.setAgencyId(agencyId);
332                     requestId.setRequestIdentifierValue(oleHold.getRequestId());
333                     requestedItem.setRequestId(requestId);
334                     RequestType requestType = new RequestType(OLENCIPConstants.REQUEST_TYPES, oleHold.getRequestType());
335                     requestedItem.setRequestType(requestType);
336                     RequestStatusType requestStatusType = new RequestStatusType("");
337                     requestedItem.setRequestStatusType(requestStatusType);
338                     requestedItem.setDatePlaced(getOleCirculationHelperService().getGregorianCalendarDate(oleHold.getCreateDate()));
339                     requestedItem.setPickupDate(getOleCirculationHelperService().getGregorianCalendarDate(oleHold.getAvailableDate()));
340                     PickupLocation pickupLocation = new PickupLocation(oleHold.getPickupLocation());
341                     requestedItem.setPickupLocation(pickupLocation);
342                     requestedItem.setTitle(oleHold.getTitle());
343                     requestedItems.add(requestedItem);
344                 }
345             }
346         } catch (Exception e) {
347             LOG.error("Exception while getting requested items" + e);
348         }
349         return requestedItems;
350     }
351 
352     private List<UserFiscalAccount> getUserFiscalAccounts(OLEItemFines oleItemFines, AgencyId agencyId) {
353         OleStopWatch oleStopWatch = new OleStopWatch();
354         oleStopWatch.start();
355         List<UserFiscalAccount> userFiscalAccounts = new ArrayList<>();
356         try {
357             if (oleItemFines != null && CollectionUtils.isNotEmpty(oleItemFines.getOleItemFineList())) {
358                 for (OLEItemFine oleItemFine : oleItemFines.getOleItemFineList()) {
359                     UserFiscalAccount userFiscalAccount = new UserFiscalAccount();
360                     AccountBalance accountBalance = new AccountBalance();
361                     CurrencyCode currencyCode = new CurrencyCode(OLENCIPConstants.USD, 1);
362                     accountBalance.setCurrencyCode(currencyCode);
363                     accountBalance.setMonetaryValue(oleItemFine.getBalance());
364                     userFiscalAccount.setAccountBalance(accountBalance);
365                     List<AccountDetails> accountDetailsList = new ArrayList<AccountDetails>();
366                     AccountDetails accountDetails = new AccountDetails();
367                     accountDetails.setAccrualDate(getOleCirculationHelperService().getGregorianCalendarDate(oleItemFine.getDateCharged()));
368 
369                     FiscalTransactionInformation fiscalTransactionInformation = new FiscalTransactionInformation();
370                     Amount amount = new Amount();
371                     amount.setCurrencyCode(currencyCode);
372                     amount.setMonetaryValue(oleItemFine.getAmount());
373                     fiscalTransactionInformation.setAmount(amount);
374                     PaymentMethodType paymentMethodType = new PaymentMethodType(OLENCIPConstants.PAYMENT_METHOD_TYPE, OLENCIPConstants.CASH);
375                     fiscalTransactionInformation.setPaymentMethodType(paymentMethodType);
376                     FiscalActionType fiscalActionType = new FiscalActionType(OLENCIPConstants.FISCAL_ACTION_TYPE, OLENCIPConstants.FINES);
377                     fiscalTransactionInformation.setFiscalActionType(fiscalActionType);
378                     FiscalTransactionType fiscalTransactionType = new FiscalTransactionType(OLENCIPConstants.FISCAL_TRANSACTION_TYPE, oleItemFine.getReason());
379                     fiscalTransactionInformation.setFiscalTransactionType(fiscalTransactionType);
380                     ItemDetails itemDetails = new ItemDetails();
381                     ItemId itemId = new ItemId();
382                     if (oleItemFine.getItemId() != null)
383                         itemId.setItemIdentifierValue(oleItemFine.getItemId());
384                     else
385                         itemId.setItemIdentifierValue("");
386                     itemId.setAgencyId(agencyId);
387                     ItemIdentifierType itemIdentifierType = new ItemIdentifierType(OLENCIPConstants.IDENTIFIER_TYPE, OLENCIPConstants.ITEM_BARCODES);
388                     itemId.setItemIdentifierType(itemIdentifierType);
389                     itemDetails.setItemId(itemId);
390                     BibliographicDescription bibliographicDescription = new BibliographicDescription();
391                     bibliographicDescription.setTitle(oleItemFine.getTitle());
392                     bibliographicDescription.setAuthor(oleItemFine.getAuthor());
393                     itemDetails.setBibliographicDescription(bibliographicDescription);
394                     fiscalTransactionInformation.setItemDetails(itemDetails);
395                     accountDetails.setFiscalTransactionInformation(fiscalTransactionInformation);
396                     accountDetailsList.add(accountDetails);
397                     userFiscalAccount.setAccountDetails(accountDetailsList);
398                     userFiscalAccounts.add(userFiscalAccount);
399                 }
400             }
401         } catch (Exception e) {
402             LOG.error("Exception while getting user physical accounts " + e);
403         }
404         oleStopWatch.end();
405         LOG.info("For " + userFiscalAccounts.size() + " user fisical accounts, time taken : " + oleStopWatch.getTotalTime());
406         return userFiscalAccounts;
407     }
408 
409     @Override
410     public void validatePatron() {
411 
412     }
413 
414     @Override
415     public boolean isRenewalInfoNeeded() {
416         return false;
417     }
418 
419     @Override
420     public OLEUserPrivilege getStatusPrivilege() {
421         OLEUserPrivilege statusPriv = null;
422 
423         String errorMessage = new OLENCIPUtil().fireLookupUserRules(getOlePatronDocument());
424 
425         if (StringUtils.isBlank(errorMessage)) {
426             statusPriv = getPrivilege(OLEConstants.OK, OLEConstants.STATUS, OLEConstants.STATUS_DESCRIPTION);
427         } else {
428             statusPriv = getPrivilege(OLEConstants.BLOCKED, OLEConstants.STATUS, OLEConstants.STATUS_DESCRIPTION);
429         }
430 
431         return statusPriv;
432     }
433 
434     @Override
435     protected void processErrorResponseForOperator() {
436         getOleLookupUser().setMessage(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.CIRCULATION_DESK_NOT_MAPPED_OPERATOR));
437     }
438 
439     @Override
440     protected void processErrorResponseForPatron() {
441         getOleLookupUser().setMessage(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.NO_PATRON_INFO));
442     }
443 
444     @Override
445     protected void processSuccessResponseForLookupUser() {
446         getOleLookupUser().setMessage(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.RTRVD_SUCCESS));
447     }
448 
449     @Override
450     protected void processSuccessResponseForItemFine(OLEItemFines oleItemFines) {
451         oleItemFines.setMessage(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.RTRVD_SUCCESS));
452     }
453 
454     @Override
455     protected void processInfoForItemFine(OLEItemFines oleItemFines) {
456         oleItemFines.setMessage(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.NO_FINE));
457     }
458 
459     @Override
460     protected boolean nameInformationDesired() {
461         return getLookupUserInitiationData().getNameInformationDesired();
462     }
463 
464     @Override
465     protected boolean userAddressInformationDesired() {
466         return getLookupUserInitiationData().getUserAddressInformationDesired();
467     }
468 
469     @Override
470     protected boolean userPrivilegeDesired() {
471         return getLookupUserInitiationData().getUserPrivilegeDesired();
472     }
473 
474     @Override
475     protected boolean loanedItemsDesired() {
476         return getLookupUserInitiationData().getLoanedItemsDesired();
477     }
478 
479     @Override
480     protected boolean requestedItemsDesired() {
481         return getLookupUserInitiationData().getRequestedItemsDesired();
482     }
483 
484     @Override
485     protected boolean userFiscalAccountDesired() {
486         return getLookupUserInitiationData().getUserFiscalAccountDesired();
487     }
488 
489     @Override
490     protected void preProcess(Map lookupUserParameters) {
491 
492     }
493 }