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  /*
20   * Created on Mar 7, 2006
21   *
22   */
23  package org.kuali.kfs.module.purap.businessobject;
24  
25  import java.util.ArrayList;
26  import java.util.List;
27  
28  import org.apache.commons.lang.builder.ToStringBuilder;
29  
30  public class ElectronicInvoicePostalAddress {
31    // no deliverTo attributes currently
32    private String type;
33    private String line1 = "";
34    private String line2 = "";
35    private String line3 = "";
36    private String cityName;
37    private String stateCode;
38    private String postalCode;
39    private String countryCode;
40    private String countryName;
41    
42    private List names = new ArrayList();
43    
44    private List<String> street = new ArrayList<String>();
45    
46    public ElectronicInvoicePostalAddress() {
47      super();
48    }
49    
50    public void addName(String name) {
51      this.names.add(name);
52    }
53    
54    /**
55     * @return first name found in names list
56     */
57    public String getName() {
58      if (names.isEmpty()) {
59        return "";
60      } else {
61        return (String)names.get(0);
62      }
63    }
64    /**
65     * @return Returns the cityName.
66     */
67    public String getCityName() {
68      return cityName;
69    }
70    /**
71     * @param cityName The cityName to set.
72     */
73    public void setCityName(String cityName) {
74      this.cityName = cityName;
75    }
76    /**
77     * @return Returns the countryCode.
78     */
79    public String getCountryCode() {
80      return countryCode;
81    }
82    /**
83     * @param countryCode The countryCode to set.
84     */
85    public void setCountryCode(String countryCode) {
86      this.countryCode = countryCode;
87    }
88    /**
89     * @return Returns the countryName.
90     */
91    public String getCountryName() {
92      return countryName;
93    }
94    /**
95     * @param countryName The countryName to set.
96     */
97    public void setCountryName(String countryName) {
98      this.countryName = countryName;
99    }
100   /**
101    * @return Returns the line1.
102    */
103   public String getLine1() {
104 //    return line1;
105       if (street.size() > 0){
106           return street.get(0);
107       }else{
108           return null;
109       }
110   }
111   /**
112    * @param line1 The line1 to set.
113    */
114   public void setLine1(String line1) {
115     this.line1 = line1;
116   }
117   /**
118    * @return Returns the line2.
119    */
120   public String getLine2() {
121 //    return line2;
122       if (street.size() > 1){
123           return street.get(1);
124       }else{
125           return null;
126       }
127   }
128   /**
129    * @param line2 The line2 to set.
130    */
131   public void setLine2(String line2) {
132     this.line2 = line2;
133   }
134   /**
135    * @return Returns the line3.
136    */
137   public String getLine3() {
138 //    return line3;
139       if (street.size() > 2){
140           return street.get(2);
141       }else{
142           return null;
143       }
144   }
145   /**
146    * @param line3 The line3 to set.
147    */
148   public void setLine3(String line3) {
149     this.line3 = line3;
150   }
151   /**
152    * @return Returns the names.
153    */
154   public List getNames() {
155     return names;
156   }
157   /**
158    * @param names The names to set.
159    */
160   public void setNames(List names) {
161     this.names = names;
162   }
163   /**
164    * @return Returns the postalCode.
165    */
166   public String getPostalCode() {
167     return postalCode;
168   }
169   /**
170    * @param postalCode The postalCode to set.
171    */
172   public void setPostalCode(String postalCode) {
173     this.postalCode = postalCode;
174   }
175   /**
176    * @return Returns the stateCode.
177    */
178   public String getStateCode() {
179     return stateCode;
180   }
181   /**
182    * @param stateCode The stateCode to set.
183    */
184   public void setStateCode(String stateCode) {
185     this.stateCode = stateCode;
186   }
187   /**
188    * @return Returns the type.
189    */
190   public String getType() {
191     return type;
192   }
193   /**
194    * @param type The type to set.
195    */
196   public void setType(String type) {
197     this.type = type;
198   }
199   
200   public void addStreet(String street){
201       this.street.add(street);
202   }
203   
204   public String toString(){
205       
206       ToStringBuilder toString = new ToStringBuilder(this);
207       
208       toString.append("type",getType());
209       toString.append("line1",getLine1());
210       toString.append("line2",getLine2());
211       toString.append("line3",getLine3());
212       toString.append("cityName",getCityName());
213       toString.append("stateCode",getStateCode());
214       toString.append("postalCode",getPostalCode());
215       toString.append("countryCode",getCountryCode());
216       toString.append("countryName",getCountryName());
217       toString.append("Names(DeliverTo)",getNames());
218       
219       return toString.toString();
220   }
221 }