View Javadoc
1   /*
2    * Copyright 2007 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.kuali.ole.vnd.businessobject;
18  
19  import java.sql.Date;
20  import java.util.ArrayList;
21  import java.util.HashMap;
22  import java.util.LinkedHashMap;
23  import java.util.List;
24  import java.util.Map;
25  
26  import org.apache.commons.lang.StringUtils;
27  import org.apache.commons.lang.builder.EqualsBuilder;
28  import org.apache.log4j.Logger;
29  import org.kuali.ole.select.businessobject.OlePaymentMethod;
30  import org.kuali.ole.sys.context.SpringContext;
31  import org.kuali.ole.vnd.VendorPropertyConstants;
32  import org.kuali.rice.core.api.util.type.KualiDecimal;
33  import org.kuali.rice.kim.api.identity.Person;
34  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
35  import org.kuali.rice.krad.service.LookupService;
36  import org.kuali.rice.krad.util.ObjectUtils;
37  
38  /**
39   * Contains all data for a specific parent or division Vendor, including a link to the <code>VendorHeader</code>, which only
40   * contains information about the parent company, but can be shared between division Vendors.
41   *
42   * @see org.kuali.ole.vnd.businessobject.VendorHeader
43   */
44  public class VendorDetail extends PersistableBusinessObjectBase implements VendorRoutingComparable {
45      private static Logger LOG = Logger.getLogger(VendorDetail.class);
46  
47      private Integer vendorHeaderGeneratedIdentifier;
48      private Integer vendorDetailAssignedIdentifier;
49      private String vendorNumber; // not persisted in the db
50      private boolean vendorParentIndicator;
51      private String vendorCurrency;
52      private String vendorName;
53      private String vendorFirstName; // not persisted in the db
54      private String vendorLastName; // not persisted in the db
55      private String vendorStateForLookup; // not persisted in the db
56  
57      private boolean activeIndicator;
58      private String vendorInactiveReasonCode;
59      private String vendorDunsNumber;
60      private String vendorPaymentTermsCode;
61      private Integer paymentMethodId;
62      private Long currencyTypeId;
63    //  private String currencyType;
64      private String vendorShippingTitleCode;
65      private String vendorShippingPaymentTermsCode;
66      private Boolean vendorConfirmationIndicator;
67      private Boolean vendorPrepaymentIndicator;
68      private Boolean vendorCreditCardIndicator;
69      private KualiDecimal vendorMinimumOrderAmount;
70      private String vendorUrlAddress;
71      private String vendorRemitName;
72      private Boolean vendorRestrictedIndicator;
73      private String vendorRestrictedReasonText;
74      private Date vendorRestrictedDate;
75      private String vendorRestrictedPersonIdentifier;
76      private String vendorSoldToNumber; // not persisted in the db
77      private Integer vendorSoldToGeneratedIdentifier;
78      private Integer vendorSoldToAssignedIdentifier;
79      private String vendorSoldToName;
80      private boolean vendorFirstLastNameIndicator;
81      private boolean taxableIndicator;
82  
83      private List<VendorTransmissionFormatDetail> vendorTransmissionFormat;
84      private List<VendorAddress> vendorAddresses;
85      private List<VendorAlias> vendorAliases;
86      private List<VendorContact> vendorContacts;
87      private List<VendorContract> vendorContracts;
88      private List<VendorCustomerNumber> vendorCustomerNumbers;
89      private List<VendorPhoneNumber> vendorPhoneNumbers;
90      private List<VendorShippingSpecialCondition> vendorShippingSpecialConditions;
91      private List<VendorCommodityCode> vendorCommodities;
92     // private Account accountNumber;
93      private OleCurrencyType currencyType;
94      private VendorHeader vendorHeader;
95      private VendorInactiveReason vendorInactiveReason;
96      private PaymentTermType vendorPaymentTerms;
97      private ShippingTitle vendorShippingTitle;
98      private ShippingPaymentTerms vendorShippingPaymentTerms;
99      private VendorDetail soldToVendorDetail;
100     private Person vendorRestrictedPerson;
101 
102     private String vendorParentName; // not persisted in the db
103     private String defaultAddressLine1; // not persisted in the db
104     private String defaultAddressLine2; // not persisted in the db
105     private String defaultAddressCity; // not persisted in the db
106     private String defaultAddressStateCode; // not persisted in the db
107     private String defaultAddressInternationalProvince; // not persisted in the db
108     private String defaultAddressPostalCode; // not persisted in the db
109     private String defaultAddressCountryCode; // not persisted in the db
110     private String defaultFaxNumber; // not persisted in the db
111     private OlePaymentMethod vendorPaymentMethod;
112     private List    boNotes;
113     
114     // jira OLE-3081
115     private String vendorLinkingNumber;
116     /**
117      * Default constructor.
118      */
119     public VendorDetail() {
120         vendorHeader = new VendorHeader();
121         vendorTransmissionFormat = new ArrayList<VendorTransmissionFormatDetail>();
122         vendorAddresses = new ArrayList<VendorAddress>();
123         vendorAliases = new ArrayList<VendorAlias>();
124         vendorContacts = new ArrayList<VendorContact>();
125         vendorContracts = new ArrayList<VendorContract>();
126         vendorCustomerNumbers = new ArrayList<VendorCustomerNumber>();
127         vendorPhoneNumbers = new ArrayList<VendorPhoneNumber>();
128         vendorShippingSpecialConditions = new ArrayList<VendorShippingSpecialCondition>();
129         vendorCommodities = new ArrayList<VendorCommodityCode>();
130         vendorParentIndicator = true;
131 
132     }
133 
134     public Integer getVendorHeaderGeneratedIdentifier() {
135         return vendorHeaderGeneratedIdentifier;
136     }
137 
138     public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) {
139         this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
140     }
141 
142     public Integer getVendorDetailAssignedIdentifier() {
143         return vendorDetailAssignedIdentifier;
144     }
145 
146     public void setVendorDetailAssignedIdentifier(Integer vendorDetailAssignedIdentifier) {
147         this.vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
148     }
149 
150     /**
151      * A concatenation of the vendorHeaderGeneratedIdentifier, a dash, and the vendorDetailAssignedIdentifier
152      *
153      * @return Returns the vendorNumber.
154      */
155     public String getVendorNumber() {
156         String headerId = "";
157         String detailId = "";
158         String vendorNumber = "";
159         if (ObjectUtils.isNotNull(this.vendorHeaderGeneratedIdentifier)) {
160             headerId = this.vendorHeaderGeneratedIdentifier.toString();
161         }
162         if (ObjectUtils.isNotNull(this.vendorDetailAssignedIdentifier)) {
163             detailId = this.vendorDetailAssignedIdentifier.toString();
164         }
165         if (!StringUtils.isEmpty(headerId) && !StringUtils.isEmpty(detailId)) {
166             vendorNumber = headerId + "-" + detailId;
167         }
168 
169         return vendorNumber;
170     }
171 
172     /**
173      * Sets the vendorNumber attribute value.
174      * If vendorNumber is empty, clears header and detail IDs.
175      * If vendorNumber is invalid, leaves header and detail IDs as were.
176      *
177      * @param vendorNumber The vendorNumber to set.
178      */
179     public void setVendorNumber(String vendorNumber) {
180         this.vendorNumber = vendorNumber;
181 
182         if (StringUtils.isEmpty(vendorNumber)) {
183             vendorHeaderGeneratedIdentifier = null;
184             vendorDetailAssignedIdentifier = null;
185             return;
186         }
187 
188         int dashInd = vendorNumber.indexOf('-');
189         // make sure there's at least one char before and after '-'
190         if (dashInd > 0 && dashInd < vendorNumber.length() - 1) {
191             try {
192                 vendorHeaderGeneratedIdentifier = new Integer(vendorNumber.substring(0, dashInd));
193                 vendorDetailAssignedIdentifier = new Integer(vendorNumber.substring(dashInd + 1));
194             }
195             catch (NumberFormatException e) {
196                 // in case of invalid number format
197             }
198         }
199     }
200 
201    /* public Account getAccountNumber() {
202         return accountNumber;
203     }
204 
205     public void setAccountNumber(Account accountNumber) {
206         this.accountNumber = accountNumber;
207     }*/
208 
209 
210     public String getVendorName() {
211         return vendorName;
212     }
213 
214     public void setVendorName(String vendorName) {
215         this.vendorName = vendorName;
216     }
217 
218     public Integer getVendorSoldToGeneratedIdentifier() {
219         return vendorSoldToGeneratedIdentifier;
220     }
221 
222     public void setVendorSoldToGeneratedIdentifier(Integer vendorSoldToGeneratedIdentifier) {
223         this.vendorSoldToGeneratedIdentifier = vendorSoldToGeneratedIdentifier;
224     }
225 
226     public Integer getVendorSoldToAssignedIdentifier() {
227         return vendorSoldToAssignedIdentifier;
228     }
229 
230     public void setVendorSoldToAssignedIdentifier(Integer vendorSoldToAssignedIdentifier) {
231         this.vendorSoldToAssignedIdentifier = vendorSoldToAssignedIdentifier;
232     }
233 
234     /**
235      * Gets the vendorSoldToNumber attribute.
236      *
237      * @return Returns the vendorSoldToNumber.
238      */
239     public String getVendorSoldToNumber() {
240         String headerId = "";
241         String detailId = "";
242         String vendorSoldToNumber = "";
243 
244         if (this.vendorSoldToGeneratedIdentifier != null) {
245             headerId = this.vendorSoldToGeneratedIdentifier.toString();
246         }
247         if (this.vendorSoldToAssignedIdentifier != null) {
248             detailId = this.vendorSoldToAssignedIdentifier.toString();
249         }
250         if (!StringUtils.isEmpty(headerId) && !StringUtils.isEmpty(detailId)) {
251             vendorSoldToNumber = headerId + "-" + detailId;
252         }
253 
254         return vendorSoldToNumber;
255     }
256 
257     /**
258      * Sets the vendorSoldToNumber attribute value.
259      * If vendorSoldToNumber is empty, clears soldToVendor header and detail IDs.
260      * If vendorSoldToNumber is invalid, leaves soldToVendor header and detail IDs as were.
261      *
262      * @param vendorSoldToNumber The vendorSoldToNumber to set.
263      */
264     public void setVendorSoldToNumber(String vendorSoldToNumber) {
265         this.vendorSoldToNumber = vendorSoldToNumber;
266 
267         if (StringUtils.isEmpty(vendorSoldToNumber)) {
268             vendorSoldToGeneratedIdentifier = null;
269             vendorSoldToAssignedIdentifier = null;
270             return;
271         }
272 
273         int dashInd = vendorSoldToNumber.indexOf('-');
274         // make sure there's at least one char before and after '-'
275         if (dashInd > 0 && dashInd < vendorSoldToNumber.length() - 1) {
276             try {
277                 vendorSoldToGeneratedIdentifier = new Integer(vendorSoldToNumber.substring(0, dashInd));
278                 vendorSoldToAssignedIdentifier = new Integer(vendorSoldToNumber.substring(dashInd + 1));
279             }
280             catch (NumberFormatException e) {
281                 // in case of invalid number format
282             }
283         }
284     }
285 
286     /**
287      * Gets the vendorSoldToName attribute.
288      *
289      * @return Returns the vendorSoldToName
290      */
291     public String getVendorSoldToName() {
292         return this.vendorSoldToName;
293     }
294 
295     public void setVendorSoldToName(String vendorSoldToName) {
296         this.vendorSoldToName = vendorSoldToName;
297     }
298 
299     public String getAltVendorName() {
300         return vendorName;
301     }
302 
303     public void setAltVendorName(String altVendorName) {
304         this.vendorName = altVendorName;
305     }
306 
307     public String getVendorRemitName() {
308         return vendorRemitName;
309     }
310 
311     public void setVendorRemitName(String vendorRemitName) {
312         this.vendorRemitName = vendorRemitName;
313     }
314 
315     public boolean isVendorParentIndicator() {
316         return vendorParentIndicator;
317     }
318 
319     public void setVendorParentIndicator(boolean vendorParentIndicator) {
320         this.vendorParentIndicator = vendorParentIndicator;
321     }
322 
323     public boolean isTaxableIndicator() {
324         return taxableIndicator;
325     }
326 
327     public void setTaxableIndicator(boolean taxableIndicator) {
328         this.taxableIndicator = taxableIndicator;
329     }
330 
331     public boolean isVendorDebarred() {
332         return (ObjectUtils.isNotNull(getVendorHeader().getVendorDebarredIndicator()) && getVendorHeader().getVendorDebarredIndicator());
333     }
334 
335     public boolean isActiveIndicator() {
336         return activeIndicator;
337     }
338 
339     public void setActiveIndicator(boolean activeIndicator) {
340         this.activeIndicator = activeIndicator;
341     }
342 
343     public String getVendorInactiveReasonCode() {
344         return vendorInactiveReasonCode;
345     }
346 
347     public void setVendorInactiveReasonCode(String vendorInactiveReasonCode) {
348         this.vendorInactiveReasonCode = vendorInactiveReasonCode;
349     }
350 
351     public String getVendorPaymentTermsCode() {
352         return vendorPaymentTermsCode;
353     }
354 
355     public void setVendorPaymentTermsCode(String vendorPaymentTermsCode) {
356         this.vendorPaymentTermsCode = vendorPaymentTermsCode;
357     }
358 
359     public String getVendorShippingTitleCode() {
360         return vendorShippingTitleCode;
361     }
362 
363     public void setVendorShippingTitleCode(String vendorShippingTitleCode) {
364         this.vendorShippingTitleCode = vendorShippingTitleCode;
365     }
366 
367     public String getVendorShippingPaymentTermsCode() {
368         return vendorShippingPaymentTermsCode;
369     }
370 
371     public void setVendorShippingPaymentTermsCode(String vendorShippingPaymentTermsCode) {
372         this.vendorShippingPaymentTermsCode = vendorShippingPaymentTermsCode;
373     }
374 
375     public Boolean getVendorConfirmationIndicator() {
376         return vendorConfirmationIndicator;
377     }
378 
379     public void setVendorConfirmationIndicator(Boolean vendorConfirmationIndicator) {
380         this.vendorConfirmationIndicator = vendorConfirmationIndicator;
381     }
382 
383     public Boolean getVendorPrepaymentIndicator() {
384         return vendorPrepaymentIndicator;
385     }
386 
387     public void setVendorPrepaymentIndicator(Boolean vendorPrepaymentIndicator) {
388         this.vendorPrepaymentIndicator = vendorPrepaymentIndicator;
389     }
390 
391     public Boolean getVendorCreditCardIndicator() {
392         return vendorCreditCardIndicator;
393     }
394 
395     public void setVendorCreditCardIndicator(Boolean vendorCreditCardIndicator) {
396         this.vendorCreditCardIndicator = vendorCreditCardIndicator;
397     }
398 
399     public KualiDecimal getVendorMinimumOrderAmount() {
400         return vendorMinimumOrderAmount;
401     }
402 
403     public void setVendorMinimumOrderAmount(KualiDecimal vendorMinimumOrderAmount) {
404         this.vendorMinimumOrderAmount = vendorMinimumOrderAmount;
405     }
406 
407     public String getVendorUrlAddress() {
408         return vendorUrlAddress;
409     }
410 
411     public void setVendorUrlAddress(String vendorUrlAddress) {
412         this.vendorUrlAddress = vendorUrlAddress;
413     }
414 
415     public Boolean getVendorRestrictedIndicator() {
416         return vendorRestrictedIndicator;
417     }
418 
419     public void setVendorRestrictedIndicator(Boolean vendorRestrictedIndicator) {
420         this.vendorRestrictedIndicator = vendorRestrictedIndicator;
421     }
422 
423     public String getVendorRestrictedReasonText() {
424         return vendorRestrictedReasonText;
425     }
426 
427     public void setVendorRestrictedReasonText(String vendorRestrictedReasonText) {
428         this.vendorRestrictedReasonText = vendorRestrictedReasonText;
429     }
430 
431     public Date getVendorRestrictedDate() {
432         return vendorRestrictedDate;
433     }
434 
435     public void setVendorRestrictedDate(Date vendorRestrictedDate) {
436         this.vendorRestrictedDate = vendorRestrictedDate;
437     }
438 
439     public String getVendorRestrictedPersonIdentifier() {
440         return vendorRestrictedPersonIdentifier;
441     }
442 
443     public void setVendorRestrictedPersonIdentifier(String vendorRestrictedPersonIdentifier) {
444         this.vendorRestrictedPersonIdentifier = vendorRestrictedPersonIdentifier;
445     }
446 
447     public String getVendorDunsNumber() {
448         return vendorDunsNumber;
449     }
450 
451     public void setVendorDunsNumber(String vendorDunsNumber) {
452         this.vendorDunsNumber = vendorDunsNumber;
453     }
454 
455     public VendorHeader getVendorHeader() {
456         return vendorHeader;
457     }
458 
459     public void setVendorHeader(VendorHeader vendorHeader) {
460         this.vendorHeader = vendorHeader;
461     }
462 
463     public PaymentTermType getVendorPaymentTerms() {
464         return vendorPaymentTerms;
465     }
466 
467     /**
468      * Sets the vendorPaymentTerms attribute.
469      *
470      * @param vendorPaymentTerms The vendorPaymentTerms to set.
471      * @deprecated
472      */
473     @Deprecated
474     public void setVendorPaymentTerms(PaymentTermType vendorPaymentTerms) {
475         this.vendorPaymentTerms = vendorPaymentTerms;
476     }
477 
478     public ShippingTitle getVendorShippingTitle() {
479         return vendorShippingTitle;
480     }
481 
482     /**
483      * Sets the vendorShippingTitle attribute.
484      *
485      * @param vendorShippingTitle The vendorShippingTitle to set.
486      * @deprecated
487      */
488     @Deprecated
489     public void setVendorShippingTitle(ShippingTitle vendorShippingTitle) {
490         this.vendorShippingTitle = vendorShippingTitle;
491     }
492 
493     public ShippingPaymentTerms getVendorShippingPaymentTerms() {
494         return vendorShippingPaymentTerms;
495     }
496 
497     /**
498      * Sets the vendorShippingPaymentTerms attribute.
499      *
500      * @param vendorShippingPaymentTerms The vendorShippingPaymentTerms to set.
501      * @deprecated
502      */
503     @Deprecated
504     public void setVendorShippingPaymentTerms(ShippingPaymentTerms vendorShippingPaymentTerms) {
505         this.vendorShippingPaymentTerms = vendorShippingPaymentTerms;
506     }
507 
508     public VendorInactiveReason getVendorInactiveReason() {
509         return vendorInactiveReason;
510     }
511 
512     /**
513      * Sets the vendorInactiveReason attribute value.
514      *
515      * @param vendorInactiveReason The vendorInactiveReason to set.
516      * @deprecated
517      */
518     @Deprecated
519     public void setVendorInactiveReason(VendorInactiveReason vendorInactiveReason) {
520         this.vendorInactiveReason = vendorInactiveReason;
521     }
522 
523     public List<VendorAddress> getVendorAddresses() {
524         return vendorAddresses;
525     }
526 
527     public void setVendorAddresses(List<VendorAddress> vendorAddresses) {
528         this.vendorAddresses = vendorAddresses;
529     }
530 
531     public List<VendorContact> getVendorContacts() {
532         return vendorContacts;
533     }
534 
535     public void setVendorContacts(List<VendorContact> vendorContacts) {
536         this.vendorContacts = vendorContacts;
537     }
538 
539     public List<VendorContract> getVendorContracts() {
540         return vendorContracts;
541     }
542 
543     public void setVendorContracts(List<VendorContract> vendorContracts) {
544         this.vendorContracts = vendorContracts;
545     }
546 
547     public List<VendorCustomerNumber> getVendorCustomerNumbers() {
548         return vendorCustomerNumbers;
549     }
550 
551     public void setVendorCustomerNumbers(List<VendorCustomerNumber> vendorCustomerNumbers) {
552         this.vendorCustomerNumbers = vendorCustomerNumbers;
553     }
554 
555     public List<VendorShippingSpecialCondition> getVendorShippingSpecialConditions() {
556         return vendorShippingSpecialConditions;
557     }
558 
559     public void setVendorShippingSpecialConditions(List<VendorShippingSpecialCondition> vendorShippingSpecialConditions) {
560         this.vendorShippingSpecialConditions = vendorShippingSpecialConditions;
561     }
562 
563     public List<VendorCommodityCode> getVendorCommodities() {
564         return vendorCommodities;
565     }
566 
567     public String getVendorCommoditiesAsString() {
568         StringBuilder sb = new StringBuilder("[");
569 
570         boolean first = true;
571         for (VendorCommodityCode vcc : this.getVendorCommodities()) {
572             if (!first) {
573                 sb.append(", ");
574             } else {
575                 first = false;
576             }
577             sb.append(vcc.getCommodityCode().getPurchasingCommodityCode());
578         }
579         sb.append(']');
580         return sb.toString();
581     }
582 
583     public void setVendorCommodities(List<VendorCommodityCode> vendorCommodities) {
584         this.vendorCommodities = vendorCommodities;
585     }
586 
587     public List<VendorAlias> getVendorAliases() {
588         return vendorAliases;
589     }
590 
591     public void setVendorAliases(List<VendorAlias> vendorAliases) {
592         this.vendorAliases = vendorAliases;
593     }
594 
595     public List<VendorPhoneNumber> getVendorPhoneNumbers() {
596         return vendorPhoneNumbers;
597     }
598 
599     public void setVendorPhoneNumbers(List<VendorPhoneNumber> vendorPhoneNumbers) {
600         this.vendorPhoneNumbers = vendorPhoneNumbers;
601     }
602 
603     public String getVendorFirstName() {
604         return vendorFirstName;
605     }
606 
607     public void setVendorFirstName(String vendorFirstName) {
608         this.vendorFirstName = vendorFirstName;
609     }
610 
611     public String getVendorLastName() {
612         return vendorLastName;
613     }
614 
615     public void setVendorLastName(String vendorLastName) {
616         this.vendorLastName = vendorLastName;
617     }
618 
619     public VendorDetail getSoldToVendorDetail() {
620         return soldToVendorDetail;
621     }
622 
623     public void setSoldToVendorDetail(VendorDetail soldToVendorDetail) {
624         this.soldToVendorDetail = soldToVendorDetail;
625     }
626 
627     public boolean isVendorFirstLastNameIndicator() {
628         return vendorFirstLastNameIndicator;
629     }
630 
631     public void setVendorFirstLastNameIndicator(boolean vendorFirstLastNameIndicator) {
632         this.vendorFirstLastNameIndicator = vendorFirstLastNameIndicator;
633     }
634 
635     public String getVendorStateForLookup() {
636         return vendorStateForLookup;
637     }
638 
639     public void setVendorStateForLookup(String vendorStateForLookup) {
640         this.vendorStateForLookup = vendorStateForLookup;
641     }
642 
643     public Person getVendorRestrictedPerson() {
644         vendorRestrictedPerson = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(vendorRestrictedPersonIdentifier, vendorRestrictedPerson);
645         return vendorRestrictedPerson;
646     }
647 
648     /**
649      * Sets the vendorRestrictedPerson attribute.
650      *
651      * @param vendorRestrictedPerson The vendorRestrictedPerson to set.
652      * @deprecated
653      */
654     @Deprecated
655     public void setVendorRestrictedPerson(Person vendorRestrictedPerson) {
656         this.vendorRestrictedPerson = vendorRestrictedPerson;
657     }
658 
659     public String getDefaultAddressLine1() {
660         return defaultAddressLine1;
661     }
662 
663     public void setDefaultAddressLine1(String defaultAddressLine1) {
664         this.defaultAddressLine1 = defaultAddressLine1;
665     }
666 
667     public String getDefaultAddressCity() {
668         return defaultAddressCity;
669     }
670 
671     public void setDefaultAddressCity(String defaultAddressCity) {
672         this.defaultAddressCity = defaultAddressCity;
673     }
674 
675     public String getDefaultAddressLine2() {
676         return defaultAddressLine2;
677     }
678 
679     public void setDefaultAddressLine2(String defaultAddressLine2) {
680         this.defaultAddressLine2 = defaultAddressLine2;
681     }
682 
683     public String getDefaultAddressPostalCode() {
684         return defaultAddressPostalCode;
685     }
686 
687     public void setDefaultAddressPostalCode(String defaultAddressPostalCode) {
688         this.defaultAddressPostalCode = defaultAddressPostalCode;
689     }
690 
691     public String getDefaultAddressStateCode() {
692         return defaultAddressStateCode;
693     }
694 
695     public void setDefaultAddressStateCode(String defaultAddressStateCode) {
696         this.defaultAddressStateCode = defaultAddressStateCode;
697     }
698 
699     public String getDefaultAddressInternationalProvince() {
700         return defaultAddressInternationalProvince;
701     }
702 
703     public void setDefaultAddressInternationalProvince(String defaultAddressInternationalProvince) {
704         this.defaultAddressInternationalProvince = defaultAddressInternationalProvince;
705     }
706 
707     public String getDefaultAddressCountryCode() {
708         return defaultAddressCountryCode;
709     }
710 
711     public void setDefaultAddressCountryCode(String defaultAddressCountryCode) {
712         this.defaultAddressCountryCode = defaultAddressCountryCode;
713     }
714 
715     public String getDefaultFaxNumber() {
716         return defaultFaxNumber;
717     }
718 
719     public void setDefaultFaxNumber(String defaultFaxNumber) {
720         this.defaultFaxNumber = defaultFaxNumber;
721     }
722 
723     /**
724      * @see org.kuali.ole.vnd.document.routing.VendorRoutingComparable#isEqualForRouting(java.lang.Object)
725      */
726     @Override
727     public boolean isEqualForRouting(Object toCompare) {
728         LOG.debug("Entering isEqualForRouting.");
729         if ((ObjectUtils.isNull(toCompare)) || !(toCompare instanceof VendorDetail)) {
730             return false;
731         }
732         else {
733             VendorDetail detail = (VendorDetail) toCompare;
734             return new EqualsBuilder().append(
735                     this.getVendorHeaderGeneratedIdentifier(), detail.getVendorHeaderGeneratedIdentifier()).append(
736                     this.getVendorDetailAssignedIdentifier(), detail.getVendorDetailAssignedIdentifier()).append(
737                     this.isVendorParentIndicator(), detail.isVendorParentIndicator()).append(
738                     this.getVendorName(), detail.getVendorName()).append(
739                     //MSU Contribution OLEMI-8580 DTT-3367 OLECNTRB-952
740                     this.getVendorLastName(), detail.getVendorLastName()).append(
741                     this.getVendorFirstName(), detail.getVendorFirstName()).append(
742                     this.isActiveIndicator(), detail.isActiveIndicator()).append(
743                     this.getVendorInactiveReasonCode(), detail.getVendorInactiveReasonCode()).append(
744                     this.getVendorDunsNumber(), detail.getVendorDunsNumber()).append(
745                     this.getVendorPaymentTermsCode(), detail.getVendorPaymentTermsCode()).append(
746                             this.getPaymentMethodId(), detail.getPaymentMethodId()).append(
747                     this.getVendorShippingTitleCode(), detail.getVendorShippingTitleCode()).append(
748                     this.getVendorShippingPaymentTermsCode(), detail.getVendorShippingPaymentTermsCode()).append(
749                     this.getVendorConfirmationIndicator(), detail.getVendorConfirmationIndicator()).append(
750                     this.getVendorPrepaymentIndicator(), detail.getVendorPrepaymentIndicator()).append(
751                     this.getVendorCreditCardIndicator(), detail.getVendorCreditCardIndicator()).append(
752                     this.getVendorMinimumOrderAmount(), detail.getVendorMinimumOrderAmount()).append(
753                     this.getVendorUrlAddress(), detail.getVendorUrlAddress()).append(
754                     this.getVendorRemitName(), detail.getVendorRemitName()).append(
755                     this.getVendorRestrictedIndicator(), detail.getVendorRestrictedIndicator()).append(
756                     this.getVendorRestrictedReasonText(), detail.getVendorRestrictedReasonText()).append(
757                     this.getVendorRestrictedDate(), detail.getVendorRestrictedDate()).append(
758                     this.getVendorRestrictedPersonIdentifier(), detail.getVendorRestrictedPersonIdentifier()).append(
759                     this.getVendorSoldToGeneratedIdentifier(), detail.getVendorSoldToGeneratedIdentifier()).append(
760                     this.getVendorSoldToAssignedIdentifier(), detail.getVendorSoldToAssignedIdentifier()).append(
761                     this.getVendorSoldToName(), detail.getVendorSoldToName()).append(
762                     this.isVendorFirstLastNameIndicator(), detail.isVendorFirstLastNameIndicator()).isEquals();
763         }
764     }
765 
766     /**
767      *  The vendor is B2B if they have a contract that has the B2B
768      *  indicator set to Yes. This method returns true if this vendor
769      *  is a B2B vendor and false otherwise.
770      *
771      * @return true if this vendor is a B2B vendor and false otherwise.
772      *
773      */
774     public boolean isB2BVendor() {
775         for (VendorContract contract : this.getVendorContracts()) {
776             if (contract.getVendorB2bIndicator()) {
777                 return true;
778             }
779         }
780         return false;
781     }
782 
783     public VendorDetail getVendorParent() {
784         Map<String, String> tmpValues = new HashMap<String, String>();
785         List<VendorDetail> relatedVendors = new ArrayList<VendorDetail>();
786         tmpValues.put(VendorPropertyConstants.VENDOR_HEADER_GENERATED_ID, getVendorHeaderGeneratedIdentifier().toString());
787         tmpValues.put(VendorPropertyConstants.VENDOR_PARENT_INDICATOR, "Y");
788         VendorDetail parentVendor = SpringContext.getBean(LookupService.class).findObjectBySearch(VendorDetail.class, tmpValues);
789         return parentVendor;
790     }
791 
792     public String getVendorParentName() {
793         if (StringUtils.isNotBlank(this.vendorParentName)) {
794             return vendorParentName;
795         }
796         else if (isVendorParentIndicator()) {
797             setVendorParentName(this.getVendorName());
798             return vendorParentName;
799         }
800         else {
801             this.setVendorParentName(getVendorParent().getVendorName());
802             return vendorParentName;
803         }
804     }
805 
806     public void setVendorParentName(String vendorParentName) {
807         this.vendorParentName = vendorParentName;
808     }
809 
810 
811     public String getVendorAliasesAsString() {
812         StringBuilder sb = new StringBuilder("[");
813 
814         boolean first = true;
815         for (VendorAlias vsd : this.getVendorAliases()) {
816             if(vsd.isActive()){
817                 if (!first) {
818                     sb.append(", ");
819                 } else {
820                     first = false;
821                 }
822                 sb.append(vsd.getVendorAliasName());
823             }
824         }
825         sb.append(']');
826         return sb.toString();
827     }
828 
829 
830     /**
831      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
832      */
833     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
834         LinkedHashMap m = new LinkedHashMap();
835         if (this.vendorHeaderGeneratedIdentifier != null) {
836             m.put("vendorHeaderGeneratedIdentifier", this.vendorHeaderGeneratedIdentifier.toString());
837         }
838         if (this.vendorDetailAssignedIdentifier != null) {
839             m.put("vendorDetailAssignedIdentifier", this.vendorDetailAssignedIdentifier.toString());
840         }
841 
842         return m;
843     }
844 
845     public String getVendorCurrency() {
846         return vendorCurrency;
847     }
848 
849     public void setVendorCurrency(String vendorCurrency) {
850         this.vendorCurrency = vendorCurrency;
851     }
852 
853     public Long getCurrencyTypeId() {
854         return currencyTypeId;
855     }
856 
857     public void setCurrencyTypeId(Long currencyTypeId) {
858         this.currencyTypeId = currencyTypeId;
859     }
860 
861 
862     public OleCurrencyType getCurrencyType() {
863         return currencyType;
864     }
865 
866     public void setCurrencyType(OleCurrencyType currencyType) {
867         this.currencyType = currencyType;
868     }
869 
870     public List<VendorTransmissionFormatDetail> getVendorTransmissionFormat() {
871         return vendorTransmissionFormat;
872     }
873 
874     public void setVendorTransmissionFormat(List<VendorTransmissionFormatDetail> vendorTransmissionFormat) {
875         this.vendorTransmissionFormat = vendorTransmissionFormat;
876     }
877 
878 
879     public Integer getPaymentMethodId() {
880         return paymentMethodId;
881     }
882 
883     public void setPaymentMethodId(Integer paymentMethodId) {
884         this.paymentMethodId = paymentMethodId;
885     }
886     public OlePaymentMethod getVendorPaymentMethod() {
887         return vendorPaymentMethod;
888     }
889 
890     public void setVendorPaymentMethod(OlePaymentMethod vendorPaymentMethod) {
891         this.vendorPaymentMethod = vendorPaymentMethod;
892     }
893 
894     public String getVendorLinkingNumber() {
895         return vendorLinkingNumber;
896     }
897 
898     public void setVendorLinkingNumber(String vendorLinkingNumber) {
899         this.vendorLinkingNumber = vendorLinkingNumber;
900     }
901 
902     private String claimInterval;
903 
904     public String getClaimInterval() {
905         return claimInterval;
906     }
907 
908     public void setClaimInterval(String claimInterval) {
909         this.claimInterval = claimInterval;
910     }
911 
912 }
913