174 lines
No EOL
3.8 KiB
Java
174 lines
No EOL
3.8 KiB
Java
package fr.organizee.model;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import com.sun.istack.NotNull;
|
|
import org.hibernate.annotations.SQLDelete;
|
|
import org.hibernate.annotations.Where;
|
|
|
|
import javax.persistence.*;
|
|
import java.time.LocalDate;
|
|
import java.util.List;
|
|
|
|
|
|
@Entity
|
|
@Table(name = "membre")
|
|
@SQLDelete(sql = "UPDATE membre SET deleted = true WHERE id=?")
|
|
@Where(clause = "deleted=false")
|
|
public class Membre {
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private int id;
|
|
private String nom;
|
|
private String prenom;
|
|
private LocalDate dateNaissance;
|
|
|
|
@NotNull
|
|
@Column(nullable = false)
|
|
private String email;
|
|
|
|
@NotNull
|
|
@Column(nullable = false)
|
|
private String password;
|
|
|
|
@ElementCollection(fetch = FetchType.EAGER)
|
|
@Enumerated(EnumType.STRING)
|
|
private List<Role> roleList;
|
|
|
|
private String isAdmin;
|
|
private String couleur;
|
|
private String smiley;
|
|
|
|
@ManyToOne
|
|
@JoinColumn(name = "TEAM_ID")
|
|
@JsonIgnoreProperties("membre")
|
|
private Team team;
|
|
|
|
private boolean deleted = Boolean.FALSE;
|
|
|
|
public Membre() {
|
|
}
|
|
|
|
public Membre(String nom, String prenom, String couleur, LocalDate dateNaissance, Team team, @NotNull String email, @NotNull String password, List<Role> roleList) {
|
|
this.nom = nom;
|
|
this.prenom = prenom;
|
|
this.couleur = couleur;
|
|
this.dateNaissance = dateNaissance;
|
|
this.email = email;
|
|
this.password = password;
|
|
this.team = team;
|
|
this.roleList = roleList;
|
|
}
|
|
|
|
public boolean isDeleted() {
|
|
return deleted;
|
|
}
|
|
|
|
public void setDeleted(boolean deleted) {
|
|
this.deleted = deleted;
|
|
}
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(int id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getNom() {
|
|
return nom;
|
|
}
|
|
|
|
public void setNom(String nom) {
|
|
this.nom = nom;
|
|
}
|
|
|
|
public String getCouleur() {
|
|
return couleur;
|
|
}
|
|
|
|
public void setCouleur(String couleur) {
|
|
this.couleur = couleur;
|
|
}
|
|
|
|
public String getPrenom() {
|
|
return prenom;
|
|
}
|
|
|
|
public void setPrenom(String prenom) {
|
|
this.prenom = prenom;
|
|
}
|
|
|
|
public LocalDate getDateNaissance() {
|
|
return dateNaissance;
|
|
}
|
|
|
|
public void setDateNaissance(LocalDate dateNaissance) {
|
|
this.dateNaissance = dateNaissance;
|
|
}
|
|
|
|
public String getEmail() {
|
|
return email;
|
|
}
|
|
|
|
public void setEmail(String email) {
|
|
this.email = email;
|
|
}
|
|
|
|
public String getPassword() {
|
|
return password;
|
|
}
|
|
|
|
public void setPassword(String password) {
|
|
this.password = password;
|
|
}
|
|
|
|
public String getIsAdmin() {
|
|
return isAdmin;
|
|
}
|
|
|
|
public void setIsAdmin(String isAdmin) {
|
|
this.isAdmin = isAdmin;
|
|
}
|
|
|
|
public Team getTeam() {
|
|
return team;
|
|
}
|
|
|
|
public void setTeam(Team team) {
|
|
this.team = team;
|
|
}
|
|
|
|
public List<Role> getRoleList() {
|
|
return roleList;
|
|
}
|
|
|
|
|
|
public String getSmiley() {
|
|
return smiley;
|
|
}
|
|
|
|
public void setSmiley(String smiley) {
|
|
this.smiley = smiley;
|
|
}
|
|
|
|
public void setRoleList(List<Role> roleList) {
|
|
this.roleList = roleList;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Membre{" +
|
|
"id=" + id +
|
|
", nom='" + nom + '\'' +
|
|
", prenom='" + prenom + '\'' +
|
|
", dateNaissance=" + dateNaissance +
|
|
", email='" + email + '\'' +
|
|
", password='" + password + '\'' +
|
|
", isAdmin='" + isAdmin + '\'' +
|
|
", couleur='" + couleur + '\'' +
|
|
", smiley='" + smiley + '\'' +
|
|
/*", team=" + team +*/
|
|
'}';
|
|
}
|
|
} |