001: /*
002: * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
003: * Reserved.
004: *
005: * This source code file is distributed by Lutris Technologies, Inc. for
006: * use only by licensed users of product(s) that include this source
007: * file. Use of this source file or the software that uses it is covered
008: * by the terms and conditions of the Lutris Enhydra Development License
009: * Agreement included with this product.
010: *
011: * This Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
012: * ANY KIND, either express or implied. See the License for the specific terms
013: * governing rights and limitations under the License.
014: *
015: * Contributor(s):
016: *
017: * $Id: AddressImpl.java,v 1.1 2006-09-11 12:27:24 sinisa Exp $
018: */
019:
020: package com.lutris.airsent.business.address;
021:
022: import com.lutris.airsent.business.AirSentBusinessException;
023: import com.lutris.airsent.data.person.AddressDO;
024: import com.lutris.appserver.server.sql.DatabaseManagerException;
025: import com.lutris.appserver.server.sql.ObjectIdException;
026: import com.lutris.dods.builder.generator.query.DataObjectException;
027: import com.lutris.airsent.spec.address.Address;
028:
029: /**
030: * Class declaration
031: *
032: *
033: * @author joseph shoop
034: * @version %I%, %G%
035: */
036: public class AddressImpl implements Address {
037: protected AddressDO addressDO = null;
038:
039: /**
040: * Creates an AddressImpl object.
041: */
042: public AddressImpl() throws AirSentBusinessException {
043: try {
044: addressDO = AddressDO.createVirgin();
045: } catch (Exception ex) {
046: throw new AirSentBusinessException("Error creating Address");
047: }
048: }
049:
050: /**
051: * Creates an Address object.
052: * @param AddressDO address
053: */
054: public AddressImpl(AddressDO address)
055: throws AirSentBusinessException {
056: this .addressDO = address;
057: }
058:
059: /**
060: * Creates an Address object with the given id
061: * @param AddressDO address
062: */
063: public AddressImpl(String id) throws AirSentBusinessException {
064: try {
065: addressDO = AddressDO.createExisting(id);
066: } catch (Exception ex) {
067: throw new AirSentBusinessException("Error creating Address");
068: }
069: }
070:
071: /**
072: * Gets the object handle.
073: * @return String
074: * @exception AirSentBusinessException
075: */
076: public String getHandle() throws AirSentBusinessException {
077: try {
078: return addressDO.getHandle();
079: } catch (DatabaseManagerException ex) {
080: throw new AirSentBusinessException(
081: "Error getting address's handle", ex);
082: }
083: }
084:
085: /**
086: *Gets the address data object
087: *@return data object
088: */
089: public AddressDO getDataObject() {
090: return addressDO;
091: }
092:
093: /**
094: * Gets the Address name.
095: * @return String
096: * @exception AirSentBusinessException
097: */
098: public String getName() throws AirSentBusinessException {
099: try {
100: return addressDO.getName();
101: } catch (DataObjectException ex) {
102: throw new AirSentBusinessException(
103: "Error getting address name", ex);
104: }
105: }
106:
107: /**
108: * Sets the Address name.
109: * @param name Address name
110: * @exception AirSentBusinessException
111: */
112: public void setName(String name) throws AirSentBusinessException {
113: try {
114: this .addressDO.setName(name);
115: } catch (DataObjectException ex) {
116: throw new AirSentBusinessException("Error setting name", ex);
117: }
118: }
119:
120: /**
121: * Get street1.
122: *
123: *
124: * @return
125: *
126: * @throws AirSentBusinessException
127: *
128: *
129: */
130: public String getStreet1() throws AirSentBusinessException {
131: try {
132: return addressDO.getStreet1();
133: } catch (DataObjectException ex) {
134: throw new AirSentBusinessException("Error getting street",
135: ex);
136: }
137: }
138:
139: /**
140: * Sets street1.
141: *
142: *
143: * @param street
144: *
145: * @throws AirSentBusinessException
146: *
147: *
148: */
149: public void setStreet1(String street)
150: throws AirSentBusinessException {
151: try {
152: this .addressDO.setStreet1(street);
153: } catch (DataObjectException ex) {
154: throw new AirSentBusinessException("Error setting street",
155: ex);
156: }
157: }
158:
159: /**
160: * Sets street2.
161: *
162: *
163: * @return
164: *
165: * @throws AirSentBusinessException
166: *
167: *
168: */
169: public String getStreet2() throws AirSentBusinessException {
170: try {
171: return addressDO.getStreet2();
172: } catch (DataObjectException ex) {
173: throw new AirSentBusinessException("Error getting street",
174: ex);
175: }
176: }
177:
178: /**
179: * Sets street2.
180: *
181: *
182: * @param street
183: *
184: * @throws AirSentBusinessException
185: *
186: *
187: */
188: public void setStreet2(String street)
189: throws AirSentBusinessException {
190: try {
191: this .addressDO.setStreet2(street);
192: } catch (DataObjectException ex) {
193: throw new AirSentBusinessException("Error setting street",
194: ex);
195: }
196: }
197:
198: /**
199: * Gets street3.
200: *
201: *
202: * @return
203: *
204: * @throws AirSentBusinessException
205: *
206: *
207: */
208: public String getStreet3() throws AirSentBusinessException {
209: try {
210: return addressDO.getStreet3();
211: } catch (DataObjectException ex) {
212: throw new AirSentBusinessException(
213: "Error getting address street", ex);
214: }
215: }
216:
217: /**
218: * Sets street3.
219: *
220: *
221: * @param street
222: *
223: * @throws AirSentBusinessException
224: *
225: *
226: */
227: public void setStreet3(String street)
228: throws AirSentBusinessException {
229: try {
230: this .addressDO.setStreet3(street);
231: } catch (DataObjectException ex) {
232: throw new AirSentBusinessException(
233: "Error setting address street", ex);
234: }
235: }
236:
237: /**
238: * Get the city.
239: *
240: *
241: * @return
242: *
243: * @throws AirSentBusinessException
244: *
245: *
246: */
247: public String getCity() throws AirSentBusinessException {
248: try {
249: return addressDO.getCity();
250: } catch (DataObjectException ex) {
251: throw new AirSentBusinessException(
252: "Error getting address city", ex);
253: }
254: }
255:
256: /**
257: * Sets the city.
258: *
259: *
260: * @param city
261: *
262: * @throws AirSentBusinessException
263: *
264: *
265: */
266: public void setCity(String city) throws AirSentBusinessException {
267: try {
268: this .addressDO.setCity(city);
269: } catch (DataObjectException ex) {
270: throw new AirSentBusinessException(
271: "Error setting address street", ex);
272: }
273: }
274:
275: /**
276: * Get the postal code.
277: *
278: *
279: * @return
280: *
281: * @throws AirSentBusinessException
282: *
283: *
284: */
285: public String getPostalCode() throws AirSentBusinessException {
286: try {
287: return addressDO.getPostalCode();
288: } catch (DataObjectException ex) {
289: throw new AirSentBusinessException(
290: "Error getting address postal", ex);
291: }
292: }
293:
294: /**
295: * Set the postal code.
296: *
297: *
298: * @param code
299: *
300: * @throws AirSentBusinessException
301: *
302: *
303: */
304: public void setPostalCode(String code)
305: throws AirSentBusinessException {
306: try {
307: this .addressDO.setPostalCode(code);
308: } catch (DataObjectException ex) {
309: throw new AirSentBusinessException(
310: "Error setting address postal", ex);
311: }
312: }
313:
314: /**
315: * Gets the local number.
316: *
317: *
318: * @return
319: *
320: * @throws AirSentBusinessException
321: *
322: *
323: */
324: public String getLocalNumber() throws AirSentBusinessException {
325: try {
326: return addressDO.getLocalNumber();
327: } catch (DataObjectException ex) {
328: throw new AirSentBusinessException(
329: "Error getting address phone", ex);
330: }
331: }
332:
333: /**
334: * Sets the local number.
335: *
336: *
337: * @param number
338: *
339: * @throws AirSentBusinessException
340: *
341: *
342: */
343: public void setLocalNumber(String number)
344: throws AirSentBusinessException {
345: try {
346: this .addressDO.setLocalNumber(number);
347: } catch (DataObjectException ex) {
348: throw new AirSentBusinessException(
349: "Error setting address phone", ex);
350: }
351: }
352:
353: /**
354: * Get the area code.
355: *
356: *
357: * @return
358: *
359: * @throws AirSentBusinessException
360: *
361: *
362: */
363: public String getAreaCode() throws AirSentBusinessException {
364: try {
365: return addressDO.getAreaCode();
366: } catch (DataObjectException ex) {
367: throw new AirSentBusinessException(
368: "Error getting address area code", ex);
369: }
370: }
371:
372: /**
373: * Sets the area code.
374: *
375: *
376: * @param area
377: *
378: * @throws AirSentBusinessException
379: *
380: *
381: */
382: public void setAreaCode(String area)
383: throws AirSentBusinessException {
384: try {
385: this .addressDO.setAreaCode(area);
386: } catch (DataObjectException ex) {
387: throw new AirSentBusinessException(
388: "Error setting address area code", ex);
389: }
390: }
391:
392: /**
393: * gets the state.
394: *
395: *
396: * @return
397: *
398: * @throws AirSentBusinessException
399: *
400: *
401: */
402: public String getState() throws AirSentBusinessException {
403: try {
404: return addressDO.getState();
405: } catch (DataObjectException ex) {
406: throw new AirSentBusinessException(
407: "Error getting address state", ex);
408: }
409: }
410:
411: /**
412: * Sets the state.
413: *
414: *
415: * @param state
416: *
417: * @throws AirSentBusinessException
418: *
419: *
420: */
421: public void setState(String state) throws AirSentBusinessException {
422: try {
423: this .addressDO.setState(state);
424: } catch (DataObjectException ex) {
425: throw new AirSentBusinessException(
426: "Error setting address state", ex);
427: }
428: }
429:
430: /**
431: * Gets the country.
432: *
433: *
434: * @return
435: *
436: * @throws AirSentBusinessException
437: *
438: *
439: */
440: public String getCountry() throws AirSentBusinessException {
441: try {
442: return addressDO.getCountry();
443: } catch (DataObjectException ex) {
444: throw new AirSentBusinessException(
445: "Error getting address country", ex);
446: }
447: }
448:
449: /**
450: * Sets the country.
451: *
452: *
453: * @param country
454: *
455: * @throws AirSentBusinessException
456: *
457: *
458: */
459: public void setCountry(String country)
460: throws AirSentBusinessException {
461: try {
462: this .addressDO.setCountry(country);
463: } catch (DataObjectException ex) {
464: throw new AirSentBusinessException(
465: "Error setting address country", ex);
466: }
467: }
468:
469: /**
470: * Gets the directions.
471: *
472: *
473: * @return
474: *
475: * @throws AirSentBusinessException
476: *
477: *
478: */
479: public String getDirections() throws AirSentBusinessException {
480: try {
481: return addressDO.getDirections();
482: } catch (DataObjectException ex) {
483: throw new AirSentBusinessException(
484: "Error getting address directions", ex);
485: }
486: }
487:
488: /**
489: * Sets the directions.
490: *
491: *
492: * @param directions
493: *
494: * @throws AirSentBusinessException
495: *
496: *
497: */
498: public void setDirections(String directions)
499: throws AirSentBusinessException {
500: try {
501: this .addressDO.setDirections(directions);
502: } catch (DataObjectException ex) {
503: throw new AirSentBusinessException(
504: "Error setting address directions", ex);
505: }
506: }
507:
508: /**
509: * Saves the address.
510: *
511: *
512: * @throws AirSentBusinessException
513: *
514: *
515: */
516: public void save() throws AirSentBusinessException {
517: try {
518: this .addressDO.commit();
519: } catch (Exception ex) {
520: throw new AirSentBusinessException("Error saving address",
521: ex);
522: }
523: }
524:
525: /**
526: * Deletes the address.
527: *
528: *
529: * @throws AirSentBusinessException
530: *
531: *
532: */
533: public void delete() throws AirSentBusinessException {
534: try {
535: this .addressDO.delete();
536: } catch (Exception ex) {
537: throw new AirSentBusinessException(
538: "Error deleting address", ex);
539: }
540: }
541:
542: }
|