Kenmegne
7 days ago 1bc8864f134272c4bf23a9b05831803a423a4771
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
package com.megatim.apifdxweb.model.administration;
 
import com.megatim.fdxcommons.model.enumeration.EtatOperation;
import com.megatim.fdxcommons.model.enumeration.TypeOperation;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotEmpty;
 
/**
 *
 * @author DYNABOOK
 */
@Entity(name = "Role")
@Table(name = "FDX_ROLE")
public class Role implements Comparable<Role>, Serializable {
 
    @SequenceGenerator(name = "SEQ_ROLE",
            sequenceName = "SEQ_ROLE",
            allocationSize = 1,
            initialValue = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_ROLE")
    @Column(name = "ID")
    @Id
    private Long id;
 
    @Column(name = "ID_GENERER")
    protected String idGenerer;
 
    @Column(nullable = false, name = "libelle")
    @NotEmpty(message = "Le libellĂ© est obligatoire")
    private String libelle;
 
    @Column(name = "description")
    private String description;
 
    @Column(name = "TYPE_OPERATION")
    private TypeOperation typeOperation = TypeOperation.AJOUTER;
 
    @Column(name = "ETAT_OPERATION")
    @Enumerated(EnumType.STRING)
    private EtatOperation etatOperation;
 
    @Column(name = "IS_ADMIN")
    private boolean admin = false;
 
    @Column(name = "IS_SUPER_ADMIN")
    private boolean superAdmin = false;
 
    @Column(name = "IS_MEGA_ADMIN")
    private boolean megaAdmin = false;
 
    @OneToMany(mappedBy = "role")
    private List<User> users = new ArrayList<>();
 
    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(
            name = "FS_ROLE_ACTION",
            joinColumns = @JoinColumn(name = "FS_ROLE_ID"),
            inverseJoinColumns = @JoinColumn(name = "FS_ACTION_ID"))
    private List<Action> actions = new ArrayList<>();
 
    @Column(name = "DATE_CREATION")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreation;
 
    @Column(name = "USER_CREATION")
    private String utilisateurCreation;
 
    @Column(name = "DATE_DERN_MOD")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateDerniereModification;
 
    @Column(name = "USER_UPDATE")
    private String utilisateurModification;
 
    @Column(name = "DATE_SUPPR")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateSuppression;
 
    @Column(name = "USER_DELETE")
    private String utilisateurSuppression;
 
    public Role() {
    }
 
    public Long getId() {
        return id;
    }
 
    public void setId(Long id) {
        this.id = id;
    }
 
    public String getLibelle() {
        return libelle;
    }
 
    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }
 
    public String getDescription() {
        return description;
    }
 
    public void setDescription(String description) {
        this.description = description;
    }
 
    public TypeOperation getTypeOperation() {
        return typeOperation;
    }
 
    public void setTypeOperation(TypeOperation typeOperation) {
        this.typeOperation = typeOperation;
    }
 
    public String getIdGenerer() {
        return idGenerer;
    }
 
    public void setIdGenerer(String idGenerer) {
        this.idGenerer = idGenerer;
    }
 
    public List<Action> getActions() {
        return actions;
    }
 
    public void setActions(List<Action> actions) {
        this.actions = actions;
    }
 
    public Date getDateCreation() {
        return dateCreation;
    }
 
    public void setDateCreation(Date dateCreation) {
        this.dateCreation = dateCreation;
    }
 
    public String getUtilisateurCreation() {
        return utilisateurCreation;
    }
 
    public void setUtilisateurCreation(String utilisateurCreation) {
        this.utilisateurCreation = utilisateurCreation;
    }
 
    public Date getDateDerniereModification() {
        return dateDerniereModification;
    }
 
    public void setDateDerniereModification(Date dateDerniereModification) {
        this.dateDerniereModification = dateDerniereModification;
    }
 
    public String getUtilisateurModification() {
        return utilisateurModification;
    }
 
    public void setUtilisateurModification(String utilisateurModification) {
        this.utilisateurModification = utilisateurModification;
    }
 
    public Date getDateSuppression() {
        return dateSuppression;
    }
 
    public void setDateSuppression(Date dateSuppression) {
        this.dateSuppression = dateSuppression;
    }
 
    public String getUtilisateurSuppression() {
        return utilisateurSuppression;
    }
 
    public boolean isAdmin() {
        return admin;
    }
 
    public void setAdmin(boolean admin) {
        this.admin = admin;
    }
 
    public boolean isSuperAdmin() {
        return superAdmin;
    }
 
    public void setSuperAdmin(boolean superAdmin) {
        this.superAdmin = superAdmin;
    }
 
    public boolean isMegaAdmin() {
        return megaAdmin;
    }
 
    public void setMegaAdmin(boolean megaAdmin) {
        this.megaAdmin = megaAdmin;
    }
 
    public void setUtilisateurSuppression(String utilisateurSuppression) {
        this.utilisateurSuppression = utilisateurSuppression;
    }
 
    public EtatOperation getEtatOperation() {
        return etatOperation;
    }
 
    public void setEtatOperation(EtatOperation etatOperation) {
        this.etatOperation = etatOperation;
    }
 
    public List<User> getUsers() {
        return users;
    }
 
    public void setUsers(List<User> users) {
        this.users = users;
    }
 
    @Override
    public int hashCode() {
        int hash = 7;
        hash = 11 * hash + Objects.hashCode(this.id);
        return hash;
    }
 
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Role other = (Role) obj;
        if (!Objects.equals(this.id, other.id)) {
            return false;
        }
        return true;
    }
 
    /*
     * (non-Javadoc)
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    @Override
    public int compareTo(Role parameter) {
        if (parameter == null) {
            return -1;
        }
        if (parameter.libelle == null || parameter.libelle.trim().length() == 0) {
            return -1;
        }
        if (libelle == null || libelle.trim().length() == 0) {
            return 1;
        }
        return libelle.compareTo(parameter.libelle);
    }
}