1 package projectmanagement.business.employee; 2 3 import projectmanagement.business.ProjectManagementBusinessException; 4 import projectmanagement.data.employee.*; 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 projectmanagement.spec.employee.*; 10 11 import java.sql.Date ; 12 13 19 public class EmployeeImpl implements Employee,java.io.Serializable { 20 23 protected EmployeeDO myDO = null; 24 25 28 public EmployeeImpl() throws ProjectManagementBusinessException { 29 try { 30 this.myDO = EmployeeDO.createVirgin(); 31 } catch(DatabaseManagerException ex) { 32 throw new ProjectManagementBusinessException("Error creating empty employee", ex); 33 } catch(ObjectIdException ex) { 34 throw new ProjectManagementBusinessException("Error creating object ID for employee", ex); 35 } 36 } 37 38 42 public EmployeeImpl(EmployeeDO theEmployee) { 43 this.myDO = theEmployee; 44 } 45 46 53 public EmployeeDO getDO() 54 throws ProjectManagementBusinessException { 55 if (this.myDO!=null) { 56 return this.myDO; 57 } else { 58 throw new ProjectManagementBusinessException("Error getting DO object for employee"); 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 employee", ex); 76 } 77 } 78 79 public int getAuthLevel () { 80 try { 81 boolean isAdmin=getIsAdmin(); 82 if (isAdmin) { 83 return 2; 84 } else { 85 return 1; 86 } 87 } catch (Exception ex) { 88 return 0; 89 } 90 } 91 92 100 public void setLogin(String login) 101 throws ProjectManagementBusinessException { 102 try { 103 myDO.setLogin(login); 104 } catch(DataObjectException ex) { 105 throw new ProjectManagementBusinessException("Error setting user's login name", ex); 106 } 107 } 108 109 117 public String getLogin() 118 throws ProjectManagementBusinessException { 119 try { 120 return myDO.getLogin(); 121 } catch(DataObjectException ex) { 122 throw new ProjectManagementBusinessException("Error getting user's login name", ex); 123 } 124 } 125 126 134 public void setPassword(String password) 135 throws ProjectManagementBusinessException { 136 try { 137 myDO.setPassword(password); 138 } catch(DataObjectException ex) { 139 throw new ProjectManagementBusinessException("Error setting user's password", ex); 140 } 141 } 142 143 151 public String getPassword() 152 throws ProjectManagementBusinessException { 153 try { 154 return myDO.getPassword(); 155 } catch(DataObjectException ex) { 156 throw new ProjectManagementBusinessException("Error getting user's password", ex); 157 } 158 } 159 160 168 public void setFirstName(String firstname) 169 throws ProjectManagementBusinessException { 170 try { 171 myDO.setFirstName(firstname); 172 } catch(DataObjectException ex) { 173 throw new ProjectManagementBusinessException("Error setting user's first name", ex); 174 } 175 } 176 177 185 public String getFirstName() 186 throws ProjectManagementBusinessException { 187 try { 188 return myDO.getFirstName(); 189 } catch(DataObjectException ex) { 190 throw new ProjectManagementBusinessException("Error getting user's first name", ex); 191 } 192 } 193 194 202 public void setLastName(String lastname) 203 throws ProjectManagementBusinessException { 204 try { 205 myDO.setLastName(lastname); 206 } catch(DataObjectException ex) { 207 throw new ProjectManagementBusinessException("Error setting user's last name", ex); 208 } 209 } 210 211 219 public String getLastName() 220 throws ProjectManagementBusinessException { 221 try { 222 return myDO.getLastName(); 223 } catch(DataObjectException ex) { 224 throw new ProjectManagementBusinessException("Error getting user's last name", ex); 225 } 226 } 227 228 236 public void setTitle(String title) 237 throws ProjectManagementBusinessException { 238 try { 239 myDO.setTitle(title); 240 } catch(DataObjectException ex) { 241 throw new ProjectManagementBusinessException("Error setting user's title", ex); 242 } 243 } 244 245 253 public String getTitle() 254 throws ProjectManagementBusinessException { 255 try { 256 return myDO.getTitle(); 257 } catch(DataObjectException ex) { 258 throw new ProjectManagementBusinessException("Error getting user's title", ex); 259 } 260 } 261 262 270 public void setTitleOfCourtesy(String titleOfCourtesy) 271 throws ProjectManagementBusinessException { 272 try { 273 myDO.setTitleOfCourtesy(titleOfCourtesy); 274 } catch(DataObjectException ex) { 275 throw new ProjectManagementBusinessException("Error setting user's title of courtesy", ex); 276 } 277 } 278 279 287 public String getTitleOfCourtesy() 288 throws ProjectManagementBusinessException { 289 try { 290 return myDO.getTitleOfCourtesy(); 291 } catch(DataObjectException ex) { 292 throw new ProjectManagementBusinessException("Error getting user's title of courtesy", ex); 293 } 294 } 295 296 304 public void setBirthDate(Date birthDate) 305 throws ProjectManagementBusinessException { 306 try { 307 myDO.setBirthDate(birthDate); 308 } catch(DataObjectException ex) { 309 throw new ProjectManagementBusinessException("Error setting user's birth date", ex); 310 } 311 } 312 313 321 public Date getBirthDate() 322 throws ProjectManagementBusinessException { 323 try { 324 return myDO.getBirthDate(); 325 } catch(DataObjectException ex) { 326 throw new ProjectManagementBusinessException("Error getting user's birth date", ex); 327 } 328 } 329 330 338 public void setHireDate(Date hireDate) 339 throws ProjectManagementBusinessException { 340 try { 341 myDO.setHireDate(hireDate); 342 } catch(DataObjectException ex) { 343 throw new ProjectManagementBusinessException("Error setting user's hire date", ex); 344 } 345 } 346 347 355 public Date getHireDate() 356 throws ProjectManagementBusinessException { 357 try { 358 return myDO.getHireDate(); 359 } catch(DataObjectException ex) { 360 throw new ProjectManagementBusinessException("Error getting user's hire date", ex); 361 } 362 } 363 364 372 public void setAddress(String address) 373 throws ProjectManagementBusinessException { 374 try { 375 myDO.setAddress(address); 376 } catch(DataObjectException ex) { 377 throw new ProjectManagementBusinessException("Error setting address", ex); 378 } 379 } 380 381 389 public String getAddress() 390 throws ProjectManagementBusinessException { 391 try { 392 return myDO.getAddress(); 393 } catch(DataObjectException ex) { 394 throw new ProjectManagementBusinessException("Error getting address", ex); 395 } 396 } 397 398 406 public void setCity(String city) 407 throws ProjectManagementBusinessException { 408 try { 409 myDO.setCity(city); 410 } catch(DataObjectException ex) { 411 throw new ProjectManagementBusinessException("Error setting city", ex); 412 } 413 } 414 415 423 public String getCity() 424 throws ProjectManagementBusinessException { 425 try { 426 return myDO.getCity(); 427 } catch(DataObjectException ex) { 428 throw new ProjectManagementBusinessException("Error getting employee city", ex); 429 } 430 } 431 432 440 public void setRegion(String region) 441 throws ProjectManagementBusinessException { 442 try { 443 myDO.setRegion(region); 444 } catch(DataObjectException ex) { 445 throw new ProjectManagementBusinessException("Error setting region", ex); 446 } 447 } 448 449 457 public String getRegion() 458 throws ProjectManagementBusinessException { 459 try { 460 return myDO.getRegion(); 461 } catch(DataObjectException ex) { 462 throw new ProjectManagementBusinessException("Error getting employee region", ex); 463 } 464 } 465 466 474 public void setPostalCode(String postalCode) 475 throws ProjectManagementBusinessException { 476 try { 477 myDO.setPostalCode(postalCode); 478 } catch(DataObjectException ex) { 479 throw new ProjectManagementBusinessException("Error setting postal code", ex); 480 } 481 } 482 483 491 public String getPostalCode() 492 throws ProjectManagementBusinessException { 493 try { 494 return myDO.getPostalCode(); 495 } catch(DataObjectException ex) { 496 throw new ProjectManagementBusinessException("Error getting employee postal code", ex); 497 } 498 } 499 500 508 public void setCountry(String country) 509 throws ProjectManagementBusinessException { 510 try { 511 myDO.setCountry(country); 512 } catch(DataObjectException ex) { 513 throw new ProjectManagementBusinessException("Error setting country", ex); 514 } 515 } 516 517 525 public String getCountry() 526 throws ProjectManagementBusinessException { 527 try { 528 return myDO.getCountry(); 529 } catch(DataObjectException ex) { 530 throw new ProjectManagementBusinessException("Error getting employee country", ex); 531 } 532 } 533 534 542 public void setHomePhone(String homePhone) 543 throws ProjectManagementBusinessException { 544 try { 545 myDO.setHomePhone(homePhone); 546 } catch(DataObjectException ex) { 547 throw new ProjectManagementBusinessException("Error setting home phone", ex); 548 } 549 } 550 551 559 public String getHomePhone() 560 throws ProjectManagementBusinessException { 561 try { 562 return myDO.getHomePhone(); 563 } catch(DataObjectException ex) { 564 throw new ProjectManagementBusinessException("Error getting employee home phone", ex); 565 } 566 } 567 568 576 public void setMobilePhone(String mobilePhone) 577 throws ProjectManagementBusinessException { 578 try { 579 myDO.setMobilePhone(mobilePhone); 580 } catch(DataObjectException ex) { 581 throw new ProjectManagementBusinessException("Error setting mobile phone", ex); 582 } 583 } 584 585 593 public String getMobilePhone() 594 throws ProjectManagementBusinessException { 595 try { 596 return myDO.getMobilePhone(); 597 } catch(DataObjectException ex) { 598 throw new ProjectManagementBusinessException("Error getting employee mobile phone", ex); 599 } 600 } 601 602 610 public void setEmail(String email) 611 throws ProjectManagementBusinessException { 612 try { 613 myDO.setEmail(email); 614 } catch(DataObjectException ex) { 615 throw new ProjectManagementBusinessException("Error setting email", ex); 616 } 617 } 618 619 627 public String getEmail() 628 throws ProjectManagementBusinessException { 629 try { 630 return myDO.getEmail(); 631 } catch(DataObjectException ex) { 632 throw new ProjectManagementBusinessException("Error getting employee email", ex); 633 } 634 } 635 636 644 public void setNotes(String notes) 645 throws ProjectManagementBusinessException { 646 try { 647 myDO.setNotes(notes); 648 } catch(DataObjectException ex) { 649 throw new ProjectManagementBusinessException("Error setting notes", ex); 650 } 651 } 652 653 661 public String getNotes() 662 throws ProjectManagementBusinessException { 663 try { 664 return myDO.getNotes(); 665 } catch(DataObjectException ex) { 666 throw new ProjectManagementBusinessException("Error getting employee notes", ex); 667 } 668 } 669 670 678 public void setIsAdmin(boolean isAdmin) 679 throws ProjectManagementBusinessException { 680 try { 681 myDO.setIsAdmin(isAdmin); 682 } catch(DataObjectException ex) { 683 throw new ProjectManagementBusinessException("Error setting administration flag", ex); 684 } 685 } 686 687 695 public boolean getIsAdmin() 696 throws ProjectManagementBusinessException { 697 try { 698 return myDO.getIsAdmin(); 699 } catch(DataObjectException ex) { 700 throw new ProjectManagementBusinessException("Error getting indication if th user is admin", ex); 701 } 702 } 703 704 711 public void save() throws ProjectManagementBusinessException { 712 try { 713 this.myDO.commit(); 714 } catch(Exception ex) { 715 throw new ProjectManagementBusinessException("Error saving employee", ex); 716 } 717 } 718 719 726 public void delete() throws ProjectManagementBusinessException { 727 try { 728 this.myDO.delete(); 729 } catch(Exception ex) { 730 throw new ProjectManagementBusinessException("Error deleting employee", ex); 731 } 732 } 733 734 } 735 | Popular Tags |