KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > discRack > biz > person > Person


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: Person.java,v 1.5 2005/04/14 08:00:22 slobodan Exp $
22  */

23 package org.enhydra.barracuda.discRack.biz.person;
24
25 import org.enhydra.barracuda.discRack.biz.DiscRackBusinessException;
26 import org.enhydra.barracuda.discRack.data.person.*;
27 import org.enhydra.barracuda.discRack.data.disc.DiscDO;
28 import org.enhydra.barracuda.discRack.biz.disc.Disc;
29 import com.lutris.appserver.server.sql.DatabaseManagerException;
30 import com.lutris.appserver.server.sql.ObjectIdException;
31 import com.lutris.dods.builder.generator.query.DataObjectException;
32         
33 /**
34  * Represents a person.
35  */

36 public class Person implements java.io.Serializable JavaDoc {
37     /**
38      * The DO of the Person.
39      */

40     protected PersonDO myDO = null;
41     
42     /**
43      * The public constructor.
44      */

45     public Person() throws DiscRackBusinessException {
46         try {
47             this.myDO = PersonDO.createVirgin();
48         } catch(DatabaseManagerException ex) {
49             throw new DiscRackBusinessException("Error creating empty person", ex);
50         } catch(ObjectIdException ex) {
51             throw new DiscRackBusinessException("Error creating object ID for person", ex);
52         }
53     }
54     
55     /** The public constructor
56      *
57      * @param thePerson. The data object of the person.
58      */

59     public Person(PersonDO thePerson) {
60         this.myDO = thePerson;
61     }
62     
63     /**
64      * Gets the object id for the person
65      *
66      * @return the object id.
67      * @exception DiscRackBusinessException if an error occurs
68      * retrieving data (usually due to an underlying data layer
69      * error).
70      */

71     public String JavaDoc getHandle()
72         throws DiscRackBusinessException {
73         try {
74             return this.myDO.getHandle();
75         } catch(DatabaseManagerException ex) {
76             throw new DiscRackBusinessException("Error getting handle for person", ex);
77         }
78     }
79     
80     /**
81      * Gets the login name for the person
82      *
83      * @return the login name.
84      * @exception DiscRackBusinessException if an error occurs
85      * retrieving data (usually due to an underlying data layer
86      * error).
87      */

88     public String JavaDoc getLogin()
89         throws DiscRackBusinessException {
90         try {
91             return myDO.getLogin();
92         } catch(DataObjectException ex) {
93             throw new DiscRackBusinessException("Error getting user's login name", ex);
94         }
95     }
96     
97     /**
98      * Gets the password for the person
99      *
100      * @return the password.
101      * @exception DiscRackBusinessException if an error occurs
102      * retrieving data (usually due to an underlying data layer
103      * error).
104      */

105     public String JavaDoc getPassword()
106         throws DiscRackBusinessException {
107         try {
108             return myDO.getPassword();
109         } catch(DataObjectException ex) {
110             throw new DiscRackBusinessException("Error getting user's password", ex);
111         }
112     }
113     
114     /**
115      * Gets the firstname for the person
116      *
117      * @return the firstname.
118      * @exception DiscRackBusinessException if an error occurs
119      * retrieving data (usually due to an underlying data layer
120      * error).
121      */

122     public String JavaDoc getFirstname()
123         throws DiscRackBusinessException {
124         try {
125             return myDO.getFirstname();
126         } catch(DataObjectException ex) {
127             throw new DiscRackBusinessException("Error getting user's first name", ex);
128         }
129     }
130     
131     /**
132      * Gets the lastname for the person
133      *
134      * @return the lastname.
135      * @exception DiscRackBusinessException if an error occurs
136      * retrieving data (usually due to an underlying data layer
137      * error).
138      */

139     public String JavaDoc getLastname()
140         throws DiscRackBusinessException {
141         try {
142             return myDO.getLastname();
143         } catch(DataObjectException ex) {
144             throw new DiscRackBusinessException("Error getting user's last name", ex);
145         }
146     }
147     
148     /**
149      * Sets the login name for the person.
150      *
151      * @param the login name.
152      * @exception DiscRackBusinessException if an error occurs
153      * setting the data (usually due to an underlying data layer
154      * error).
155      */

156     public void setLogin(String JavaDoc login)
157         throws DiscRackBusinessException {
158         try {
159             myDO.setLogin(login);
160         } catch(DataObjectException ex) {
161             throw new DiscRackBusinessException("Error setting user's login name", ex);
162         }
163     }
164     
165     /**
166      * Sets the password for the person.
167      *
168      * @param the password.
169      * @exception DiscRackBusinessException if an error occurs
170      * setting the data (usually due to an underlying data layer
171      * error).
172      */

173     public void setPassword(String JavaDoc password)
174         throws DiscRackBusinessException {
175         try {
176             myDO.setPassword(password);
177         } catch(DataObjectException ex) {
178             throw new DiscRackBusinessException("Error setting user's password", ex);
179         }
180     }
181     
182     /**
183      * Sets the firstname for the person.
184      *
185      * @param the firstname.
186      * @exception DiscRackBusinessException if an error occurs
187      * setting the data (usually due to an underlying data layer
188      * error).
189      */

190     public void setFirstname(String JavaDoc firstname)
191         throws DiscRackBusinessException {
192         try {
193             myDO.setFirstname(firstname);
194         } catch(DataObjectException ex) {
195             throw new DiscRackBusinessException("Error setting user's first name", ex);
196         }
197     }
198     
199     /**
200      * Sets the lastname for the person.
201      *
202      * @param the lastname.
203      * @exception DiscRackBusinessException if an error occurs
204      * setting the data (usually due to an underlying data layer
205      * error).
206      */

207     public void setLastname(String JavaDoc lastname)
208         throws DiscRackBusinessException {
209         try {
210             myDO.setLastname(lastname);
211         } catch(DataObjectException ex) {
212             throw new DiscRackBusinessException("Error setting user's last name", ex);
213         }
214     }
215     
216     /**
217      * Commits all changes to the database.
218      *
219      * @exception DiscRackBusinessException if an error occurs
220      * retrieving data (usually due to an underlying data layer
221      * error).
222      */

223     public void save() throws DiscRackBusinessException {
224         try {
225             this.myDO.commit();
226         } catch(Exception JavaDoc ex) {
227             throw new DiscRackBusinessException("Error saving person", ex);
228         }
229     }
230 }
231
Popular Tags