/taurus-logic/src/org/taurus/domain/Employee.java

http://tauruss.googlecode.com/ · Java · 187 lines · 116 code · 38 blank · 33 comment · 10 complexity · 8d1c37bf6abe07661a9e1372fdba8e21 MD5 · raw file

  1. /*
  2. * This file is part of Taurus
  3. *
  4. * Taurus is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * at your option) any later version.
  8. *
  9. * Taurus is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with Melenti. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package org.taurus.domain;
  18. import java.util.Date;
  19. import javax.persistence.Column;
  20. import javax.persistence.Entity;
  21. import javax.persistence.FetchType;
  22. import javax.persistence.JoinColumn;
  23. import javax.persistence.ManyToOne;
  24. import javax.persistence.NamedQueries;
  25. import javax.persistence.NamedQuery;
  26. import javax.persistence.PostLoad;
  27. import javax.persistence.Table;
  28. import javax.persistence.Temporal;
  29. import javax.persistence.TemporalType;
  30. import javax.persistence.Transient;
  31. import org.taurus.domain.base.ModelBasic;
  32. import com.google.gson.annotations.Expose;
  33. /**
  34. * Incluir aqui? la descripcion de la clase.
  35. *
  36. * @version $Revision: 1.0 $ [29/03/2009]
  37. * @author Vinicio Llumiquinga <a href="mailto:vllumiquinga@atikasoft.com.ec">taurus</a>
  38. */
  39. @Entity
  40. @Table(name = "taurus_employee")
  41. @NamedQueries( { @NamedQuery(name = "Employee.findAllActive", query = "SELECT o FROM Employee o WHERE"
  42. + " o.status='1' order by firstName, lastName") })
  43. public class Employee extends ModelBasic {
  44. /**
  45. *
  46. */
  47. private static final long serialVersionUID = 6378538139727591397L;
  48. @Column(name = "FIRST_NAME", length = 128)
  49. @Expose
  50. private String firstName;
  51. @Column(name = "LAST_NAME", length = 128)
  52. @Expose
  53. private String lastName;
  54. @Temporal(TemporalType.DATE)
  55. @Column(name = "REGISTER_DATE")
  56. @Expose
  57. private Date registerDate;
  58. @Column(name = "MAIL", length = 60)
  59. @Expose
  60. private String mail;
  61. @Column(name = "TYPE", length = 3)
  62. @Expose
  63. private String type;
  64. @Column(name = "ADDRESS", length = 200)
  65. @Expose
  66. private String address;
  67. @Column(name = "PHONO", length = 45)
  68. @Expose
  69. private String phono;
  70. @ManyToOne(fetch = FetchType.LAZY)
  71. @JoinColumn(name = "ID_UNIT")
  72. @Expose
  73. private UnitOrganizational unitOrganizational;
  74. @Transient
  75. @Expose
  76. private String name;
  77. // @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, mappedBy = "employee")
  78. // private List<Project> projects;
  79. public String getAddress() {
  80. return this.address;
  81. }
  82. public String getFirstName() {
  83. return this.firstName;
  84. }
  85. public String getLastName() {
  86. return this.lastName;
  87. }
  88. public String getMail() {
  89. return this.mail;
  90. }
  91. public String getName() {
  92. return this.name;
  93. }
  94. public String getPhono() {
  95. return this.phono;
  96. }
  97. public Date getRegisterDate() {
  98. return this.registerDate;
  99. }
  100. public String getType() {
  101. return this.type;
  102. }
  103. public UnitOrganizational getUnitOrganizational() {
  104. return this.unitOrganizational;
  105. }
  106. @PostLoad
  107. public void postLoad() {
  108. if (this.firstName != null && this.lastName != null) {
  109. this.name = this.firstName + " " + this.lastName;
  110. } else if (this.firstName != null) {
  111. this.name = this.firstName;
  112. } else if (this.lastName != null) {
  113. this.name = this.lastName;
  114. }
  115. }
  116. public void setAddress(String address) {
  117. this.address = address;
  118. }
  119. public void setFirstName(String firstName) {
  120. this.firstName = firstName;
  121. }
  122. public void setLastName(String lastName) {
  123. this.lastName = lastName;
  124. }
  125. public void setMail(String mail) {
  126. this.mail = mail;
  127. }
  128. public void setName(String name) {
  129. this.name = name;
  130. }
  131. public void setPhono(String phono) {
  132. this.phono = phono;
  133. }
  134. public void setRegisterDate(Date registerDate) {
  135. this.registerDate = registerDate;
  136. }
  137. public void setType(String type) {
  138. this.type = type;
  139. }
  140. // public List<Project> getProjects() {
  141. // return projects;
  142. // }
  143. // public void setProjects(List<Project> projects) {
  144. // this.projects = projects;
  145. // }
  146. public void setUnitOrganizational(UnitOrganizational unitOrganizational) {
  147. this.unitOrganizational = unitOrganizational;
  148. }
  149. }