KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > airsent > business > address > AddressImpl


1 /*
2  * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
3  * Reserved.
4  *
5  * This source code file is distributed by Lutris Technologies, Inc. for
6  * use only by licensed users of product(s) that include this source
7  * file. Use of this source file or the software that uses it is covered
8  * by the terms and conditions of the Lutris Enhydra Development License
9  * Agreement included with this product.
10  *
11  * This Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
12  * ANY KIND, either express or implied. See the License for the specific terms
13  * governing rights and limitations under the License.
14  *
15  * Contributor(s):
16  *
17  * $Id: AddressImpl.java,v 1.1 2004/08/16 09:33:11 slobodan Exp $
18  */

19
20 package com.lutris.airsent.business.address;
21
22 import com.lutris.airsent.business.AirSentBusinessException;
23 import com.lutris.airsent.data.person.AddressDO;
24 import com.lutris.appserver.server.sql.DatabaseManagerException;
25 import com.lutris.appserver.server.sql.ObjectIdException;
26 import com.lutris.dods.builder.generator.query.DataObjectException;
27 import com.lutris.airsent.spec.address.Address;
28 /**
29  * Class declaration
30  *
31  *
32  * @author joseph shoop
33  * @version %I%, %G%
34  */

35 public class AddressImpl implements Address {
36     protected AddressDO addressDO = null;
37
38     /**
39      * Creates an AddressImpl object.
40      */

41     public AddressImpl() throws AirSentBusinessException {
42     try {
43         addressDO = AddressDO.createVirgin();
44     } catch (Exception JavaDoc ex) {
45         throw new AirSentBusinessException("Error creating Address");
46     }
47     }
48
49     /**
50      * Creates an Address object.
51      * @param AddressDO address
52      */

53     public AddressImpl(AddressDO address) throws AirSentBusinessException {
54     this.addressDO = address;
55     }
56
57
58      /**
59      * Creates an Address object with the given id
60      * @param AddressDO address
61      */

62     public AddressImpl(String JavaDoc id)
63         throws AirSentBusinessException {
64     try {
65             addressDO = AddressDO.createExisting(id);
66     } catch (Exception JavaDoc ex) {
67         throw new AirSentBusinessException("Error creating Address");
68     }
69     }
70
71
72
73
74     /**
75      * Gets the object handle.
76      * @return String
77      * @exception AirSentBusinessException
78      */

79     public String JavaDoc getHandle() throws AirSentBusinessException {
80     try {
81         return addressDO.getHandle();
82     } catch (DatabaseManagerException ex) {
83         throw new AirSentBusinessException("Error getting address's handle", ex);
84     }
85     }
86
87     /**
88      *Gets the address data object
89      *@return data object
90      */

91     public AddressDO getDataObject() {
92         return addressDO;
93     }
94
95
96     /**
97      * Gets the Address name.
98      * @return String
99      * @exception AirSentBusinessException
100      */

101     public String JavaDoc getName() throws AirSentBusinessException {
102     try {
103         return addressDO.getName();
104     } catch (DataObjectException ex) {
105         throw new AirSentBusinessException("Error getting address name",
106                            ex);
107     }
108     }
109
110     /**
111      * Sets the Address name.
112      * @param name Address name
113      * @exception AirSentBusinessException
114      */

115     public void setName(String JavaDoc name) throws AirSentBusinessException {
116     try {
117         this.addressDO.setName(name);
118     } catch (DataObjectException ex) {
119         throw new AirSentBusinessException("Error setting name", ex);
120     }
121     }
122
123     /**
124      * Get street1.
125      *
126      *
127      * @return
128      *
129      * @throws AirSentBusinessException
130      *
131      *
132      */

133     public String JavaDoc getStreet1() throws AirSentBusinessException {
134     try {
135         return addressDO.getStreet1();
136     } catch (DataObjectException ex) {
137         throw new AirSentBusinessException("Error getting street", ex);
138     }
139     }
140
141     /**
142      * Sets street1.
143      *
144      *
145      * @param street
146      *
147      * @throws AirSentBusinessException
148      *
149      *
150      */

151     public void setStreet1(String JavaDoc street) throws AirSentBusinessException {
152     try {
153         this.addressDO.setStreet1(street);
154     } catch (DataObjectException ex) {
155         throw new AirSentBusinessException("Error setting street", ex);
156     }
157     }
158
159     /**
160      * Sets street2.
161      *
162      *
163      * @return
164      *
165      * @throws AirSentBusinessException
166      *
167      *
168      */

169     public String JavaDoc getStreet2() throws AirSentBusinessException {
170     try {
171         return addressDO.getStreet2();
172     } catch (DataObjectException ex) {
173         throw new AirSentBusinessException("Error getting street", ex);
174     }
175     }
176
177     /**
178      * Sets street2.
179      *
180      *
181      * @param street
182      *
183      * @throws AirSentBusinessException
184      *
185      *
186      */

187     public void setStreet2(String JavaDoc street) throws AirSentBusinessException {
188     try {
189         this.addressDO.setStreet2(street);
190     } catch (DataObjectException ex) {
191         throw new AirSentBusinessException("Error setting street", ex);
192     }
193     }
194
195     /**
196      * Gets street3.
197      *
198      *
199      * @return
200      *
201      * @throws AirSentBusinessException
202      *
203      *
204      */

205     public String JavaDoc getStreet3() throws AirSentBusinessException {
206     try {
207         return addressDO.getStreet3();
208     } catch (DataObjectException ex) {
209         throw new AirSentBusinessException("Error getting address street",
210                            ex);
211     }
212     }
213
214     /**
215      * Sets street3.
216      *
217      *
218      * @param street
219      *
220      * @throws AirSentBusinessException
221      *
222      *
223      */

224     public void setStreet3(String JavaDoc street) throws AirSentBusinessException {
225     try {
226         this.addressDO.setStreet3(street);
227     } catch (DataObjectException ex) {
228         throw new AirSentBusinessException("Error setting address street",
229                            ex);
230     }
231     }
232
233     /**
234      * Get the city.
235      *
236      *
237      * @return
238      *
239      * @throws AirSentBusinessException
240      *
241      *
242      */

243     public String JavaDoc getCity() throws AirSentBusinessException {
244     try {
245         return addressDO.getCity();
246     } catch (DataObjectException ex) {
247         throw new AirSentBusinessException("Error getting address city",
248                            ex);
249     }
250     }
251
252     /**
253      * Sets the city.
254      *
255      *
256      * @param city
257      *
258      * @throws AirSentBusinessException
259      *
260      *
261      */

262     public void setCity(String JavaDoc city) throws AirSentBusinessException {
263     try {
264         this.addressDO.setCity(city);
265     } catch (DataObjectException ex) {
266         throw new AirSentBusinessException("Error setting address street",
267                            ex);
268     }
269     }
270
271     /**
272      * Get the postal code.
273      *
274      *
275      * @return
276      *
277      * @throws AirSentBusinessException
278      *
279      *
280      */

281     public String JavaDoc getPostalCode() throws AirSentBusinessException {
282     try {
283         return addressDO.getPostalCode();
284     } catch (DataObjectException ex) {
285         throw new AirSentBusinessException("Error getting address postal",
286                            ex);
287     }
288     }
289
290     /**
291      * Set the postal code.
292      *
293      *
294      * @param code
295      *
296      * @throws AirSentBusinessException
297      *
298      *
299      */

300     public void setPostalCode(String JavaDoc code) throws AirSentBusinessException {
301     try {
302         this.addressDO.setPostalCode(code);
303     } catch (DataObjectException ex) {
304         throw new AirSentBusinessException("Error setting address postal",
305                            ex);
306     }
307     }
308
309     /**
310      * Gets the local number.
311      *
312      *
313      * @return
314      *
315      * @throws AirSentBusinessException
316      *
317      *
318      */

319     public String JavaDoc getLocalNumber() throws AirSentBusinessException {
320     try {
321         return addressDO.getLocalNumber();
322     } catch (DataObjectException ex) {
323         throw new AirSentBusinessException("Error getting address phone",
324                            ex);
325     }
326     }
327
328     /**
329      * Sets the local number.
330      *
331      *
332      * @param number
333      *
334      * @throws AirSentBusinessException
335      *
336      *
337      */

338     public void setLocalNumber(String JavaDoc number)
339         throws AirSentBusinessException {
340     try {
341         this.addressDO.setLocalNumber(number);
342     } catch (DataObjectException ex) {
343         throw new AirSentBusinessException("Error setting address phone",
344                            ex);
345     }
346     }
347
348     /**
349      * Get the area code.
350      *
351      *
352      * @return
353      *
354      * @throws AirSentBusinessException
355      *
356      *
357      */

358     public String JavaDoc getAreaCode() throws AirSentBusinessException {
359     try {
360         return addressDO.getAreaCode();
361     } catch (DataObjectException ex) {
362         throw new AirSentBusinessException("Error getting address area code",
363                            ex);
364     }
365     }
366
367     /**
368      * Sets the area code.
369      *
370      *
371      * @param area
372      *
373      * @throws AirSentBusinessException
374      *
375      *
376      */

377     public void setAreaCode(String JavaDoc area) throws AirSentBusinessException {
378     try {
379         this.addressDO.setAreaCode(area);
380     } catch (DataObjectException ex) {
381         throw new AirSentBusinessException("Error setting address area code",
382                            ex);
383     }
384     }
385
386     /**
387      * gets the state.
388      *
389      *
390      * @return
391      *
392      * @throws AirSentBusinessException
393      *
394      *
395      */

396     public String JavaDoc getState() throws AirSentBusinessException {
397     try {
398         return addressDO.getState();
399     } catch (DataObjectException ex) {
400         throw new AirSentBusinessException("Error getting address state",
401                            ex);
402     }
403     }
404
405     /**
406      * Sets the state.
407      *
408      *
409      * @param state
410      *
411      * @throws AirSentBusinessException
412      *
413      *
414      */

415     public void setState(String JavaDoc state) throws AirSentBusinessException {
416     try {
417         this.addressDO.setState(state);
418     } catch (DataObjectException ex) {
419         throw new AirSentBusinessException("Error setting address state",
420                            ex);
421     }
422     }
423
424     /**
425      * Gets the country.
426      *
427      *
428      * @return
429      *
430      * @throws AirSentBusinessException
431      *
432      *
433      */

434     public String JavaDoc getCountry() throws AirSentBusinessException {
435     try {
436         return addressDO.getCountry();
437     } catch (DataObjectException ex) {
438         throw new AirSentBusinessException("Error getting address country",
439                            ex);
440     }
441     }
442
443     /**
444      * Sets the country.
445      *
446      *
447      * @param country
448      *
449      * @throws AirSentBusinessException
450      *
451      *
452      */

453     public void setCountry(String JavaDoc country) throws AirSentBusinessException {
454     try {
455         this.addressDO.setCountry(country);
456     } catch (DataObjectException ex) {
457         throw new AirSentBusinessException("Error setting address country",
458                            ex);
459     }
460     }
461
462     /**
463      * Gets the directions.
464      *
465      *
466      * @return
467      *
468      * @throws AirSentBusinessException
469      *
470      *
471      */

472     public String JavaDoc getDirections() throws AirSentBusinessException {
473     try {
474         return addressDO.getDirections();
475     } catch (DataObjectException ex) {
476         throw new AirSentBusinessException("Error getting address directions",
477                            ex);
478     }
479     }
480
481     /**
482      * Sets the directions.
483      *
484      *
485      * @param directions
486      *
487      * @throws AirSentBusinessException
488      *
489      *
490      */

491     public void setDirections(String JavaDoc directions)
492         throws AirSentBusinessException {
493     try {
494         this.addressDO.setDirections(directions);
495     } catch (DataObjectException ex) {
496         throw new AirSentBusinessException("Error setting address directions",
497                            ex);
498     }
499     }
500
501     /**
502      * Saves the address.
503      *
504      *
505      * @throws AirSentBusinessException
506      *
507      *
508      */

509     public void save() throws AirSentBusinessException {
510     try {
511         this.addressDO.commit();
512     } catch (Exception JavaDoc ex) {
513         throw new AirSentBusinessException("Error saving address", ex);
514     }
515     }
516
517     /**
518      * Deletes the address.
519      *
520      *
521      * @throws AirSentBusinessException
522      *
523      *
524      */

525     public void delete() throws AirSentBusinessException {
526     try {
527         this.addressDO.delete();
528     } catch (Exception JavaDoc ex) {
529         throw new AirSentBusinessException("Error deleting address", ex);
530     }
531     }
532
533 }
534
535
Popular Tags