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
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
package com.megatim.apifdxweb.service.impl.administration;
 
 
import javax.ws.rs.Path;
 
/**
 * REST Web Service
 *
 * @author ABEGA
 */
//@SecuredClass(module = "application", path = "action", description = "Actions")
@Path("action")
public class ActionRSImpl {//implements ActionRS {
//
//    /**
//     * On injecte un Gestionnaire d'entites
//     *
//     */
//    @Inject
//    protected ActionManager manager;
//
//    /**
//     * On injecte un Gestionnaire d'entites
//     *
//     */
//    @Inject
//    protected ActionManager roleManager;
//
//    @Context
//    private UriInfo context;
//
//    @AuthenticatedUser
//    private Noeud utilisateurConnecte;
//
//    @Inject
//    private MapStructMapper mapstructMapper;
//
//    public ActionRSImpl() {
//        super();
//    }
//
//    /**
//     * Permet de retourne les parametres de la requete sous forme de d'entité
//     *
//     * @param searchEntity
//     * @param typeOperation
//     * @return
//     */
//    @Override
//    public RestrictionsContainer construireRequete(Action searchEntity, TypeOperation typeOperation) {
//
//        //Variables
//        RestrictionsContainer requeteur = RestrictionsContainer.newInstance();
//
//        //On ajoute le code
//        if (searchEntity.getPath() != null) {
//            requeteur.addLike("path", "%" + searchEntity.getPath());
//        }
//
//        //On ajoute le nom
//        if (searchEntity.getName() != null) {
//            requeteur.addLike("name", "%" + searchEntity.getName());
//        }
//
//        //On ajoute les critères de recherche
//        requeteur.addEq("typeOperation", typeOperation);
//
//        return requeteur;
//    }
//
//    @Override
//    public void performDelete(Action entity) {
//        //On marque comme supprimé
//        entity.setTypeOperation(TypeOperation.SUPPRIMER);
//
//        //On update ne bd
//        manager.update(entity.getId(), entity);
//    }
//
//    @Override
//    public void performUpdate(Action actualEntity, Action requestEntity) {
//
//        if (actualEntity == null) {
//            throw new CommonRessourceNotFoundException("Action introuvable");
//        }
//
//        //On copie les nouvelles valeurs
//        actualEntity.setPath(requestEntity.getPath());
//        actualEntity.setName(requestEntity.getName());
//        actualEntity.setModule(requestEntity.getModule());
//
//        //On update ne bd
//        manager.update(actualEntity.getId(), actualEntity);
//    }
//
//    @Override
//    public String getIdPropertyName() {
//        return "id";
//    }
//
//    @Override
//    public GenericManager<Action, Long> getManager() {
//        return manager;
//    }
//
//    @Override
//    public void beforeSave(Action entity) {
//
//    }
//
//    @Override
//    public void afterSave(Action entity) {
//
//    }
//
//    @Override
//    public ActionDto mapToDto(Action entity) {
//        return mapstructMapper.actionToActionDto(entity);
//    }
//
//    @Override
//    public Response save(HttpHeaders headers, Action entity) {
//        //Pre-traitements
//        beforeSave(entity);
//
//        //On save
//        Action newEntity = getManager().save(entity);
//
//        //Post-traitements
//        afterSave(entity);
//        logAfterSave(entity);
//        return Response.ok(mapToDto(newEntity)).build();
//    }
//
//    @Override
//    public Response update(HttpHeaders headers, Long id, Action entity) {
//        //Variables
//        Action actualEntity = getManager().find(getIdPropertyName(), id);
//
//        //On copie les nouvelles valeurs
//        performUpdate(actualEntity, entity);
//        logAfterUpdate(actualEntity);
//        return Response.ok(mapToDto(actualEntity)).build();
//    }
//
//    @Override
//    public void delete(HttpHeaders headers, Long id) {
//        //Variables
//        Action entity = getManager().find(getIdPropertyName(), id);
//
//        performDelete(entity);
//        logAfterDelete(entity);
//    }
//
//    @Override
//    public Response findById(HttpHeaders headers, Long id) {
//        //Variables
//        Action entity = getManager().find(getIdPropertyName(), id);
//        logAfterGetRessource();
//        return Response.ok(mapToDto(entity)).build();
//    }
//
//    @Override
//    public Response findByOneProperty(HttpHeaders headers, String propertyName, String propertyValue) {
//        //Variables
//        List<Action> datas = null;
//
//        List<ActionDto> dtos = new ArrayList<ActionDto>();
//
//        //On on recherche l'entité
//        datas = getManager().findByUniqueProperty(propertyName, propertyValue, null);
//
//        //Si non vide
//        if (datas != null) {
//
//            for (Action data : datas) {
//                dtos.add(mapToDto(data));
//            }
//
//        }
//        logAfterGetRessource();
//        return Response.ok(dtos).build();
//    }
//
//    @Override
//    public Response findWithPagination(HttpHeaders headers, Integer pageNumber, Integer pagesize, Action searchEntity) {
//        //Variables
//        List<Action> datas = null;
//        List<ActionDto> dtos = new ArrayList<>();
//
//        Map<String, OrderType> orders = new HashMap<>();
//
//        //On trie par id
//        orders.put("id", OrderType.DESC);
//        //On construit la requete
//        RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER);
//
//        //Construction de l'index
//        int index = (pageNumber - 1) * pagesize;
//
//        //On on recherche l'entité
//        datas = getManager().filter(requeteur.getPredicats(), orders, null, index, pagesize);
//
//        //Si non vide
//        if (datas != null) {
//
//            for (Action data : datas) {
//                dtos.add(mapToDto(data));
//            }
//
//        }
//        logAfterGetRessource();
//        return Response.ok(dtos).build();
//    }
//
//    @Override
//    public Response findAll(HttpHeaders headers, Action searchEntity) {
//        //Variables
//        List<Action> datas = null;
//        List<ActionDto> dtos = new ArrayList<>();
//
//        //On construit la requete
//        RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER);
//        Map<String, OrderType> orders = new HashMap<>();
//
//        //On trie par id
//        orders.put("id", OrderType.DESC);
//
//        //On on recherche l'entité
//        datas = getManager().filter(requeteur.getPredicats(), orders, null, 0, -1);
//
//        //Si non vide
//        if (datas != null) {
//            for (Action data : datas) {
//                dtos.add(mapToDto(data));
//            }
//
//        }
//        logAfterGetRessource();
//        return Response.ok(dtos).build();
//    }
//
//    @Override
//    public Long count(HttpHeaders headers, Action searchEntity) {
//        //Variables
//        Long count = 0l;
//
//        //On construit la requete
//        RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER);
//
//        //On on recherche l'entité
//        count = getManager().count(requeteur.getPredicats());
//
//        return count;
//    }
//
//    @Override
//    public void logAfterSave(Action entity) {
////        journalActionUtilisateurManager.logAction("Enregistrement de l'action : " + entity.getName(), Gravite.INFO, utilisateurConnecte);
//    }
//
//    @Override
//    public void logAfterUpdate(Action entity) {
////        journalActionUtilisateurManager.logAction("Mise à jour de l'action : " + entity.getName(), Gravite.INFO, utilisateurConnecte);
//    }
//
//    @Override
//    public void logAfterDelete(Action entity) {
////        journalActionUtilisateurManager.logAction("Suppression de l'action : " + entity.getName(), Gravite.INFO, utilisateurConnecte);
//    }
//
//    @Override
//    public void logAfterGetRessource() {
////        journalActionUtilisateurManager.logAction("Consultation de la liste des actions ", Gravite.INFO, utilisateurConnecte);
//    }
 
}