View Javadoc

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