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