/* * GestionRH * * Copyright (C) Maisel Team * * GestionRH 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 2 of the License, * or (at your option) any later version. * * GestionRH 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 Cobertura; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package metier.core; import java.io.Serializable; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * * * @version 1.0 * @author Yohann lepage * @author Alexandre Besnard * @author Jonathan Morfin * @author Quentin Rousseau */ @Entity @Table(name="employes") public class Employe implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="EMP_SEQ") @SequenceGenerator(name="EMP_SEQ", sequenceName="EMP_SEQ", allocationSize=1) private Long id; @Column(name="nom") private String nom; @Column(name="prenom") private String prenom; @Column(name="poste") private String poste; @OneToMany(mappedBy = "employe") private Collection <Offre> offres; public Employe () {} public Employe(String prenom,String nom, String poste) { //ID autoincrémentation this.prenom = prenom; this.nom = nom; this.poste = poste; //INITILISATION ?? this.offres = new Collection(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } /** * Get the value of nom * * @return the value of nom */ public String getNom() { return nom; } /** * Set the value of nom * * @param nom new value of nom */ public void setNom(String nom) { this.nom = nom; } /** * Get the value of prenom * * @return the value of prenom */ public String getPrenom() { return prenom; } /** * Set the value of prenom * * @param prenom new value of prenom */ public void setPrenom(String prenom) { this.prenom = prenom; } /** * Get the value of poste * * @return the value of poste */ public String getPoste() { return poste; } /** * Set the value of poste * * @param poste new value of poste */ public void setPoste(String poste) { this.poste = poste; } /** * Get the value of offres * * @return the value of offres */ public Collection getOffres() { return offres; } /** * Set the value of offres * * @param offres new value of offres */ public void setOffres(Collection <Offre> offres) { this.offres = offres; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Employe)) { return false; } Employe other = (Employe) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "Employe{" + "id=" + id + ", nom=" + nom + ", prenom=" + prenom + ", poste=" + poste + '}'; } }