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