KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > projectmanagement > business > timewage > WorkSheetImpl


1 package projectmanagement.business.timewage;
2
3 import projectmanagement.business.ProjectManagementBusinessException;
4 import projectmanagement.data.timewage.*;
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 java.sql.Date JavaDoc;
10 import java.sql.Time JavaDoc;
11
12 import projectmanagement.spec.timewage.*;
13 /**
14  * Represents a work sheet.
15  *
16  * @author Sasa Bojanic
17  * @version 1.0
18  */

19 public class WorkSheetImpl implements WorkSheet {
20    /**
21     * The DO of the WorkSheet.
22     */

23    protected WorkSheetDO myDO = null;
24
25    /**
26     * The public constructor.
27     */

28    public WorkSheetImpl() throws ProjectManagementBusinessException {
29       try {
30          this.myDO = WorkSheetDO.createVirgin();
31       } catch(DatabaseManagerException ex) {
32          throw new ProjectManagementBusinessException("Error creating empty work sheet", ex);
33       } catch(ObjectIdException ex) {
34          throw new ProjectManagementBusinessException("Error creating object ID for work sheet", ex);
35       }
36    }
37
38    /** The public constructor
39     *
40     * @param theWorkSheet. The data object of the work sheet.
41     */

42    public WorkSheetImpl(WorkSheetDO theWorkSheet) {
43       this.myDO = theWorkSheet;
44    }
45
46    /**
47     * Gets the DO object for the work sheet
48     *
49     * @return the DO object.
50     * @exception ProjectManagementBusinessException if an error occurs
51     * retrieving data.
52     */

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

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

87    public void setPayRate(PayRate thePayRate)
88       throws ProjectManagementBusinessException {
89       try {
90          myDO.setPayRate(((PayRateImpl)thePayRate).getDO());
91       } catch(DataObjectException ex) {
92          throw new ProjectManagementBusinessException("Error setting work sheet rate", ex);
93       }
94    }
95
96    /**
97     * Gets the pay rate for the work sheet
98     *
99     * @return the pay rate.
100     * @exception ProjectManagementBusinessException if an error occurs
101     * retrieving data (usually due to an underlying data layer
102     * error).
103     */

104    public PayRate getPayRate ()
105       throws ProjectManagementBusinessException {
106       try {
107          return new PayRateImpl(myDO.getPayRate());
108       } catch(DataObjectException ex) {
109          throw new ProjectManagementBusinessException("Error getting work sheet pay rate", ex);
110       }
111    }
112
113    /**
114     * Sets the working date for work sheet.
115     *
116     * @param the working date for the worksheet.
117     * @exception ProjectManagementBusinessException if an error occurs
118     * setting the data (usually due to an underlying data layer
119     * error).
120     */

121    public void setWorkingDate(Date JavaDoc workingDate)
122       throws ProjectManagementBusinessException {
123       try {
124          myDO.setWorkingDate(workingDate);
125       } catch(DataObjectException ex) {
126          throw new ProjectManagementBusinessException("Error setting working date", ex);
127       }
128    }
129
130    /**
131     * Gets the working date for work sheet.
132     *
133     * @return the working date for work sheet.
134     * @exception ProjectManagementBusinessException if an error occurs
135     * retrieving data (usually due to an underlying data layer
136     * error).
137     */

138    public Date JavaDoc getWorkingDate ()
139       throws ProjectManagementBusinessException {
140       try {
141          return myDO.getWorkingDate();
142       } catch(DataObjectException ex) {
143          throw new ProjectManagementBusinessException("Error getting the working date for work sheet", ex);
144       }
145    }
146
147    /**
148     * Sets the time started for the work sheet.
149     *
150     * @param the time started.
151     * @exception ProjectManagementBusinessException if an error occurs
152     * setting the data (usually due to an underlying data layer
153     * error).
154     */

155    public void setTimeStarted(Time JavaDoc timeStarted)
156       throws ProjectManagementBusinessException {
157       try {
158          myDO.setTimeStarted(timeStarted);
159       } catch(DataObjectException ex) {
160          throw new ProjectManagementBusinessException("Error setting time started", ex);
161       }
162    }
163
164    /**
165     * Gets the time started.
166     *
167     * @return the time started.
168     * @exception ProjectManagementBusinessException if an error occurs
169     * retrieving data (usually due to an underlying data layer
170     * error).
171     */

172    public Time JavaDoc getTimeStarted()
173       throws ProjectManagementBusinessException {
174       try {
175          return myDO.getTimeStarted();
176       } catch(DataObjectException ex) {
177          throw new ProjectManagementBusinessException("Error getting time started", ex);
178       }
179    }
180
181    /**
182     * Sets the time finished for the work sheet.
183     *
184     * @param the time finished.
185     * @exception ProjectManagementBusinessException if an error occurs
186     * setting the data (usually due to an underlying data layer
187     * error).
188     */

189    public void setTimeFinished(Time JavaDoc timeFinished)
190       throws ProjectManagementBusinessException {
191       try {
192          myDO.setTimeFinished(timeFinished);
193       } catch(DataObjectException ex) {
194          throw new ProjectManagementBusinessException("Error setting time finished", ex);
195       }
196    }
197
198    /**
199     * Gets the time finished.
200     *
201     * @return the time finished.
202     * @exception ProjectManagementBusinessException if an error occurs
203     * retrieving data (usually due to an underlying data layer
204     * error).
205     */

206    public Time JavaDoc getTimeFinished()
207       throws ProjectManagementBusinessException {
208       try {
209          return myDO.getTimeFinished();
210       } catch(DataObjectException ex) {
211          throw new ProjectManagementBusinessException("Error getting time finished", ex);
212       }
213    }
214
215    /**
216     * Sets the personal comment for the work sheet.
217     *
218     * @param the personal comment.
219     * @exception ProjectManagementBusinessException if an error occurs
220     * setting the data (usually due to an underlying data layer
221     * error).
222     */

223    public void setPersonalComment(String JavaDoc personalComment)
224       throws ProjectManagementBusinessException {
225       try {
226          myDO.setPersonalComment(personalComment);
227       } catch(DataObjectException ex) {
228          throw new ProjectManagementBusinessException("Error setting work sheet personal comment", ex);
229       }
230    }
231
232    /**
233     * Gets the personal comment for the work sheet
234     *
235     * @return the personal comment.
236     * @exception ProjectManagementBusinessException if an error occurs
237     * retrieving data (usually due to an underlying data layer
238     * error).
239     */

240    public String JavaDoc getPersonalComment ()
241       throws ProjectManagementBusinessException {
242       try {
243          return myDO.getPersonalComment();
244       } catch(DataObjectException ex) {
245          throw new ProjectManagementBusinessException("Error getting work sheet personal comment", ex);
246       }
247    }
248
249    /**
250     * Sets the comment for client for the work sheet.
251     *
252     * @param the comment for client.
253     * @exception ProjectManagementBusinessException if an error occurs
254     * setting the data (usually due to an underlying data layer
255     * error).
256     */

257    public void setCommentForClient(String JavaDoc commentForClient)
258       throws ProjectManagementBusinessException {
259       try {
260          myDO.setCommentForClient(commentForClient);
261       } catch(DataObjectException ex) {
262          throw new ProjectManagementBusinessException("Error setting work sheet comment for client", ex);
263       }
264    }
265
266    /**
267     * Gets the comment for client for the work sheet
268     *
269     * @return the comment for client.
270     * @exception ProjectManagementBusinessException if an error occurs
271     * retrieving data (usually due to an underlying data layer
272     * error).
273     */

274    public String JavaDoc getCommentForClient ()
275       throws ProjectManagementBusinessException {
276       try {
277          return myDO.getCommentForClient();
278       } catch(DataObjectException ex) {
279          throw new ProjectManagementBusinessException("Error getting work sheet comment for client", ex);
280       }
281    }
282
283    /**
284     * Commits all changes to the database.
285     *
286     * @exception ProjectManagementBusinessException if an error occurs
287     * retrieving data (usually due to an underlying data layer
288     * error).
289     */

290    public void save() throws ProjectManagementBusinessException {
291       try {
292          this.myDO.save();
293       } catch(Exception JavaDoc ex) {
294          throw new ProjectManagementBusinessException("Error saving work sheet", ex);
295       }
296    }
297
298    /**
299     * Deletes the work sheet from database.
300     *
301     * @exception ProjectManagementBusinessException if an error occurs
302     * deleting data (usually due to an underlying data layer
303     * error).
304     */

305    public void delete() throws ProjectManagementBusinessException {
306       try {
307          this.myDO.delete();
308       } catch(Exception JavaDoc ex) {
309          throw new ProjectManagementBusinessException("Error deleting work sheet", ex);
310       }
311    }
312
313 }
314
Popular Tags