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