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 edu.sampleu.financial.bo;
18  
19  import java.sql.Date;
20  
21  import org.apache.commons.lang.builder.EqualsBuilder;
22  import org.apache.log4j.Logger;
23  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
24  
25  /**
26   * Contains information specific to a parent Vendor, which may be shared by its division Vendors if it has any. Contained by a
27   * <code>VendorDetail</code>.
28   *
29   * @see org.kuali.kfs.vnd.businessobject.VendorDetail
30   */
31  public class VendorHeader extends PersistableBusinessObjectBase {
32      private static Logger LOG = Logger.getLogger(VendorHeader.class);
33  
34      private Integer vendorHeaderGeneratedIdentifier;
35      private String vendorTypeCode;
36      private String vendorTaxNumber;
37      private String vendorTaxTypeCode;
38      private String vendorOwnershipCode;
39      private String vendorOwnershipCategoryCode;
40      private Date vendorFederalWithholdingTaxBeginningDate;
41      private Date vendorFederalWithholdingTaxEndDate;
42      private Boolean vendorW9ReceivedIndicator;
43      private Boolean vendorW8BenReceivedIndicator;
44      private Boolean vendorDebarredIndicator;
45      private Boolean vendorForeignIndicator;
46  
47      //    private VendorType vendorType;
48      private OwnershipType vendorOwnership;
49  //    private OwnershipCategory vendorOwnershipCategory;
50  //    private List<VendorSupplierDiversity> vendorSupplierDiversities;
51  //    private List<VendorTaxChange> vendorTaxChanges;
52  
53      /**
54       * Default constructor.
55       */
56      public VendorHeader() {
57          super();
58  //        vendorSupplierDiversities = new TypedArrayList(VendorSupplierDiversity.class);
59      }
60  
61      public Integer getVendorHeaderGeneratedIdentifier() {
62  
63          return vendorHeaderGeneratedIdentifier;
64      }
65  
66      public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) {
67          this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
68      }
69  
70      public String getVendorTypeCode() {
71  
72          return vendorTypeCode;
73      }
74  
75      public void setVendorTypeCode(String vendorTypeCode) {
76          this.vendorTypeCode = vendorTypeCode;
77      }
78  
79      public String getVendorTaxNumber() {
80  
81          return vendorTaxNumber;
82      }
83  
84      public void setVendorTaxNumber(String vendorTaxNumber) {
85          this.vendorTaxNumber = vendorTaxNumber;
86      }
87  
88      public String getVendorTaxTypeCode() {
89  
90          return vendorTaxTypeCode;
91      }
92  
93      public void setVendorTaxTypeCode(String vendorTaxTypeCode) {
94          this.vendorTaxTypeCode = vendorTaxTypeCode;
95      }
96  
97      public String getVendorOwnershipCode() {
98  
99          return vendorOwnershipCode;
100     }
101 
102     public void setVendorOwnershipCode(String vendorOwnershipCode) {
103         this.vendorOwnershipCode = vendorOwnershipCode;
104     }
105 
106     public String getVendorOwnershipCategoryCode() {
107 
108         return vendorOwnershipCategoryCode;
109     }
110 
111     public void setVendorOwnershipCategoryCode(String vendorOwnershipCategoryCode) {
112         this.vendorOwnershipCategoryCode = vendorOwnershipCategoryCode;
113     }
114 
115     public Date getVendorFederalWithholdingTaxBeginningDate() {
116 
117         return vendorFederalWithholdingTaxBeginningDate;
118     }
119 
120     public void setVendorFederalWithholdingTaxBeginningDate(Date vendorFederalWithholdingTaxBeginningDate) {
121         this.vendorFederalWithholdingTaxBeginningDate = vendorFederalWithholdingTaxBeginningDate;
122     }
123 
124     public Date getVendorFederalWithholdingTaxEndDate() {
125 
126         return vendorFederalWithholdingTaxEndDate;
127     }
128 
129     public void setVendorFederalWithholdingTaxEndDate(Date vendorFederalWithholdingTaxEndDate) {
130         this.vendorFederalWithholdingTaxEndDate = vendorFederalWithholdingTaxEndDate;
131     }
132 
133     public Boolean getVendorW9ReceivedIndicator() {
134 
135         return vendorW9ReceivedIndicator;
136     }
137 
138     public void setVendorW9ReceivedIndicator(Boolean vendorW9ReceivedIndicator) {
139         this.vendorW9ReceivedIndicator = vendorW9ReceivedIndicator;
140     }
141 
142     public Boolean getVendorW8BenReceivedIndicator() {
143 
144         return vendorW8BenReceivedIndicator;
145     }
146 
147     public void setVendorW8BenReceivedIndicator(Boolean vendorW8BenReceivedIndicator) {
148         this.vendorW8BenReceivedIndicator = vendorW8BenReceivedIndicator;
149     }
150 
151     /*public VendorType getVendorType() {
152         // refresh because proxy doesn't work properly and vendor type sometimes is null
153         if (vendorType == null)
154             this.refreshReferenceObject("vendorType");
155         return vendorType;
156     }
157 
158     */
159 
160     /**
161      * Sets the vendorType attribute.
162      *
163      * @param vendorType The vendorType to set.
164      * @deprecated
165      *//*
166     public void setVendorType(VendorType vendorType) {
167         this.vendorType = vendorType;
168     }*/
169     public OwnershipType getVendorOwnership() {
170 
171         return vendorOwnership;
172     }
173 
174     /**
175      * Sets the vendorOwnership attribute.
176      *
177      * @param vendorOwnership The vendorOwnership to set.
178      * @deprecated
179      */
180     public void setVendorOwnership(OwnershipType vendorOwnership) {
181         this.vendorOwnership = vendorOwnership;
182     }
183 
184 //    public OwnershipCategory getVendorOwnershipCategory() {
185 //
186 //        return vendorOwnershipCategory;
187 //    }
188 
189     /**
190      * Sets the vendorOwnershipCategory attribute.
191      *
192      * @param vendorOwnershipCategory The vendorOwnershipCategory to set.
193      * @deprecated
194      */
195 //    public void setVendorOwnershipCategory(OwnershipCategory vendorOwnershipCategory) {
196 //        this.vendorOwnershipCategory = vendorOwnershipCategory;
197 //    }
198     public Boolean getVendorDebarredIndicator() {
199 
200         return vendorDebarredIndicator;
201     }
202 
203     /**
204      * Sets the vendorDebarredIndicator attribute value.
205      *
206      * @param vendorDebarredIndicator The vendorDebarredIndicator to set.
207      */
208     public void setVendorDebarredIndicator(Boolean vendorDebarredIndicator) {
209         this.vendorDebarredIndicator = vendorDebarredIndicator;
210     }
211 
212     public Boolean getVendorForeignIndicator() {
213 
214         return vendorForeignIndicator;
215     }
216 
217     /**
218      * Sets the vendorForeignIndicator attribute value.
219      *
220      * @param vendorForeignIndicator The vendorForeignIndicator to set.
221      */
222     public void setVendorForeignIndicator(Boolean vendorForeignIndicator) {
223         this.vendorForeignIndicator = vendorForeignIndicator;
224     }
225 
226 //    public List<VendorSupplierDiversity> getVendorSupplierDiversities() {
227 //
228 //        return vendorSupplierDiversities;
229 //    }
230 //
231 //    public void setVendorSupplierDiversities(List<VendorSupplierDiversity> vendorSupplierDiversities) {
232 //        this.vendorSupplierDiversities = vendorSupplierDiversities;
233 //    }
234 
235     /**
236      * Used by the Spring Framework to correctly retrieve the vendor supplier diversities as a single
237      * attribute. The vendorSupplierDiversities is a collection of diversities, and without this method, 
238      * there was no way to get a single attribute for it.
239      *
240      * @return the vendor supplier diversities as a single attribute
241      */
242 //    public String getVendorSupplierDiversitiesAsString() {
243 //        StringBuilder sb = new StringBuilder("vendorSupplierDiversities=[");
244 //
245 //        boolean first = true;
246 //        for (VendorSupplierDiversity vsd : vendorSupplierDiversities) {
247 //            if (!first) {
248 //                sb.append(", ");
249 //            } else {
250 //                first = false;
251 //            }
252 //            sb.append(vsd.getVendorSupplierDiversityCode().toString());
253 //        }
254 //        sb.append(']');
255 //
256 //        return sb.toString();
257 //    }
258 //
259 //    public List<VendorTaxChange> getVendorTaxChanges() {
260 //
261 //        return vendorTaxChanges;
262 //    }
263 //
264 //    public void setVendorTaxChanges(List<VendorTaxChange> vendorTaxChanges) {
265 //        this.vendorTaxChanges = vendorTaxChanges;
266 //    }
267 
268     /**
269      * This method is a predicate to test equality of all the persisted attributes of an instance of this class, including member
270      * collections. This is used to determine whether to route
271      *
272      * @param vh Another VendorHeader object
273      * @return True if all non-derived attributes of the given object are equal to this one's
274      */
275     public boolean isEqualForRouting(Object toCompare) {
276         LOG.debug("Entering isEqualForRouting.");
277         if (!(toCompare instanceof VendorHeader)) {
278             return false;
279         } else {
280             VendorHeader vh = (VendorHeader) toCompare;
281             return new EqualsBuilder().append(this.getVendorTypeCode(), vh.getVendorTypeCode()).append(this.getVendorTaxNumber(), vh.getVendorTaxNumber()).append(this.getVendorOwnershipCode(), vh.getVendorOwnershipCode()).append(this.getVendorOwnershipCategoryCode(), vh.getVendorOwnershipCategoryCode()).append(this.getVendorFederalWithholdingTaxBeginningDate(), vh.getVendorFederalWithholdingTaxBeginningDate()).append(this.getVendorFederalWithholdingTaxEndDate(), vh.getVendorFederalWithholdingTaxEndDate()).append(this.getVendorW9ReceivedIndicator(), vh.getVendorW9ReceivedIndicator()).append(this.getVendorW8BenReceivedIndicator(), vh.getVendorW8BenReceivedIndicator()).append(this.getVendorDebarredIndicator(), vh.getVendorDebarredIndicator()).append(this.getVendorForeignIndicator(), vh.getVendorForeignIndicator()).isEquals();
282         }
283     }
284 
285 }