1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  package org.kuali.ole.fp.businessobject;
18  
19  import java.util.HashMap;
20  import java.util.LinkedHashMap;
21  import java.util.Map;
22  
23  import org.apache.commons.lang.StringUtils;
24  import org.kuali.ole.fp.document.service.DisbursementVoucherPayeeService;
25  import org.kuali.ole.sys.OLEConstants;
26  import org.kuali.ole.sys.OLEPropertyConstants;
27  import org.kuali.ole.sys.context.SpringContext;
28  import org.kuali.ole.vnd.document.service.VendorService;
29  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
30  import org.kuali.rice.krad.service.KualiModuleService;
31  import org.kuali.rice.krad.service.ModuleService;
32  import org.kuali.rice.krad.util.ObjectUtils;
33  import org.kuali.rice.location.api.LocationConstants;
34  import org.kuali.rice.location.framework.country.CountryEbo;
35  import org.kuali.rice.location.framework.postalcode.PostalCodeEbo;
36  import org.kuali.rice.location.framework.state.StateEbo;
37  
38  
39  
40  
41  public class DisbursementVoucherPayeeDetail extends PersistableBusinessObjectBase {
42  
43      private String documentNumber;
44      private String disbVchrPaymentReasonCode;
45  
46      private String disbVchrPayeeIdNumber;
47      private String disbVchrPayeePersonName;
48  
49      private String disbVchrPayeeLine1Addr;
50      private String disbVchrPayeeLine2Addr;
51      private String disbVchrPayeeCityName;
52      private String disbVchrPayeeStateCode;
53      private String disbVchrPayeeZipCode;
54      private String disbVchrPayeeCountryCode;
55  
56      private String disbVchrSpecialHandlingPersonName;
57      private String disbVchrSpecialHandlingLine1Addr;
58      private String disbVchrSpecialHandlingLine2Addr;
59      private String disbVchrSpecialHandlingCityName;
60      private String disbVchrSpecialHandlingStateCode;
61      private String disbVchrSpecialHandlingZipCode;
62      private String disbVchrSpecialHandlingCountryCode;
63  
64      private Boolean dvPayeeSubjectPaymentCode;
65      private Boolean disbVchrAlienPaymentCode;
66      private Boolean disbVchrPayeeEmployeeCode;
67      private Boolean disbVchrEmployeePaidOutsidePayrollCode;
68      private String disbursementVoucherPayeeTypeCode;
69  
70      private PaymentReasonCode disbVchrPaymentReason;
71  
72      
73      private String disbVchrVendorHeaderIdNumber;
74      private String disbVchrVendorDetailAssignedIdNumber;
75      private String disbVchrVendorAddressIdNumber;
76      private boolean hasMultipleVendorAddresses = false;
77      
78      private StateEbo disbVchrPayeeState;
79      private CountryEbo disbVchrPayeeCountry;    
80      private PostalCodeEbo disbVchrPayeePostalZipCode;
81  
82      
83  
84  
85      public DisbursementVoucherPayeeDetail() {
86          super();
87      }
88  
89      
90  
91  
92  
93  
94      public String getDocumentNumber() {
95          return documentNumber;
96      }
97  
98  
99      
100 
101 
102 
103 
104     public void setDocumentNumber(String documentNumber) {
105         this.documentNumber = documentNumber;
106     }
107 
108     
109 
110 
111 
112 
113     public String getDisbVchrPaymentReasonCode() {
114         return disbVchrPaymentReasonCode;
115     }
116 
117 
118     
119 
120 
121 
122 
123     public void setDisbVchrPaymentReasonCode(String disbVchrPaymentReasonCode) {
124         this.disbVchrPaymentReasonCode = disbVchrPaymentReasonCode;
125     }
126 
127     
128 
129 
130 
131 
132     public String getDisbVchrPayeeIdNumber() {
133         return disbVchrPayeeIdNumber;
134     }
135 
136 
137     
138 
139 
140 
141 
142     public void setDisbVchrPayeeIdNumber(String disbVchrPayeeIdNumber) {
143         this.disbVchrPayeeIdNumber = disbVchrPayeeIdNumber;
144         
145         disbVchrVendorHeaderIdNumber = null;
146         disbVchrVendorDetailAssignedIdNumber = null;
147     }
148 
149     
150 
151 
152 
153 
154     public String getDisbVchrVendorHeaderIdNumber() {
155         if (this.isVendor()) {
156             if (StringUtils.isBlank(disbVchrVendorHeaderIdNumber)) {
157                 int dashIndex = disbVchrPayeeIdNumber.indexOf('-');
158                 disbVchrVendorHeaderIdNumber = disbVchrPayeeIdNumber.substring(0, dashIndex);
159             }
160         }
161         else { 
162             return null;
163         }
164         return disbVchrVendorHeaderIdNumber;
165     }
166 
167     
168 
169 
170 
171 
172     public void setDisbVchrVendorHeaderIdNumber(String disbVchrVendorHeaderIdNumber) {
173         if (this.isVendor()) {
174             this.disbVchrVendorHeaderIdNumber = disbVchrVendorHeaderIdNumber;
175         }
176     }
177 
178     
179 
180 
181 
182 
183     public Integer getDisbVchrVendorHeaderIdNumberAsInteger() {
184         if (getDisbVchrVendorHeaderIdNumber() != null)
185             try {
186                 return new Integer(getDisbVchrVendorHeaderIdNumber());
187             }
188             catch (NumberFormatException nfe) {
189                 nfe.printStackTrace();
190             }
191         return null;
192     }
193 
194     
195 
196 
197 
198 
199     public String getDisbVchrVendorDetailAssignedIdNumber() {
200         if (this.isVendor()) {
201             if (StringUtils.isBlank(disbVchrVendorDetailAssignedIdNumber)) {
202                 int dashIndex = disbVchrPayeeIdNumber.indexOf('-');
203                 disbVchrVendorDetailAssignedIdNumber = disbVchrPayeeIdNumber.substring(dashIndex + 1);
204             }
205         }
206         else { 
207             return null;
208         }
209         return disbVchrVendorDetailAssignedIdNumber;
210     }
211 
212     
213 
214 
215 
216 
217     public void setDisbVchrVendorDetailAssignedIdNumber(String disbVchrVendorDetailAssignedIdNumber) {
218         
219         if (this.isVendor()) {
220             this.disbVchrVendorDetailAssignedIdNumber = disbVchrVendorDetailAssignedIdNumber;
221         }
222     }
223 
224     
225 
226 
227 
228 
229     public Integer getDisbVchrVendorDetailAssignedIdNumberAsInteger() {
230         if (getDisbVchrVendorDetailAssignedIdNumber() != null)
231             try {
232                 return new Integer(getDisbVchrVendorDetailAssignedIdNumber());
233             }
234             catch (NumberFormatException nfe) {
235                 nfe.printStackTrace();
236             }
237         return null;
238     }
239 
240     
241 
242 
243 
244 
245 
246 
247     public String getDisbVchrEmployeeIdNumber() {
248         if (this.isEmployee()) {
249             return disbVchrPayeeIdNumber;
250         }
251         else { 
252             return null;
253         }
254     }
255 
256     
257 
258 
259 
260 
261     public String getDisbVchrPayeePersonName() {
262         return disbVchrPayeePersonName;
263     }
264 
265     
266 
267 
268 
269 
270     public void setDisbVchrPayeePersonName(String disbVchrPayeePersonName) {
271         this.disbVchrPayeePersonName = disbVchrPayeePersonName;
272     }
273 
274     
275 
276 
277 
278 
279     public String getDisbVchrPayeeLine1Addr() {
280         return disbVchrPayeeLine1Addr;
281     }
282 
283     
284 
285 
286 
287 
288     public void setDisbVchrPayeeLine1Addr(String disbVchrPayeeLine1Addr) {
289         this.disbVchrPayeeLine1Addr = disbVchrPayeeLine1Addr;
290     }
291 
292     
293 
294 
295 
296 
297     public String getDisbVchrPayeeLine2Addr() {
298         return disbVchrPayeeLine2Addr;
299     }
300 
301     
302 
303 
304 
305 
306     public void setDisbVchrPayeeLine2Addr(String disbVchrPayeeLine2Addr) {
307         this.disbVchrPayeeLine2Addr = disbVchrPayeeLine2Addr;
308     }
309 
310     
311 
312 
313 
314 
315     public String getDisbVchrPayeeCityName() {
316         return disbVchrPayeeCityName;
317     }
318 
319 
320     
321 
322 
323 
324 
325     public void setDisbVchrPayeeCityName(String disbVchrPayeeCityName) {
326         this.disbVchrPayeeCityName = disbVchrPayeeCityName;
327     }
328 
329     
330 
331 
332 
333 
334     public String getDisbVchrPayeeStateCode() {
335         return disbVchrPayeeStateCode;
336     }
337 
338 
339     
340 
341 
342 
343 
344     public void setDisbVchrPayeeStateCode(String disbVchrPayeeStateCode) {
345         this.disbVchrPayeeStateCode = disbVchrPayeeStateCode;
346     }
347 
348     
349 
350 
351 
352 
353     public String getDisbVchrPayeeZipCode() {
354         return disbVchrPayeeZipCode;
355     }
356 
357 
358     
359 
360 
361 
362 
363     public void setDisbVchrPayeeZipCode(String disbVchrPayeeZipCode) {
364         this.disbVchrPayeeZipCode = disbVchrPayeeZipCode;
365     }
366 
367     
368 
369 
370 
371 
372     public String getDisbVchrPayeeCountryCode() {
373         return disbVchrPayeeCountryCode;
374     }
375 
376 
377     
378 
379 
380 
381 
382     public void setDisbVchrPayeeCountryCode(String disbVchrPayeeCountryCode) {
383         this.disbVchrPayeeCountryCode = disbVchrPayeeCountryCode;
384     }
385 
386     
387 
388 
389 
390 
391     public String getDisbVchrSpecialHandlingPersonName() {
392         return disbVchrSpecialHandlingPersonName;
393     }
394 
395 
396     
397 
398 
399 
400 
401     public void setDisbVchrSpecialHandlingPersonName(String disbVchrSpecialHandlingPersonName) {
402         this.disbVchrSpecialHandlingPersonName = disbVchrSpecialHandlingPersonName;
403     }
404 
405     
406 
407 
408 
409 
410     public String getDisbVchrSpecialHandlingLine1Addr() {
411         return disbVchrSpecialHandlingLine1Addr;
412     }
413 
414 
415     
416 
417 
418 
419 
420     public void setDisbVchrSpecialHandlingLine1Addr(String disbVchrSpecialHandlingLine1Addr) {
421         this.disbVchrSpecialHandlingLine1Addr = disbVchrSpecialHandlingLine1Addr;
422     }
423 
424     
425 
426 
427 
428 
429     public String getDisbVchrSpecialHandlingLine2Addr() {
430         return disbVchrSpecialHandlingLine2Addr;
431     }
432 
433 
434     
435 
436 
437 
438 
439     public void setDisbVchrSpecialHandlingLine2Addr(String disbVchrSpecialHandlingLine2Addr) {
440         this.disbVchrSpecialHandlingLine2Addr = disbVchrSpecialHandlingLine2Addr;
441     }
442 
443     
444 
445 
446 
447 
448     public String getDisbVchrSpecialHandlingCityName() {
449         return disbVchrSpecialHandlingCityName;
450     }
451 
452 
453     
454 
455 
456 
457 
458     public void setDisbVchrSpecialHandlingCityName(String disbVchrSpecialHandlingCityName) {
459         this.disbVchrSpecialHandlingCityName = disbVchrSpecialHandlingCityName;
460     }
461 
462     
463 
464 
465 
466 
467     public String getDisbVchrSpecialHandlingStateCode() {
468         return disbVchrSpecialHandlingStateCode;
469     }
470 
471 
472     
473 
474 
475 
476 
477     public void setDisbVchrSpecialHandlingStateCode(String disbVchrSpecialHandlingStateCode) {
478         this.disbVchrSpecialHandlingStateCode = disbVchrSpecialHandlingStateCode;
479     }
480 
481     
482 
483 
484 
485 
486     public String getDisbVchrSpecialHandlingZipCode() {
487         return disbVchrSpecialHandlingZipCode;
488     }
489 
490 
491     
492 
493 
494 
495 
496     public void setDisbVchrSpecialHandlingZipCode(String disbVchrSpecialHandlingZipCode) {
497         this.disbVchrSpecialHandlingZipCode = disbVchrSpecialHandlingZipCode;
498     }
499 
500     
501 
502 
503 
504 
505     public String getDisbVchrSpecialHandlingCountryCode() {
506         return disbVchrSpecialHandlingCountryCode;
507     }
508 
509 
510     
511 
512 
513 
514 
515     public void setDisbVchrSpecialHandlingCountryCode(String disbVchrSpecialHandlingCountryCode) {
516         this.disbVchrSpecialHandlingCountryCode = disbVchrSpecialHandlingCountryCode;
517     }
518 
519     
520 
521 
522 
523 
524     public boolean isDisbVchrPayeeEmployeeCode() {
525         if (ObjectUtils.isNull(disbVchrPayeeEmployeeCode)) {
526             if (this.isEmployee()) {
527                 disbVchrPayeeEmployeeCode = true;
528             }
529             else if (this.isVendor()) {
530                 try {
531                     disbVchrPayeeEmployeeCode = SpringContext.getBean(VendorService.class).isVendorInstitutionEmployee(getDisbVchrVendorHeaderIdNumberAsInteger());
532                     this.setDisbVchrEmployeePaidOutsidePayrollCode(disbVchrPayeeEmployeeCode);
533                 }
534                 catch (Exception ex) {
535                     disbVchrPayeeEmployeeCode = false;
536                     ex.printStackTrace();
537                 }
538             }
539         }
540         return disbVchrPayeeEmployeeCode;
541     }
542 
543 
544     
545 
546 
547 
548 
549     public void setDisbVchrPayeeEmployeeCode(boolean disbVchrPayeeEmployeeCode) {
550         this.disbVchrPayeeEmployeeCode = disbVchrPayeeEmployeeCode;
551     }
552 
553     
554 
555 
556 
557 
558     public boolean isDisbVchrAlienPaymentCode() {
559         if (StringUtils.isNotBlank(this.getDisbVchrEmployeeIdNumber()) && this.isVendor()) {
560             try {
561                 disbVchrAlienPaymentCode = SpringContext.getBean(VendorService.class).isVendorForeign(getDisbVchrVendorHeaderIdNumberAsInteger());
562             }
563             catch (Exception ex) {
564                 disbVchrAlienPaymentCode = false;
565                 ex.printStackTrace();
566             }
567         }
568 
569         return ObjectUtils.isNull(disbVchrAlienPaymentCode) ? false : disbVchrAlienPaymentCode;
570     }
571 
572 
573     
574 
575 
576 
577 
578     public void setDisbVchrAlienPaymentCode(boolean disbVchrAlienPaymentCode) {
579         this.disbVchrAlienPaymentCode = disbVchrAlienPaymentCode;
580     }
581 
582     
583 
584 
585 
586 
587     public boolean isDvPayeeSubjectPaymentCode() {
588         if (ObjectUtils.isNull(dvPayeeSubjectPaymentCode) && (getDisbVchrVendorHeaderIdNumberAsInteger() != null)) {
589             dvPayeeSubjectPaymentCode = SpringContext.getBean(VendorService.class).isSubjectPaymentVendor(getDisbVchrVendorHeaderIdNumberAsInteger());
590         }
591         return dvPayeeSubjectPaymentCode;
592     }
593 
594     
595 
596 
597 
598 
599     public void setDvPayeeSubjectPaymentCode(boolean dvPayeeSubjectPaymentCode) {
600         this.dvPayeeSubjectPaymentCode = dvPayeeSubjectPaymentCode;
601     }
602 
603     
604 
605 
606 
607 
608     public boolean isDisbVchrEmployeePaidOutsidePayrollCode() {
609         return disbVchrEmployeePaidOutsidePayrollCode;
610     }
611 
612     
613 
614 
615 
616 
617     public boolean getDisbVchrEmployeePaidOutsidePayrollCode() {
618         return disbVchrEmployeePaidOutsidePayrollCode;
619     }
620 
621     
622 
623 
624 
625 
626     public void setDisbVchrEmployeePaidOutsidePayrollCode(boolean disbVchrEmployeePaidOutsidePayrollCode) {
627         this.disbVchrEmployeePaidOutsidePayrollCode = disbVchrEmployeePaidOutsidePayrollCode;
628     }
629 
630     
631 
632 
633 
634 
635     public PaymentReasonCode getDisbVchrPaymentReason() {
636         return disbVchrPaymentReason;
637     }
638 
639 
640     
641 
642 
643 
644 
645 
646     public void setDisbVchrPaymentReason(PaymentReasonCode disbVchrPaymentReason) {
647         this.disbVchrPaymentReason = disbVchrPaymentReason;
648     }
649 
650     
651 
652 
653     public String getDisbursementVoucherPayeeTypeCode() {
654         return disbursementVoucherPayeeTypeCode;
655     }
656 
657     
658 
659 
660     public void setDisbursementVoucherPayeeTypeCode(String disbursementVoucherPayeeTypeCode) {
661         this.disbursementVoucherPayeeTypeCode = disbursementVoucherPayeeTypeCode;
662     }
663 
664     
665 
666 
667     public String getDisbursementVoucherPayeeTypeName() {
668         DisbursementVoucherPayeeService payeeService = SpringContext.getBean(DisbursementVoucherPayeeService.class);
669 
670         return payeeService.getPayeeTypeDescription(disbursementVoucherPayeeTypeCode);
671     }
672 
673     
674 
675 
676 
677 
678     public void setDisbursementVoucherPayeeTypeName(String name) {
679     }
680 
681     
682 
683 
684 
685 
686     public String getDisbVchrPaymentReasonName() {
687         this.refreshReferenceObject(OLEPropertyConstants.DISB_VCHR_PAYMENT_REASON);
688         return this.getDisbVchrPaymentReason().getCodeAndDescription();
689     }
690 
691     
692 
693 
694 
695 
696     public void setDisbVchrPaymentReasonName(String name) {
697     }
698 
699     
700 
701 
702 
703 
704     public String getDisbVchrVendorAddressIdNumber() {
705         return disbVchrVendorAddressIdNumber;
706     }
707 
708     
709 
710 
711 
712 
713     public Integer getDisbVchrVendorAddressIdNumberAsInteger() {
714         if (getDisbVchrVendorAddressIdNumber() != null)
715             try {
716                 return new Integer(getDisbVchrVendorAddressIdNumber());
717             }
718             catch (NumberFormatException nfe) {
719                 nfe.printStackTrace();
720             }
721         return null;
722     }
723 
724     
725 
726 
727 
728 
729     public void setDisbVchrVendorAddressIdNumber(String disbVchrVendorAddressIdNumber) {
730         this.disbVchrVendorAddressIdNumber = disbVchrVendorAddressIdNumber;
731     }
732 
733     
734 
735 
736 
737 
738     public Boolean getHasMultipleVendorAddresses() {
739         return hasMultipleVendorAddresses;
740     }
741 
742     
743 
744 
745 
746 
747     public void setHasMultipleVendorAddresses(boolean hasMultipleVendorAddresses) {
748         this.hasMultipleVendorAddresses = hasMultipleVendorAddresses;
749     }
750     
751     
752 
753 
754 
755 
756     public StateEbo getDisbVchrPayeeState() {
757         if ( StringUtils.isBlank(disbVchrPayeeStateCode) || StringUtils.isBlank(OLEConstants.COUNTRY_CODE_UNITED_STATES ) ) {
758             disbVchrPayeeState = null;
759         } else {
760             if ( disbVchrPayeeState == null || !StringUtils.equals( disbVchrPayeeState.getCode(),disbVchrPayeeStateCode) || !StringUtils.equals(disbVchrPayeeState.getCountryCode(), OLEConstants.COUNTRY_CODE_UNITED_STATES ) ) {
761                 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(StateEbo.class);
762                 if ( moduleService != null ) {
763                     Map<String,Object> keys = new HashMap<String, Object>(2);
764                     keys.put(LocationConstants.PrimaryKeyConstants.COUNTRY_CODE, OLEConstants.COUNTRY_CODE_UNITED_STATES);
765                     keys.put(LocationConstants.PrimaryKeyConstants.CODE, disbVchrPayeeStateCode);
766                     disbVchrPayeeState = moduleService.getExternalizableBusinessObject(StateEbo.class, keys);
767                 } else {
768                     throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
769                 }
770             }
771         }
772         
773         return disbVchrPayeeState;
774     }
775 
776     
777 
778 
779 
780     public void setDisbVchrPayeeState(StateEbo disbVchrPayeeState) {
781         this.disbVchrPayeeState = disbVchrPayeeState;
782     }
783 
784     
785 
786 
787 
788 
789     public CountryEbo getDisbVchrPayeeCountry() {
790         if ( StringUtils.isBlank(disbVchrPayeeCountryCode) ) {
791             disbVchrPayeeCountry = null;
792         } else {
793             if ( disbVchrPayeeCountry == null || !StringUtils.equals( disbVchrPayeeCountry.getCode(),disbVchrPayeeCountryCode) ) {
794                 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CountryEbo.class);
795                 if ( moduleService != null ) {
796                     Map<String,Object> keys = new HashMap<String, Object>(1);
797                     keys.put(LocationConstants.PrimaryKeyConstants.CODE, disbVchrPayeeCountryCode);
798                     disbVchrPayeeCountry = moduleService.getExternalizableBusinessObject(CountryEbo.class, keys);
799                 } else {
800                     throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
801                 }
802             }
803         }
804         return disbVchrPayeeCountry;
805     }
806 
807     
808 
809 
810 
811     public void setDisbVchrPayeeCountry(CountryEbo disbVchrPayeeCountry) {
812         this.disbVchrPayeeCountry = disbVchrPayeeCountry;
813     }
814 
815     
816     
817 
818 
819 
820 
821     public PostalCodeEbo getDisbVchrPayeePostalZipCode() {
822         if ( StringUtils.isBlank(disbVchrPayeeZipCode) || StringUtils.isBlank(OLEConstants.COUNTRY_CODE_UNITED_STATES ) ) {
823             disbVchrPayeePostalZipCode = null;
824         } else {
825             if ( disbVchrPayeePostalZipCode == null || !StringUtils.equals( disbVchrPayeePostalZipCode.getCode(), disbVchrPayeeZipCode) || !StringUtils.equals(disbVchrPayeePostalZipCode.getCountryCode(), OLEConstants.COUNTRY_CODE_UNITED_STATES ) ) {
826                 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(PostalCodeEbo.class);
827                 if ( moduleService != null ) {
828                     Map<String,Object> keys = new HashMap<String, Object>(2);
829                     keys.put(LocationConstants.PrimaryKeyConstants.COUNTRY_CODE, OLEConstants.COUNTRY_CODE_UNITED_STATES);
830                     keys.put(LocationConstants.PrimaryKeyConstants.CODE, disbVchrPayeeZipCode);
831                     disbVchrPayeePostalZipCode = moduleService.getExternalizableBusinessObject(PostalCodeEbo.class, keys);
832                 } else {
833                     throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
834                 }
835             }
836         }
837         
838         return disbVchrPayeePostalZipCode;
839     }
840 
841     
842 
843 
844 
845     public void setDisbVchrPayeePostalZipCode(PostalCodeEbo disbVchrPayeePostalZipCode) {
846         this.disbVchrPayeePostalZipCode = disbVchrPayeePostalZipCode;
847     }
848     
849 
850     
851 
852 
853     public boolean isVendor() {
854         return SpringContext.getBean(DisbursementVoucherPayeeService.class).isVendor(this);
855     }
856 
857     
858 
859 
860     public boolean isEmployee() {
861         return SpringContext.getBean(DisbursementVoucherPayeeService.class).isEmployee(this);
862     }
863 
864     
865 
866 
867     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
868         LinkedHashMap m = new LinkedHashMap();
869         m.put(OLEPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
870         return m;
871     }
872 
873     
874 
875 
876 
877 
878 
879     public boolean hasSameAddress(DisbursementVoucherPayeeDetail compareDetail) {
880         boolean isEqual = true;
881 
882         isEqual &= nullSafeEquals(this.getDisbVchrPayeeLine1Addr(), compareDetail.getDisbVchrPayeeLine1Addr());
883         isEqual &= nullSafeEquals(this.getDisbVchrPayeeLine2Addr(), compareDetail.getDisbVchrPayeeLine2Addr());
884         isEqual &= nullSafeEquals(this.getDisbVchrPayeeCityName(), compareDetail.getDisbVchrPayeeCityName());
885         isEqual &= nullSafeEquals(this.getDisbVchrPayeeStateCode(), compareDetail.getDisbVchrPayeeStateCode());
886         isEqual &= nullSafeEquals(this.getDisbVchrPayeeZipCode(), compareDetail.getDisbVchrPayeeZipCode());
887         isEqual &= nullSafeEquals(this.getDisbVchrPayeeCountryCode(), compareDetail.getDisbVchrPayeeCountryCode());
888 
889         return isEqual;
890     }
891 
892     
893 
894 
895 
896 
897 
898 
899 
900     private boolean nullSafeEquals(Object obj1, Object obj2) {
901         if (obj1 != null && obj2 != null) {
902             return obj1.equals(obj2);
903         }
904         else {
905             return (obj1 == obj2);
906         }
907     }
908     
909     
910 
911 
912 
913 
914     public String getAddressAsString() {
915         StringBuffer address = new StringBuffer();
916 
917         address.append(this.getDisbVchrPayeeLine1Addr()).append(", ");
918         address.append(this.getDisbVchrPayeeLine2Addr()).append(", ");
919         address.append(this.getDisbVchrPayeeCityName()).append(", ");
920         address.append(this.getDisbVchrPayeeStateCode()).append(" ");
921         address.append(this.getDisbVchrPayeeZipCode()).append(", ");
922         address.append(this.getDisbVchrPayeeCountryCode());
923 
924         return address.toString();
925     }
926 }