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
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.apifdxweb.model.administration;
 
import com.megatim.fdxcommons.model.enumeration.TypeOperation;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
 
/**
 *
 * @author Leonel FOFOU
 */
@Entity(name = "Action")
@Table(name = "FS_ACTION")
public class Action implements Comparable<Action>, Serializable {
 
    @SequenceGenerator(name = "SEQ_ACTION",
            sequenceName = "SEQ_ACTION",
            allocationSize = 1,
            initialValue = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_ACTION")
    @Column(name = "ID")
    @Id
    private Long id;
 
    @Column(name = "path")
    private String path;
 
    @Column(name = "module")
    private String module;
 
    @Column(name = "name")
    private String name;
 
    @Column(name = "categorie")
    private String categorie;
 
    @Column(name = "description")
    private String description;
 
    @Column(name = "autorise")
    private Boolean autorise;
 
    @Column(name = "ID_GENERER")
    protected String idGenerer;
 
    @Column(name = "TYPE_OPERATION")
    private TypeOperation typeOperation = TypeOperation.AJOUTER;
 
    @ManyToMany(mappedBy = "actions")
    private List<Role> roles = new ArrayList<Role>();
 
    public Action() {
    }
 
    public Action(String name, String description, String path, String module, Boolean autorise) {
        this.name = name;
        this.description = description;
        this.path = path;
        this.module = module;
        this.autorise = autorise;
    }
 
    public Action(String name, String description, String path, String module, String categorie, Boolean autorise) {
        this.name = name;
        this.description = description;
        this.path = path;
        this.module = module;
        this.categorie = categorie;
        this.autorise = autorise;
    }
 
    public Action(String name, String description, String path, String module, Boolean autorise, Role role) {
        this.name = name;
        this.description = description;
        this.path = path;
        this.module = module;
        this.autorise = autorise;
    }
 
    public Long getId() {
        return id;
    }
 
    public void setId(Long id) {
        this.id = id;
    }
 
    public String getPath() {
        return path;
    }
 
    public void setPath(String path) {
        this.path = path;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public List<Role> getRoles() {
        return roles;
    }
 
    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }
 
    public String getIdGenerer() {
        return idGenerer;
    }
 
    public void setIdGenerer(String idGenerer) {
        this.idGenerer = idGenerer;
    }
 
    public TypeOperation getTypeOperation() {
        return typeOperation;
    }
 
    public void setTypeOperation(TypeOperation typeOperation) {
        this.typeOperation = typeOperation;
    }
 
    public Boolean getAutorise() {
        return autorise;
    }
 
    public void setAutorise(Boolean autorise) {
        this.autorise = autorise;
    }
 
    public String getModule() {
        return module;
    }
 
    public void setModule(String module) {
        this.module = module;
    }
 
    public String getDescription() {
        return description;
    }
 
    public void setDescription(String description) {
        this.description = description;
    }
 
    public String getCategorie() {
        return categorie;
    }
 
    public void setCategorie(String categorie) {
        this.categorie = categorie;
    }
 
    @Override
    public int hashCode() {
        int hash = 7;
        hash = 79 * 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 Action other = (Action) obj;
        return Objects.equals(this.id, other.id);
    }
 
    /*
     * (non-Javadoc)
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    @Override
    public int compareTo(Action parameter) {
 
        // Si le parametre est null
        if (parameter == null) {
            return -1;
        }
 
        // Si le code du parametre est vide
        if (parameter.id == null) {
            return -1;
        }
 
        // Si le code du parametre en cours est vide
        if (id == null) {
            return 1;
        }
 
        // On retourne la comparaison des codes
        return id.compareTo(parameter.id);
    }
}