View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.kfs.module.cg.businessobject;
20  
21  import java.sql.Date;
22  import java.util.LinkedHashMap;
23  
24  import org.kuali.kfs.integration.ar.AccountsReceivableCustomer;
25  import org.kuali.kfs.integration.ar.AccountsReceivableCustomerAddressType;
26  import org.kuali.kfs.integration.cg.ContractsAndGrantsAgencyAddress;
27  import org.kuali.kfs.module.ar.ArPropertyConstants;
28  import org.kuali.kfs.module.cg.CGConstants;
29  import org.kuali.kfs.module.cg.CGPropertyConstants;
30  import org.kuali.kfs.sys.KFSPropertyConstants;
31  import org.kuali.kfs.sys.context.SpringContext;
32  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
33  import org.kuali.rice.krad.service.KualiModuleService;
34  import org.kuali.rice.krad.util.ObjectUtils;
35  import org.kuali.rice.location.framework.country.CountryEbo;
36  
37  public class AgencyAddress extends PersistableBusinessObjectBase implements Primaryable, ContractsAndGrantsAgencyAddress {
38  
39      private String agencyNumber;
40      private Long agencyAddressIdentifier;
41      private String agencyAddressName;
42      private String agencyContactName;
43      private String agencyLine1StreetAddress;
44      private String agencyLine2StreetAddress;
45      private String agencyLine3StreetAddress;
46      private String agencyLine4StreetAddress;
47      private String agencyCityName;
48      private String agencyStateCode;
49      private String agencyZipCode;
50      private String agencyCountryCode;
51      private String agencyPhoneNumber;
52      private String agencyFaxNumber;
53      private String agencyAddressInternationalProvinceName;
54      private String agencyInternationalMailCode;
55      private String agencyContactEmailAddress;
56      private String customerAddressTypeCode;
57      private Date agencyAddressEndDate;
58  
59      private AccountsReceivableCustomerAddressType customerAddressType;
60      private Agency agency;
61      private CountryEbo agencyCountry;
62  
63       /**
64       * Gets the agencyNumber attribute.
65       *
66       * @return Returns the agencyNumber
67       */
68      @Override
69      public String getAgencyNumber() {
70          return agencyNumber;
71      }
72  
73      /**
74       * Sets the agencyNumber attribute.
75       *
76       * @param agencyNumber The agencyNumber to set.
77       */
78      public void setAgencyNumber(String agencyNumber) {
79          this.agencyNumber = agencyNumber;
80      }
81  
82  
83      /**
84       * Gets the agencyAddressIdentifier attribute.
85       *
86       * @return Returns the agencyAddressIdentifier
87       */
88      @Override
89      public Long getAgencyAddressIdentifier() {
90          return agencyAddressIdentifier;
91      }
92  
93      /**
94       * Sets the agencyAddressIdentifier attribute.
95       *
96       * @param agencyAddressIdentifier The agencyAddressIdentifier to set.
97       */
98      public void setAgencyAddressIdentifier(Long agencyAddressIdentifier) {
99          this.agencyAddressIdentifier = agencyAddressIdentifier;
100     }
101 
102 
103     /**
104      * Gets the agencyAddressName attribute.
105      *
106      * @return Returns the agencyAddressName
107      */
108     @Override
109     public String getAgencyAddressName() {
110         return agencyAddressName;
111     }
112 
113     /**
114      * Sets the agencyAddressName attribute.
115      *
116      * @param agencyAddressName The agencyAddressName to set.
117      */
118     public void setAgencyAddressName(String agencyAddressName) {
119         this.agencyAddressName = agencyAddressName;
120     }
121 
122 
123     /**
124      * Gets the agencyLine1StreetAddress attribute.
125      *
126      * @return Returns the agencyLine1StreetAddress
127      */
128     @Override
129     public String getAgencyLine1StreetAddress() {
130         return agencyLine1StreetAddress;
131     }
132 
133     /**
134      * Sets the agencyLine1StreetAddress attribute.
135      *
136      * @param agencyLine1StreetAddress The agencyLine1StreetAddress to set.
137      */
138     public void setAgencyLine1StreetAddress(String agencyLine1StreetAddress) {
139         this.agencyLine1StreetAddress = agencyLine1StreetAddress;
140     }
141 
142 
143     /**
144      * Gets the agencyLine2StreetAddress attribute.
145      *
146      * @return Returns the agencyLine2StreetAddress
147      */
148     @Override
149     public String getAgencyLine2StreetAddress() {
150         return agencyLine2StreetAddress;
151     }
152 
153     /**
154      * Sets the agencyLine2StreetAddress attribute.
155      *
156      * @param agencyLine2StreetAddress The agencyLine2StreetAddress to set.
157      */
158     public void setAgencyLine2StreetAddress(String agencyLine2StreetAddress) {
159         this.agencyLine2StreetAddress = agencyLine2StreetAddress;
160     }
161 
162     /**
163      * Gets the agencyLine3StreetAddress attribute.
164      *
165      * @return Returns the agencyLine3StreetAddress
166      */
167     @Override
168     public String getAgencyLine3StreetAddress() {
169         return agencyLine3StreetAddress;
170     }
171 
172     /**
173      * Sets the agencyLine3StreetAddress attribute.
174      *
175      * @param agencyLine3StreetAddress The agencyLine3StreetAddress to set.
176      */
177     public void setAgencyLine3StreetAddress(String agencyLine3StreetAddress) {
178         this.agencyLine3StreetAddress = agencyLine3StreetAddress;
179     }
180 
181     /**
182      * Gets the agencyLine4StreetAddress attribute.
183      *
184      * @return Returns the agencyLine4StreetAddress
185      */
186     @Override
187     public String getAgencyLine4StreetAddress() {
188         return agencyLine4StreetAddress;
189     }
190 
191     /**
192      * Sets the agencyLine4StreetAddress attribute.
193      *
194      * @param agencyLine4StreetAddress The agencyLine4StreetAddress to set.
195      */
196     public void setAgencyLine4StreetAddress(String agencyLine4StreetAddress) {
197         this.agencyLine4StreetAddress = agencyLine4StreetAddress;
198     }
199 
200     /**
201      * Gets the agencyCityName attribute.
202      *
203      * @return Returns the agencyCityName
204      */
205     @Override
206     public String getAgencyCityName() {
207         return agencyCityName;
208     }
209 
210     /**
211      * Sets the agencyCityName attribute.
212      *
213      * @param agencyCityName The agencyCityName to set.
214      */
215     public void setAgencyCityName(String agencyCityName) {
216         this.agencyCityName = agencyCityName;
217     }
218 
219 
220     /**
221      * Gets the agencyStateCode attribute.
222      *
223      * @return Returns the agencyStateCode
224      */
225     @Override
226     public String getAgencyStateCode() {
227         return agencyStateCode;
228     }
229 
230     /**
231      * Sets the agencyStateCode attribute.
232      *
233      * @param agencyStateCode The agencyStateCode to set.
234      */
235     public void setAgencyStateCode(String agencyStateCode) {
236         this.agencyStateCode = agencyStateCode;
237     }
238 
239 
240     /**
241      * Gets the agencyZipCode attribute.
242      *
243      * @return Returns the agencyZipCode
244      */
245     @Override
246     public String getAgencyZipCode() {
247         return agencyZipCode;
248     }
249 
250     /**
251      * Sets the agencyZipCode attribute.
252      *
253      * @param agencyZipCode The agencyZipCode to set.
254      */
255     public void setAgencyZipCode(String agencyZipCode) {
256         this.agencyZipCode = agencyZipCode;
257     }
258 
259     /**
260      * Gets the agencyAddressInternationalProvinceName attribute.
261      *
262      * @return Returns the agencyAddressInternationalProvinceName.
263      */
264     @Override
265     public String getAgencyAddressInternationalProvinceName() {
266         return agencyAddressInternationalProvinceName;
267     }
268 
269     /**
270      * Sets the agencyAddressInternationalProvinceName attribute value.
271      *
272      * @param agencyAddressInternationalProvinceName The agencyAddressInternationalProvinceName to set.
273      */
274     public void setAgencyAddressInternationalProvinceName(String agencyAddressInternationalProvinceName) {
275         this.agencyAddressInternationalProvinceName = agencyAddressInternationalProvinceName;
276     }
277 
278     /**
279      * Gets the agencyCountryCode attribute.
280      *
281      * @return Returns the agencyCountryCode.
282      */
283     @Override
284     public String getAgencyCountryCode() {
285         return agencyCountryCode;
286     }
287 
288     /**
289      * Sets the agencyCountryCode attribute value.
290      *
291      * @param agencyCountryCode The agencyCountryCode to set.
292      */
293     public void setAgencyCountryCode(String agencyCountryCode) {
294         this.agencyCountryCode = agencyCountryCode;
295     }
296 
297     /**
298      * Gets the agencyInternationalMailCode attribute.
299      *
300      * @return Returns the agencyInternationalMailCode
301      */
302     @Override
303     public String getAgencyInternationalMailCode() {
304         return agencyInternationalMailCode;
305     }
306 
307     /**
308      * Sets the agencyInternationalMailCode attribute.
309      *
310      * @param agencyInternationalMailCode The agencyInternationalMailCode to set.
311      */
312     public void setAgencyInternationalMailCode(String agencyInternationalMailCode) {
313         this.agencyInternationalMailCode = agencyInternationalMailCode;
314     }
315 
316 
317     /**
318      * Gets the agencyContactEmailAddress attribute.
319      *
320      * @return Returns the agencyContactEmailAddress.
321      */
322     @Override
323     public String getAgencyContactEmailAddress() {
324         return agencyContactEmailAddress;
325     }
326 
327     /**
328      * Sets the agencyContactEmailAddress attribute value.
329      *
330      * @param agencyContactEmailAddress The agencyContactEmailAddress to set.
331      */
332     public void setAgencyContactEmailAddress(String agencyContactEmailAddress) {
333         this.agencyContactEmailAddress = agencyContactEmailAddress;
334     }
335 
336     @Override
337     public String getCustomerAddressTypeCode() {
338         return customerAddressTypeCode;
339     }
340 
341     public void setCustomerAddressTypeCode(String customerAddressTypeCode) {
342         this.customerAddressTypeCode = customerAddressTypeCode;
343     }
344 
345     /**
346      * Gets the agencyAddressEndDate attribute.
347      *
348      * @return Returns the agencyAddressEndDate
349      */
350     @Override
351     public Date getAgencyAddressEndDate() {
352         return agencyAddressEndDate;
353     }
354 
355     /**
356      * Sets the agencyAddressEndDate attribute.
357      *
358      * @param agencyAddressEndDate The agencyAddressEndDate to set.
359      */
360     public void setAgencyAddressEndDate(Date agencyAddressEndDate) {
361         this.agencyAddressEndDate = agencyAddressEndDate;
362     }
363 
364     /**
365      * Gets the customerAddressType attribute.
366      *
367      * @return Returns the customerAddressType
368      */
369     public AccountsReceivableCustomerAddressType getCustomerAddressType() {
370         return customerAddressType;
371     }
372 
373     /**
374      * Sets the customerAddressType attribute.
375      *
376      * @param customerAddressType The customerAddressType to set.
377      * @deprecated
378      */
379     @Deprecated
380     public void setCustomerAddressType(AccountsReceivableCustomerAddressType customerAddressType) {
381         this.customerAddressType = customerAddressType;
382     }
383 
384 
385     /**
386      * Gets the agency attribute.
387      *
388      * @return Returns the agency.
389      */
390     @Override
391     public Agency getAgency() {
392         return agency;
393     }
394 
395     /**
396      * Sets the agency attribute value.
397      *
398      * @param agency The agency to set.
399      */
400     public void setAgency(Agency agency) {
401         this.agency = agency;
402     }
403 
404     /**
405      * Gets the agencyCountry attribute.
406      *
407      * @return Returns the agencyCountry.
408      */
409     public CountryEbo getAgencyCountry() {
410         return agencyCountry = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(AccountsReceivableCustomer.class).retrieveExternalizableBusinessObjectIfNecessary(this, agencyCountry, CGPropertyConstants.AgencyAddressFields.AGENCY_COUNTRY);
411     }
412 
413     /**
414      * Sets the agencyCountry attribute value.
415      *
416      * @param agencyCountry The agencyCountry to set.
417      * @deprecated
418      */
419     @Deprecated
420     public void setAgencyCountry(CountryEbo agencyCountry) {
421         this.agencyCountry = agencyCountry;
422     }
423 
424     /**
425      * Gets the agencyContactName attribute.
426      *
427      * @return Returns the agencyContactName.
428      */
429     @Override
430     public String getAgencyContactName() {
431         return agencyContactName;
432     }
433 
434     /**
435      * Sets the agencyContactName attribute value.
436      *
437      * @param agencyContactName The agencyContactName to set.
438      */
439     public void setAgencyContactName(String agencyContactName) {
440         this.agencyContactName = agencyContactName;
441     }
442 
443     /**
444      * Gets the agencyPhoneNumber attribute.
445      *
446      * @return Returns the agencyPhoneNumber.
447      */
448     @Override
449     public String getAgencyPhoneNumber() {
450         return agencyPhoneNumber;
451     }
452 
453     /**
454      * Sets the agencyPhoneNumber attribute value.
455      *
456      * @param agencyPhoneNumber The agencyPhoneNumber to set.
457      */
458     public void setAgencyPhoneNumber(String agencyPhoneNumber) {
459         this.agencyPhoneNumber = agencyPhoneNumber;
460     }
461 
462     /**
463      * Gets the agencyFaxNumber attribute.
464      *
465      * @return Returns the agencyFaxNumber.
466      */
467     @Override
468     public String getAgencyFaxNumber() {
469         return agencyFaxNumber;
470     }
471 
472     /**
473      * Sets the agencyFaxNumber attribute value.
474      *
475      * @param agencyFaxNumber The agencyFaxNumber to set.
476      */
477     public void setAgencyFaxNumber(String agencyFaxNumber) {
478         this.agencyFaxNumber = agencyFaxNumber;
479     }
480 
481     /**
482      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
483      */
484     @SuppressWarnings("unchecked")
485     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
486         LinkedHashMap m = new LinkedHashMap();
487         m.put(KFSPropertyConstants.AGENCY_NUMBER, this.agencyNumber);
488         if (this.agencyAddressIdentifier != null) {
489             m.put(ArPropertyConstants.ContractsAndGrantsAgencyAddressFields.AGENCY_ADDRESS_IDENTIFIER, this.agencyAddressIdentifier.toString());
490         }
491         return m;
492     }
493 
494     @Override
495     public boolean isPrimary() {
496         if (ObjectUtils.isNotNull(this.customerAddressTypeCode) && this.customerAddressTypeCode.equals(CGConstants.AGENCY_PRIMARY_ADDRESSES_TYPE_CODE)) {
497             return true;
498         }
499         return false;
500     }
501 }