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 ; 10 import java.sql.Time ; 11 12 import projectmanagement.spec.timewage.*; 13 19 public class WorkSheetImpl implements WorkSheet { 20 23 protected WorkSheetDO myDO = null; 24 25 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 42 public WorkSheetImpl(WorkSheetDO theWorkSheet) { 43 this.myDO = theWorkSheet; 44 } 45 46 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 70 public String 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 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 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 121 public void setWorkingDate(Date 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 138 public Date 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 155 public void setTimeStarted(Time 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 172 public Time 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 189 public void setTimeFinished(Time 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 206 public Time 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 223 public void setPersonalComment(String 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 240 public String 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 257 public void setCommentForClient(String 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 274 public String 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 290 public void save() throws ProjectManagementBusinessException { 291 try { 292 this.myDO.save(); 293 } catch(Exception ex) { 294 throw new ProjectManagementBusinessException("Error saving work sheet", ex); 295 } 296 } 297 298 305 public void delete() throws ProjectManagementBusinessException { 306 try { 307 this.myDO.delete(); 308 } catch(Exception ex) { 309 throw new ProjectManagementBusinessException("Error deleting work sheet", ex); 310 } 311 } 312 313 } 314 | Popular Tags |