1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  package org.kuali.ole.vnd.businessobject;
18  
19  import java.util.ArrayList;
20  import java.util.HashMap;
21  import java.util.List;
22  import java.util.Map;
23  
24  import org.apache.commons.lang.StringUtils;
25  import org.kuali.ole.coa.businessobject.Account;
26  import org.kuali.ole.sys.context.SpringContext;
27  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
28  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
29  import org.kuali.rice.krad.service.KualiModuleService;
30  import org.kuali.rice.krad.service.ModuleService;
31  import org.kuali.rice.location.api.LocationConstants;
32  import org.kuali.rice.location.framework.country.CountryEbo;
33  import org.kuali.rice.location.framework.state.StateEbo;
34  
35  
36  
37  
38  public class VendorContact extends PersistableBusinessObjectBase implements MutableInactivatable {
39  
40      protected Integer vendorContactGeneratedIdentifier;
41      protected Integer vendorHeaderGeneratedIdentifier;
42      protected Integer vendorDetailAssignedIdentifier;
43      protected String vendorContactTypeCode;
44      protected String vendorContactName;
45      protected String vendorContactEmailAddress;
46      protected String vendorContactCommentText;
47      protected String vendorLine1Address;
48      protected String vendorLine2Address;
49     
50     
51      protected String vendorCityName;
52      protected String vendorStateCode;
53      protected String vendorZipCode;
54      protected String vendorCountryCode;
55      protected String vendorAttentionName;
56      protected String vendorAddressInternationalProvinceName;
57      protected boolean active;
58  
59      
60      protected String phoneNumberForLookup;
61      protected String tollFreeForLookup;
62      protected String faxForLookup;
63     
64     
65      protected List<VendorContactPhoneNumber> vendorContactPhoneNumbers;
66      protected VendorDetail vendorDetail;
67      protected ContactType vendorContactType;
68      protected StateEbo vendorState;
69      protected CountryEbo vendorCountry;
70      protected Account vendorAccounts;
71      
72      
73  
74      
75  
76  
77      public VendorContact() {
78          vendorContactPhoneNumbers = new ArrayList<VendorContactPhoneNumber>();
79      }
80  
81  
82     
83  
84  
85  
86  
87  
88  
89  
90      public Integer getVendorContactGeneratedIdentifier() {
91          return vendorContactGeneratedIdentifier;
92      }
93  
94      public void setVendorContactGeneratedIdentifier(Integer vendorContactGeneratedIdentifier) {
95          this.vendorContactGeneratedIdentifier = vendorContactGeneratedIdentifier;
96      }
97  
98      public Integer getVendorHeaderGeneratedIdentifier() {
99          return vendorHeaderGeneratedIdentifier;
100     }
101 
102     public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) {
103         this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
104     }
105 
106     public Integer getVendorDetailAssignedIdentifier() {
107         return vendorDetailAssignedIdentifier;
108     }
109 
110     public void setVendorDetailAssignedIdentifier(Integer vendorDetailAssignedIdentifier) {
111         this.vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
112     }
113 
114     public String getVendorContactTypeCode() {
115         return vendorContactTypeCode;
116     }
117 
118     public void setVendorContactTypeCode(String vendorContactTypeCode) {
119         this.vendorContactTypeCode = vendorContactTypeCode;
120     }
121 
122     public String getVendorContactName() {
123         return vendorContactName;
124     }
125 
126     public void setVendorContactName(String vendorContactName) {
127         this.vendorContactName = vendorContactName;
128     }
129 
130     public String getVendorContactEmailAddress() {
131         return vendorContactEmailAddress;
132     }
133 
134     public void setVendorContactEmailAddress(String vendorContactEmailAddress) {
135         this.vendorContactEmailAddress = vendorContactEmailAddress;
136     }
137 
138     public String getVendorContactCommentText() {
139         return vendorContactCommentText;
140     }
141 
142     public void setVendorContactCommentText(String vendorContactCommentText) {
143         this.vendorContactCommentText = vendorContactCommentText;
144     }
145 
146     public ContactType getVendorContactType() {
147         return vendorContactType;
148     }
149 
150     public void setVendorContactType(ContactType vendorContactType) {
151         this.vendorContactType = vendorContactType;
152     }
153 
154     public VendorDetail getVendorDetail() {
155         return vendorDetail;
156     }
157 
158     public void setVendorDetail(VendorDetail vendorDetail) {
159         this.vendorDetail = vendorDetail;
160     }
161 
162     public String getVendorAddressInternationalProvinceName() {
163         return vendorAddressInternationalProvinceName;
164     }
165 
166     public void setVendorAddressInternationalProvinceName(String vendorAddressInternationalProvinceName) {
167         this.vendorAddressInternationalProvinceName = vendorAddressInternationalProvinceName;
168     }
169 
170     @Override
171     public boolean isActive() {
172         return active;
173     }
174 
175     @Override
176     public void setActive(boolean active) {
177         this.active = active;
178     }
179 
180     public String getVendorAttentionName() {
181         return vendorAttentionName;
182     }
183 
184     public void setVendorAttentionName(String vendorAttentionName) {
185         this.vendorAttentionName = vendorAttentionName;
186     }
187 
188     public String getVendorCityName() {
189         return vendorCityName;
190     }
191 
192     public void setVendorCityName(String vendorCityName) {
193         this.vendorCityName = vendorCityName;
194     }
195 
196     public String getVendorCountryCode() {
197         return vendorCountryCode;
198     }
199 
200     public void setVendorCountryCode(String vendorCountryCode) {
201         this.vendorCountryCode = vendorCountryCode;
202     }
203 
204     public String getVendorLine1Address() {
205         return vendorLine1Address;
206     }
207 
208     public void setVendorLine1Address(String vendorLine1Address) {
209         this.vendorLine1Address = vendorLine1Address;
210     }
211 
212     public String getVendorLine2Address() {
213         return vendorLine2Address;
214     }
215 
216     public void setVendorLine2Address(String vendorLine2Address) {
217         this.vendorLine2Address = vendorLine2Address;
218     }
219 
220     public String getVendorStateCode() {
221         return vendorStateCode;
222     }
223 
224     public void setVendorStateCode(String vendorStateCode) {
225         this.vendorStateCode = vendorStateCode;
226     }
227 
228     public String getVendorZipCode() {
229         return vendorZipCode;
230     }
231 
232     public void setVendorZipCode(String vendorZipCode) {
233         this.vendorZipCode = vendorZipCode;
234     }
235 
236     public CountryEbo getVendorCountry() {
237         if ( StringUtils.isBlank(vendorCountryCode) ) {
238             vendorCountry = null;
239         } else {
240             if ( vendorCountry == null || !StringUtils.equals( vendorCountry.getCode(),vendorCountryCode) ) {
241                 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CountryEbo.class);
242                 if ( moduleService != null ) {
243                     Map<String,Object> keys = new HashMap<String, Object>(1);
244                     keys.put(LocationConstants.PrimaryKeyConstants.CODE, vendorCountryCode);
245                     vendorCountry = moduleService.getExternalizableBusinessObject(CountryEbo.class, keys);
246                 } else {
247                     throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
248                 }
249             }
250         }
251         return vendorCountry;
252     }
253 
254     public void setVendorCountry(CountryEbo vendorCountry) {
255         this.vendorCountry = vendorCountry;
256     }
257 
258     public StateEbo getVendorState() {
259         if ( StringUtils.isBlank(vendorStateCode) || StringUtils.isBlank(vendorCountryCode ) ) {
260             vendorState = null;
261         } else {
262             if ( vendorState == null || !StringUtils.equals( vendorState.getCode(),vendorStateCode) || !StringUtils.equals(vendorState.getCountryCode(), vendorCountryCode ) ) {
263                 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(StateEbo.class);
264                 if ( moduleService != null ) {
265                     Map<String,Object> keys = new HashMap<String, Object>(2);
266                     keys.put(LocationConstants.PrimaryKeyConstants.COUNTRY_CODE, vendorCountryCode);
267                     keys.put(LocationConstants.PrimaryKeyConstants.CODE, vendorStateCode);
268                     vendorState = moduleService.getExternalizableBusinessObject(StateEbo.class, keys);
269                 } else {
270                     throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
271                 }
272             }
273         }
274         return vendorState;
275     }
276 
277     public void setVendorState(StateEbo vendorState) {
278         this.vendorState = vendorState;
279     }
280 
281     public String getFaxForLookup() {
282         return faxForLookup;
283     }
284 
285     public void setFaxForLookup(String faxForLookup) {
286         this.faxForLookup = faxForLookup;
287     }
288 
289     public String getPhoneNumberForLookup() {
290         return phoneNumberForLookup;
291     }
292 
293     public void setPhoneNumberForLookup(String phoneNumberForLookup) {
294         this.phoneNumberForLookup = phoneNumberForLookup;
295     }
296 
297     public String getTollFreeForLookup() {
298         return tollFreeForLookup;
299     }
300 
301     public void setTollFreeForLookup(String tollFreeForLookup) {
302         this.tollFreeForLookup = tollFreeForLookup;
303     }
304 
305     public List<VendorContactPhoneNumber> getVendorContactPhoneNumbers() {
306         return vendorContactPhoneNumbers;
307     }
308 
309     public void setVendorContactPhoneNumbers(List<VendorContactPhoneNumber> vendorContactPhoneNumbers) {
310         this.vendorContactPhoneNumbers = vendorContactPhoneNumbers;
311     }
312 
313    
314 
315 
316 
317 
318 
319 
320 
321     public Account getVendorAccounts() {
322         return vendorAccounts;
323     }
324 
325     public void setVendorAccounts(Account vendorAccounts) {
326         this.vendorAccounts = vendorAccounts;
327     }
328 
329   
330 
331 
332 
333 
334 
335 
336 
337 
338 
339 
340 
341 
342 
343 
344 
345 
346 
347 
348 
349 
350 
351 
352 
353 
354 
355 
356 
357 
358 
359 
360 
361 
362 
363 
364 
365 
366 
367 
368 
369 
370 
371 
372 
373 
374 
375 
376 
377 
378 
379    
380 
381 
382 
383 
384 
385 
386 
387 
388 
389 
390 
391 
392 
393 
394 
395 }