KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > projectmanagement > business > customer > CustomerImpl


1 package projectmanagement.business.customer;
2
3 import projectmanagement.business.ProjectManagementBusinessException;
4 import projectmanagement.data.customer.*;
5 import com.lutris.appserver.server.sql.DatabaseManagerException;
6 import com.lutris.appserver.server.sql.ObjectIdException;
7 import com.lutris.dods.builder.generator.query.DataObjectException;
8
9 import projectmanagement.spec.customer.*;
10 /**
11  * Represents a customer.
12  *
13  * @author Sasa Bojanic
14  * @version 1.0
15  */

16 public class CustomerImpl implements Customer {
17    /**
18     * The DO of the Customer.
19     */

20    protected CustomerDO myDO = null;
21
22    /**
23     * The public constructor.
24     */

25    public CustomerImpl() throws ProjectManagementBusinessException {
26       try {
27          this.myDO = CustomerDO.createVirgin();
28       } catch(DatabaseManagerException ex) {
29          throw new ProjectManagementBusinessException("Error creating empty customer", ex);
30       } catch(ObjectIdException ex) {
31          throw new ProjectManagementBusinessException("Error creating object ID for customer", ex);
32       }
33    }
34
35    /** The public constructor
36     *
37     * @param theCustomer. The data object of the customer.
38     */

39    public CustomerImpl(CustomerDO theCustomer) {
40       this.myDO = theCustomer;
41    }
42
43    /**
44     * Gets the DO object for the customer
45     *
46     * @return the DO object.
47     * @exception ProjectManagementBusinessException if an error occurs
48     * retrieving data.
49     */

50    public CustomerDO getDO()
51          throws ProjectManagementBusinessException {
52       if (this.myDO!=null) {
53          return this.myDO;
54       } else {
55          throw new ProjectManagementBusinessException("Error getting DO object for customer");
56       }
57    }
58
59    /**
60     * Gets the object id for the customer
61     *
62     * @return the object id.
63     * @exception ProjectManagementBusinessException if an error occurs
64     * retrieving data (usually due to an underlying data layer
65     * error).
66     */

67    public String JavaDoc getHandle()
68          throws ProjectManagementBusinessException {
69       try {
70          return this.myDO.getHandle();
71       } catch(DatabaseManagerException ex) {
72          throw new ProjectManagementBusinessException("Error getting handle for customer", ex);
73       }
74    }
75
76    /**
77     * Sets the company name for the customer.
78     *
79     * @param the company name.
80     * @exception ProjectManagementBusinessException if an error occurs
81     * setting the data (usually due to an underlying data layer
82     * error).
83     */

84    public void setCompanyName(String JavaDoc companyName)
85       throws ProjectManagementBusinessException {
86       try {
87          myDO.setCompanyName(companyName);
88       } catch(DataObjectException ex) {
89          throw new ProjectManagementBusinessException("Error setting company name", ex);
90       }
91    }
92
93    /**
94     * Gets the company name for the customer
95     *
96     * @return the company name.
97     * @exception ProjectManagementBusinessException if an error occurs
98     * retrieving data (usually due to an underlying data layer
99     * error).
100     */

101    public String JavaDoc getCompanyName ()
102       throws ProjectManagementBusinessException {
103       try {
104          return myDO.getCompanyName();
105       } catch(DataObjectException ex) {
106          throw new ProjectManagementBusinessException("Error getting company name", ex);
107       }
108    }
109
110    /**
111     * Sets the contact name for the customer.
112     *
113     * @param the contact name.
114     * @exception ProjectManagementBusinessException if an error occurs
115     * setting the data (usually due to an underlying data layer
116     * error).
117     */

118    public void setContactName(String JavaDoc contactName)
119       throws ProjectManagementBusinessException {
120       try {
121          myDO.setContactName(contactName);
122       } catch(DataObjectException ex) {
123          throw new ProjectManagementBusinessException("Error setting contact name", ex);
124       }
125    }
126
127    /**
128     * Gets the contact name for the customer
129     *
130     * @return the contact name.
131     * @exception ProjectManagementBusinessException if an error occurs
132     * retrieving data (usually due to an underlying data layer
133     * error).
134     */

135    public String JavaDoc getContactName ()
136       throws ProjectManagementBusinessException {
137       try {
138          return myDO.getContactName();
139       } catch(DataObjectException ex) {
140          throw new ProjectManagementBusinessException("Error getting contact name", ex);
141       }
142    }
143
144    /**
145     * Sets the contact title.
146     *
147     * @param the contact title.
148     * @exception ProjectManagementBusinessException if an error occurs
149     * setting the data (usually due to an underlying data layer
150     * error).
151     */

152    public void setContactTitle(String JavaDoc contactTitle)
153       throws ProjectManagementBusinessException {
154       try {
155          myDO.setContactTitle(contactTitle);
156       } catch(DataObjectException ex) {
157          throw new ProjectManagementBusinessException("Error setting contact title", ex);
158       }
159    }
160
161    /**
162     * Gets the contact title
163     *
164     * @return the contact title.
165     * @exception ProjectManagementBusinessException if an error occurs
166     * retrieving data (usually due to an underlying data layer
167     * error).
168     */

169    public String JavaDoc getContactTitle()
170       throws ProjectManagementBusinessException {
171       try {
172          return myDO.getContactTitle();
173       } catch(DataObjectException ex) {
174          throw new ProjectManagementBusinessException("Error getting contact title", ex);
175       }
176    }
177
178    /**
179     * Sets the address for the customer.
180     *
181     * @param the address.
182     * @exception ProjectManagementBusinessException if an error occurs
183     * setting the data (usually due to an underlying data layer
184     * error).
185     */

186    public void setAddress(String JavaDoc address)
187       throws ProjectManagementBusinessException {
188       try {
189          myDO.setAddress(address);
190       } catch(DataObjectException ex) {
191          throw new ProjectManagementBusinessException("Error setting address", ex);
192       }
193    }
194
195    /**
196     * Gets the address.
197     *
198     * @return the address.
199     * @exception ProjectManagementBusinessException if an error occurs
200     * retrieving data (usually due to an underlying data layer
201     * error).
202     */

203    public String JavaDoc getAddress()
204       throws ProjectManagementBusinessException {
205       try {
206          return myDO.getAddress();
207       } catch(DataObjectException ex) {
208          throw new ProjectManagementBusinessException("Error getting address", ex);
209       }
210    }
211
212    /**
213     * Sets the customer's city.
214     *
215     * @param the customer's city.
216     * @exception ProjectManagementBusinessException if an error occurs
217     * setting the data (usually due to an underlying data layer
218     * error).
219     */

220    public void setCity(String JavaDoc city)
221       throws ProjectManagementBusinessException {
222       try {
223          myDO.setCity(city);
224       } catch(DataObjectException ex) {
225          throw new ProjectManagementBusinessException("Error setting city", ex);
226       }
227    }
228
229    /**
230     * Gets the customer city.
231     *
232     * @return the customer city.
233     * @exception ProjectManagementBusinessException if an error occurs
234     * retrieving data (usually due to an underlying data layer
235     * error).
236     */

237    public String JavaDoc getCity()
238       throws ProjectManagementBusinessException {
239       try {
240          return myDO.getCity();
241       } catch(DataObjectException ex) {
242          throw new ProjectManagementBusinessException("Error getting customer city", ex);
243       }
244    }
245
246    /**
247     * Sets the customer's region.
248     *
249     * @param the customer's region.
250     * @exception ProjectManagementBusinessException if an error occurs
251     * setting the data (usually due to an underlying data layer
252     * error).
253     */

254    public void setRegion(String JavaDoc region)
255       throws ProjectManagementBusinessException {
256       try {
257          myDO.setRegion(region);
258       } catch(DataObjectException ex) {
259          throw new ProjectManagementBusinessException("Error setting region", ex);
260       }
261    }
262
263    /**
264     * Gets the customer's region.
265     *
266     * @return the customer region.
267     * @exception ProjectManagementBusinessException if an error occurs
268     * retrieving data (usually due to an underlying data layer
269     * error).
270     */

271    public String JavaDoc getRegion()
272       throws ProjectManagementBusinessException {
273       try {
274          return myDO.getRegion();
275       } catch(DataObjectException ex) {
276          throw new ProjectManagementBusinessException("Error getting customer region", ex);
277       }
278    }
279
280    /**
281     * Sets the customer's postal code.
282     *
283     * @param the customer's postal code.
284     * @exception ProjectManagementBusinessException if an error occurs
285     * setting the data (usually due to an underlying data layer
286     * error).
287     */

288    public void setPostalCode(String JavaDoc postalCode)
289       throws ProjectManagementBusinessException {
290       try {
291          myDO.setPostalCode(postalCode);
292       } catch(DataObjectException ex) {
293          throw new ProjectManagementBusinessException("Error setting postal code", ex);
294       }
295    }
296
297    /**
298     * Gets the customer's postal code.
299     *
300     * @return the customer postal code.
301     * @exception ProjectManagementBusinessException if an error occurs
302     * retrieving data (usually due to an underlying data layer
303     * error).
304     */

305    public String JavaDoc getPostalCode()
306       throws ProjectManagementBusinessException {
307       try {
308          return myDO.getPostalCode();
309       } catch(DataObjectException ex) {
310          throw new ProjectManagementBusinessException("Error getting customer postal code", ex);
311       }
312    }
313
314    /**
315     * Sets the customer's country.
316     *
317     * @param the customer's country.
318     * @exception ProjectManagementBusinessException if an error occurs
319     * setting the data (usually due to an underlying data layer
320     * error).
321     */

322    public void setCountry(String JavaDoc country)
323       throws ProjectManagementBusinessException {
324       try {
325          myDO.setCountry(country);
326       } catch(DataObjectException ex) {
327          throw new ProjectManagementBusinessException("Error setting country", ex);
328       }
329    }
330
331    /**
332     * Gets the customer's country.
333     *
334     * @return the customer country.
335     * @exception ProjectManagementBusinessException if an error occurs
336     * retrieving data (usually due to an underlying data layer
337     * error).
338     */

339    public String JavaDoc getCountry()
340       throws ProjectManagementBusinessException {
341       try {
342          return myDO.getCountry();
343       } catch(DataObjectException ex) {
344          throw new ProjectManagementBusinessException("Error getting customer country", ex);
345       }
346    }
347
348    /**
349     * Sets the customer's phone.
350     *
351     * @param the customer's phone.
352     * @exception ProjectManagementBusinessException if an error occurs
353     * setting the data (usually due to an underlying data layer
354     * error).
355     */

356    public void setPhone(String JavaDoc phone)
357       throws ProjectManagementBusinessException {
358       try {
359          myDO.setPhone(phone);
360       } catch(DataObjectException ex) {
361          throw new ProjectManagementBusinessException("Error setting phone", ex);
362       }
363    }
364
365    /**
366     * Gets the customer's phone.
367     *
368     * @return the customer phone.
369     * @exception ProjectManagementBusinessException if an error occurs
370     * retrieving data (usually due to an underlying data layer
371     * error).
372     */

373    public String JavaDoc getPhone()
374       throws ProjectManagementBusinessException {
375       try {
376          return myDO.getPhone();
377       } catch(DataObjectException ex) {
378          throw new ProjectManagementBusinessException("Error getting customer phone", ex);
379       }
380    }
381
382    /**
383     * Sets the customer's fax.
384     *
385     * @param the customer's fax.
386     * @exception ProjectManagementBusinessException if an error occurs
387     * setting the data (usually due to an underlying data layer
388     * error).
389     */

390    public void setFax(String JavaDoc fax)
391       throws ProjectManagementBusinessException {
392       try {
393          myDO.setFax(fax);
394       } catch(DataObjectException ex) {
395          throw new ProjectManagementBusinessException("Error setting fax", ex);
396       }
397    }
398
399    /**
400     * Gets the customer's fax.
401     *
402     * @return the customer fax.
403     * @exception ProjectManagementBusinessException if an error occurs
404     * retrieving data (usually due to an underlying data layer
405     * error).
406     */

407    public String JavaDoc getFax()
408       throws ProjectManagementBusinessException {
409       try {
410          return myDO.getFax();
411       } catch(DataObjectException ex) {
412          throw new ProjectManagementBusinessException("Error getting customer fax", ex);
413       }
414    }
415
416    /**
417     * Sets the customer's email.
418     *
419     * @param the customer's email.
420     * @exception ProjectManagementBusinessException if an error occurs
421     * setting the data (usually due to an underlying data layer
422     * error).
423     */

424    public void setEmail(String JavaDoc email)
425       throws ProjectManagementBusinessException {
426       try {
427          myDO.setEmail(email);
428       } catch(DataObjectException ex) {
429          throw new ProjectManagementBusinessException("Error setting email", ex);
430       }
431    }
432
433    /**
434     * Gets the customer's email.
435     *
436     * @return the customer email.
437     * @exception ProjectManagementBusinessException if an error occurs
438     * retrieving data (usually due to an underlying data layer
439     * error).
440     */

441    public String JavaDoc getEmail()
442       throws ProjectManagementBusinessException {
443       try {
444          return myDO.getEmail();
445       } catch(DataObjectException ex) {
446          throw new ProjectManagementBusinessException("Error getting customer email", ex);
447       }
448    }
449
450    /**
451     * Sets the customer's notes.
452     *
453     * @param the customer's notes.
454     * @exception ProjectManagementBusinessException if an error occurs
455     * setting the data (usually due to an underlying data layer
456     * error).
457     */

458    public void setNotes(String JavaDoc notes)
459       throws ProjectManagementBusinessException {
460       try {
461          myDO.setNotes(notes);
462       } catch(DataObjectException ex) {
463          throw new ProjectManagementBusinessException("Error setting notes", ex);
464       }
465    }
466
467    /**
468     * Gets the customer's notes.
469     *
470     * @return the customer notes.
471     * @exception ProjectManagementBusinessException if an error occurs
472     * retrieving data (usually due to an underlying data layer
473     * error).
474     */

475    public String JavaDoc getNotes()
476       throws ProjectManagementBusinessException {
477       try {
478          return myDO.getNotes();
479       } catch(DataObjectException ex) {
480          throw new ProjectManagementBusinessException("Error getting customer notes", ex);
481       }
482    }
483
484    /**
485     * Commits all changes to the database.
486     *
487     * @exception ProjectManagementBusinessException if an error occurs
488     * retrieving data (usually due to an underlying data layer
489     * error).
490     */

491    public void save() throws ProjectManagementBusinessException {
492       try {
493          this.myDO.save();
494       } catch(Exception JavaDoc ex) {
495          throw new ProjectManagementBusinessException("Error saving customer", ex);
496       }
497    }
498
499    /**
500     * Deletes the customer from database.
501     *
502     * @exception ProjectManagementBusinessException if an error occurs
503     * deleting data (usually due to an underlying data layer
504     * error).
505     */

506    public void delete() throws ProjectManagementBusinessException {
507       try {
508          this.myDO.delete();
509       } catch(Exception JavaDoc ex) {
510          throw new ProjectManagementBusinessException("Error deleting customer", ex);
511       }
512    }
513
514 }
515
Popular Tags