001: package projectmanagement.business.timewage;
002:
003: import projectmanagement.business.ProjectManagementBusinessException;
004: import projectmanagement.data.timewage.*;
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 java.sql.Date;
010: import java.sql.Time;
011:
012: import projectmanagement.spec.timewage.*;
013:
014: /**
015: * Represents a work sheet.
016: *
017: * @author Sasa Bojanic
018: * @version 1.0
019: */
020: public class WorkSheetImpl implements WorkSheet {
021: /**
022: * The DO of the WorkSheet.
023: */
024: protected WorkSheetDO myDO = null;
025:
026: /**
027: * The public constructor.
028: */
029: public WorkSheetImpl() throws ProjectManagementBusinessException {
030: try {
031: this .myDO = WorkSheetDO.createVirgin();
032: } catch (DatabaseManagerException ex) {
033: throw new ProjectManagementBusinessException(
034: "Error creating empty work sheet", ex);
035: } catch (ObjectIdException ex) {
036: throw new ProjectManagementBusinessException(
037: "Error creating object ID for work sheet", ex);
038: }
039: }
040:
041: /** The public constructor
042: *
043: * @param theWorkSheet. The data object of the work sheet.
044: */
045: public WorkSheetImpl(WorkSheetDO theWorkSheet) {
046: this .myDO = theWorkSheet;
047: }
048:
049: /**
050: * Gets the DO object for the work sheet
051: *
052: * @return the DO object.
053: * @exception ProjectManagementBusinessException if an error occurs
054: * retrieving data.
055: */
056: public WorkSheetDO getDO()
057: throws ProjectManagementBusinessException {
058: if (this .myDO != null) {
059: return this .myDO;
060: } else {
061: throw new ProjectManagementBusinessException(
062: "Error getting DO object for work sheet");
063: }
064: }
065:
066: /**
067: * Gets the object id for the work sheet
068: *
069: * @return the object id.
070: * @exception ProjectManagementBusinessException if an error occurs
071: * retrieving data (usually due to an underlying data layer
072: * error).
073: */
074: public String getHandle() throws ProjectManagementBusinessException {
075: try {
076: return this .myDO.getHandle();
077: } catch (DatabaseManagerException ex) {
078: throw new ProjectManagementBusinessException(
079: "Error getting handle for work sheet", ex);
080: }
081: }
082:
083: /**
084: * Sets the PayRate for the work sheet.
085: *
086: * @param the pay rate.
087: * @exception ProjectManagementBusinessException if an error occurs
088: * setting the data (usually due to an underlying data layer
089: * error).
090: */
091: public void setPayRate(PayRate thePayRate)
092: throws ProjectManagementBusinessException {
093: try {
094: myDO.setPayRate(((PayRateImpl) thePayRate).getDO());
095: } catch (DataObjectException ex) {
096: throw new ProjectManagementBusinessException(
097: "Error setting work sheet rate", ex);
098: }
099: }
100:
101: /**
102: * Gets the pay rate for the work sheet
103: *
104: * @return the pay rate.
105: * @exception ProjectManagementBusinessException if an error occurs
106: * retrieving data (usually due to an underlying data layer
107: * error).
108: */
109: public PayRate getPayRate()
110: throws ProjectManagementBusinessException {
111: try {
112: return new PayRateImpl(myDO.getPayRate());
113: } catch (DataObjectException ex) {
114: throw new ProjectManagementBusinessException(
115: "Error getting work sheet pay rate", ex);
116: }
117: }
118:
119: /**
120: * Sets the working date for work sheet.
121: *
122: * @param the working date for the worksheet.
123: * @exception ProjectManagementBusinessException if an error occurs
124: * setting the data (usually due to an underlying data layer
125: * error).
126: */
127: public void setWorkingDate(Date workingDate)
128: throws ProjectManagementBusinessException {
129: try {
130: myDO.setWorkingDate(workingDate);
131: } catch (DataObjectException ex) {
132: throw new ProjectManagementBusinessException(
133: "Error setting working date", ex);
134: }
135: }
136:
137: /**
138: * Gets the working date for work sheet.
139: *
140: * @return the working date for work sheet.
141: * @exception ProjectManagementBusinessException if an error occurs
142: * retrieving data (usually due to an underlying data layer
143: * error).
144: */
145: public Date getWorkingDate()
146: throws ProjectManagementBusinessException {
147: try {
148: return myDO.getWorkingDate();
149: } catch (DataObjectException ex) {
150: throw new ProjectManagementBusinessException(
151: "Error getting the working date for work sheet", ex);
152: }
153: }
154:
155: /**
156: * Sets the time started for the work sheet.
157: *
158: * @param the time started.
159: * @exception ProjectManagementBusinessException if an error occurs
160: * setting the data (usually due to an underlying data layer
161: * error).
162: */
163: public void setTimeStarted(Time timeStarted)
164: throws ProjectManagementBusinessException {
165: try {
166: myDO.setTimeStarted(timeStarted);
167: } catch (DataObjectException ex) {
168: throw new ProjectManagementBusinessException(
169: "Error setting time started", ex);
170: }
171: }
172:
173: /**
174: * Gets the time started.
175: *
176: * @return the time started.
177: * @exception ProjectManagementBusinessException if an error occurs
178: * retrieving data (usually due to an underlying data layer
179: * error).
180: */
181: public Time getTimeStarted()
182: throws ProjectManagementBusinessException {
183: try {
184: return myDO.getTimeStarted();
185: } catch (DataObjectException ex) {
186: throw new ProjectManagementBusinessException(
187: "Error getting time started", ex);
188: }
189: }
190:
191: /**
192: * Sets the time finished for the work sheet.
193: *
194: * @param the time finished.
195: * @exception ProjectManagementBusinessException if an error occurs
196: * setting the data (usually due to an underlying data layer
197: * error).
198: */
199: public void setTimeFinished(Time timeFinished)
200: throws ProjectManagementBusinessException {
201: try {
202: myDO.setTimeFinished(timeFinished);
203: } catch (DataObjectException ex) {
204: throw new ProjectManagementBusinessException(
205: "Error setting time finished", ex);
206: }
207: }
208:
209: /**
210: * Gets the time finished.
211: *
212: * @return the time finished.
213: * @exception ProjectManagementBusinessException if an error occurs
214: * retrieving data (usually due to an underlying data layer
215: * error).
216: */
217: public Time getTimeFinished()
218: throws ProjectManagementBusinessException {
219: try {
220: return myDO.getTimeFinished();
221: } catch (DataObjectException ex) {
222: throw new ProjectManagementBusinessException(
223: "Error getting time finished", ex);
224: }
225: }
226:
227: /**
228: * Sets the personal comment for the work sheet.
229: *
230: * @param the personal comment.
231: * @exception ProjectManagementBusinessException if an error occurs
232: * setting the data (usually due to an underlying data layer
233: * error).
234: */
235: public void setPersonalComment(String personalComment)
236: throws ProjectManagementBusinessException {
237: try {
238: myDO.setPersonalComment(personalComment);
239: } catch (DataObjectException ex) {
240: throw new ProjectManagementBusinessException(
241: "Error setting work sheet personal comment", ex);
242: }
243: }
244:
245: /**
246: * Gets the personal comment for the work sheet
247: *
248: * @return the personal comment.
249: * @exception ProjectManagementBusinessException if an error occurs
250: * retrieving data (usually due to an underlying data layer
251: * error).
252: */
253: public String getPersonalComment()
254: throws ProjectManagementBusinessException {
255: try {
256: return myDO.getPersonalComment();
257: } catch (DataObjectException ex) {
258: throw new ProjectManagementBusinessException(
259: "Error getting work sheet personal comment", ex);
260: }
261: }
262:
263: /**
264: * Sets the comment for client for the work sheet.
265: *
266: * @param the comment for client.
267: * @exception ProjectManagementBusinessException if an error occurs
268: * setting the data (usually due to an underlying data layer
269: * error).
270: */
271: public void setCommentForClient(String commentForClient)
272: throws ProjectManagementBusinessException {
273: try {
274: myDO.setCommentForClient(commentForClient);
275: } catch (DataObjectException ex) {
276: throw new ProjectManagementBusinessException(
277: "Error setting work sheet comment for client", ex);
278: }
279: }
280:
281: /**
282: * Gets the comment for client for the work sheet
283: *
284: * @return the comment for client.
285: * @exception ProjectManagementBusinessException if an error occurs
286: * retrieving data (usually due to an underlying data layer
287: * error).
288: */
289: public String getCommentForClient()
290: throws ProjectManagementBusinessException {
291: try {
292: return myDO.getCommentForClient();
293: } catch (DataObjectException ex) {
294: throw new ProjectManagementBusinessException(
295: "Error getting work sheet comment for client", ex);
296: }
297: }
298:
299: /**
300: * Commits all changes to the database.
301: *
302: * @exception ProjectManagementBusinessException if an error occurs
303: * retrieving data (usually due to an underlying data layer
304: * error).
305: */
306: public void save() throws ProjectManagementBusinessException {
307: try {
308: this .myDO.save();
309: } catch (Exception ex) {
310: throw new ProjectManagementBusinessException(
311: "Error saving work sheet", ex);
312: }
313: }
314:
315: /**
316: * Deletes the work sheet from database.
317: *
318: * @exception ProjectManagementBusinessException if an error occurs
319: * deleting data (usually due to an underlying data layer
320: * error).
321: */
322: public void delete() throws ProjectManagementBusinessException {
323: try {
324: this .myDO.delete();
325: } catch (Exception ex) {
326: throw new ProjectManagementBusinessException(
327: "Error deleting work sheet", ex);
328: }
329: }
330:
331: }
|