1 package org.kuali.ole.deliver.bo;
2
3 import org.apache.commons.collections.CollectionUtils;
4 import org.apache.commons.lang3.StringUtils;
5 import org.kuali.ole.OLEConstants;
6 import org.kuali.ole.deliver.api.*;
7 import org.kuali.ole.docstore.engine.service.storage.rdbms.pojo.ItemRecord;
8 import org.kuali.rice.kim.api.KimConstants;
9 import org.kuali.rice.kim.api.identity.IdentityService;
10 import org.kuali.rice.kim.api.identity.address.EntityAddress;
11 import org.kuali.rice.kim.api.identity.email.EntityEmail;
12 import org.kuali.rice.kim.api.identity.employment.EntityEmployment;
13 import org.kuali.rice.kim.api.identity.phone.EntityPhone;
14 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
15 import org.kuali.rice.kim.impl.identity.address.EntityAddressBo;
16 import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationBo;
17 import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationTypeBo;
18 import org.kuali.rice.kim.impl.identity.email.EntityEmailBo;
19 import org.kuali.rice.kim.impl.identity.employment.EntityEmploymentBo;
20 import org.kuali.rice.kim.impl.identity.entity.EntityBo;
21 import org.kuali.rice.kim.impl.identity.name.EntityNameBo;
22 import org.kuali.rice.kim.impl.identity.phone.EntityPhoneBo;
23 import org.kuali.rice.kim.impl.identity.type.EntityTypeContactInfoBo;
24 import org.kuali.rice.krad.bo.PersistableBusinessObject;
25 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
26 import org.kuali.rice.krad.service.BusinessObjectService;
27 import org.kuali.rice.krad.service.KRADServiceLocator;
28
29 import java.util.*;
30 import java.util.concurrent.TimeUnit;
31
32
33
34
35 public class OlePatronDocument extends PersistableBusinessObjectBase implements OlePatronContract {
36
37 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OlePatronDocument.class);
38
39 private String olePatronId;
40 private String patronRecordURL;
41 private String barcode;
42 private String borrowerType;
43 private String affiliationType;
44 private boolean activeIndicator;
45 private boolean generalBlock;
46 private String generalBlockNotes;
47 private boolean pagingPrivilege;
48 private boolean courtesyNotice;
49 private boolean deliveryPrivilege;
50 private boolean realPatronCheck;
51 private boolean selfCheckOut = false;
52 private Date expirationDate;
53 private Date activationDate;
54 private String firstName;
55 private String middleName;
56 private String lastName;
57 private String emailAddress;
58 private String phoneNumber;
59 private String borrowerTypeName;
60 private String processMessage;
61 private String source;
62 private String statisticalCategory;
63 private String oleSourceName;
64 private String oleStatisticalCategoryName;
65 private boolean patronBillFlag;
66 private String proxyPatronId;
67 private byte[] patronPhotograph;
68 private boolean loanFlag;
69 private boolean tempCircHistoryFlag;
70 private boolean requestFlag;
71 private boolean upload = true;
72 private boolean patronHomePage;
73 private boolean pointing;
74 private boolean startingIndexExecuted;
75 private boolean activateBarcode;
76 private boolean deactivateBarcode;
77 private String lostStatus;
78 private String lostDescription;
79 private String lostOperatorId;
80 private boolean invalidateBarcode;
81 private boolean reinstateBarcode;
82 private boolean skipBarcodeValidation;
83 private boolean barcodeChanged;
84 private boolean barcodeEditable;
85 private boolean expirationFlag=true;
86 private boolean popupDialog;
87 private String patronMessage;
88 private String uiMessageType;
89 private boolean reinstated;
90 private int numberOfClaimsReturned;
91 private boolean showLoanedRecords;
92 private boolean showRequestedItems;
93 private boolean showTemporaryCirculationHistoryRecords;
94 private boolean showBillUrlsFlag;
95 private OlePatronDocument selectedProxyForPatron;
96 private HashMap<String,String> errorsAndPermission = new HashMap<>();
97 private String errorMessage;
98 private boolean blockPatron;
99 private String realPatronFirstName;
100
101 private String realPatronLastName;
102 private int loanCount;
103 private int requestedItemRecordsCount;
104 private int tempCirculationHistoryCount;
105
106 private transient IdentityService identityService;
107 private boolean lostPatron = false;
108 private BusinessObjectService businessObjectService;
109 private boolean addressVerified;
110 private String preferredAddress;
111 private String email;
112 private boolean deleteImageFlag;
113 private Integer overdueFineAmt;
114 private Integer replacementFeeAmt;
115 private Integer allCharges;
116 private List<FeeType> feeTypeList;
117 public IdentityService getIdentityService() {
118 if (identityService == null) {
119 identityService = KimApiServiceLocator.getIdentityService();
120 }
121 return identityService;
122 }
123
124 public boolean isPatronHomePage() {
125 return patronHomePage;
126 }
127
128 public boolean isExpirationFlag() {
129 return expirationFlag;
130 }
131
132 public void setExpirationFlag(boolean expirationFlag) {
133 this.expirationFlag = expirationFlag;
134 }
135
136 public void setPatronHomePage(boolean patronHomePage) {
137 this.patronHomePage = patronHomePage;
138 }
139
140 private List<OleLoanDocument> oleLoanDocuments = new ArrayList<OleLoanDocument>();
141 private List<EntityPhoneBo> phones = new ArrayList<EntityPhoneBo>();
142 private List<EntityPhoneBo> deletedPhones = new ArrayList<EntityPhoneBo>();
143 private List<EntityAddressBo> addresses = new ArrayList<EntityAddressBo>();
144 private List<OleEntityAddressBo> oleEntityAddressBo = new ArrayList<OleEntityAddressBo>();
145 private List<OleEntityAddressBo> deletedOleEntityAddressBo = new ArrayList<OleEntityAddressBo>();
146 private EntityNameBo name = new EntityNameBo();
147 private List<OleAddressBo> oleAddresses = new ArrayList<OleAddressBo>();
148 private List<EntityEmailBo> emails = new ArrayList<EntityEmailBo>();
149 private List<EntityEmailBo> deletedEmails = new ArrayList<EntityEmailBo>();
150 private List<OlePatronNotes> notes = new ArrayList<OlePatronNotes>();
151 private List<OlePatronNotes> deletedNotes = new ArrayList<OlePatronNotes>();
152 private List<OlePatronLostBarcode> lostBarcodes = new ArrayList<OlePatronLostBarcode>();
153 private OleBorrowerType oleBorrowerType;
154 private EntityBo entity = new EntityBo();
155 private OleSourceBo sourceBo;
156 private OleStatisticalCategoryBo statisticalCategoryBo;
157 private List<OlePatronAffiliation> patronAffiliations = new ArrayList<OlePatronAffiliation>();
158 private List<OlePatronAffiliation> deletedPatronAffiliations = new ArrayList<OlePatronAffiliation>();
159 private List<EntityEmploymentBo> employments = new ArrayList<EntityEmploymentBo>();
160 private List<EntityEmploymentBo> deletedEmployments = new ArrayList<EntityEmploymentBo>();
161 private List<OleDeliverRequestBo> oleDeliverRequestBos = new ArrayList<OleDeliverRequestBo>();
162 private List<OleProxyPatronDocument> oleProxyPatronDocuments = new ArrayList<OleProxyPatronDocument>();
163 private List<OleProxyPatronDocument> deletedOleProxyPatronDocuments = new ArrayList<OleProxyPatronDocument>();
164 private List<OleTemporaryCirculationHistory> oleTemporaryCirculationHistoryRecords = new ArrayList<OleTemporaryCirculationHistory>();
165 private List<OlePatronLocalIdentificationBo> olePatronLocalIds = new ArrayList<OlePatronLocalIdentificationBo>();
166 private List<OlePatronLocalIdentificationBo> deletedOlePatronLocalIds = new ArrayList<OlePatronLocalIdentificationBo>();
167 private List<OleProxyPatronDocument> oleProxyPatronDocumentList = new ArrayList<OleProxyPatronDocument>();
168 private List<OlePatronDocument> currentPatronList = new ArrayList<OlePatronDocument>();
169 private List<PatronBillPayment> patronBillPayments = new ArrayList<>();
170 private OLEPatronEntityViewBo olePatronEntityViewBo;
171 private String patronBillFileName;
172 private String viewBillUrl;
173 private String createBillUrl;
174 private String namePrefix;
175 private String nameSuffix;
176 private OleDeliverRequestBo oleDeliverRequestBo;
177 private boolean checkoutForSelf;
178 private List<OlePatronNotes> olePatronUserNotes = new ArrayList<>();
179 private List<OleEntityPhoneBo> oleEntityPhoneBo = new ArrayList<>();
180 private List<OleEntityPhoneBo> deletedOleEntityPhoneBo = new ArrayList<>();
181 private List<OlePhoneBo> olePhones = new ArrayList<>();
182 private List<OleEntityEmailBo> oleEntityEmailBo = new ArrayList<>();
183 private List<OleEntityEmailBo> deletedOleEntityEmailBo = new ArrayList<>();
184 private List<OleEmailBo> oleEmails = new ArrayList<>();
185
186 public HashMap<String, String> getErrorsAndPermission() {
187 return errorsAndPermission;
188 }
189
190 public void setErrorsAndPermission(HashMap<String, String> errorsAndPermission) {
191 this.errorsAndPermission = errorsAndPermission;
192 }
193
194 public String getErrorMessage() {
195 return errorMessage;
196 }
197
198 public void setErrorMessage(String errorMessage) {
199 this.errorMessage = errorMessage;
200 }
201
202 public boolean isBlockPatron() {
203 return blockPatron;
204 }
205
206 public void setBlockPatron(boolean blockPatron) {
207 this.blockPatron = blockPatron;
208 }
209
210 public void setBorrowerTypeName(String borrowerTypeName) {
211 this.borrowerTypeName = borrowerTypeName;
212 }
213
214 private String patronName;
215
216 private String borrowerTypeCode;
217
218 public List<PatronBillPayment> getPatronBillPayments() {
219 return patronBillPayments;
220 }
221
222 public void setPatronBillPayments(List<PatronBillPayment> patronBillPayments) {
223 this.patronBillPayments = patronBillPayments;
224 }
225
226 public int getNumberOfClaimsReturned() {
227 return numberOfClaimsReturned;
228 }
229
230 public void setNumberOfClaimsReturned(int numberOfClaimsReturned) {
231 this.numberOfClaimsReturned = numberOfClaimsReturned;
232 }
233
234 public String getBorrowerTypeCode() {
235 if (borrowerTypeCode == null) {
236 borrowerTypeCode = getOleBorrowerType().getBorrowerTypeCode();
237 }
238 return borrowerTypeCode;
239 }
240
241 public void setBorrowerTypeCode(String borrowerTypeCode) {
242 this.borrowerTypeCode = borrowerTypeCode;
243 }
244
245 public boolean isSelfCheckOut() {
246 return selfCheckOut;
247 }
248
249 public void setSelfCheckOut(boolean selfCheckOut) {
250 this.selfCheckOut = selfCheckOut;
251 }
252
253 public String getPatronName() {
254 if (null == patronName) {
255 List<EntityNameBo> names = getEntity().getNames();
256 if (CollectionUtils.isNotEmpty(names)) {
257 EntityNameBo entityNameBo = names.get(0);
258 patronName = entityNameBo.getLastName() + "," + entityNameBo.getFirstName();
259 }
260 }
261 return patronName;
262 }
263
264 public void setPatronName(String patronName) {
265 this.patronName = patronName;
266 }
267
268 public OlePatronDocument() {
269 this.setActivationDate(new Date());
270 this.setDeliveryPrivilege(true);
271 this.setPagingPrivilege(true);
272 this.setCourtesyNotice(true);
273 this.setBarcodeEditable(true);
274 }
275
276 public boolean isUpload() {
277 return upload;
278 }
279
280 public void setUpload(boolean upload) {
281 this.upload = upload;
282 }
283
284 public List<OleTemporaryCirculationHistory> getOleTemporaryCirculationHistoryRecords() {
285 return oleTemporaryCirculationHistoryRecords;
286 }
287
288 public void setOleTemporaryCirculationHistoryRecords(List<OleTemporaryCirculationHistory> oleTemporaryCirculationHistoryRecords) {
289 this.oleTemporaryCirculationHistoryRecords = oleTemporaryCirculationHistoryRecords;
290 }
291
292 public List<OleDeliverRequestBo> getOleDeliverRequestBos() {
293 return oleDeliverRequestBos;
294 }
295
296 public void setOleDeliverRequestBos(List<OleDeliverRequestBo> oleDeliverRequestBos) {
297 this.oleDeliverRequestBos = oleDeliverRequestBos;
298 }
299
300
301
302
303
304
305
306 public static OlePatronDefinition to(org.kuali.ole.deliver.bo.OlePatronDocument bo) {
307 if (bo == null) {
308 return null;
309 }
310 return OlePatronDefinition.Builder.create(bo).build();
311 }
312
313
314
315
316
317
318
319 public static org.kuali.ole.deliver.bo.OlePatronDocument from(OlePatronDefinition immutable) {
320 return fromAndUpdate(immutable, null);
321 }
322
323
324
325
326
327
328
329
330 static org.kuali.ole.deliver.bo.OlePatronDocument fromAndUpdate(OlePatronDefinition immutable, org.kuali.ole.deliver.bo.OlePatronDocument toUpdate) {
331 if (immutable == null) {
332 return null;
333 }
334 org.kuali.ole.deliver.bo.OlePatronDocument bo = toUpdate;
335 if (toUpdate == null) {
336 bo = new org.kuali.ole.deliver.bo.OlePatronDocument();
337 }
338
339 bo.olePatronId = immutable.getOlePatronId();
340
341 bo.name = new EntityNameBo();
342
343 if (immutable.getName() != null) {
344 bo.name = EntityNameBo.from(immutable.getName());
345 }
346
347 bo.barcode = immutable.getBarcode();
348 bo.borrowerType = immutable.getBorrowerType();
349 bo.courtesyNotice = immutable.isCourtesyNotice();
350 bo.generalBlock = immutable.isGeneralBlock();
351 bo.deliveryPrivilege = immutable.isDeliveryPrivilege();
352 bo.pagingPrivilege = immutable.isPagingPrivilege();
353 bo.expirationDate = immutable.getExpirationDate();
354 bo.activationDate = immutable.getActivationDate();
355 bo.activeIndicator = immutable.isActiveIndicator();
356 bo.generalBlockNotes = immutable.getGeneralBlockNotes();
357 bo.source = immutable.getSource();
358 bo.statisticalCategory = immutable.getStatisticalCategory();
359
360
361
362
363
364
365
366
367
368 if (immutable.getEntity() != null) {
369 bo.entity = EntityBo.from(immutable.getEntity());
370 }
371 if (immutable.getOleBorrowerType() != null) {
372 bo.oleBorrowerType = OleBorrowerType.from(immutable.getOleBorrowerType());
373 }
374 if (CollectionUtils.isNotEmpty(immutable.getAddresses())) {
375 for (EntityAddress entityAddr : immutable.getAddresses()) {
376 if(bo.addresses == null){
377 bo.addresses = new ArrayList<>();
378 }
379 bo.addresses.add(EntityAddressBo.from(entityAddr));
380 }
381 }
382 if (CollectionUtils.isNotEmpty(immutable.getEmails())) {
383 for (EntityEmail entityEmail : immutable.getEmails()) {
384 bo.emails.add(EntityEmailBo.from(entityEmail));
385 }
386 }
387 if (CollectionUtils.isNotEmpty(immutable.getPhones())) {
388 for (EntityPhone entityPhone : immutable.getPhones()) {
389 bo.phones.add(EntityPhoneBo.from(entityPhone));
390 }
391 }
392
393 if (CollectionUtils.isNotEmpty(immutable.getNotes())) {
394 for (OlePatronNotesDefinition note : immutable.getNotes()) {
395 if(bo.notes == null){
396 bo.notes = new ArrayList<>();
397 }
398 bo.notes.add(OlePatronNotes.from(note));
399 }
400 }
401 if (CollectionUtils.isNotEmpty(immutable.getLostBarcodes())) {
402 for (OlePatronLostBarcodeDefinition lostBarcode : immutable.getLostBarcodes()) {
403 if(bo.lostBarcodes == null){
404 bo.lostBarcodes = new ArrayList<>();
405 }
406 bo.lostBarcodes.add(OlePatronLostBarcode.from(lostBarcode));
407 }
408 }
409 if (CollectionUtils.isNotEmpty(immutable.getOleEntityAddressBo())) {
410 for (OleEntityAddressDefinition address : immutable.getOleEntityAddressBo()) {
411 bo.oleEntityAddressBo.add(OleEntityAddressBo.from(address));
412 }
413 }
414
415 if(CollectionUtils.isNotEmpty(immutable.getOleEntityPhoneBo())) {
416 for(OleEntityPhoneDefinition phone : immutable.getOleEntityPhoneBo()) {
417 bo.oleEntityPhoneBo.add(OleEntityPhoneBo.from(phone));
418 }
419 }
420 if(CollectionUtils.isNotEmpty(immutable.getOleEntityEmailBo())) {
421 for(OleEntityEmailDefinition email : immutable.getOleEntityEmailBo()) {
422 bo.oleEntityEmailBo.add(OleEntityEmailBo.from(email));
423 }
424 }
425 if (CollectionUtils.isNotEmpty(immutable.getPatronAffiliations())) {
426 for (OlePatronAffiliationDefinition affiliation : immutable.getPatronAffiliations()) {
427 bo.patronAffiliations.add(OlePatronAffiliation.from(affiliation));
428 }
429 }
430 if (CollectionUtils.isNotEmpty(immutable.getOleProxyPatronDocuments())) {
431 for (OleProxyPatronDefinition proxyPatron : immutable.getOleProxyPatronDocuments()) {
432 if(bo.oleProxyPatronDocuments == null){
433 bo.oleProxyPatronDocuments = new ArrayList<>();
434 }
435 bo.oleProxyPatronDocuments.add(OleProxyPatronDocument.from(proxyPatron));
436 }
437 }
438 if (CollectionUtils.isNotEmpty(immutable.getOleAddresses())) {
439 for (OleAddressDefinition oleAddress : immutable.getOleAddresses()) {
440 if(bo.oleAddresses == null){
441 bo.oleAddresses = new ArrayList<>();
442 }
443 bo.oleAddresses.add(OleAddressBo.from(oleAddress));
444 }
445 }
446 if (CollectionUtils.isNotEmpty(immutable.getOlePhones())) {
447 for (OlePhoneDefinition olePhone : immutable.getOlePhones()) {
448 if(bo.olePhones == null) {
449 bo.olePhones = new ArrayList<>();
450 }
451 bo.olePhones.add(OlePhoneBo.from(olePhone));
452 }
453 }
454 if (CollectionUtils.isNotEmpty(immutable.getOleEmails())) {
455 for (OleEmailDefinition oleEmail : immutable.getOleEmails()) {
456 if(bo.oleEmails == null) {
457 bo.oleEmails = new ArrayList<>();
458 }
459 bo.oleEmails.add(OleEmailBo.from(oleEmail));
460 }
461 }
462 if (CollectionUtils.isNotEmpty(immutable.getOlePatronLocalIds())) {
463 for (OlePatronLocalIdentificationDefinition olePatronLocalId : immutable.getOlePatronLocalIds()) {
464 if(bo.olePatronLocalIds == null){
465 bo.olePatronLocalIds = new ArrayList<>();
466 }
467 bo.olePatronLocalIds.add(OlePatronLocalIdentificationBo.from(olePatronLocalId));
468 }
469 }
470
471 bo.versionNumber = immutable.getVersionNumber();
472
473 EntityBo entityBo = new EntityBo();
474 entityBo.setActive(true);
475
476 if (null != bo.getEntity()) {
477 entityBo = bo.getEntity();
478 entityBo.setActive(true);
479 }
480 if (CollectionUtils.isNotEmpty(immutable.getPatronAffiliations())) {
481 for (OlePatronAffiliationDefinition affiliation : immutable.getPatronAffiliations()) {
482 EntityAffiliationBo entityAffiliationBo = new EntityAffiliationBo();
483 entityAffiliationBo.setId(affiliation.getEntityAffiliationId());
484 entityAffiliationBo.setAffiliationTypeCode(affiliation.getAffiliationTypeCode());
485 entityAffiliationBo.setAffiliationType(EntityAffiliationTypeBo.from(affiliation.getAffiliationType()));
486 entityAffiliationBo.setActive(affiliation.isActive());
487 entityAffiliationBo.setDefaultValue(affiliation.isDefaultValue());
488 entityAffiliationBo.setCampusCode(affiliation.getCampusCode());
489 entityAffiliationBo.setObjectId(affiliation.getObjectId());
490 entityAffiliationBo.setVersionNumber(affiliation.getVersionNumber());
491 entityAffiliationBo.setEntityId(affiliation.getEntityId());
492
493 entityBo.getAffiliations().add(entityAffiliationBo);
494 for (EntityEmployment entityEmployment : affiliation.getEmployments()) {
495 entityBo.getEmploymentInformation().add(EntityEmploymentBo.from(entityEmployment));
496 }
497
498 bo.patronAffiliations.add(OlePatronAffiliation.from(affiliation));
499 }
500 }
501 entityBo.setNames(Arrays.asList(bo.getName()));
502 EntityTypeContactInfoBo entityTypeContactInfoBo = new EntityTypeContactInfoBo();
503 if (bo.getEntity() != null && null != bo.getEntity().getEntityTypeContactInfos() && bo.getEntity().getEntityTypeContactInfos().size() > 0) {
504 entityTypeContactInfoBo = bo.getEntity().getEntityTypeContactInfos().get(0);
505 }
506 entityTypeContactInfoBo.setAddresses(bo.getAddresses());
507 entityTypeContactInfoBo.setEmailAddresses(bo.getEmails());
508 entityTypeContactInfoBo.setPhoneNumbers(bo.getPhones());
509 entityTypeContactInfoBo.setEntityTypeCode(KimConstants.EntityTypes.PERSON);
510 entityBo.setEntityTypeContactInfos(Arrays.asList(entityTypeContactInfoBo));
511 bo.setEntity(entityBo);
512 return bo;
513 }
514
515 public boolean isRealPatronCheck() {
516 return realPatronCheck;
517 }
518
519 public void setRealPatronCheck(boolean realPatronCheck) {
520 this.realPatronCheck = realPatronCheck;
521 }
522
523
524
525
526
527
528 public List<OleLoanDocument> getOleLoanDocuments() {
529 return oleLoanDocuments;
530 }
531
532
533
534
535
536
537 public void setOleLoanDocuments(List<OleLoanDocument> oleLoanDocuments) {
538 List<OleLoanDocument> LoanDocumentList = new ArrayList<>();
539 List<OleLoanDocument> indefiniteLoanDocumentList = new ArrayList<>();
540 for (OleLoanDocument loanDoc : oleLoanDocuments) {
541 if (loanDoc.getLoanDueDate() != null && !(loanDoc.getLoanDueDate().toString().isEmpty())) {
542 LoanDocumentList.add(loanDoc);
543 } else {
544
545 indefiniteLoanDocumentList.add(loanDoc);
546 }
547 }
548 Collections.sort(LoanDocumentList, new Comparator<OleLoanDocument>() {
549 public int compare(OleLoanDocument o1, OleLoanDocument o2) {
550 return o1.getLoanDueDate().compareTo(o2.getLoanDueDate());
551 }
552 });
553 LoanDocumentList.addAll(indefiniteLoanDocumentList);
554 this.oleLoanDocuments = LoanDocumentList;
555 }
556
557
558
559
560
561
562 public String getBorrowerTypeName() {
563 if (getOleBorrowerType() != null) {
564 return oleBorrowerType.getBorrowerTypeName();
565 }
566 return null;
567 }
568
569
570
571
572
573
574 public EntityBo getEntity() {
575 if (getOlePatronId() != null) {
576 EntityBo entityBo = (EntityBo) EntityBo.from( getIdentityService().getEntity(getOlePatronId()));
577 if(entityBo!=null){
578 return entityBo;
579 }
580
581 return entity;
582 } else {
583 return entity;
584 }
585 }
586
587
588
589
590
591
592 public void setEntity(EntityBo entity) {
593 this.entity = entity;
594 }
595
596 public String getAffiliationType() {
597 return affiliationType;
598 }
599
600 public void setAffiliationType(String affiliationType) {
601 this.affiliationType = affiliationType;
602 }
603
604
605
606
607
608
609 public List<OlePatronNotes> getNotes() {
610 return notes;
611 }
612
613
614
615
616
617
618 public void setNotes(List<OlePatronNotes> notes) {
619 this.notes = notes;
620 }
621
622
623
624
625
626
627 public String getBarcode() {
628 return barcode;
629 }
630
631
632
633
634
635
636 public void setBarcode(String barcode) {
637 this.barcode = barcode;
638 }
639
640
641
642
643
644
645 public String getBorrowerType() {
646 return borrowerType;
647 }
648
649
650
651
652
653
654 public void setBorrowerType(String borrowerType) {
655 this.borrowerType = borrowerType;
656 }
657
658
659
660
661
662
663 public boolean isActiveIndicator() {
664 return activeIndicator;
665 }
666
667
668
669
670
671
672 public void setActiveIndicator(boolean activeIndicator) {
673 this.activeIndicator = activeIndicator;
674 }
675
676
677
678
679
680
681 public String getOlePatronId() {
682 return olePatronId;
683 }
684
685
686
687
688
689
690 public void setOlePatronId(String olePatronId) {
691 this.olePatronId = olePatronId;
692 }
693
694
695
696
697
698
699 @Override
700 public boolean isGeneralBlock() {
701 return generalBlock;
702 }
703
704
705
706
707
708
709 public void setGeneralBlock(boolean generalBlock) {
710 this.generalBlock = generalBlock;
711 }
712
713
714
715
716
717
718 public boolean isCourtesyNotice() {
719 return courtesyNotice;
720 }
721
722
723
724
725
726
727 public void setCourtesyNotice(boolean courtesyNotice) {
728 this.courtesyNotice = courtesyNotice;
729 }
730
731
732
733
734
735
736 public boolean isDeliveryPrivilege() {
737 return deliveryPrivilege;
738 }
739
740
741
742
743
744
745 public void setDeliveryPrivilege(boolean deliveryPrivilege) {
746 this.deliveryPrivilege = deliveryPrivilege;
747 }
748
749
750
751
752
753
754 public boolean isPagingPrivilege() {
755 return pagingPrivilege;
756 }
757
758
759
760
761
762
763 public void setPagingPrivilege(boolean pagingPrivilege) {
764 this.pagingPrivilege = pagingPrivilege;
765 }
766
767
768
769
770
771
772 public Date getExpirationDate() {
773 return expirationDate;
774 }
775
776
777
778
779
780
781 public void setExpirationDate(Date expirationDate) {
782 this.expirationDate = expirationDate;
783 }
784
785
786
787
788
789
790 public String getFirstName() {
791 return firstName;
792 }
793
794
795
796
797
798
799 public void setFirstName(String firstName) {
800 this.firstName = firstName;
801 }
802
803
804
805
806
807
808 public String getMiddleName() {
809 return middleName;
810 }
811
812
813
814
815
816
817 public void setMiddleName(String middleName) {
818 this.middleName = middleName;
819 }
820
821
822
823
824
825
826 public String getLastName() {
827 return lastName;
828 }
829
830
831
832
833
834
835 public void setLastName(String lastName) {
836 this.lastName = lastName;
837 }
838
839
840
841
842
843
844 public String getEmailAddress() {
845 return emailAddress;
846 }
847
848
849
850
851
852
853 public void setEmailAddress(String emailAddress) {
854 this.emailAddress = emailAddress;
855 }
856
857
858
859
860
861
862 public String getPhoneNumber() {
863 if(null == phoneNumber){
864 List<EntityTypeContactInfoBo> entityTypeContactInfos = getEntity().getEntityTypeContactInfos();
865 if (CollectionUtils.isNotEmpty(entityTypeContactInfos)) {
866 EntityTypeContactInfoBo entityTypeContactInfoBo = entityTypeContactInfos.get(0);
867 if (entityTypeContactInfoBo!=null && entityTypeContactInfoBo.getPhoneNumbers() != null) {
868 for (int j = 0; j < entityTypeContactInfoBo.getPhoneNumbers().size(); j++) {
869 if (entityTypeContactInfoBo.getPhoneNumbers().get(j).getPhoneTypeCode().equalsIgnoreCase("HM")) {
870 phoneNumber = (entityTypeContactInfoBo.getPhoneNumbers().get(j).getPhoneNumber());
871 }
872 }
873 }
874 }
875 }
876 return phoneNumber;
877 }
878
879
880
881
882
883
884 public void setPhoneNumber(String phoneNumber) {
885 this.phoneNumber = phoneNumber;
886 }
887
888
889
890
891
892
893 public List<EntityPhoneBo> getPhones() {
894 return phones;
895 }
896
897
898
899
900
901
902 public void setPhones(List<EntityPhoneBo> phones) {
903 this.phones = phones;
904 }
905
906
907
908
909
910
911 public List<EntityAddressBo> getAddresses() {
912 return addresses;
913 }
914
915
916
917
918
919
920 public void setAddresses(List<EntityAddressBo> addresses) {
921 this.addresses = addresses;
922 }
923
924
925
926
927
928
929 public EntityNameBo getName() {
930 return name;
931 }
932
933
934
935
936
937
938 public void setName(EntityNameBo name) {
939 this.name = name;
940 }
941
942
943
944
945
946
947 public List<EntityEmailBo> getEmails() {
948 return emails;
949 }
950
951
952
953
954
955
956 public void setEmails(List<EntityEmailBo> emails) {
957 this.emails = emails;
958 }
959
960
961
962
963
964
965 public OleBorrowerType getOleBorrowerType() {
966 return oleBorrowerType;
967 }
968
969
970
971
972
973
974 public void setOleBorrowerType(OleBorrowerType oleBorrowerType) {
975 this.oleBorrowerType = oleBorrowerType;
976 }
977
978
979
980
981
982
983 public String getProcessMessage() {
984 return processMessage;
985 }
986
987
988
989
990
991
992 public void setProcessMessage(String processMessage) {
993 this.processMessage = processMessage;
994 }
995
996 protected LinkedHashMap toStringMapper() {
997 LinkedHashMap toStringMap = new LinkedHashMap();
998 toStringMap.put("olePatronId", olePatronId);
999 return toStringMap;
1000 }
1001
1002
1003
1004
1005
1006
1007 @Override
1008 public String getId() {
1009 return this.getOlePatronId();
1010 }
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031 public String getProxyPatronId() {
1032 return proxyPatronId;
1033 }
1034
1035
1036
1037
1038
1039
1040 public void setProxyPatronId(String proxyPatronId) {
1041 this.proxyPatronId = proxyPatronId;
1042 }
1043
1044
1045
1046
1047
1048
1049 public List<OleProxyPatronDocument> getOleProxyPatronDocuments() {
1050 return oleProxyPatronDocuments;
1051 }
1052
1053
1054
1055
1056
1057
1058 public void setOleProxyPatronDocuments(List<OleProxyPatronDocument> oleProxyPatronDocuments) {
1059 this.oleProxyPatronDocuments = oleProxyPatronDocuments;
1060 }
1061
1062 public OlePatronDocument getSelectedProxyForPatron() {
1063 return selectedProxyForPatron;
1064 }
1065
1066 public void setSelectedProxyForPatron(OlePatronDocument selectedProxyForPatron) {
1067 this.selectedProxyForPatron = selectedProxyForPatron;
1068 }
1069
1070
1071
1072
1073
1074
1075 public Date getActivationDate() {
1076 return activationDate;
1077 }
1078
1079
1080
1081
1082
1083
1084 public void setActivationDate(Date activationDate) {
1085 this.activationDate = activationDate;
1086 }
1087
1088
1089
1090
1091
1092
1093 public String getGeneralBlockNotes() {
1094 return generalBlockNotes;
1095 }
1096
1097
1098
1099
1100
1101
1102 public void setGeneralBlockNotes(String generalBlockNotes) {
1103 this.generalBlockNotes = generalBlockNotes;
1104 }
1105
1106
1107
1108
1109
1110
1111 public List<OleEntityAddressBo> getOleEntityAddressBo() {
1112 return oleEntityAddressBo;
1113 }
1114
1115
1116
1117
1118
1119
1120 public void setOleEntityAddressBo(List<OleEntityAddressBo> oleEntityAddressBo) {
1121 this.oleEntityAddressBo = oleEntityAddressBo;
1122 }
1123
1124
1125
1126
1127
1128
1129 public List<OlePatronAffiliation> getPatronAffiliations() {
1130 return patronAffiliations;
1131 }
1132
1133
1134
1135
1136
1137
1138 public void setPatronAffiliations(List<OlePatronAffiliation> patronAffiliations) {
1139 this.patronAffiliations = patronAffiliations;
1140 }
1141
1142
1143
1144
1145
1146
1147 public OleSourceBo getSourceBo() {
1148 return sourceBo;
1149 }
1150
1151
1152
1153
1154
1155
1156 public void setSourceBo(OleSourceBo sourceBo) {
1157 this.sourceBo = sourceBo;
1158 }
1159
1160
1161
1162
1163
1164
1165 public OleStatisticalCategoryBo getStatisticalCategoryBo() {
1166 return statisticalCategoryBo;
1167 }
1168
1169
1170
1171
1172
1173
1174 public void setStatisticalCategoryBo(OleStatisticalCategoryBo statisticalCategoryBo) {
1175 this.statisticalCategoryBo = statisticalCategoryBo;
1176 }
1177
1178
1179
1180
1181
1182
1183 public List<EntityEmploymentBo> getEmployments() {
1184 return employments;
1185 }
1186
1187 public void setEmployments(List<EntityEmploymentBo> employments) {
1188 this.employments = employments;
1189 }
1190
1191
1192
1193
1194
1195
1196 public String getSource() {
1197 return source;
1198 }
1199
1200 public void setSource(String source) {
1201 if (source != null && source.equals("")) {
1202 this.source = null;
1203 } else {
1204 this.source = source;
1205 }
1206 }
1207
1208
1209
1210
1211
1212
1213 public String getStatisticalCategory() {
1214 return statisticalCategory;
1215 }
1216
1217 public void setStatisticalCategory(String statisticalCategory) {
1218 if (statisticalCategory != null && statisticalCategory.equals("")) {
1219 this.statisticalCategory = null;
1220 } else {
1221 this.statisticalCategory = statisticalCategory;
1222 }
1223 }
1224
1225
1226
1227
1228
1229
1230 public String getOleSourceName() {
1231 if (sourceBo != null) {
1232 return sourceBo.getOleSourceName();
1233 }
1234 return null;
1235 }
1236
1237
1238
1239
1240
1241
1242 public String getOleStatisticalCategoryName() {
1243 if (statisticalCategoryBo != null) {
1244 return statisticalCategoryBo.getOleStatisticalCategoryName();
1245 }
1246 return null;
1247 }
1248
1249
1250
1251
1252
1253
1254 public boolean isPatronBillFlag() {
1255 return patronBillFlag;
1256 }
1257
1258
1259
1260
1261
1262
1263 public void setPatronBillFlag(boolean patronBillFlag) {
1264 this.patronBillFlag = patronBillFlag;
1265 }
1266
1267 public List<OlePatronLostBarcode> getLostBarcodes() {
1268 return lostBarcodes;
1269 }
1270
1271 public void setLostBarcodes(List<OlePatronLostBarcode> lostBarcodes) {
1272 this.lostBarcodes = lostBarcodes;
1273 }
1274
1275 public List<OleAddressBo> getOleAddresses() {
1276 return oleAddresses;
1277 }
1278
1279 public void setOleAddresses(List<OleAddressBo> oleAddresses) {
1280 this.oleAddresses = oleAddresses;
1281 }
1282
1283 public byte[] getPatronPhotograph() {
1284 return patronPhotograph;
1285 }
1286
1287 public void setPatronPhotograph(byte[] patronPhotograph) {
1288 this.patronPhotograph = patronPhotograph;
1289 }
1290
1291 public List<OlePatronLocalIdentificationBo> getOlePatronLocalIds() {
1292 return olePatronLocalIds;
1293 }
1294
1295 public void setOlePatronLocalIds(List<OlePatronLocalIdentificationBo> olePatronLocalIds) {
1296 this.olePatronLocalIds = olePatronLocalIds;
1297 }
1298
1299 public boolean isLoanFlag() {
1300 return loanFlag;
1301 }
1302
1303 public void setLoanFlag(boolean loanFlag) {
1304 this.loanFlag = loanFlag;
1305 }
1306
1307 public boolean isTempCircHistoryFlag() {
1308 return tempCircHistoryFlag;
1309 }
1310
1311 public void setTempCircHistoryFlag(boolean tempCircHistoryFlag) {
1312 this.tempCircHistoryFlag = tempCircHistoryFlag;
1313 }
1314
1315 public boolean isRequestFlag() {
1316 return requestFlag;
1317 }
1318
1319 public void setRequestFlag(boolean requestFlag) {
1320 this.requestFlag = requestFlag;
1321 }
1322
1323 public List<OleProxyPatronDocument> getOleProxyPatronDocumentList() {
1324 return oleProxyPatronDocumentList;
1325 }
1326
1327 public void setOleProxyPatronDocumentList(List<OleProxyPatronDocument> oleProxyPatronDocumentList) {
1328 this.oleProxyPatronDocumentList = oleProxyPatronDocumentList;
1329 }
1330
1331 public boolean isPointing() {
1332 return pointing;
1333 }
1334
1335 public void setPointing(boolean pointing) {
1336 this.pointing = pointing;
1337 }
1338
1339 public boolean isStartingIndexExecuted() {
1340 return startingIndexExecuted;
1341 }
1342
1343 public void setStartingIndexExecuted(boolean startingIndexExecuted) {
1344 this.startingIndexExecuted = startingIndexExecuted;
1345 }
1346
1347 public boolean isActivateBarcode() {
1348 return activateBarcode;
1349 }
1350
1351 public void setActivateBarcode(boolean activateBarcode) {
1352 this.activateBarcode = activateBarcode;
1353 }
1354
1355 public boolean isDeactivateBarcode() {
1356 return deactivateBarcode;
1357 }
1358
1359 public void setDeactivateBarcode(boolean deactivateBarcode) {
1360 this.deactivateBarcode = deactivateBarcode;
1361 }
1362
1363 public String getLostStatus() {
1364 return lostStatus;
1365 }
1366
1367 public void setLostStatus(String lostStatus) {
1368 this.lostStatus = lostStatus;
1369 }
1370
1371 public String getLostDescription() {
1372 return lostDescription;
1373 }
1374
1375 public void setLostDescription(String lostDescription) {
1376 this.lostDescription = lostDescription;
1377 }
1378
1379 public boolean isInvalidateBarcode() {
1380 return invalidateBarcode;
1381 }
1382
1383 public void setInvalidateBarcode(boolean invalidateBarcode) {
1384 this.invalidateBarcode = invalidateBarcode;
1385 }
1386
1387 public boolean isReinstateBarcode() {
1388 return reinstateBarcode;
1389 }
1390
1391 public void setReinstateBarcode(boolean reinstateBarcode) {
1392 this.reinstateBarcode = reinstateBarcode;
1393 }
1394
1395 public boolean isSkipBarcodeValidation() {
1396 return skipBarcodeValidation;
1397 }
1398
1399 public void setSkipBarcodeValidation(boolean skipBarcodeValidation) {
1400 this.skipBarcodeValidation = skipBarcodeValidation;
1401 }
1402
1403 public boolean isBarcodeChanged() {
1404 return barcodeChanged;
1405 }
1406
1407 public void setBarcodeChanged(boolean barcodeChanged) {
1408 this.barcodeChanged = barcodeChanged;
1409 }
1410
1411 public boolean isBarcodeEditable() {
1412 return barcodeEditable;
1413 }
1414
1415 public void setBarcodeEditable(boolean barcodeEditable) {
1416 this.barcodeEditable = barcodeEditable;
1417 }
1418
1419 public boolean isPopupDialog() {
1420 return popupDialog;
1421 }
1422
1423 public void setPopupDialog(boolean popupDialog) {
1424 this.popupDialog = popupDialog;
1425 }
1426
1427 public String getPatronMessage() {
1428 return patronMessage;
1429 }
1430
1431 public void setPatronMessage(String patronMessage) {
1432 this.patronMessage = patronMessage;
1433 }
1434
1435 public String getUiMessageType() {
1436 return uiMessageType;
1437 }
1438
1439 public void setUiMessageType(String uiMessageType) {
1440 this.uiMessageType = uiMessageType;
1441 }
1442
1443 public boolean isReinstated() {
1444 return reinstated;
1445 }
1446
1447 public void setReinstated(boolean reinstated) {
1448 this.reinstated = reinstated;
1449 }
1450
1451 public OLEPatronEntityViewBo getOlePatronEntityViewBo() {
1452 return olePatronEntityViewBo;
1453 }
1454
1455 public void setOlePatronEntityViewBo(OLEPatronEntityViewBo olePatronEntityViewBo) {
1456 this.olePatronEntityViewBo = olePatronEntityViewBo;
1457 }
1458
1459 public String getPatronBillFileName() {
1460 return patronBillFileName;
1461 }
1462
1463 public void setPatronBillFileName(String patronBillFileName) {
1464 this.patronBillFileName = patronBillFileName;
1465 }
1466
1467 public String getViewBillUrl() {
1468 return viewBillUrl;
1469 }
1470
1471 public void setViewBillUrl(String viewBillUrl) {
1472 this.viewBillUrl = viewBillUrl;
1473 }
1474
1475 public String getCreateBillUrl() {
1476 return createBillUrl;
1477 }
1478
1479 public void setCreateBillUrl(String createBillUrl) {
1480 this.createBillUrl = createBillUrl;
1481 }
1482
1483 public String getNamePrefix() {
1484 return namePrefix;
1485 }
1486
1487 public void setNamePrefix(String namePrefix) {
1488 this.namePrefix = namePrefix;
1489 }
1490
1491 public String getNameSuffix() {
1492 return nameSuffix;
1493 }
1494
1495 public void setNameSuffix(String nameSuffix) {
1496 this.nameSuffix = nameSuffix;
1497 }
1498
1499 public List<EntityPhoneBo> getDeletedPhones() {
1500 return deletedPhones;
1501 }
1502
1503 public void setDeletedPhones(List<EntityPhoneBo> deletedPhones) {
1504 this.deletedPhones = deletedPhones;
1505 }
1506
1507 public List<OleEntityAddressBo> getDeletedOleEntityAddressBo() {
1508 return deletedOleEntityAddressBo;
1509 }
1510
1511 public void setDeletedOleEntityAddressBo(List<OleEntityAddressBo> deletedOleEntityAddressBo) {
1512 this.deletedOleEntityAddressBo = deletedOleEntityAddressBo;
1513 }
1514
1515 public List<EntityEmailBo> getDeletedEmails() {
1516 return deletedEmails;
1517 }
1518
1519 public void setDeletedEmails(List<EntityEmailBo> deletedEmails) {
1520 this.deletedEmails = deletedEmails;
1521 }
1522
1523 public List<OleProxyPatronDocument> getDeletedOleProxyPatronDocuments() {
1524 return deletedOleProxyPatronDocuments;
1525 }
1526
1527 public void setDeletedOleProxyPatronDocuments(List<OleProxyPatronDocument> deletedOleProxyPatronDocuments) {
1528 this.deletedOleProxyPatronDocuments = deletedOleProxyPatronDocuments;
1529 }
1530
1531 public List<OlePatronAffiliation> getDeletedPatronAffiliations() {
1532 return deletedPatronAffiliations;
1533 }
1534
1535 public void setDeletedPatronAffiliations(List<OlePatronAffiliation> deletedPatronAffiliations) {
1536 this.deletedPatronAffiliations = deletedPatronAffiliations;
1537 }
1538
1539 public List<EntityEmploymentBo> getDeletedEmployments() {
1540 return deletedEmployments;
1541 }
1542
1543 public void setDeletedEmployments(List<EntityEmploymentBo> deletedEmployments) {
1544 this.deletedEmployments = deletedEmployments;
1545 }
1546
1547 public List<OlePatronNotes> getDeletedNotes() {
1548 return deletedNotes;
1549 }
1550
1551 public void setDeletedNotes(List<OlePatronNotes> deletedNotes) {
1552 this.deletedNotes = deletedNotes;
1553 }
1554
1555 public List<OlePatronLocalIdentificationBo> getDeletedOlePatronLocalIds() {
1556 return deletedOlePatronLocalIds;
1557 }
1558
1559 public void setDeletedOlePatronLocalIds(List<OlePatronLocalIdentificationBo> deletedOlePatronLocalIds) {
1560 this.deletedOlePatronLocalIds = deletedOlePatronLocalIds;
1561 }
1562
1563 public boolean isShowLoanedRecords() {
1564 return showLoanedRecords;
1565 }
1566
1567 public void setShowLoanedRecords(boolean showLoanedRecords) {
1568 this.showLoanedRecords = showLoanedRecords;
1569 }
1570
1571 public boolean isShowRequestedItems() {
1572 return showRequestedItems;
1573 }
1574
1575 public void setShowRequestedItems(boolean showRequestedItems) {
1576 this.showRequestedItems = showRequestedItems;
1577 }
1578
1579 public boolean isShowTemporaryCirculationHistoryRecords() {
1580 return showTemporaryCirculationHistoryRecords;
1581 }
1582
1583 public void setShowTemporaryCirculationHistoryRecords(boolean showTemporaryCirculationHistoryRecords) {
1584 this.showTemporaryCirculationHistoryRecords = showTemporaryCirculationHistoryRecords;
1585 }
1586
1587 public String getRealPatronFirstName() {
1588 if(entity!=null && entity.getNames()!=null && entity.getNames().size()>0){
1589 this.realPatronFirstName=entity.getNames().get(0).getFirstName().replaceAll("'", "\'");
1590 }
1591 return realPatronFirstName;
1592 }
1593
1594 public void setRealPatronFirstName(String realPatronFirstName) {
1595 this.realPatronFirstName = realPatronFirstName;
1596 }
1597
1598 public String getRealPatronLastName() {
1599 if(entity!=null && entity.getNames()!=null && entity.getNames().size()>0){
1600 this.realPatronLastName=entity.getNames().get(0).getLastName().replaceAll("'", "\'");
1601 }
1602 return realPatronLastName;
1603 }
1604
1605 public void setRealPatronLastName(String realPatronLastName) {
1606 this.realPatronLastName = realPatronLastName;
1607 }
1608
1609 public boolean isShowBillUrlsFlag() {
1610 return showBillUrlsFlag;
1611 }
1612
1613 public void setShowBillUrlsFlag(boolean showBillUrlsFlag) {
1614 this.showBillUrlsFlag = showBillUrlsFlag;
1615 }
1616
1617 public int getLoanCount() {
1618 return loanCount;
1619 }
1620
1621 public void setLoanCount(int loanCount) {
1622 this.loanCount = loanCount;
1623 }
1624
1625 public int getRequestedItemRecordsCount() {
1626 return requestedItemRecordsCount;
1627 }
1628
1629 public void setRequestedItemRecordsCount(int requestedItemRecordsCount) {
1630 this.requestedItemRecordsCount = requestedItemRecordsCount;
1631 }
1632
1633 public int getTempCirculationHistoryCount() {
1634 return tempCirculationHistoryCount;
1635 }
1636
1637 public void setTempCirculationHistoryCount(int tempCirculationHistoryCount) {
1638 this.tempCirculationHistoryCount = tempCirculationHistoryCount;
1639 }
1640
1641 public String getPatronRecordURL() {
1642 return patronRecordURL;
1643 }
1644
1645 public void setPatronRecordURL(String patronRecordURL) {
1646 this.patronRecordURL = patronRecordURL;
1647 }
1648
1649 public boolean isDeleteImageFlag() {
1650 return deleteImageFlag;
1651 }
1652
1653 public void setDeleteImageFlag(boolean deleteImageFlag) {
1654 this.deleteImageFlag = deleteImageFlag;
1655 }
1656
1657 public String getLostOperatorId() {
1658 return lostOperatorId;
1659 }
1660
1661 public void setLostOperatorId(String lostOperatorId) {
1662 this.lostOperatorId = lostOperatorId;
1663 }
1664
1665 public List<OleEntityPhoneBo> getOleEntityPhoneBo() {
1666 return oleEntityPhoneBo;
1667 }
1668
1669 public void setOleEntityPhoneBo(List<OleEntityPhoneBo> oleEntityPhoneBo) {
1670 this.oleEntityPhoneBo = oleEntityPhoneBo;
1671 }
1672
1673 public List<OleEntityPhoneBo> getDeletedOleEntityPhoneBo() {
1674 return deletedOleEntityPhoneBo;
1675 }
1676
1677 public void setDeletedOleEntityPhoneBo(List<OleEntityPhoneBo> deletedOleEntityPhoneBo) {
1678 this.deletedOleEntityPhoneBo = deletedOleEntityPhoneBo;
1679 }
1680
1681 public List<OlePhoneBo> getOlePhones() {
1682 return olePhones;
1683 }
1684
1685 public void setOlePhones(List<OlePhoneBo> olePhones) {
1686 this.olePhones = olePhones;
1687 }
1688
1689 public List<OleEntityEmailBo> getOleEntityEmailBo() {
1690 return oleEntityEmailBo;
1691 }
1692
1693 public void setOleEntityEmailBo(List<OleEntityEmailBo> oleEntityEmailBo) {
1694 this.oleEntityEmailBo = oleEntityEmailBo;
1695 }
1696
1697 public List<OleEntityEmailBo> getDeletedOleEntityEmailBo() {
1698 return deletedOleEntityEmailBo;
1699 }
1700
1701 public void setDeletedOleEntityEmailBo(List<OleEntityEmailBo> deletedOleEntityEmailBo) {
1702 this.deletedOleEntityEmailBo = deletedOleEntityEmailBo;
1703 }
1704
1705 public List<OleEmailBo> getOleEmails() {
1706 return oleEmails;
1707 }
1708
1709 public void setOleEmails(List<OleEmailBo> oleEmails) {
1710 this.oleEmails = oleEmails;
1711 }
1712
1713 public BusinessObjectService getBusinessObjectService() {
1714 if (null == businessObjectService) {
1715 businessObjectService = KRADServiceLocator.getBusinessObjectService();
1716 }
1717 return businessObjectService;
1718 }
1719
1720 public boolean isLostPatron() {
1721 LOG.debug("Inside the checkLostPatronBarcode method");
1722 Map barMap = new HashMap();
1723 barMap.put("invalidOrLostBarcodeNumber", barcode);
1724 List<OlePatronLostBarcode> olePatronLostBarcodes = (List<OlePatronLostBarcode>) getBusinessObjectService().findMatching(OlePatronLostBarcode.class, barMap);
1725
1726 return olePatronLostBarcodes.size() > 0;
1727 }
1728
1729 public boolean isAddressVerified() {
1730 Map<String, String> addressCriteria = new HashMap<String, String>();
1731 EntityBo entityBo = getEntity();
1732 if (null != entityBo) {
1733 List<EntityTypeContactInfoBo> entityTypeContactInfos = entityBo.getEntityTypeContactInfos();
1734 if (null != entityTypeContactInfos && entityTypeContactInfos.size() > 0) {
1735 List<EntityAddressBo> addresses = entityTypeContactInfos.get(0).getAddresses();
1736 if (addresses != null && addresses
1737 .size() > 0) {
1738 for (int address = 0; address < addresses.size(); address++) {
1739 addressCriteria.put("id", addresses.get(address).getId());
1740 List<OleAddressBo> oleAddressBos = (List<OleAddressBo>) KRADServiceLocator.getBusinessObjectService().findMatching(OleAddressBo.class, addressCriteria);
1741 if (oleAddressBos != null && oleAddressBos.size() > 0 && addresses.get(address).isDefaultValue() && oleAddressBos.get(0).isAddressVerified()) {
1742 return true;
1743 }
1744 }
1745 }
1746 }
1747 }
1748 return false;
1749 }
1750
1751 public String getPreferredAddress() {
1752 StringBuilder stringBuilder = new StringBuilder();
1753 if (null == preferredAddress) {
1754 EntityTypeContactInfoBo entityTypeContactInfoBo = getEntity().getEntityTypeContactInfos().get(0);
1755 if (entityTypeContactInfoBo.getAddresses() != null) {
1756 for (EntityAddressBo entityAddressBo : entityTypeContactInfoBo.getAddresses()) {
1757 if (entityAddressBo.isDefaultValue()) {
1758 String address = "";
1759 if (entityAddressBo.getLine1() != null) {
1760 if (!entityAddressBo.getLine1().isEmpty()) {
1761 stringBuilder.append(entityAddressBo.getLine1() + OLEConstants.COMMA);
1762 }
1763 }
1764
1765 if (entityAddressBo.getLine2() != null) {
1766 if (!entityAddressBo.getLine2().isEmpty()) {
1767 stringBuilder.append(entityAddressBo.getLine2() + OLEConstants.COMMA);
1768 }
1769 }
1770
1771 if (entityAddressBo.getLine3() != null) {
1772 if (!entityAddressBo.getLine3().isEmpty()) {
1773 stringBuilder.append(entityAddressBo.getLine3() + OLEConstants.COMMA);
1774 }
1775 }
1776
1777 if (entityAddressBo.getCity() != null) {
1778 if (!entityAddressBo.getCity().isEmpty()) {
1779 stringBuilder.append(entityAddressBo.getCity() + OLEConstants.COMMA);
1780 }
1781 }
1782
1783 if (entityAddressBo.getStateProvinceCode() != null) {
1784 if (!entityAddressBo.getStateProvinceCode().isEmpty()) {
1785 stringBuilder.append(entityAddressBo.getStateProvinceCode() + OLEConstants.COMMA);
1786 }
1787 }
1788
1789 if (entityAddressBo.getCountryCode() != null) {
1790 if (!entityAddressBo.getCountryCode().isEmpty()) {
1791 stringBuilder.append(entityAddressBo.getCountryCode() + OLEConstants.COMMA);
1792 }
1793 }
1794
1795 if (entityAddressBo.getPostalCode() != null) {
1796 if (!entityAddressBo.getPostalCode().isEmpty()) {
1797 stringBuilder.append(entityAddressBo.getPostalCode());
1798 }
1799 }
1800 preferredAddress = stringBuilder.toString();
1801 break;
1802 }
1803 }
1804 }
1805 }
1806 return preferredAddress;
1807 }
1808
1809 public String getEmail() {
1810 if (null == email) {
1811 EntityTypeContactInfoBo entityTypeContactInfoBo = getEntity().getEntityTypeContactInfos().get(0);
1812 if (entityTypeContactInfoBo.getEmailAddresses() != null) {
1813 for (EntityEmailBo entityEmailBo : entityTypeContactInfoBo.getEmailAddresses()) {
1814 if (entityEmailBo.isDefaultValue()) {
1815 email = entityEmailBo.getEmailAddress();
1816 break;
1817 }
1818 }
1819 }
1820
1821 }
1822 return email;
1823 }
1824
1825 public List<OlePatronDocument> getCurrentPatronList() {
1826 if (CollectionUtils.isEmpty(currentPatronList)) {
1827 currentPatronList.add(this);
1828 }
1829 return currentPatronList;
1830 }
1831
1832 public void setCurrentPatronList(List<OlePatronDocument> currentPatronList) {
1833 this.currentPatronList = currentPatronList;
1834 }
1835
1836 public int getLoanedItemsCountByItemType(String itemType) {
1837 Integer itemCount = 0;
1838 List<OleLoanDocument> oleLoanDocuments = getOleLoanDocuments();
1839 for (Iterator<OleLoanDocument> iterator = oleLoanDocuments.iterator(); iterator.hasNext(); ) {
1840 OleLoanDocument oleLoanDocument = iterator.next();
1841 String itemId = oleLoanDocument.getItemId();
1842 String itemTypeCode = getItemTypeFromItemId(itemId);
1843 if (itemTypeCode.equalsIgnoreCase(itemType)) {
1844 itemCount = itemCount + 1;
1845 }
1846 }
1847 return itemCount;
1848 }
1849
1850 private String getItemTypeFromItemId(String itemId) {
1851 HashMap<String, Object> map = new HashMap<String, Object>();
1852 map.put("barCode", itemId);
1853 List<ItemRecord> itemRecords = (List<ItemRecord>) getBusinessObjectService().findMatching(ItemRecord.class, map);
1854 ItemRecord itemRecord = itemRecords.get(0);
1855 return itemRecord.getItemTypeRecord().getCode();
1856 }
1857
1858 public int getTotalLoanedItemsCount() {
1859 return getOleLoanDocuments().size();
1860 }
1861
1862 public String getRequestTypeCode(String itemUUID) {
1863 OleDeliverRequestBo prioritizedRequest = getPrioritizedRequest(itemUUID);
1864 return prioritizedRequest.getRequestTypeCode();
1865 }
1866
1867 public OleDeliverRequestBo getPrioritizedRequest(String itemUuid) {
1868 LOG.debug("Inside the getPrioritizedRequest method");
1869 Map requestMap = new HashMap();
1870 requestMap.put("itemUuid", itemUuid);
1871 requestMap.put("borrowerQueuePosition", 1);
1872 List<OleDeliverRequestBo> oleDeliverRequestBos = (List<OleDeliverRequestBo>) getBusinessObjectService().findMatching(OleDeliverRequestBo.class, requestMap);
1873 return oleDeliverRequestBos != null && oleDeliverRequestBos.size() > 0 ?
1874 oleDeliverRequestBos.get(0) : null;
1875 }
1876
1877 public Integer getAllCharges(String... feeTypes) {
1878 allCharges = 0;
1879 if (feeTypes.length == 0) {
1880 Integer overdueFineAmount = getFeeAmountBasedOnFeeType(OLEConstants.FEE_TYPE_CODE_OVERDUE);
1881 Integer replacementFineAmount = getFeeAmountBasedOnFeeType(OLEConstants.FEE_TYPE_CODE_REPL_FEE);
1882 if (null != overdueFineAmount && null != replacementFineAmount) {
1883 allCharges = overdueFineAmount + replacementFineAmount;
1884 } else {
1885 allCharges = 0;
1886 }
1887 } else {
1888 for(String individualFeeType : feeTypes){
1889 Integer feeAmountBasedOnFeeType = getFeeAmountBasedOnFeeType(individualFeeType);
1890 allCharges += feeAmountBasedOnFeeType;
1891 }
1892 }
1893 return allCharges;
1894 }
1895
1896 private Integer getFeeAmountBasedOnFeeType(String feeType) {
1897 Integer feeAmount = 0;
1898 List<FeeType> feeTypeList = getPatronFeeTypes();
1899 if(CollectionUtils.isNotEmpty(feeTypeList)){
1900 for (Iterator<FeeType> iterator = feeTypeList.iterator(); iterator.hasNext(); ) {
1901 FeeType patronFeeType = iterator.next();
1902 if(patronFeeType.getOleFeeType().getFeeTypeCode().equalsIgnoreCase(feeType)){
1903 feeAmount += patronFeeType.getBalFeeAmount().intValue();
1904 }
1905 }
1906 }
1907 return feeAmount;
1908 }
1909
1910 public Integer getOverdueFineAmount() {
1911 if (null == overdueFineAmt) {
1912 overdueFineAmt = getFeeAmountBasedOnFeeType(OLEConstants.FEE_TYPE_CODE_OVERDUE);
1913 }
1914 return overdueFineAmt;
1915 }
1916
1917 public List<FeeType> getPatronFeeTypes() {
1918 if (null == feeTypeList) {
1919 feeTypeList = new ArrayList<FeeType>();
1920 Map<String, String> criteria = new HashMap<String, String>();
1921 criteria.put("patronId", olePatronId);
1922 List<PatronBillPayment> patronBillPayments = (List<PatronBillPayment>) KRADServiceLocator.getBusinessObjectService().findMatching(PatronBillPayment.class, criteria);
1923 for (PatronBillPayment patronBillPayment : patronBillPayments) {
1924 feeTypeList.addAll(patronBillPayment.getFeeType());
1925 }
1926 }
1927 return feeTypeList;
1928 }
1929
1930 public Integer getReplacementFineAmount() {
1931 if (null == replacementFeeAmt) {
1932 replacementFeeAmt = getFeeAmountBasedOnFeeType(OLEConstants.FEE_TYPE_CODE_REPL_FEE);
1933 }
1934 return replacementFeeAmt;
1935 }
1936
1937 public List<OleLoanDocument> getOleLoanDocumentsFromDb() {
1938 if (StringUtils.isNotEmpty(getOlePatronId())) {
1939 if (StringUtils.isNotEmpty(getOlePatronId())) {
1940 Map<String, String> parameterMap = new HashMap<>();
1941 parameterMap.put("patronId", getOlePatronId());
1942 List<OleLoanDocument> oleLoanDocumentList = (List<OleLoanDocument>) KRADServiceLocator.getBusinessObjectService().findMatching(OleLoanDocument.class, parameterMap);
1943 if (CollectionUtils.isNotEmpty(oleLoanDocumentList)) {
1944 oleLoanDocuments = oleLoanDocumentList;
1945 }
1946 }
1947 }
1948 return oleLoanDocuments;
1949 }
1950
1951 public Boolean isOverDueDays(Integer allowedOverDueDays) {
1952 List<OleLoanDocument> oleLoanDocuments = getOleLoanDocuments();
1953 for (Iterator<OleLoanDocument> iterator = oleLoanDocuments.iterator(); iterator.hasNext(); ) {
1954 OleLoanDocument oleLoanDocument = iterator.next();
1955 if (oleLoanDocument.getLoanDueDate() != null) {
1956 Integer timeDiff = new Integer(getTimeDiff(oleLoanDocument.getLoanDueDate(), new Date()));
1957 if (timeDiff > allowedOverDueDays) {
1958 return true;
1959 }
1960 }
1961 }
1962 return false;
1963 }
1964
1965 public Boolean isRecalledAndOverDue(Integer days) {
1966 List<OleLoanDocument> oleLoanDocuments = getOleLoanDocuments();
1967 for (Iterator<OleLoanDocument> iterator = oleLoanDocuments.iterator(); iterator.hasNext(); ) {
1968 OleLoanDocument oleLoanDocument = iterator.next();
1969 if (oleLoanDocument.getLoanDueDate() != null) {
1970 Integer timeDiff = new Integer(getTimeDiff(oleLoanDocument.getLoanDueDate(), new Date()));
1971 if (timeDiff > days && recallRequestExists(oleLoanDocument)) {
1972 return true;
1973 }
1974 }
1975 }
1976 return false;
1977 }
1978
1979 private boolean recallRequestExists(OleLoanDocument oleLoanDocument) {
1980
1981 List<OleDeliverRequestBo> oleDeliverRequestBos = getOleDeliverRequestBos();
1982 for (Iterator<OleDeliverRequestBo> iterator = oleDeliverRequestBos.iterator(); iterator.hasNext(); ) {
1983 OleDeliverRequestBo oleDeliverRequestBo = iterator.next();
1984 if(oleDeliverRequestBo.getOleDeliverRequestType().getRequestTypeCode().equals("Recall") &&
1985 oleDeliverRequestBo.getLoanTransactionRecordNumber().equals(oleLoanDocument.getLoanId())){
1986 return true;
1987
1988 }
1989 }
1990 return false;
1991 }
1992
1993 public String getTimeDiff(Date dateOne, Date dateTwo) {
1994 String diff = "";
1995 long timeDiff = Math.abs(dateOne.getTime() - dateTwo.getTime());
1996 diff = String.format("%d", TimeUnit.MILLISECONDS.toDays(timeDiff),
1997 -TimeUnit.HOURS.toDays(timeDiff));
1998 return diff;
1999 }
2000
2001 public boolean isCheckoutForSelf() {
2002 return checkoutForSelf;
2003 }
2004
2005 public void setCheckoutForSelf(boolean checkoutForSelf) {
2006 this.checkoutForSelf = checkoutForSelf;
2007 }
2008
2009 public List<OlePatronNotes> getOlePatronUserNotes() {
2010 List<OlePatronNotes> olePatronUserNoteList = new ArrayList<>();
2011 if(CollectionUtils.isNotEmpty(this.getNotes())) {
2012 for(OlePatronNotes olePatronNotes : this.getNotes()) {
2013 if(olePatronNotes.getOlePatronNoteType() != null && (OLEConstants.USER).equalsIgnoreCase(olePatronNotes.getOlePatronNoteType().getPatronNoteTypeCode())) {
2014 olePatronUserNoteList.add(olePatronNotes);
2015 }
2016 }
2017 this.olePatronUserNotes = olePatronUserNoteList;
2018 }
2019 return olePatronUserNotes;
2020 }
2021
2022 public void setOlePatronUserNotes(List<OlePatronNotes> olePatronUserNotes) {
2023 this.olePatronUserNotes = olePatronUserNotes;
2024 }
2025
2026 @Override
2027 public List<Collection<PersistableBusinessObject>> buildListOfDeletionAwareLists() {
2028 List managedLists = super.buildListOfDeletionAwareLists();
2029 managedLists.add(getNotes());
2030 return managedLists;
2031 }
2032 }