From 23a46b4be35277e06ec89f48730eeb694e686be8 Mon Sep 17 00:00:00 2001
From: Kenmegne <stephanie.kenmegne@gmail.com>
Date: Thu, 18 Jun 2026 15:40:06 +0000
Subject: [PATCH] add fdx-commons and fdx-consultation
---
apifdxweb/api/apifdxweb-service-impl/src/main/java/com/megatim/apifdxweb/service/impl/administration/RoleRSImpl.java | 369 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 369 insertions(+), 0 deletions(-)
diff --git a/apifdxweb/api/apifdxweb-service-impl/src/main/java/com/megatim/apifdxweb/service/impl/administration/RoleRSImpl.java b/apifdxweb/api/apifdxweb-service-impl/src/main/java/com/megatim/apifdxweb/service/impl/administration/RoleRSImpl.java
new file mode 100644
index 0000000..808e012
--- /dev/null
+++ b/apifdxweb/api/apifdxweb-service-impl/src/main/java/com/megatim/apifdxweb/service/impl/administration/RoleRSImpl.java
@@ -0,0 +1,369 @@
+package com.megatim.apifdxweb.service.impl.administration;
+
+import javax.ws.rs.Path;
+
+/**
+ * REST Web Service
+ *
+ * @author ABEGA
+ */
+//@SecuredClass(module = "application", path = "role", description = "Roles")
+@Path("role")
+public class RoleRSImpl {//implements RoleRS {
+//
+// @Inject
+// protected RoleManager manager;
+//
+// @Dependent
+// protected NoeudManager userManager;
+//
+// @Inject
+// protected ActionManager actionManager;
+//
+// @Context
+// private UriInfo context;
+//
+// @Inject
+// private MapStructMapper mapstructMapper;
+//
+// public RoleRSImpl() {
+// super();
+// }
+//
+// public RoleDto mapToDto(Role entity) {
+// return mapstructMapper.roleToRoleDto(entity);
+// }
+//
+// /**
+// * Permet de retourne les parametres de la requete sous forme de d'entité
+// *
+// * @param searchEntity
+// * @param typeOperation
+// * @return
+// */
+// @Override
+// public RestrictionsContainer construireRequete(Role searchEntity, TypeOperation typeOperation) {
+//
+// //Variables
+// RestrictionsContainer requeteur = RestrictionsContainer.newInstance();
+//
+// //On ajoute le code
+// if (searchEntity.getLibelle() != null && !searchEntity.getLibelle().isEmpty()) {
+// requeteur.addLike("libelle", "%" + searchEntity.getLibelle());
+// }
+//
+// //On ajoute le description du role
+// if (searchEntity.getDescription() != null && !searchEntity.getDescription().isEmpty()) {
+// requeteur.addLike("description", "%" + searchEntity.getDescription());
+// }
+//
+// //On ajoute l'etat operation
+// if (searchEntity.getEtatOperation() != null) {
+// requeteur.addEq("etatOperation", searchEntity.getEtatOperation());
+// }
+//
+// //On ajoute le type opération
+// requeteur.addEq("typeOperation", typeOperation);
+//
+// return requeteur;
+// }
+//
+// @Override
+// public void validate(@Context HttpHeaders headers, @PathParam("id") Long id) {
+//
+// //Variables
+// Role entity = getManager().find(getIdPropertyName(), id);
+// if (entity == null) {
+// throw new CommonRessourceNotFoundException("Role introuvable pour l'identifiant " + id);
+// }
+// //On change l'etat
+// entity.setEtatOperation(EtatOperation.ACTIF);
+//
+// //On update ne bd
+// manager.update(entity.getId(), entity);
+//
+// }
+//
+// @Override
+// public void reject(@Context HttpHeaders headers, @PathParam("id") Long id) {
+//
+// //Variables
+// Role entity = getManager().find(getIdPropertyName(), id);
+// if (entity == null) {
+// throw new CommonRessourceNotFoundException("Role introuvable pour l'identifiant " + id);
+// }
+// //On change l'etat
+// entity.setEtatOperation(EtatOperation.INNACTIF);
+//
+// //On marque comme supprimé
+// entity.setTypeOperation(TypeOperation.SUPPRIMER);
+//
+// //On update ne bd
+// manager.update(entity.getId(), entity);
+//
+// }
+//
+// @Override
+// public void performDelete(Role entity) {
+//
+// //On marque comme supprimé
+// entity.setTypeOperation(TypeOperation.SUPPRIMER);
+//
+// //On set les informations supplementaires
+// entity.setDateSuppression(new Date());
+//
+// //On update ne bd
+// manager.update(entity.getId(), entity);
+// }
+//
+// @Override
+// public void performUpdate(Role actualEntity, Role requestEntity) {
+//
+// if (actualEntity == null) {
+// throw new CommonRessourceNotFoundException("Role introuvable pour l'identifiant ");
+// }
+//
+// //Si ce libelle existe dejà
+// if (requestEntity.getLibelle() != null && !requestEntity.getLibelle().isEmpty() && !getManager().findByUniqueProperty("libelle", requestEntity.getLibelle(), null).isEmpty()) {
+// //On retourne le message d'erreur
+// if (!getManager().findByUniqueProperty("libelle", requestEntity.getLibelle(), null).get(0).getLibelle().equals(actualEntity.getLibelle())) {
+// throw new CommonAlredyExistException("libelle", "Ce Libelle Existe déjà.");
+// }
+// }
+//
+// //On copie les nouvelles valeurs
+// actualEntity.setLibelle(requestEntity.getLibelle());
+// actualEntity.setDescription(requestEntity.getDescription());
+//
+// //On set les informations supplementaires
+// actualEntity.setDateDerniereModification(new Date());
+//
+// //On update ne bd
+// getManager().update(actualEntity.getId(), actualEntity);
+//
+// }
+//
+// @Override
+// public String getIdPropertyName() {
+// return "id";
+// }
+//
+// @Override
+// public GenericManager<Role, Long> getManager() {
+// return manager;
+// }
+//
+// @Override
+// public Response findByEtatOperation(@Context HttpHeaders headers, @PathParam("property") String propertyName, @PathParam("value") String propertyValue) {
+//
+// //Variables
+// List<Role> datas = null;
+// RestrictionsContainer requeteur = RestrictionsContainer.newInstance();
+//
+// //On ajoute les criteres
+// requeteur.addEq(propertyName, EtatOperation.fromValeur(propertyValue));
+// requeteur.addEq("typeOperation", TypeOperation.AJOUTER);
+//
+// //On on recherche l'entité
+// datas = getManager().filter(requeteur.getPredicats(), null, null, 0, -1);
+//
+// //Si non vide
+// if (datas == null || datas.isEmpty()) {
+//
+// //Liste vide
+// datas = new ArrayList<>();
+//
+// }
+//
+// return Response.ok(mapstructMapper.roleSlimDtos(datas)).build();
+// }
+//
+// @Override
+// public void beforeSave(Role entity) {
+// //Si ce libelle existe dejà
+// if (entity.getLibelle() != null && !entity.getLibelle().isEmpty() && !getManager().findByUniqueProperty("libelle", entity.getLibelle(), null).isEmpty()) {
+// //On retourne le message d'erreur
+// throw new CommonAlredyExistException("libelle", "Ce Libelle Existe déjà.");
+// }
+// entity.setDateCreation(new Date());
+// entity.setEtatOperation(EtatOperation.NOUVEAU);
+//
+// }
+//
+// @Override
+// public void afterSave(Role entity) {
+//
+// }
+//
+
+// @Override
+// public Response getFormModel(@Context HttpHeaders headers) {
+// RoleFormModel formModel = new RoleFormModel();
+// formModel.setActions(mapstructMapper.actionSlimDtos(actionManager.findAll()));
+// return Response.ok(formModel).build();
+// }
+//
+// @Override
+// public Response getFormModelUpdate(@Context HttpHeaders headers) {
+// RoleFormModel formModel = new RoleFormModel();
+// formModel.setActions(mapstructMapper.actionSlimDtos(actionManager.findAll()));
+// return Response.ok(formModel).build();
+// }
+//
+// @Override
+// public Response save(HttpHeaders headers, Role entity) {
+// //Pre-traitements
+// beforeSave(entity);
+//
+// //On save
+// Role newEntity = getManager().save(entity);
+//
+// //Post-traitements
+// afterSave(entity);
+// logAfterSave(entity);
+// return Response.ok(mapToDto(newEntity)).build();
+// }
+//
+// @Override
+// public Response update(HttpHeaders headers, Long id, Role entity) {
+// //Variables
+// Role 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
+// Role entity = getManager().find(getIdPropertyName(), id);
+//
+// performDelete(entity);
+// logAfterDelete(entity);
+// }
+//
+// @Override
+// public Response findById(HttpHeaders headers, Long id) {
+// //Variables
+// Role entity = getManager().find(getIdPropertyName(), id);
+// logAfterGetRessource();
+// return Response.ok(mapToDto(entity)).build();
+// }
+//
+// @Override
+// public Response findByOneProperty(HttpHeaders headers, String propertyName, String propertyValue) {
+// //Variables
+// List<Role> datas = null;
+//
+// List<RoleDto> dtos = new ArrayList<>();
+//
+// //On on recherche l'entité
+// datas = getManager().findByUniqueProperty(propertyName, propertyValue, null);
+//
+// //Si non vide
+// if (datas != null) {
+// for (Role data : datas) {
+// dtos.add(mapToDto(data));
+// }
+// }
+//
+// logAfterGetRessource();
+//
+// return Response.ok(dtos).build();
+// }
+//
+// @Override
+// public Response findWithPagination(HttpHeaders headers, Integer pageNumber, Integer pagesize, Role searchEntity) {
+// //Variables
+// List<Role> datas = null;
+// List<RoleDto> 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 (Role data : datas) {
+// dtos.add(mapToDto(data));
+// }
+// }
+//
+// logAfterGetRessource();
+//
+// return Response.ok(dtos).build();
+// }
+//
+// @Override
+// public Response findAll(HttpHeaders headers, Role searchEntity) {
+// //Variables
+// List<Role> datas = null;
+// List<RoleDto> 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 (Role data : datas) {
+// dtos.add(mapToDto(data));
+// }
+// }
+//
+// logAfterGetRessource();
+//
+// return Response.ok(dtos).build();
+// }
+//
+// @Override
+// public Long count(HttpHeaders headers, Role 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(Role entity) {
+//// journalActionUtilisateurManager.logAction("Enregistrement du groupe d'utilisateur : " + entity.getLibelle(), Gravite.INFO, utilisateurConnecte);
+// }
+//
+// @Override
+// public void logAfterUpdate(Role entity) {
+//// journalActionUtilisateurManager.logAction("Mise à jour du groupe d'utilisateur : " + entity.getLibelle(), Gravite.INFO, utilisateurConnecte);
+// }
+//
+// @Override
+// public void logAfterDelete(Role entity) {
+//// journalActionUtilisateurManager.logAction("Suppression du groupe d'utilisateur : " + entity.getLibelle(), Gravite.INFO, utilisateurConnecte);
+// }
+//
+// @Override
+// public void logAfterGetRessource() {
+//// journalActionUtilisateurManager.logAction("Consultation de la liste des groupes d'utilisateur : ", Gravite.INFO, utilisateurConnecte);
+// }
+}
--
Gitblit v1.10.0