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