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