View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.sampleu.financial.bo;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.apache.log4j.Logger;
20  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
21  import org.kuali.rice.core.framework.services.CoreFrameworkServiceLocator;
22  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
23  import org.kuali.rice.krad.util.KRADConstants;
24  import org.kuali.rice.location.api.country.Country;
25  import org.kuali.rice.location.api.services.LocationApiServiceLocator;
26  import org.kuali.rice.location.api.state.State;
27  
28  import java.util.ArrayList;
29  import java.util.List;
30  
31  /**
32   * Address to be associated with a particular Vendor.
33   */
34  public class VendorAddress extends PersistableBusinessObjectBase implements MutableInactivatable {
35      private static Logger LOG = Logger.getLogger(VendorAddress.class);
36  
37      private Integer vendorAddressGeneratedIdentifier;
38      private Integer vendorHeaderGeneratedIdentifier;
39      private Integer vendorDetailAssignedIdentifier;
40      private String vendorAddressTypeCode;
41      private String vendorLine1Address;
42      private String vendorLine2Address;
43      private String vendorCityName;
44      private String vendorStateCode;
45      private String vendorZipCode;
46      private String vendorCountryCode;
47      private String vendorAttentionName;
48      private String vendorAddressInternationalProvinceName;
49      private String vendorAddressEmailAddress;
50      private String vendorBusinessToBusinessUrlAddress;
51      private String vendorFaxNumber;
52      private boolean vendorDefaultAddressIndicator;
53      private boolean active;
54  
55      private List<VendorDefaultAddress> vendorDefaultAddresses;
56  
57      private VendorDetail vendorDetail;
58      private AddressType vendorAddressType;
59      private State vendorState;
60      private Country vendorCountry;
61  
62      /**
63       * Default constructor.
64       */
65      public VendorAddress() {
66          vendorDefaultAddresses = new ArrayList();
67      }
68  
69      public Integer getVendorAddressGeneratedIdentifier() {
70  
71          return vendorAddressGeneratedIdentifier;
72      }
73  
74      public void setVendorAddressGeneratedIdentifier(Integer vendorAddressGeneratedIdentifier) {
75          this.vendorAddressGeneratedIdentifier = vendorAddressGeneratedIdentifier;
76      }
77  
78      public Integer getVendorHeaderGeneratedIdentifier() {
79          return vendorHeaderGeneratedIdentifier;
80      }
81  
82      public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) {
83          this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
84      }
85  
86      public Integer getVendorDetailAssignedIdentifier() {
87          return vendorDetailAssignedIdentifier;
88      }
89  
90      public void setVendorDetailAssignedIdentifier(Integer vendorDetailAssignedIdentifier) {
91          this.vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
92      }
93  
94      public String getVendorAddressInternationalProvinceName() {
95          return vendorAddressInternationalProvinceName;
96      }
97  
98      public void setVendorAddressInternationalProvinceName(String vendorAddressInternationalProvinceName) {
99          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 }