KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > barracudaDiscRack > business > 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.4 2004/12/03 14:12:34 slobodan Exp $
22  */

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

37 public class Person {
38     /**
39      * The DO of the Person.
40      */

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

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

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

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

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

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

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

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

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

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

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

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

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