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);
|
// }
|
|
}
|