1 package projectmanagement.business.timewage; 2 3 import projectmanagement.business.project.*; 4 import projectmanagement.business.employee.*; 5 import projectmanagement.business.ProjectManagementBusinessException; 6 import projectmanagement.data.timewage.*; 7 import com.lutris.appserver.server.sql.DatabaseManagerException; 8 import com.lutris.appserver.server.sql.ObjectIdException; 9 import com.lutris.dods.builder.generator.query.DataObjectException; 10 11 import projectmanagement.spec.timewage.*; 12 import projectmanagement.spec.employee.*; 13 import projectmanagement.spec.project.*; 14 15 import java.sql.Date ; 16 17 23 public class PayRateImpl implements PayRate { 24 27 protected PayRateDO myDO = null; 28 29 32 public PayRateImpl() throws ProjectManagementBusinessException { 33 try { 34 this.myDO = PayRateDO.createVirgin(); 35 } catch(DatabaseManagerException ex) { 36 throw new ProjectManagementBusinessException("Error creating empty pay rate", ex); 37 } catch(ObjectIdException ex) { 38 throw new ProjectManagementBusinessException("Error creating object ID for pay rate", ex); 39 } 40 } 41 42 46 public PayRateImpl(PayRateDO thePayRate) { 47 this.myDO = thePayRate; 48 } 49 50 57 public PayRateDO getDO() 58 throws ProjectManagementBusinessException { 59 if (this.myDO!=null) { 60 return this.myDO; 61 } else { 62 throw new ProjectManagementBusinessException("Error getting DO object for pay rate"); 63 } 64 } 65 66 74 public String getHandle() 75 throws ProjectManagementBusinessException { 76 try { 77 return this.myDO.getHandle(); 78 } catch(DatabaseManagerException ex) { 79 throw new ProjectManagementBusinessException("Error getting handle for pay rate", ex); 80 } 81 } 82 83 91 public void setRate(double rate) 92 throws ProjectManagementBusinessException { 93 try { 94 myDO.setRate(rate); 95 } catch(DataObjectException ex) { 96 throw new ProjectManagementBusinessException("Error setting pay rate rate", ex); 97 } 98 } 99 100 108 public double getRate () 109 throws ProjectManagementBusinessException { 110 try { 111 return myDO.getRate(); 112 } catch(DataObjectException ex) { 113 throw new ProjectManagementBusinessException("Error getting pay rate rate", ex); 114 } 115 } 116 117 125 public void setValidFrom(Date validFrom) 126 throws ProjectManagementBusinessException { 127 try { 128 myDO.setValidFrom(validFrom); 129 } catch(DataObjectException ex) { 130 throw new ProjectManagementBusinessException("Error setting valid from", ex); 131 } 132 } 133 134 142 public Date getValidFrom () 143 throws ProjectManagementBusinessException { 144 try { 145 return myDO.getValidFrom(); 146 } catch(DataObjectException ex) { 147 throw new ProjectManagementBusinessException("Error getting valid from", ex); 148 } 149 } 150 151 159 public void setEmployee(Employee employee) 160 throws ProjectManagementBusinessException { 161 try { 162 myDO.setEmployee(((EmployeeImpl)employee).getDO()); 163 } catch(DataObjectException ex) { 164 throw new ProjectManagementBusinessException("Error setting employee", ex); 165 } 166 } 167 168 176 public Employee getEmployee() 177 throws ProjectManagementBusinessException { 178 try { 179 return new EmployeeImpl(myDO.getEmployee()); 180 } catch(DataObjectException ex) { 181 throw new ProjectManagementBusinessException("Error getting employee", ex); 182 } 183 } 184 185 193 public void setProject(Project project) 194 throws ProjectManagementBusinessException { 195 try { 196 myDO.setProject(((ProjectImpl)project).getDO()); 197 } catch(DataObjectException ex) { 198 throw new ProjectManagementBusinessException("Error setting project", ex); 199 } 200 } 201 202 210 public Project getProject() 211 throws ProjectManagementBusinessException { 212 try { 213 return new ProjectImpl(myDO.getProject()); 214 } catch(DataObjectException ex) { 215 throw new ProjectManagementBusinessException("Error getting project", ex); 216 } 217 } 218 219 226 public void save() throws ProjectManagementBusinessException { 227 try { 228 this.myDO.save(); 229 } catch(Exception ex) { 230 throw new ProjectManagementBusinessException("Error saving pay rate", ex); 231 } 232 } 233 234 241 public void delete() throws ProjectManagementBusinessException { 242 try { 243 this.myDO.delete(); 244 } catch(Exception ex) { 245 throw new ProjectManagementBusinessException("Error deleting pay rate", ex); 246 } 247 } 248 249 } 250 | Popular Tags |