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