Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package com.megatim.fdxcommons.model.referentiel;
 
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import com.megatim.fdxcommons.model.search.CriteriaEntitySearch;
 
/**
 *
 * @author ASUS
 */
@Entity
@Getter
@Setter
@XmlRootElement(name = "participants")
@XmlAccessorType(XmlAccessType.FIELD)
@NoArgsConstructor
public class Participant implements Serializable {
 
    @Id
    @NotEmpty(message = "Code obligatoire")
    @Size(min = 3, message = "Le champ code doit avoir 3 caractères")
    @Size(max = 3, message = "Le champ code doit avoir 3 caractères")
    @CriteriaEntitySearch(libelle = "Code", fieldName = "code", rang = 1)
    private String code;
 
    @NotEmpty(message = "Libellé obligatoire")
    @CriteriaEntitySearch(libelle = "Libellé", fieldName = "code", rang = 2)
    private String libelle;
 
    private String description;
 
    private String rue;
 
    private String adresse;
 
    private String ville;
 
    private String email;
 
    @NotNull(message = "Le participant doit être associé à un référentiel en préparation")
    @ManyToOne
    @CriteriaEntitySearch(libelle = "Référentiel", fieldName = "referentiel.version", rang = 3)
    private Referentiel referentiel;
 
    @NotNull(message = "Pays obligatoire")
    @ManyToOne
    @CriteriaEntitySearch(libelle = "Pays", fieldName = "pays.code", rang = 4)
    private Pays pays;
 
    @XmlTransient
    @OneToMany(mappedBy = "participant")
    @JsonIgnore
    private Set<Noeud> noeuds;
 
    @XmlTransient
    @ManyToMany(mappedBy = "participants")
    @JsonIgnore
    private Set<GroupeParticipant> groupeParticipants;
 
    @XmlTransient
    @ManyToMany(mappedBy = "participantsEnvoi")
    @JsonIgnore
    private Set<Routage> routageEnvois = new HashSet<>();
 
    @XmlTransient
    @ManyToMany(mappedBy = "participantsReception")
    @JsonIgnore
    private Set<Routage> routageReceptions = new HashSet<>();
 
    @XmlJavaTypeAdapter(LocalDateTimeAdapter.class)
    private LocalDateTime dateCreation;
 
    @XmlJavaTypeAdapter(LocalDateTimeAdapter.class)
    private LocalDateTime dateMiseAjour;
 
    private String createBy;
 
    private String lastModifiedBy;
 
    @Override
    public String toString() {
        return this.getCode() + " - " + this.getLibelle();
    }
 
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Participant other = (Participant) obj;
        if (this.getCode() != null && !this.getCode().equals(other.getCode())) {
            return false;
        }
        return true;
    }
 
    @Override
    public int hashCode() {
        int hash = 7;
        hash = 13 * hash + Objects.hashCode(this.code);
        return hash;
    }
 
}