001 /* 002 * Copyright 2007 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the 005 * "License"); 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, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations under 014 * the License. 015 */ 016 017 package edu.sampleu.financial.bo; 018 019 import java.util.ArrayList; 020 import java.util.LinkedHashMap; 021 import java.util.List; 022 023 import org.apache.commons.lang.StringUtils; 024 import org.apache.log4j.Logger; 025 import org.kuali.rice.core.framework.services.CoreFrameworkServiceLocator; 026 import org.kuali.rice.kns.bo.Inactivateable; 027 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; 028 import org.kuali.rice.kns.service.KNSServiceLocator; 029 import org.kuali.rice.kns.service.KNSServiceLocatorInternal; 030 import org.kuali.rice.kns.util.KNSConstants; 031 import org.kuali.rice.shareddata.api.country.Country; 032 import org.kuali.rice.shareddata.api.services.SharedDataApiServiceLocator; 033 import org.kuali.rice.shareddata.api.state.State; 034 035 /** 036 * Address to be associated with a particular Vendor. 037 */ 038 public class VendorAddress extends PersistableBusinessObjectBase implements Inactivateable { 039 private static Logger LOG = Logger.getLogger(VendorAddress.class); 040 041 private Integer vendorAddressGeneratedIdentifier; 042 private Integer vendorHeaderGeneratedIdentifier; 043 private Integer vendorDetailAssignedIdentifier; 044 private String vendorAddressTypeCode; 045 private String vendorLine1Address; 046 private String vendorLine2Address; 047 private String vendorCityName; 048 private String vendorStateCode; 049 private String vendorZipCode; 050 private String vendorCountryCode; 051 private String vendorAttentionName; 052 private String vendorAddressInternationalProvinceName; 053 private String vendorAddressEmailAddress; 054 private String vendorBusinessToBusinessUrlAddress; 055 private String vendorFaxNumber; 056 private boolean vendorDefaultAddressIndicator; 057 private boolean active; 058 059 private List<VendorDefaultAddress> vendorDefaultAddresses; 060 061 private VendorDetail vendorDetail; 062 private AddressType vendorAddressType; 063 private State vendorState; 064 private Country vendorCountry; 065 066 /** 067 * Default constructor. 068 */ 069 public VendorAddress() { 070 vendorDefaultAddresses = new ArrayList(); 071 } 072 073 public Integer getVendorAddressGeneratedIdentifier() { 074 075 return vendorAddressGeneratedIdentifier; 076 } 077 078 public void setVendorAddressGeneratedIdentifier(Integer vendorAddressGeneratedIdentifier) { 079 this.vendorAddressGeneratedIdentifier = vendorAddressGeneratedIdentifier; 080 } 081 082 public Integer getVendorHeaderGeneratedIdentifier() { 083 return vendorHeaderGeneratedIdentifier; 084 } 085 086 public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) { 087 this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier; 088 } 089 090 public Integer getVendorDetailAssignedIdentifier() { 091 return vendorDetailAssignedIdentifier; 092 } 093 094 public void setVendorDetailAssignedIdentifier(Integer vendorDetailAssignedIdentifier) { 095 this.vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier; 096 } 097 098 public String getVendorAddressInternationalProvinceName() { 099 return vendorAddressInternationalProvinceName; 100 } 101 102 public void setVendorAddressInternationalProvinceName(String vendorAddressInternationalProvinceName) { 103 this.vendorAddressInternationalProvinceName = vendorAddressInternationalProvinceName; 104 } 105 106 public String getVendorAddressEmailAddress() { 107 return vendorAddressEmailAddress; 108 } 109 110 public void setVendorAddressEmailAddress(String vendorAddressEmailAddress) { 111 this.vendorAddressEmailAddress = vendorAddressEmailAddress; 112 } 113 114 public String getVendorAddressTypeCode() { 115 return vendorAddressTypeCode; 116 } 117 118 public void setVendorAddressTypeCode(String vendorAddressTypeCode) { 119 this.vendorAddressTypeCode = vendorAddressTypeCode; 120 } 121 122 public String getVendorLine1Address() { 123 return vendorLine1Address; 124 } 125 126 public void setVendorLine1Address(String vendorLine1Address) { 127 this.vendorLine1Address = vendorLine1Address; 128 } 129 130 public String getVendorLine2Address() { 131 return vendorLine2Address; 132 } 133 134 public void setVendorLine2Address(String vendorLine2Address) { 135 this.vendorLine2Address = vendorLine2Address; 136 } 137 138 public String getVendorCityName() { 139 return vendorCityName; 140 } 141 142 public void setVendorCityName(String vendorCityName) { 143 this.vendorCityName = vendorCityName; 144 } 145 146 public String getVendorStateCode() { 147 return vendorStateCode; 148 } 149 150 public void setVendorStateCode(String vendorStateCode) { 151 this.vendorStateCode = vendorStateCode; 152 } 153 154 public String getVendorZipCode() { 155 return vendorZipCode; 156 } 157 158 public void setVendorZipCode(String vendorZipCode) { 159 this.vendorZipCode = vendorZipCode; 160 } 161 162 public String getVendorCountryCode() { 163 return vendorCountryCode; 164 } 165 166 public void setVendorCountryCode(String vendorCountryCode) { 167 this.vendorCountryCode = vendorCountryCode; 168 } 169 170 public String getVendorAttentionName() { 171 return vendorAttentionName; 172 } 173 174 public void setVendorAttentionName(String vendorAttentionName) { 175 this.vendorAttentionName = vendorAttentionName; 176 } 177 178 public String getVendorBusinessToBusinessUrlAddress() { 179 return vendorBusinessToBusinessUrlAddress; 180 } 181 182 public void setVendorBusinessToBusinessUrlAddress(String vendorBusinessToBusinessUrlAddress) { 183 this.vendorBusinessToBusinessUrlAddress = vendorBusinessToBusinessUrlAddress; 184 } 185 186 public VendorDetail getVendorDetail() { 187 return vendorDetail; 188 } 189 190 public void setVendorDetail(VendorDetail vendorDetail) { 191 this.vendorDetail = vendorDetail; 192 } 193 194 public AddressType getVendorAddressType() { 195 return vendorAddressType; 196 } 197 198 public void setVendorAddressType(AddressType vendorAddressType) { 199 this.vendorAddressType = vendorAddressType; 200 } 201 202 public State getVendorState() { 203 if ((vendorState == null) || (StringUtils.equals(vendorState.getCode(), vendorStateCode))) { 204 vendorState = SharedDataApiServiceLocator.getStateService().getState(vendorCountryCode, vendorStateCode); 205 } 206 207 return vendorState; 208 } 209 210 public void setVendorState(State vendorState) { 211 this.vendorState = vendorState; 212 } 213 214 public Country getVendorCountry() { 215 String postalCountryCode = CoreFrameworkServiceLocator.getParameterService().getParameterValueAsString(KNSConstants.KNS_NAMESPACE, 216 KNSConstants.DetailTypes.ALL_DETAIL_TYPE, KNSConstants.SystemGroupParameterNames.DEFAULT_COUNTRY); 217 vendorCountry = SharedDataApiServiceLocator.getCountryService().getCountry(postalCountryCode); 218 219 return vendorCountry; 220 } 221 222 public void setVendorCountry(Country vendorCountry) { 223 this.vendorCountry = vendorCountry; 224 } 225 226 public String getVendorFaxNumber() { 227 return vendorFaxNumber; 228 } 229 230 public void setVendorFaxNumber(String vendorFaxNumber) { 231 this.vendorFaxNumber = vendorFaxNumber; 232 } 233 234 public boolean isVendorDefaultAddressIndicator() { 235 return vendorDefaultAddressIndicator; 236 } 237 238 public void setVendorDefaultAddressIndicator(boolean vendorDefaultAddressIndicator) { 239 this.vendorDefaultAddressIndicator = vendorDefaultAddressIndicator; 240 } 241 242 public boolean isActive() { 243 return active; 244 } 245 246 public void setActive(boolean active) { 247 this.active = active; 248 } 249 250 public List<VendorDefaultAddress> getVendorDefaultAddresses() { 251 return this.vendorDefaultAddresses; 252 } 253 254 public void setVendorDefaultAddresses(List<VendorDefaultAddress> vendorDefaultAddresses) { 255 this.vendorDefaultAddresses = vendorDefaultAddresses; 256 } 257 }