001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.kuali.kfs.fp.businessobject;
018
019 import java.util.LinkedHashMap;
020
021 import org.apache.commons.lang.StringUtils;
022 import org.kuali.kfs.fp.document.service.DisbursementVoucherPayeeService;
023 import org.kuali.kfs.sys.KFSPropertyConstants;
024 import org.kuali.kfs.sys.context.SpringContext;
025 import org.kuali.kfs.vnd.document.service.VendorService;
026 import org.kuali.rice.kns.bo.Country;
027 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
028 import org.kuali.rice.kns.bo.PostalCode;
029 import org.kuali.rice.kns.bo.State;
030 import org.kuali.rice.kns.service.CountryService;
031 import org.kuali.rice.kns.service.PostalCodeService;
032 import org.kuali.rice.kns.service.StateService;
033 import org.kuali.rice.kns.util.ObjectUtils;
034
035 /**
036 * This class is used to represent a disbursement voucher payee detail.
037 */
038 public class DisbursementVoucherPayeeDetail extends PersistableBusinessObjectBase {
039
040 private String documentNumber;
041 private String disbVchrPaymentReasonCode;
042
043 private String disbVchrPayeeIdNumber;
044 private String disbVchrPayeePersonName;
045
046 private String disbVchrPayeeLine1Addr;
047 private String disbVchrPayeeLine2Addr;
048 private String disbVchrPayeeCityName;
049 private String disbVchrPayeeStateCode;
050 private String disbVchrPayeeZipCode;
051 private String disbVchrPayeeCountryCode;
052
053 private String disbVchrSpecialHandlingPersonName;
054 private String disbVchrSpecialHandlingLine1Addr;
055 private String disbVchrSpecialHandlingLine2Addr;
056 private String disbVchrSpecialHandlingCityName;
057 private String disbVchrSpecialHandlingStateCode;
058 private String disbVchrSpecialHandlingZipCode;
059 private String disbVchrSpecialHandlingCountryCode;
060
061 private Boolean dvPayeeSubjectPaymentCode;
062 private Boolean disbVchrAlienPaymentCode;
063 private Boolean disbVchrPayeeEmployeeCode;
064 private Boolean disbVchrEmployeePaidOutsidePayrollCode;
065 private String disbursementVoucherPayeeTypeCode;
066
067 private PaymentReasonCode disbVchrPaymentReason;
068
069 // The following vendor-associated attributes are for convenience only and are not mapped to OJB or the DB.
070 private String disbVchrVendorHeaderIdNumber;
071 private String disbVchrVendorDetailAssignedIdNumber;
072 private String disbVchrVendorAddressIdNumber;
073 private boolean hasMultipleVendorAddresses = false;
074
075 // The following universal user-associated attributes are for convenience only and are not mapped to OJB or the the DB.
076 private String disbVchrEmployeeIdNumber;
077
078 private State disbVchrPayeeState;
079 private Country disbVchrPayeeCountry;
080 private PostalCode disbVchrPayeePostalZipCode;
081
082 /**
083 * Default no-arg constructor.
084 */
085 public DisbursementVoucherPayeeDetail() {
086 super();
087 }
088
089 /**
090 * Gets the documentNumber attribute.
091 *
092 * @return Returns the documentNumber
093 */
094 public String getDocumentNumber() {
095 return documentNumber;
096 }
097
098
099 /**
100 * Sets the documentNumber attribute.
101 *
102 * @param documentNumber The documentNumber to set.
103 */
104 public void setDocumentNumber(String documentNumber) {
105 this.documentNumber = documentNumber;
106 }
107
108 /**
109 * Gets the disbVchrPaymentReasonCode attribute.
110 *
111 * @return Returns the disbVchrPaymentReasonCode
112 */
113 public String getDisbVchrPaymentReasonCode() {
114 return disbVchrPaymentReasonCode;
115 }
116
117
118 /**
119 * Sets the disbVchrPaymentReasonCode attribute.
120 *
121 * @param disbVchrPaymentReasonCode The disbVchrPaymentReasonCode to set.
122 */
123 public void setDisbVchrPaymentReasonCode(String disbVchrPaymentReasonCode) {
124 this.disbVchrPaymentReasonCode = disbVchrPaymentReasonCode;
125 }
126
127 /**
128 * Gets the disbVchrPayeeIdNumber attribute.
129 *
130 * @return Returns the disbVchrVendorIdNumber
131 */
132 public String getDisbVchrPayeeIdNumber() {
133 return disbVchrPayeeIdNumber;
134 }
135
136
137 /**
138 * Sets the disbVchrPayeeIdNumber attribute.
139 *
140 * @param disbVchrPayeeIdNumber The disbVchrPayeeIdNumber to set.
141 */
142 public void setDisbVchrPayeeIdNumber(String disbVchrPayeeIdNumber) {
143 this.disbVchrPayeeIdNumber = disbVchrPayeeIdNumber;
144 // KFSMI-5976 : Blanking out these fields so they are re-derived upon next access
145 disbVchrVendorHeaderIdNumber = null;
146 disbVchrVendorDetailAssignedIdNumber = null;
147 }
148
149 /**
150 * This method...
151 *
152 * @return
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 { // Return null if payee is not a vendor
162 return null;
163 }
164 return disbVchrVendorHeaderIdNumber;
165 }
166
167 /**
168 * This method...
169 *
170 * @param disbVchrVendorheaderIdNumber
171 */
172 public void setDisbVchrVendorHeaderIdNumber(String disbVchrVendorHeaderIdNumber) {
173 if (this.isVendor()) {
174 this.disbVchrVendorHeaderIdNumber = disbVchrVendorHeaderIdNumber;
175 }
176 }
177
178 /**
179 * Gets the disbVchrVendorIdNumber attribute as an Integer.
180 *
181 * @return Returns the disbVchrVendorIdNumber in Integer form. This is the format used on the VendorDetail.
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 * This method...
196 *
197 * @return
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 { // Return null if payee is not a vendor
207 return null;
208 }
209 return disbVchrVendorDetailAssignedIdNumber;
210 }
211
212 /**
213 * This method...
214 *
215 * @param disbVchrVendorDetailAssignedIdNumber
216 */
217 public void setDisbVchrVendorDetailAssignedIdNumber(String disbVchrVendorDetailAssignedIdNumber) {
218 // This field should only be set if the payee type is "V", otherwise, ignore any calls
219 if (this.isVendor()) {
220 this.disbVchrVendorDetailAssignedIdNumber = disbVchrVendorDetailAssignedIdNumber;
221 }
222 }
223
224 /**
225 * This method...
226 *
227 * @return
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 * This method should only be called for retrieving the id associated with the payee if the payee type is equal to "E".
242 * Otherwise, this method will return null.
243 *
244 * @return The id of the universal user set as the payee on the DV, if the payee type code indicates the payee is an employee.
245 * Otherwise, this method will return null.
246 */
247 public String getDisbVchrEmployeeIdNumber() {
248 if (this.isEmployee()) {
249 if (StringUtils.isBlank(disbVchrEmployeeIdNumber)) {
250 disbVchrEmployeeIdNumber = disbVchrPayeeIdNumber;
251 }
252 }
253 else { // Return null if payee is not a employee
254 return null;
255 }
256 return disbVchrEmployeeIdNumber;
257 }
258
259 /**
260 * This method...
261 *
262 * @param disbVchrPersonIdNumber
263 */
264 public void setDisbVchrEmployeeIdNumber(String disbVchrEmployeeIdNumber) {
265 // This field should only be set if the payee type is "E", otherwise, ignore any calls
266 if (this.isEmployee()) {
267 this.disbVchrEmployeeIdNumber = disbVchrEmployeeIdNumber;
268 }
269 }
270
271 /**
272 * Gets the disbVchrPayeePersonName attribute.
273 *
274 * @return Returns the disbVchrPayeePersonName
275 */
276 public String getDisbVchrPayeePersonName() {
277 return disbVchrPayeePersonName;
278 }
279
280 /**
281 * Sets the disbVchrPayeePersonName attribute.
282 *
283 * @param disbVchrPayeePersonName The disbVchrPayeePersonName to set.
284 */
285 public void setDisbVchrPayeePersonName(String disbVchrPayeePersonName) {
286 this.disbVchrPayeePersonName = disbVchrPayeePersonName;
287 }
288
289 /**
290 * Gets the disbVchrPayeeLine1Addr attribute.
291 *
292 * @return Returns the disbVchrPayeeLine1Addr
293 */
294 public String getDisbVchrPayeeLine1Addr() {
295 return disbVchrPayeeLine1Addr;
296 }
297
298 /**
299 * Sets the disbVchrPayeeLine1Addr attribute.
300 *
301 * @param disbVchrPayeeLine1Addr The disbVchrPayeeLine1Addr to set.
302 */
303 public void setDisbVchrPayeeLine1Addr(String disbVchrPayeeLine1Addr) {
304 this.disbVchrPayeeLine1Addr = disbVchrPayeeLine1Addr;
305 }
306
307 /**
308 * Gets the disbVchrPayeeLine2Addr attribute.
309 *
310 * @return Returns the disbVchrPayeeLine2Addr
311 */
312 public String getDisbVchrPayeeLine2Addr() {
313 return disbVchrPayeeLine2Addr;
314 }
315
316 /**
317 * Sets the disbVchrPayeeLine2Addr attribute.
318 *
319 * @param disbVchrPayeeLine2Addr The disbVchrPayeeLine2Addr to set.
320 */
321 public void setDisbVchrPayeeLine2Addr(String disbVchrPayeeLine2Addr) {
322 this.disbVchrPayeeLine2Addr = disbVchrPayeeLine2Addr;
323 }
324
325 /**
326 * Gets the disbVchrPayeeCityName attribute.
327 *
328 * @return Returns the disbVchrPayeeCityName
329 */
330 public String getDisbVchrPayeeCityName() {
331 return disbVchrPayeeCityName;
332 }
333
334
335 /**
336 * Sets the disbVchrPayeeCityName attribute.
337 *
338 * @param disbVchrPayeeCityName The disbVchrPayeeCityName to set.
339 */
340 public void setDisbVchrPayeeCityName(String disbVchrPayeeCityName) {
341 this.disbVchrPayeeCityName = disbVchrPayeeCityName;
342 }
343
344 /**
345 * Gets the disbVchrPayeeStateCode attribute.
346 *
347 * @return Returns the disbVchrPayeeStateCode
348 */
349 public String getDisbVchrPayeeStateCode() {
350 return disbVchrPayeeStateCode;
351 }
352
353
354 /**
355 * Sets the disbVchrPayeeStateCode attribute.
356 *
357 * @param disbVchrPayeeStateCode The disbVchrPayeeStateCode to set.
358 */
359 public void setDisbVchrPayeeStateCode(String disbVchrPayeeStateCode) {
360 this.disbVchrPayeeStateCode = disbVchrPayeeStateCode;
361 }
362
363 /**
364 * Gets the disbVchrPayeeZipCode attribute.
365 *
366 * @return Returns the disbVchrPayeeZipCode
367 */
368 public String getDisbVchrPayeeZipCode() {
369 return disbVchrPayeeZipCode;
370 }
371
372
373 /**
374 * Sets the disbVchrPayeeZipCode attribute.
375 *
376 * @param disbVchrPayeeZipCode The disbVchrPayeeZipCode to set.
377 */
378 public void setDisbVchrPayeeZipCode(String disbVchrPayeeZipCode) {
379 this.disbVchrPayeeZipCode = disbVchrPayeeZipCode;
380 }
381
382 /**
383 * Gets the disbVchrPayeeCountryCode attribute.
384 *
385 * @return Returns the disbVchrPayeeCountryCode
386 */
387 public String getDisbVchrPayeeCountryCode() {
388 return disbVchrPayeeCountryCode;
389 }
390
391
392 /**
393 * Sets the disbVchrPayeeCountryCode attribute.
394 *
395 * @param disbVchrPayeeCountryCode The disbVchrPayeeCountryCode to set.
396 */
397 public void setDisbVchrPayeeCountryCode(String disbVchrPayeeCountryCode) {
398 this.disbVchrPayeeCountryCode = disbVchrPayeeCountryCode;
399 }
400
401 /**
402 * Gets the disbVchrSpecialHandlingPersonName attribute.
403 *
404 * @return Returns the disbVchrSpecialHandlingPersonName
405 */
406 public String getDisbVchrSpecialHandlingPersonName() {
407 return disbVchrSpecialHandlingPersonName;
408 }
409
410
411 /**
412 * Sets the disbVchrSpecialHandlingPersonName attribute.
413 *
414 * @param disbVchrSpecialHandlingPersonName The disbVchrSpecialHandlingPersonName to set.
415 */
416 public void setDisbVchrSpecialHandlingPersonName(String disbVchrSpecialHandlingPersonName) {
417 this.disbVchrSpecialHandlingPersonName = disbVchrSpecialHandlingPersonName;
418 }
419
420 /**
421 * Gets the disbVchrSpecialHandlingLine1Addr attribute.
422 *
423 * @return Returns the disbVchrSpecialHandlingLine1Addr
424 */
425 public String getDisbVchrSpecialHandlingLine1Addr() {
426 return disbVchrSpecialHandlingLine1Addr;
427 }
428
429
430 /**
431 * Sets the disbVchrSpecialHandlingLine1Addr attribute.
432 *
433 * @param disbVchrSpecialHandlingLine1Addr The disbVchrSpecialHandlingLine1Addr to set.
434 */
435 public void setDisbVchrSpecialHandlingLine1Addr(String disbVchrSpecialHandlingLine1Addr) {
436 this.disbVchrSpecialHandlingLine1Addr = disbVchrSpecialHandlingLine1Addr;
437 }
438
439 /**
440 * Gets the disbVchrSpecialHandlingLine2Addr attribute.
441 *
442 * @return Returns the disbVchrSpecialHandlingLine2Addr
443 */
444 public String getDisbVchrSpecialHandlingLine2Addr() {
445 return disbVchrSpecialHandlingLine2Addr;
446 }
447
448
449 /**
450 * Sets the disbVchrSpecialHandlingLine2Addr attribute.
451 *
452 * @param disbVchrSpecialHandlingLine2Addr The disbVchrSpecialHandlingLine2Addr to set.
453 */
454 public void setDisbVchrSpecialHandlingLine2Addr(String disbVchrSpecialHandlingLine2Addr) {
455 this.disbVchrSpecialHandlingLine2Addr = disbVchrSpecialHandlingLine2Addr;
456 }
457
458 /**
459 * Gets the disbVchrSpecialHandlingCityName attribute.
460 *
461 * @return Returns the disbVchrSpecialHandlingCityName
462 */
463 public String getDisbVchrSpecialHandlingCityName() {
464 return disbVchrSpecialHandlingCityName;
465 }
466
467
468 /**
469 * Sets the disbVchrSpecialHandlingCityName attribute.
470 *
471 * @param disbVchrSpecialHandlingCityName The disbVchrSpecialHandlingCityName to set.
472 */
473 public void setDisbVchrSpecialHandlingCityName(String disbVchrSpecialHandlingCityName) {
474 this.disbVchrSpecialHandlingCityName = disbVchrSpecialHandlingCityName;
475 }
476
477 /**
478 * Gets the disbVchrSpecialHandlingStateCode attribute.
479 *
480 * @return Returns the disbVchrSpecialHandlingStateCode
481 */
482 public String getDisbVchrSpecialHandlingStateCode() {
483 return disbVchrSpecialHandlingStateCode;
484 }
485
486
487 /**
488 * Sets the disbVchrSpecialHandlingStateCode attribute.
489 *
490 * @param disbVchrSpecialHandlingStateCode The disbVchrSpecialHandlingStateCode to set.
491 */
492 public void setDisbVchrSpecialHandlingStateCode(String disbVchrSpecialHandlingStateCode) {
493 this.disbVchrSpecialHandlingStateCode = disbVchrSpecialHandlingStateCode;
494 }
495
496 /**
497 * Gets the disbVchrSpecialHandlingZipCode attribute.
498 *
499 * @return Returns the disbVchrSpecialHandlingZipCode
500 */
501 public String getDisbVchrSpecialHandlingZipCode() {
502 return disbVchrSpecialHandlingZipCode;
503 }
504
505
506 /**
507 * Sets the disbVchrSpecialHandlingZipCode attribute.
508 *
509 * @param disbVchrSpecialHandlingZipCode The disbVchrSpecialHandlingZipCode to set.
510 */
511 public void setDisbVchrSpecialHandlingZipCode(String disbVchrSpecialHandlingZipCode) {
512 this.disbVchrSpecialHandlingZipCode = disbVchrSpecialHandlingZipCode;
513 }
514
515 /**
516 * Gets the disbVchrSpecialHandlingCountryCode attribute.
517 *
518 * @return Returns the disbVchrSpecialHandlingCountryCode
519 */
520 public String getDisbVchrSpecialHandlingCountryCode() {
521 return disbVchrSpecialHandlingCountryCode;
522 }
523
524
525 /**
526 * Sets the disbVchrSpecialHandlingCountryCode attribute.
527 *
528 * @param disbVchrSpecialHandlingCountryCode The disbVchrSpecialHandlingCountryCode to set.
529 */
530 public void setDisbVchrSpecialHandlingCountryCode(String disbVchrSpecialHandlingCountryCode) {
531 this.disbVchrSpecialHandlingCountryCode = disbVchrSpecialHandlingCountryCode;
532 }
533
534 /**
535 * Gets the disbVchrPayeeEmployeeCode attribute.
536 *
537 * @return Returns true if the vendor associated with this DV is an employee of the institution.
538 */
539 public boolean isDisbVchrPayeeEmployeeCode() {
540 if (ObjectUtils.isNull(disbVchrPayeeEmployeeCode)) {
541 if (this.isEmployee()) {
542 disbVchrPayeeEmployeeCode = true;
543 }
544 else if (this.isVendor()) {
545 try {
546 disbVchrPayeeEmployeeCode = SpringContext.getBean(VendorService.class).isVendorInstitutionEmployee(getDisbVchrVendorHeaderIdNumberAsInteger());
547 this.setDisbVchrEmployeePaidOutsidePayrollCode(disbVchrPayeeEmployeeCode);
548 }
549 catch (Exception ex) {
550 disbVchrPayeeEmployeeCode = false;
551 ex.printStackTrace();
552 }
553 }
554 }
555 return disbVchrPayeeEmployeeCode;
556 }
557
558
559 /**
560 * Sets the disbVchrPayeeEmployeeCode attribute.
561 *
562 * @param disbVchrPayeeEmployeeCode The disbVchrPayeeEmployeeCode to set.
563 */
564 public void setDisbVchrPayeeEmployeeCode(boolean disbVchrPayeeEmployeeCode) {
565 this.disbVchrPayeeEmployeeCode = disbVchrPayeeEmployeeCode;
566 }
567
568 /**
569 * Gets the disbVchrAlienPaymentCode attribute.
570 *
571 * @return Returns the disbVchrAlienPaymentCode
572 */
573 public boolean isDisbVchrAlienPaymentCode() {
574 if (StringUtils.isNotBlank(this.getDisbVchrEmployeeIdNumber()) && this.isVendor()) {
575 try {
576 disbVchrAlienPaymentCode = SpringContext.getBean(VendorService.class).isVendorForeign(getDisbVchrVendorHeaderIdNumberAsInteger());
577 }
578 catch (Exception ex) {
579 disbVchrAlienPaymentCode = false;
580 ex.printStackTrace();
581 }
582 }
583
584 return ObjectUtils.isNull(disbVchrAlienPaymentCode) ? false : disbVchrAlienPaymentCode;
585 }
586
587
588 /**
589 * Sets the disbVchrAlienPaymentCode attribute.
590 *
591 * @param disbVchrAlienPaymentCode The disbVchrAlienPaymentCode to set.
592 */
593 public void setDisbVchrAlienPaymentCode(boolean disbVchrAlienPaymentCode) {
594 this.disbVchrAlienPaymentCode = disbVchrAlienPaymentCode;
595 }
596
597 /**
598 * Gets the dvPayeeSubjectPayment attribute.
599 *
600 * @return Returns the dvPayeeSubjectPayment
601 */
602 public boolean isDvPayeeSubjectPaymentCode() {
603 if (ObjectUtils.isNull(dvPayeeSubjectPaymentCode)) {
604 dvPayeeSubjectPaymentCode = SpringContext.getBean(VendorService.class).isSubjectPaymentVendor(getDisbVchrVendorHeaderIdNumberAsInteger());
605 }
606 return dvPayeeSubjectPaymentCode;
607 }
608
609 /**
610 * Sets the dvPayeeSubjectPayment attribute.
611 *
612 * @param dvPayeeSubjectPayment The dvPayeeSubjectPayment to set.
613 */
614 public void setDvPayeeSubjectPaymentCode(boolean dvPayeeSubjectPaymentCode) {
615 this.dvPayeeSubjectPaymentCode = dvPayeeSubjectPaymentCode;
616 }
617
618 /**
619 * Gets the disbVchrEmployeePaidOutsidePayrollCode attribute.
620 *
621 * @return Returns the disbVchrEmployeePaidOutsidePayrollCode.
622 */
623 public boolean isDisbVchrEmployeePaidOutsidePayrollCode() {
624 return disbVchrEmployeePaidOutsidePayrollCode;
625 }
626
627 /**
628 * Gets the disbVchrEmployeePaidOutsidePayrollCode attribute.
629 *
630 * @return Returns the disbVchrEmployeePaidOutsidePayrollCode.
631 */
632 public boolean getDisbVchrEmployeePaidOutsidePayrollCode() {
633 return disbVchrEmployeePaidOutsidePayrollCode;
634 }
635
636 /**
637 * Sets the disbVchrEmployeePaidOutsidePayrollCode attribute value.
638 *
639 * @param disbVchrEmployeePaidOutsidePayrollCode The disbVchrEmployeePaidOutsidePayrollCode to set.
640 */
641 public void setDisbVchrEmployeePaidOutsidePayrollCode(boolean disbVchrEmployeePaidOutsidePayrollCode) {
642 this.disbVchrEmployeePaidOutsidePayrollCode = disbVchrEmployeePaidOutsidePayrollCode;
643 }
644
645 /**
646 * Gets the disbVchrPaymentReason attribute.
647 *
648 * @return Returns the disbVchrPaymentReason
649 */
650 public PaymentReasonCode getDisbVchrPaymentReason() {
651 return disbVchrPaymentReason;
652 }
653
654
655 /**
656 * Sets the disbVchrPaymentReason attribute.
657 *
658 * @param disbVchrPaymentReason The disbVchrPaymentReason to set.
659 * @deprecated
660 */
661 public void setDisbVchrPaymentReason(PaymentReasonCode disbVchrPaymentReason) {
662 this.disbVchrPaymentReason = disbVchrPaymentReason;
663 }
664
665 /**
666 * @return Returns the disbursementVoucherPayeeTypeCode.
667 */
668 public String getDisbursementVoucherPayeeTypeCode() {
669 return disbursementVoucherPayeeTypeCode;
670 }
671
672 /**
673 * @param disbursementVoucherPayeeTypeCode The disbursementVoucherPayeeTypeCode to set.
674 */
675 public void setDisbursementVoucherPayeeTypeCode(String disbursementVoucherPayeeTypeCode) {
676 this.disbursementVoucherPayeeTypeCode = disbursementVoucherPayeeTypeCode;
677 }
678
679 /**
680 * @return Returns the payee type name
681 */
682 public String getDisbursementVoucherPayeeTypeName() {
683 DisbursementVoucherPayeeService payeeService = SpringContext.getBean(DisbursementVoucherPayeeService.class);
684
685 return payeeService.getPayeeTypeDescription(disbursementVoucherPayeeTypeCode);
686 }
687
688 /**
689 * This method is a dummy method defined for OJB.
690 *
691 * @param name
692 */
693 public void setDisbursementVoucherPayeeTypeName(String name) {
694 }
695
696 /**
697 * Returns the name associated with the payment reason name
698 *
699 * @return
700 */
701 public String getDisbVchrPaymentReasonName() {
702 this.refreshReferenceObject(KFSPropertyConstants.DISB_VCHR_PAYMENT_REASON);
703 return this.getDisbVchrPaymentReason().getCodeAndDescription();
704 }
705
706 /**
707 * This method is a dummy method defined for OJB.
708 *
709 * @param name
710 */
711 public void setDisbVchrPaymentReasonName(String name) {
712 }
713
714 /**
715 * Gets the disbVchrVendorAddressIdNumber attribute.
716 *
717 * @return Returns the disbVchrVendorAddressIdNumber.
718 */
719 public String getDisbVchrVendorAddressIdNumber() {
720 return disbVchrVendorAddressIdNumber;
721 }
722
723 /**
724 * Gets the disbVchrVendorAddressIdNumber attribute.
725 *
726 * @return Returns the disbVchrVendorAddressIdNumber.
727 */
728 public Integer getDisbVchrVendorAddressIdNumberAsInteger() {
729 if (getDisbVchrVendorAddressIdNumber() != null)
730 try {
731 return new Integer(getDisbVchrVendorAddressIdNumber());
732 }
733 catch (NumberFormatException nfe) {
734 nfe.printStackTrace();
735 }
736 return null;
737 }
738
739 /**
740 * Sets the disbVchrVendorAddressIdNumber attribute value.
741 *
742 * @param disbVchrVendorAddressIdNumber The disbVchrVendorAddressIdNumber to set.
743 */
744 public void setDisbVchrVendorAddressIdNumber(String disbVchrVendorAddressIdNumber) {
745 this.disbVchrVendorAddressIdNumber = disbVchrVendorAddressIdNumber;
746 }
747
748 /**
749 * Gets the hasMultipleVendorAddresses attribute.
750 *
751 * @return Returns the hasMultipleVendorAddresses.
752 */
753 public Boolean getHasMultipleVendorAddresses() {
754 return hasMultipleVendorAddresses;
755 }
756
757 /**
758 * Sets the hasMultipleVendorAddresses attribute value.
759 *
760 * @param hasMultipleVendorAddresses The hasMultipleVendorAddresses to set.
761 */
762 public void setHasMultipleVendorAddresses(boolean hasMultipleVendorAddresses) {
763 this.hasMultipleVendorAddresses = hasMultipleVendorAddresses;
764 }
765
766 /**
767 * Gets the disbVchrPayeeState attribute.
768 * @return Returns the disbVchrPayeeState.
769 */
770 public State getDisbVchrPayeeState() {
771 disbVchrPayeeState = SpringContext.getBean(StateService.class).getByPrimaryIdIfNecessary( disbVchrPayeeCountryCode, disbVchrPayeeStateCode, disbVchrPayeeState);
772 return disbVchrPayeeState;
773 }
774
775 /**
776 * Sets the disbVchrPayeeState attribute value.
777 * @param disbVchrPayeeState The disbVchrPayeeState to set.
778 */
779 public void setDisbVchrPayeeState(State disbVchrPayeeState) {
780 this.disbVchrPayeeState = disbVchrPayeeState;
781 }
782
783 /**
784 * Gets the disbVchrPayeeCountry attribute.
785 * @return Returns the disbVchrPayeeCountry.
786 */
787 public Country getDisbVchrPayeeCountry() {
788 disbVchrPayeeCountry = SpringContext.getBean(CountryService.class).getByPrimaryIdIfNecessary(disbVchrPayeeCountryCode, disbVchrPayeeCountry);
789 return disbVchrPayeeCountry;
790 }
791
792 /**
793 * Sets the disbVchrPayeeCountry attribute value.
794 * @param disbVchrPayeeCountry The disbVchrPayeeCountry to set.
795 */
796 public void setDisbVchrPayeeCountry(Country disbVchrPayeeCountry) {
797 this.disbVchrPayeeCountry = disbVchrPayeeCountry;
798 }
799
800 /**
801 * Gets the disbVchrPayeePostalZipCode attribute.
802 * @return Returns the disbVchrPayeePostalZipCode.
803 */
804 public PostalCode getDisbVchrPayeePostalZipCode() {
805 disbVchrPayeePostalZipCode = SpringContext.getBean(PostalCodeService.class).getByPrimaryIdIfNecessary(disbVchrPayeeCountryCode, disbVchrPayeeZipCode, disbVchrPayeePostalZipCode);
806 return disbVchrPayeePostalZipCode;
807 }
808
809 /**
810 * Sets the disbVchrPayeePostalZipCode attribute value.
811 * @param disbVchrPayeePostalZipCode The disbVchrPayeePostalZipCode to set.
812 */
813 public void setDisbVchrPayeePostalZipCode(PostalCode disbVchrPayeePostalZipCode) {
814 this.disbVchrPayeePostalZipCode = disbVchrPayeePostalZipCode;
815 }
816
817
818 /**
819 * Checks the payee type code for vendor type
820 */
821 public boolean isVendor() {
822 return SpringContext.getBean(DisbursementVoucherPayeeService.class).isVendor(this);
823 }
824
825 /**
826 * Checks the payee type code for employee type
827 */
828 public boolean isEmployee() {
829 return SpringContext.getBean(DisbursementVoucherPayeeService.class).isEmployee(this);
830 }
831
832 /**
833 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
834 */
835 protected LinkedHashMap toStringMapper() {
836 LinkedHashMap m = new LinkedHashMap();
837 m.put(KFSPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
838 return m;
839 }
840
841 /**
842 * This method...
843 *
844 * @param compareDetail
845 * @return
846 */
847 public boolean hasSameAddress(DisbursementVoucherPayeeDetail compareDetail) {
848 boolean isEqual = true;
849
850 isEqual &= ObjectUtils.nullSafeEquals(this.getDisbVchrPayeeLine1Addr(), compareDetail.getDisbVchrPayeeLine1Addr());
851 isEqual &= ObjectUtils.nullSafeEquals(this.getDisbVchrPayeeLine2Addr(), compareDetail.getDisbVchrPayeeLine2Addr());
852 isEqual &= ObjectUtils.nullSafeEquals(this.getDisbVchrPayeeCityName(), compareDetail.getDisbVchrPayeeCityName());
853 isEqual &= ObjectUtils.nullSafeEquals(this.getDisbVchrPayeeStateCode(), compareDetail.getDisbVchrPayeeStateCode());
854 isEqual &= ObjectUtils.nullSafeEquals(this.getDisbVchrPayeeZipCode(), compareDetail.getDisbVchrPayeeZipCode());
855 isEqual &= ObjectUtils.nullSafeEquals(this.getDisbVchrPayeeCountryCode(), compareDetail.getDisbVchrPayeeCountryCode());
856
857 return isEqual;
858 }
859
860 /**
861 * This method creates a string representation of the address assigned to this payee.
862 *
863 * @return
864 */
865 public String getAddressAsString() {
866 StringBuffer address = new StringBuffer();
867
868 address.append(this.getDisbVchrPayeeLine1Addr()).append(", ");
869 address.append(this.getDisbVchrPayeeLine2Addr()).append(", ");
870 address.append(this.getDisbVchrPayeeCityName()).append(", ");
871 address.append(this.getDisbVchrPayeeStateCode()).append(" ");
872 address.append(this.getDisbVchrPayeeZipCode()).append(", ");
873 address.append(this.getDisbVchrPayeeCountryCode());
874
875 return address.toString();
876 }
877 }