001 /* 002 * Copyright 2007 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package edu.sampleu.financial.bo; 018 019 import java.sql.Date; 020 021 import org.apache.commons.lang.builder.EqualsBuilder; 022 import org.apache.log4j.Logger; 023 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; 024 025 /** 026 * Contains information specific to a parent Vendor, which may be shared by its division Vendors if it has any. Contained by a 027 * <code>VendorDetail</code>. 028 * 029 * @see org.kuali.kfs.vnd.businessobject.VendorDetail 030 */ 031 public class VendorHeader extends PersistableBusinessObjectBase { 032 private static Logger LOG = Logger.getLogger(VendorHeader.class); 033 034 private Integer vendorHeaderGeneratedIdentifier; 035 private String vendorTypeCode; 036 private String vendorTaxNumber; 037 private String vendorTaxTypeCode; 038 private String vendorOwnershipCode; 039 private String vendorOwnershipCategoryCode; 040 private Date vendorFederalWithholdingTaxBeginningDate; 041 private Date vendorFederalWithholdingTaxEndDate; 042 private Boolean vendorW9ReceivedIndicator; 043 private Boolean vendorW8BenReceivedIndicator; 044 private Boolean vendorDebarredIndicator; 045 private Boolean vendorForeignIndicator; 046 047 // private VendorType vendorType; 048 private OwnershipType vendorOwnership; 049 // private OwnershipCategory vendorOwnershipCategory; 050 // private List<VendorSupplierDiversity> vendorSupplierDiversities; 051 // private List<VendorTaxChange> vendorTaxChanges; 052 053 /** 054 * Default constructor. 055 */ 056 public VendorHeader() { 057 super(); 058 // vendorSupplierDiversities = new TypedArrayList(VendorSupplierDiversity.class); 059 } 060 061 public Integer getVendorHeaderGeneratedIdentifier() { 062 063 return vendorHeaderGeneratedIdentifier; 064 } 065 066 public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) { 067 this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier; 068 } 069 070 public String getVendorTypeCode() { 071 072 return vendorTypeCode; 073 } 074 075 public void setVendorTypeCode(String vendorTypeCode) { 076 this.vendorTypeCode = vendorTypeCode; 077 } 078 079 public String getVendorTaxNumber() { 080 081 return vendorTaxNumber; 082 } 083 084 public void setVendorTaxNumber(String vendorTaxNumber) { 085 this.vendorTaxNumber = vendorTaxNumber; 086 } 087 088 public String getVendorTaxTypeCode() { 089 090 return vendorTaxTypeCode; 091 } 092 093 public void setVendorTaxTypeCode(String vendorTaxTypeCode) { 094 this.vendorTaxTypeCode = vendorTaxTypeCode; 095 } 096 097 public String getVendorOwnershipCode() { 098 099 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 }