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