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 org.apache.commons.lang.builder.EqualsBuilder; 020 import org.apache.log4j.Logger; 021 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; 022 023 import java.sql.Date; 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 public class VendorHeader extends PersistableBusinessObjectBase { 030 private static Logger LOG = Logger.getLogger(VendorHeader.class); 031 032 private Integer vendorHeaderGeneratedIdentifier; 033 private String vendorTypeCode; 034 private String vendorTaxNumber; 035 private String vendorTaxTypeCode; 036 private String vendorOwnershipCode; 037 private String vendorOwnershipCategoryCode; 038 private Date vendorFederalWithholdingTaxBeginningDate; 039 private Date vendorFederalWithholdingTaxEndDate; 040 private Boolean vendorW9ReceivedIndicator; 041 private Boolean vendorW8BenReceivedIndicator; 042 private Boolean vendorDebarredIndicator; 043 private Boolean vendorForeignIndicator; 044 045 // private VendorType vendorType; 046 private OwnershipType vendorOwnership; 047 // private OwnershipCategory vendorOwnershipCategory; 048 // private List<VendorSupplierDiversity> vendorSupplierDiversities; 049 // private List<VendorTaxChange> vendorTaxChanges; 050 051 /** 052 * Default constructor. 053 */ 054 public VendorHeader() { 055 super(); 056 // vendorSupplierDiversities = new TypedArrayList(VendorSupplierDiversity.class); 057 } 058 059 public Integer getVendorHeaderGeneratedIdentifier() { 060 061 return vendorHeaderGeneratedIdentifier; 062 } 063 064 public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) { 065 this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier; 066 } 067 068 public String getVendorTypeCode() { 069 070 return vendorTypeCode; 071 } 072 073 public void setVendorTypeCode(String vendorTypeCode) { 074 this.vendorTypeCode = vendorTypeCode; 075 } 076 077 public String getVendorTaxNumber() { 078 079 return vendorTaxNumber; 080 } 081 082 public void setVendorTaxNumber(String vendorTaxNumber) { 083 this.vendorTaxNumber = vendorTaxNumber; 084 } 085 086 public String getVendorTaxTypeCode() { 087 088 return vendorTaxTypeCode; 089 } 090 091 public void setVendorTaxTypeCode(String vendorTaxTypeCode) { 092 this.vendorTaxTypeCode = vendorTaxTypeCode; 093 } 094 095 public String getVendorOwnershipCode() { 096 097 return vendorOwnershipCode; 098 } 099 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 }