View Javadoc

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