/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
- /*
- * This file is part of Taurus
- *
- * Taurus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
- *
- * Taurus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Melenti. If not, see <http://www.gnu.org/licenses/>.
- */
- package org.taurus.domain;
- import java.util.Date;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.FetchType;
- import javax.persistence.JoinColumn;
- import javax.persistence.ManyToOne;
- import javax.persistence.NamedQueries;
- import javax.persistence.NamedQuery;
- import javax.persistence.PostLoad;
- import javax.persistence.Table;
- import javax.persistence.Temporal;
- import javax.persistence.TemporalType;
- import javax.persistence.Transient;
- import org.taurus.domain.base.ModelBasic;
- import com.google.gson.annotations.Expose;
- /**
- * Incluir aqui? la descripcion de la clase.
- *
- * @version $Revision: 1.0 $ [29/03/2009]
- * @author Vinicio Llumiquinga <a href="mailto:vllumiquinga@atikasoft.com.ec">taurus</a>
- */
- @Entity
- @Table(name = "taurus_employee")
- @NamedQueries( { @NamedQuery(name = "Employee.findAllActive", query = "SELECT o FROM Employee o WHERE"
- + " o.status='1' order by firstName, lastName") })
- public class Employee extends ModelBasic {
-
- /**
- *
- */
- private static final long serialVersionUID = 6378538139727591397L;
-
- @Column(name = "FIRST_NAME", length = 128)
- @Expose
- private String firstName;
-
- @Column(name = "LAST_NAME", length = 128)
- @Expose
- private String lastName;
-
- @Temporal(TemporalType.DATE)
- @Column(name = "REGISTER_DATE")
- @Expose
- private Date registerDate;
-
- @Column(name = "MAIL", length = 60)
- @Expose
- private String mail;
-
- @Column(name = "TYPE", length = 3)
- @Expose
- private String type;
-
- @Column(name = "ADDRESS", length = 200)
- @Expose
- private String address;
-
- @Column(name = "PHONO", length = 45)
- @Expose
- private String phono;
-
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "ID_UNIT")
- @Expose
- private UnitOrganizational unitOrganizational;
-
- @Transient
- @Expose
- private String name;
-
- // @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, mappedBy = "employee")
- // private List<Project> projects;
-
- public String getAddress() {
- return this.address;
- }
-
- public String getFirstName() {
- return this.firstName;
- }
-
- public String getLastName() {
- return this.lastName;
- }
-
- public String getMail() {
- return this.mail;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getPhono() {
- return this.phono;
- }
-
- public Date getRegisterDate() {
- return this.registerDate;
- }
-
- public String getType() {
- return this.type;
- }
-
- public UnitOrganizational getUnitOrganizational() {
- return this.unitOrganizational;
- }
-
- @PostLoad
- public void postLoad() {
- if (this.firstName != null && this.lastName != null) {
- this.name = this.firstName + " " + this.lastName;
- } else if (this.firstName != null) {
- this.name = this.firstName;
- } else if (this.lastName != null) {
- this.name = this.lastName;
- }
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public void setMail(String mail) {
- this.mail = mail;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setPhono(String phono) {
- this.phono = phono;
- }
-
- public void setRegisterDate(Date registerDate) {
- this.registerDate = registerDate;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- // public List<Project> getProjects() {
- // return projects;
- // }
-
- // public void setProjects(List<Project> projects) {
- // this.projects = projects;
- // }
-
- public void setUnitOrganizational(UnitOrganizational unitOrganizational) {
- this.unitOrganizational = unitOrganizational;
- }
- }