001: package projectmanagement.business.customer;
002:
003: import projectmanagement.business.ProjectManagementBusinessException;
004: import projectmanagement.data.customer.*;
005: import com.lutris.appserver.server.sql.DatabaseManagerException;
006: import com.lutris.appserver.server.sql.ObjectIdException;
007: import com.lutris.dods.builder.generator.query.DataObjectException;
008:
009: import projectmanagement.spec.customer.*;
010:
011: /**
012: * Represents a customer.
013: *
014: * @author Sasa Bojanic
015: * @version 1.0
016: */
017: public class CustomerImpl implements Customer {
018: /**
019: * The DO of the Customer.
020: */
021: protected CustomerDO myDO = null;
022:
023: /**
024: * The public constructor.
025: */
026: public CustomerImpl() throws ProjectManagementBusinessException {
027: try {
028: this .myDO = CustomerDO.createVirgin();
029: } catch (DatabaseManagerException ex) {
030: throw new ProjectManagementBusinessException(
031: "Error creating empty customer", ex);
032: } catch (ObjectIdException ex) {
033: throw new ProjectManagementBusinessException(
034: "Error creating object ID for customer", ex);
035: }
036: }
037:
038: /** The public constructor
039: *
040: * @param theCustomer. The data object of the customer.
041: */
042: public CustomerImpl(CustomerDO theCustomer) {
043: this .myDO = theCustomer;
044: }
045:
046: /**
047: * Gets the DO object for the customer
048: *
049: * @return the DO object.
050: * @exception ProjectManagementBusinessException if an error occurs
051: * retrieving data.
052: */
053: public CustomerDO getDO() throws ProjectManagementBusinessException {
054: if (this .myDO != null) {
055: return this .myDO;
056: } else {
057: throw new ProjectManagementBusinessException(
058: "Error getting DO object for customer");
059: }
060: }
061:
062: /**
063: * Gets the object id for the customer
064: *
065: * @return the object id.
066: * @exception ProjectManagementBusinessException if an error occurs
067: * retrieving data (usually due to an underlying data layer
068: * error).
069: */
070: public String getHandle() throws ProjectManagementBusinessException {
071: try {
072: return this .myDO.getHandle();
073: } catch (DatabaseManagerException ex) {
074: throw new ProjectManagementBusinessException(
075: "Error getting handle for customer", ex);
076: }
077: }
078:
079: /**
080: * Sets the company name for the customer.
081: *
082: * @param the company name.
083: * @exception ProjectManagementBusinessException if an error occurs
084: * setting the data (usually due to an underlying data layer
085: * error).
086: */
087: public void setCompanyName(String companyName)
088: throws ProjectManagementBusinessException {
089: try {
090: myDO.setCompanyName(companyName);
091: } catch (DataObjectException ex) {
092: throw new ProjectManagementBusinessException(
093: "Error setting company name", ex);
094: }
095: }
096:
097: /**
098: * Gets the company name for the customer
099: *
100: * @return the company name.
101: * @exception ProjectManagementBusinessException if an error occurs
102: * retrieving data (usually due to an underlying data layer
103: * error).
104: */
105: public String getCompanyName()
106: throws ProjectManagementBusinessException {
107: try {
108: return myDO.getCompanyName();
109: } catch (DataObjectException ex) {
110: throw new ProjectManagementBusinessException(
111: "Error getting company name", ex);
112: }
113: }
114:
115: /**
116: * Sets the contact name for the customer.
117: *
118: * @param the contact name.
119: * @exception ProjectManagementBusinessException if an error occurs
120: * setting the data (usually due to an underlying data layer
121: * error).
122: */
123: public void setContactName(String contactName)
124: throws ProjectManagementBusinessException {
125: try {
126: myDO.setContactName(contactName);
127: } catch (DataObjectException ex) {
128: throw new ProjectManagementBusinessException(
129: "Error setting contact name", ex);
130: }
131: }
132:
133: /**
134: * Gets the contact name for the customer
135: *
136: * @return the contact name.
137: * @exception ProjectManagementBusinessException if an error occurs
138: * retrieving data (usually due to an underlying data layer
139: * error).
140: */
141: public String getContactName()
142: throws ProjectManagementBusinessException {
143: try {
144: return myDO.getContactName();
145: } catch (DataObjectException ex) {
146: throw new ProjectManagementBusinessException(
147: "Error getting contact name", ex);
148: }
149: }
150:
151: /**
152: * Sets the contact title.
153: *
154: * @param the contact title.
155: * @exception ProjectManagementBusinessException if an error occurs
156: * setting the data (usually due to an underlying data layer
157: * error).
158: */
159: public void setContactTitle(String contactTitle)
160: throws ProjectManagementBusinessException {
161: try {
162: myDO.setContactTitle(contactTitle);
163: } catch (DataObjectException ex) {
164: throw new ProjectManagementBusinessException(
165: "Error setting contact title", ex);
166: }
167: }
168:
169: /**
170: * Gets the contact title
171: *
172: * @return the contact title.
173: * @exception ProjectManagementBusinessException if an error occurs
174: * retrieving data (usually due to an underlying data layer
175: * error).
176: */
177: public String getContactTitle()
178: throws ProjectManagementBusinessException {
179: try {
180: return myDO.getContactTitle();
181: } catch (DataObjectException ex) {
182: throw new ProjectManagementBusinessException(
183: "Error getting contact title", ex);
184: }
185: }
186:
187: /**
188: * Sets the address for the customer.
189: *
190: * @param the address.
191: * @exception ProjectManagementBusinessException if an error occurs
192: * setting the data (usually due to an underlying data layer
193: * error).
194: */
195: public void setAddress(String address)
196: throws ProjectManagementBusinessException {
197: try {
198: myDO.setAddress(address);
199: } catch (DataObjectException ex) {
200: throw new ProjectManagementBusinessException(
201: "Error setting address", ex);
202: }
203: }
204:
205: /**
206: * Gets the address.
207: *
208: * @return the address.
209: * @exception ProjectManagementBusinessException if an error occurs
210: * retrieving data (usually due to an underlying data layer
211: * error).
212: */
213: public String getAddress()
214: throws ProjectManagementBusinessException {
215: try {
216: return myDO.getAddress();
217: } catch (DataObjectException ex) {
218: throw new ProjectManagementBusinessException(
219: "Error getting address", ex);
220: }
221: }
222:
223: /**
224: * Sets the customer's city.
225: *
226: * @param the customer's city.
227: * @exception ProjectManagementBusinessException if an error occurs
228: * setting the data (usually due to an underlying data layer
229: * error).
230: */
231: public void setCity(String city)
232: throws ProjectManagementBusinessException {
233: try {
234: myDO.setCity(city);
235: } catch (DataObjectException ex) {
236: throw new ProjectManagementBusinessException(
237: "Error setting city", ex);
238: }
239: }
240:
241: /**
242: * Gets the customer city.
243: *
244: * @return the customer city.
245: * @exception ProjectManagementBusinessException if an error occurs
246: * retrieving data (usually due to an underlying data layer
247: * error).
248: */
249: public String getCity() throws ProjectManagementBusinessException {
250: try {
251: return myDO.getCity();
252: } catch (DataObjectException ex) {
253: throw new ProjectManagementBusinessException(
254: "Error getting customer city", ex);
255: }
256: }
257:
258: /**
259: * Sets the customer's region.
260: *
261: * @param the customer's region.
262: * @exception ProjectManagementBusinessException if an error occurs
263: * setting the data (usually due to an underlying data layer
264: * error).
265: */
266: public void setRegion(String region)
267: throws ProjectManagementBusinessException {
268: try {
269: myDO.setRegion(region);
270: } catch (DataObjectException ex) {
271: throw new ProjectManagementBusinessException(
272: "Error setting region", ex);
273: }
274: }
275:
276: /**
277: * Gets the customer's region.
278: *
279: * @return the customer region.
280: * @exception ProjectManagementBusinessException if an error occurs
281: * retrieving data (usually due to an underlying data layer
282: * error).
283: */
284: public String getRegion() throws ProjectManagementBusinessException {
285: try {
286: return myDO.getRegion();
287: } catch (DataObjectException ex) {
288: throw new ProjectManagementBusinessException(
289: "Error getting customer region", ex);
290: }
291: }
292:
293: /**
294: * Sets the customer's postal code.
295: *
296: * @param the customer's postal code.
297: * @exception ProjectManagementBusinessException if an error occurs
298: * setting the data (usually due to an underlying data layer
299: * error).
300: */
301: public void setPostalCode(String postalCode)
302: throws ProjectManagementBusinessException {
303: try {
304: myDO.setPostalCode(postalCode);
305: } catch (DataObjectException ex) {
306: throw new ProjectManagementBusinessException(
307: "Error setting postal code", ex);
308: }
309: }
310:
311: /**
312: * Gets the customer's postal code.
313: *
314: * @return the customer postal code.
315: * @exception ProjectManagementBusinessException if an error occurs
316: * retrieving data (usually due to an underlying data layer
317: * error).
318: */
319: public String getPostalCode()
320: throws ProjectManagementBusinessException {
321: try {
322: return myDO.getPostalCode();
323: } catch (DataObjectException ex) {
324: throw new ProjectManagementBusinessException(
325: "Error getting customer postal code", ex);
326: }
327: }
328:
329: /**
330: * Sets the customer's country.
331: *
332: * @param the customer's country.
333: * @exception ProjectManagementBusinessException if an error occurs
334: * setting the data (usually due to an underlying data layer
335: * error).
336: */
337: public void setCountry(String country)
338: throws ProjectManagementBusinessException {
339: try {
340: myDO.setCountry(country);
341: } catch (DataObjectException ex) {
342: throw new ProjectManagementBusinessException(
343: "Error setting country", ex);
344: }
345: }
346:
347: /**
348: * Gets the customer's country.
349: *
350: * @return the customer country.
351: * @exception ProjectManagementBusinessException if an error occurs
352: * retrieving data (usually due to an underlying data layer
353: * error).
354: */
355: public String getCountry()
356: throws ProjectManagementBusinessException {
357: try {
358: return myDO.getCountry();
359: } catch (DataObjectException ex) {
360: throw new ProjectManagementBusinessException(
361: "Error getting customer country", ex);
362: }
363: }
364:
365: /**
366: * Sets the customer's phone.
367: *
368: * @param the customer's phone.
369: * @exception ProjectManagementBusinessException if an error occurs
370: * setting the data (usually due to an underlying data layer
371: * error).
372: */
373: public void setPhone(String phone)
374: throws ProjectManagementBusinessException {
375: try {
376: myDO.setPhone(phone);
377: } catch (DataObjectException ex) {
378: throw new ProjectManagementBusinessException(
379: "Error setting phone", ex);
380: }
381: }
382:
383: /**
384: * Gets the customer's phone.
385: *
386: * @return the customer phone.
387: * @exception ProjectManagementBusinessException if an error occurs
388: * retrieving data (usually due to an underlying data layer
389: * error).
390: */
391: public String getPhone() throws ProjectManagementBusinessException {
392: try {
393: return myDO.getPhone();
394: } catch (DataObjectException ex) {
395: throw new ProjectManagementBusinessException(
396: "Error getting customer phone", ex);
397: }
398: }
399:
400: /**
401: * Sets the customer's fax.
402: *
403: * @param the customer's fax.
404: * @exception ProjectManagementBusinessException if an error occurs
405: * setting the data (usually due to an underlying data layer
406: * error).
407: */
408: public void setFax(String fax)
409: throws ProjectManagementBusinessException {
410: try {
411: myDO.setFax(fax);
412: } catch (DataObjectException ex) {
413: throw new ProjectManagementBusinessException(
414: "Error setting fax", ex);
415: }
416: }
417:
418: /**
419: * Gets the customer's fax.
420: *
421: * @return the customer fax.
422: * @exception ProjectManagementBusinessException if an error occurs
423: * retrieving data (usually due to an underlying data layer
424: * error).
425: */
426: public String getFax() throws ProjectManagementBusinessException {
427: try {
428: return myDO.getFax();
429: } catch (DataObjectException ex) {
430: throw new ProjectManagementBusinessException(
431: "Error getting customer fax", ex);
432: }
433: }
434:
435: /**
436: * Sets the customer's email.
437: *
438: * @param the customer's email.
439: * @exception ProjectManagementBusinessException if an error occurs
440: * setting the data (usually due to an underlying data layer
441: * error).
442: */
443: public void setEmail(String email)
444: throws ProjectManagementBusinessException {
445: try {
446: myDO.setEmail(email);
447: } catch (DataObjectException ex) {
448: throw new ProjectManagementBusinessException(
449: "Error setting email", ex);
450: }
451: }
452:
453: /**
454: * Gets the customer's email.
455: *
456: * @return the customer email.
457: * @exception ProjectManagementBusinessException if an error occurs
458: * retrieving data (usually due to an underlying data layer
459: * error).
460: */
461: public String getEmail() throws ProjectManagementBusinessException {
462: try {
463: return myDO.getEmail();
464: } catch (DataObjectException ex) {
465: throw new ProjectManagementBusinessException(
466: "Error getting customer email", ex);
467: }
468: }
469:
470: /**
471: * Sets the customer's notes.
472: *
473: * @param the customer's notes.
474: * @exception ProjectManagementBusinessException if an error occurs
475: * setting the data (usually due to an underlying data layer
476: * error).
477: */
478: public void setNotes(String notes)
479: throws ProjectManagementBusinessException {
480: try {
481: myDO.setNotes(notes);
482: } catch (DataObjectException ex) {
483: throw new ProjectManagementBusinessException(
484: "Error setting notes", ex);
485: }
486: }
487:
488: /**
489: * Gets the customer's notes.
490: *
491: * @return the customer notes.
492: * @exception ProjectManagementBusinessException if an error occurs
493: * retrieving data (usually due to an underlying data layer
494: * error).
495: */
496: public String getNotes() throws ProjectManagementBusinessException {
497: try {
498: return myDO.getNotes();
499: } catch (DataObjectException ex) {
500: throw new ProjectManagementBusinessException(
501: "Error getting customer notes", ex);
502: }
503: }
504:
505: /**
506: * Commits all changes to the database.
507: *
508: * @exception ProjectManagementBusinessException if an error occurs
509: * retrieving data (usually due to an underlying data layer
510: * error).
511: */
512: public void save() throws ProjectManagementBusinessException {
513: try {
514: this .myDO.save();
515: } catch (Exception ex) {
516: throw new ProjectManagementBusinessException(
517: "Error saving customer", ex);
518: }
519: }
520:
521: /**
522: * Deletes the customer from database.
523: *
524: * @exception ProjectManagementBusinessException if an error occurs
525: * deleting data (usually due to an underlying data layer
526: * error).
527: */
528: public void delete() throws ProjectManagementBusinessException {
529: try {
530: this .myDO.delete();
531: } catch (Exception ex) {
532: throw new ProjectManagementBusinessException(
533: "Error deleting customer", ex);
534: }
535: }
536:
537: }
|