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 import java.util.LinkedHashMap; 021 022 import org.apache.commons.lang.builder.EqualsBuilder; 023 import org.apache.log4j.Logger; 024 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; 025 026 /** 027 * Contains information specific to a parent Vendor, which may be shared by its division Vendors if it has any. Contained by a 028 * <code>VendorDetail</code>. 029 * 030 * @see org.kuali.kfs.vnd.businessobject.VendorDetail 031 */ 032 public class VendorHeader extends PersistableBusinessObjectBase { 033 private static Logger LOG = Logger.getLogger(VendorHeader.class); 034 035 private Integer vendorHeaderGeneratedIdentifier; 036 private String vendorTypeCode; 037 private String vendorTaxNumber; 038 private String vendorTaxTypeCode; 039 private String vendorOwnershipCode; 040 private String vendorOwnershipCategoryCode; 041 private Date vendorFederalWithholdingTaxBeginningDate; 042 private Date vendorFederalWithholdingTaxEndDate; 043 private Boolean vendorW9ReceivedIndicator; 044 private Boolean vendorW8BenReceivedIndicator; 045 private Boolean vendorDebarredIndicator; 046 private Boolean vendorForeignIndicator; 047 048 // private VendorType vendorType; 049 private OwnershipType vendorOwnership; 050 // private OwnershipCategory vendorOwnershipCategory; 051 // private List<VendorSupplierDiversity> vendorSupplierDiversities; 052 // private List<VendorTaxChange> vendorTaxChanges; 053 054 /** 055 * Default constructor. 056 */ 057 public VendorHeader() { 058 super(); 059 // vendorSupplierDiversities = new TypedArrayList(VendorSupplierDiversity.class); 060 } 061 062 public Integer getVendorHeaderGeneratedIdentifier() { 063 064 return vendorHeaderGeneratedIdentifier; 065 } 066 067 public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) { 068 this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier; 069 } 070 071 public String getVendorTypeCode() { 072 073 return vendorTypeCode; 074 } 075 076 public void setVendorTypeCode(String vendorTypeCode) { 077 this.vendorTypeCode = vendorTypeCode; 078 } 079 080 public String getVendorTaxNumber() { 081 082 return vendorTaxNumber; 083 } 084 085 public void setVendorTaxNumber(String vendorTaxNumber) { 086 this.vendorTaxNumber = vendorTaxNumber; 087 } 088 089 public String getVendorTaxTypeCode() { 090 091 return vendorTaxTypeCode; 092 } 093 094 public void setVendorTaxTypeCode(String vendorTaxTypeCode) { 095 this.vendorTaxTypeCode = vendorTaxTypeCode; 096 } 097 098 public String getVendorOwnershipCode() { 099 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 }