IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Développement des applications Web avec Spring, Hibernate et Richfaces


précédentsommairesuivant

7. Création des « managed Beans »

7-A. Managed Bean pour la Classe Service

On va maintenant créer nos « managed Beans » (Beans gérés par JSF). On crée un nouveau package qu'on appelle Beans. Puis on crée un Managed Beans pour chaque Classe Entity. Les Managed Beans vont hériter d'une classe qu'on l'appellera MessageBean et qui contiendra les messages à afficher dans l'application.

MessageBean
Sélectionnez
package Beans;
import java.io.Serializable;
/**
* @author Jihed
 */
public class messageBean implements Serializable {
   protected boolean etat = true;
   protected boolean invetat = false;
   protected static String mess_modif_true = "Modification effectuée avec succès";
   protected static String mess_insert_true = "Ajout effectué avec succès";
   protected static String mess_op_false = "Opération échouée";
   protected static String mess_del_true = "Suppression effectuée avec succès";
   protected String style_message;
   public void chageretat() {
       this.invetat = this.etat;
       this.etat = !this.etat;
   }
//getters and setters 
}

On passe maintenant à la création des managed Beans

Image non disponible
Image non disponible

Si on valide, le Bean créé sera automatiquement déclaré dans le fichier « faces-config.xml ».

Image non disponible
ServiceBean
Sélectionnez
package Beans;

/**

* @author Jihed
* */
import Entity.Service;
import Interfaces.InterfaceService;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.ajax4jsf.model.KeepAlive;
import org.richfaces.component.UIDataTable;
public class ServiceBean extends messageBean implements Serializable {
   private Service serv;
   private InterfaceService servService;
   private boolean init;
   private Integer index = 0;
   private List service_list = new ArrayList();
   private String message;
   private boolean nouveau;
   private UIDataTable dataTable;
   public void viderchamps() {
       message = "";
       changeretat();
       this.serv = new Service();
       nouveau = true;    }
   public void annuler() {
       message = "";
       service_list = (List) getService_list();
       serv = (Service) service_list.get(index);
       changeretat();    }
   public boolean isInit() {

       message = "";
       getService_list();
       if (!(service_list.isEmpty())) {
           service_list = (List) getService_list();
           serv = (Service) service_list.get(0);        }
       etat = true;
       invetat = !etat;
       return init;    }
   public void setInit(boolean init) {
       this.init = init;    }
   public ServiceBean() {
       serv = new Service();    }
   public void create() {
       if (nouveau) {
           try {
               this.servService.save(this.serv);
               message = mess_insert_true;
               style_message = "valid_message";
           } catch (Exception hx) {
               hx.printStackTrace();
               message = mess_op_false;
               style_message = "err_message";            }
       } else {
           try {
               this.servService.modify(serv);
               message = mess_modif_true;
               style_message = "valid_message";
           } catch (Exception hx) {
               hx.printStackTrace();
               message = mess_op_false;
               style_message = "err_message";            }        }
       changeretat();    }
   public void modifierligne() {
       this.serv = (Service) dataTable.getRowData();
       message = "";
       nouveau = false;
       changeretat();    }
   public void modifier() {
       message = "";
       nouveau = false;
       changeretat();    }
   public void supprimer() {
       try {
           this.servService.delete(serv);
           message = mess_del_true;
           style_message = "valid_message";
           if (index > 0) {
               index--;            }
           service_list = (List) getService_list();
           if (!service_list.isEmpty()) {
               serv = (Service) service_list.get(index);
           } else {
               viderchamps();
               changeretat();            }
       } catch (Exception hx) {
           hx.printStackTrace();
           message = mess_op_false;        }    }
   public Integer getIndex() {
       return index;    }
   public void setIndex(Integer index) {
       this.index = index;    }
   public String getMessage() {
       return message;    }
   public void setMessage(String message) {
       this.message = message;    }
   public boolean isNouveau() {
       return nouveau;    }
   public void setNouveau(boolean nouveau) {
       this.nouveau = nouveau;    }
   public Service getServ() {

       return serv;    }
   public void setServ(Service serv) {
       this.serv = serv;    }
   public InterfaceService getServService() {
       return this.servService;    }
   public void setServService(InterfaceService servService) {
       this.servService = servService;    }
   public List getService_list() {
       service_list = this.servService.findAll();
       return service_list;    }
   public void setService_list(List service_list) {
       this.service_list = service_list;    }
   public UIDataTable getDataTable() {
       return dataTable;    }
   public void setDataTable(UIDataTable dataTable) {
       this.dataTable = dataTable;    }
}

Dans le Bean « ServiceBean » on a déclaré un attribut de type « InterfaceService » donc on doit préciser la classe qui va implémenter cette interface. Or dans le fichier de configuration de Spring on a spécifié les classes implémentant l'interface « InterfaceService » donc on ajoute une propriété à la déclaration du « ServiceBean » dans le fichier de configuration « faces-config.xml ». Le nom de la propriété est le même nom que l'attribut de type « InterfaceService » déclaré dans le Bean « ServiceBean » et sa valeur est l'id du bean déclaré dans le fichier de configuration de Spring.

Image non disponible

7-B. Liaison avec la page Service

Maintenant on va lier nos interfaces graphiques avec les Beans créés. On commence par la page service. On lie chaque input texte avec l'attribut de l'objet correspondant. Pour chaque inputText on ajoute l'attribut « disabled ». Cet attribut permet de définir l'état du champ de saisie (actif ou grisé).

Image non disponible

Pour les boutons on ajoute les méthodes qu'on va exécuter (attribut action) et les champs qu'on va actualiser après l'exécution de ces méthodes (attribut reRender qui reçoit les identifiants des composants à rafraichir comme paramètres).

Image non disponible
Page Service
Sélectionnez
<%-- 
   Document   : Service
   Created on : 12 déc. 2009, 23:46:35
   Author     : jihed
--%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
   <head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       <LINK rel="stylesheet" type="text/css" href="commun_styles.css"/>
       <title>Service</title>
   </head>
   <body>
       <h:form id="formservice">
       <a4j:include viewId="Entete.jsp"/>
       <a4j:include viewId="menu.jsp"/>
       <h:inputHidden value="#{ServiceBean.init}"/>
       <rich:spacer height="50px" />
       <center>
           <rich:tabPanel  style="width:500px;">
           <rich:tab label="Services">
           <h:outputText  id="infomsg" value="#{ServiceBean.message}" styleClass="valid_message" />
           <h:panelGrid width="450px"  columns="1">
           <rich:panel  id="tablepanel" header="Liste Services" >
               <rich:dataTable
                   binding="#{ServiceBean.dataTable}" onRowMouseOver="this.style.backgroundColor='#B5CEFD'"
                   onRowMouseOut="this.style.backgroundColor='#{org.richfaces.SKIN.tableBackgroundColor}'"
                   onRowClick="this.style.backgroundColor='#F1F1F1'" width="450px"
                   rows="8" id="tbl"  value="#{ServiceBean.service_list}" var="serv" >
               <rich:column width="80px">
                   <f:facet name="header">
                       <h:outputText value="Code" />
                   </f:facet>
                   <h:outputText value="#{serv.servCode}" />
               </rich:column>
               <rich:column width="230px" >
                   <f:facet name="header">
                       <h:outputText value="Libellé" />
                   </f:facet>
                   <h:outputText value="#{serv.servLib}" />
               </rich:column>
               <rich:column style="text-align:center" width="70px" >
                   <f:facet name="header">
                       <h:outputText value="Modifier" />
                   </f:facet>
                   <a4j:commandLink action="#{ServiceBean.modifierligne}" reRender="infomsg,tablepanel,panelinfo,crud_panel">
                       <h:graphicImage  style="border:0"url="/images/ajax/edit16.png" />
                   </a4j:commandLink>
               </rich:column>
               <rich:column style="text-align:center" width="70px">
                   <f:facet name="header">
                       <h:outputText value="Supprimer" />
                   </f:facet>
                   <a4j:commandLink action="#{ServiceBean.supprimer}" ajaxSingle="true" reRender="infomsg,tablepanel,panelinfo,crud_panel">
                       <h:graphicImage style="border:0" url="/images/ajax/delete16.png" />
                   </a4j:commandLink>
               </rich:column>
               <f:facet name="footer">
                   <rich:datascroller />
               </f:facet>
               </rich:dataTable>
           </rich:panel>
           <rich:panel  id="panelinfo" header="Informations générales">
               <h:panelGrid columns="2"  width="350" >
                   <h:outputText value="Code Service  : " />
                   <h:inputText disabled="#{ServiceBean.etat}"  id="codserv" value="#{ServiceBean.serv.servCode}"size="25" maxlength="30">
                   </h:inputText>
                   <h:outputText value="Libellé : " />
                   <h:inputText disabled="#{ServiceBean.etat}" value="#{ServiceBean.serv.servLib}" id="libserv" size="25" maxlength="30" />
                   <h:outputText value="Description : " />
                   <h:inputText disabled="#{ServiceBean.etat}" id="descrserv" value="#{ServiceBean.serv.servDescr}" size="25" maxlength="50" />
               </h:panelGrid>
           </rich:panel>
           </h:panelGrid>
           <h:panelGrid id="crud_panel" columns="5">
               <a4j:commandButton id="nouvserv" ajaxSingle="true" disabled="#{ServiceBean.invetat}"
                                  reRender="infomsg,tablepanel,panelinfo,crud_panel" value="Nouveau"
                                  action="#{ServiceBean.viderchamps}" style="width:85px"/>
               <a4j:commandButton id="modifserv" ajaxSingle="true" disabled="#{ServiceBean.invetat}"
                                  reRender="infomsg,tablepanel,panelinfo,crud_panel" value="Modifier"
                                  action="#{ServiceBean.modifier}"style="width:85px"/>
               <a4j:commandButton id="suppserv" ajaxSingle="true" disabled="#{ServiceBean.invetat}"
                                  reRender="infomsg,tablepanel,panelinfo,crud_panel" value="Supprimer"
                                  action="#{ServiceBean.supprimer}" style="width:85px"/>
               <a4j:commandButton id="validserv" disabled="#{ServiceBean.etat}"
                                  reRender="infomsg,tablepanel,panelinfo,crud_panel" value="Valider"
                                  action="#{ServiceBean.create}" style="width:85px"/>
               <a4j:commandButton id="annulserv" ajaxSingle="true" disabled="#{ServiceBean.etat}"
                                  reRender="infomsg,tablepanel,panelinfo,crud_panel" value="Annuler"
                                  action="#{ServiceBean.annuler}" style="width:85px"/>
           </h:panelGrid>
           </rich:tab>
           </rich:tabPanel>
       </center>
       </h:form>
   </body>
</html>
</f:view>

7-C. Managed Bean pour la Classe Personnel

Le Bean PersonnelBean a pratiquement la même structure que le Bean ServiceBean mais on va utiliser deux interfaces (interface servService pour les actions liées aux objets de type Service et l'interface persService pour les actions liées aux objets de type Personnel). On a donc déclaré une interface servService pour pouvoir récupérer la liste des services afin de les afficher dans un combo dans l'interface graphique.

Image non disponible

L'utilisation de deux interfaces se traduit dans le fichier « faces-config.xml » par la déclaration de deux propriétés.

Image non disponible

D'autre part on va utiliser une hashTable (table indexée) qui contient le code service concaténé avec la lib Service comme clé pour identifier un objet de type service.

Image non disponible

Dans l'interface graphique le composant combo va recevoir comme valeur suggérée (suggestionValues) la liste des clés de la hashTable et à chaque fois qu'on sélectionne une clé on peut pointer directement sur l'objet associé.

Image non disponible
PersonnelBean
Sélectionnez
package Beans;
/**
 * @author Jihed
 */
import Entity.Personnel;
import Entity.Service;
import Interfaces.InterfaceService;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import org.richfaces.component.UIDataTable;
public class PersonnelBean extends messageBean implements Serializable {
   private Personnel pers;
   private InterfaceService persService;
   private InterfaceService servService;

   private List person_list = new ArrayList();
   private List service_list = new ArrayList();
   private Hashtable servlist = new Hashtable();
   private String current_service;
   private boolean init;
   private Integer index = 0;
   private String message;
   private boolean nouveau;
   private UIDataTable dataTable;
   public void viderchamps() {
       message = "";
       changeretat();
       this.pers = new Personnel();
       nouveau = true;
   }
   public void annuler() {
       message = "";
       person_list = (List) getPerson_list();
       pers = (Personnel) person_list.get(index);
       changeretat();
   }
   public void chargercombo() {
       current_service = this.pers.getService().getServCode() + "-" + this.pers.getService().getServLib();
   }
   public boolean isInit() {
       message = "";
       getServlist();
       getPerson_list();
       if (!(person_list.isEmpty())) {
           person_list = (List) getPerson_list();
           pers = (Personnel) person_list.get(0);
           chargercombo();
       }
       etat = true;
       invetat = !etat;
       return init;
   }
   public PersonnelBean() {
       this.pers = new Personnel();
       this.pers.setService(new Service());
   }
   public void create() {
       if (nouveau) {
           try {
               this.pers.setService((Service) servlist.get(current_service));
               this.persService.save(this.pers);
               message = mess_insert_true;
               style_message = "valid_message";
               chargercombo();
           } catch (Exception hx) {
               hx.printStackTrace();
               message = mess_op_false;
               style_message = "err_message";
           }
       } else {
           try {
               this.pers.setService((Service) servlist.get(current_service));
               this.persService.modify(pers);
               message = mess_modif_true;
               style_message = "valid_message";
               chargercombo();
           } catch (Exception hx) {
               hx.printStackTrace();
               message = mess_op_false;
               style_message = "err_message";
           }
       }
       changeretat();    }
   public void modifierligne() {
       this.pers = (Personnel) dataTable.getRowData();
       chargercombo();
       message = "";
       nouveau = false;
       changeretat();}
   public void modifier() {
       message = "";
       nouveau = false;
       changeretat();    }
   public void supprimer() {
       try {
           this.persService.delete(pers);
           message = mess_del_true;
           style_message = "valid_message";
           if (index > 0) {
               index--;
           }
           person_list = (List) getPerson_list();
           if (!person_list.isEmpty()) {
               pers = (Personnel) person_list.get(index);
               chargercombo();
           } else {
               viderchamps();
               changeretat();
           }
       } catch (Exception hx) {
           hx.printStackTrace();
           message = mess_op_false;
       }
   }
   public List getPerson_list() {
       person_list = this.persService.findAll();
       return person_list;    }
   public Hashtable getServlist() {
       service_list.clear();
       servlist.clear();
       List l = this.servService.findAll();
       for (Iterator it = l.iterator(); it.hasNext();) {
           Service srv = (Service) l.get(l.indexOf(it.next()));
           service_list.add(srv.getServCode() + "-" + srv.getServLib());
           servlist.put(srv.getServCode() + "-" + srv.getServLib(), srv);
       }
       return servlist;    }
//geters and setters ....
  }

7-D. Liaison avec la page Personnel

Page Personnel
Sélectionnez
<%-- 
   Document   : Personnel
   Created on : 25 janv. 2010, 23:50:10
   Author     : jihed
--%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
   <head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       <LINK rel="stylesheet" type="text/css" href="commun_styles.css"/>
       <title>Personnel</title>
   </head>
   <body>
       <h:form id="formpersonnel">
       <a4j:include viewId="Entete.jsp"/>
       <a4j:include viewId="menu.jsp"/>
       <h:inputHidden value="#{PersonnelBean.init}"/>
       <rich:spacer height="50px" />
       <center>
           <rich:tabPanel  style="width:500px;">
           <rich:tab label="Personnel">
           <h:outputText id="infomsg" value="#{PersonnelBean.message}" styleClass="valid_message"/>
           <h:panelGrid width="450px"  columns="1">
           <rich:panel id="tablepanel" header="Liste Personnel" >
               <rich:dataTable
                   onRowMouseOver="this.style.backgroundColor='#B5CEFD'" binding="#{PersonnelBean.dataTable}"
                   onRowMouseOut="this.style.backgroundColor='#{org.richfaces.SKIN.tableBackgroundColor}'"
                   onRowClick="this.style.backgroundColor='#F1F1F1'"
                   rows="8" width="100%" id="tbl"  value="#{PersonnelBean.person_list}" var="pers">
               <rich:column>
                   <f:facet name="header">
                       <h:outputText value="Nom" />
                   </f:facet>
                   <h:outputText value="#{pers.persNom}" />
               </rich:column>
               <rich:column >
                   <f:facet name="header">
                       <h:outputText value="Prénom" />
                   </f:facet>
                   <h:outputText value="#{pers.persPrenom}" />
               </rich:column>
               <rich:column >
                   <f:facet name="header">
                       <h:outputText value="Login" />
                   </f:facet>
                   <h:outputText value="#{pers.persLogin}" />
               </rich:column>
               <rich:column >
                   <f:facet name="header">
                       <h:outputText value="Droit" />
                   </f:facet>
                   <h:outputText value="#{pers.persDroit}" />
               </rich:column>
               <rich:column style="text-align:center" width="70px" >
                   <f:facet name="header">
                       <h:outputText value="Modifier" />
                   </f:facet>
                   <a4j:commandLink action="#{PersonnelBean.modifierligne}" reRender="infomsg,tablepanel,panelinfo,crud_panel">
                       <h:graphicImage  style="border:0"url="/images/ajax/edit16.png" />
                   </a4j:commandLink>
               </rich:column>
               <rich:column style="text-align:center" width="70px">
                   <f:facet name="header">
                       <h:outputText value="Supprimer" />
                   </f:facet>
                   <a4j:commandLink action="#{PersonnelBean.supprimer}" ajaxSingle="true" reRender="infomsg,tablepanel,panelinfo,crud_panel">
                       <h:graphicImage style="border:0" url="/images/ajax/delete16.png" />
                   </a4j:commandLink>
               </rich:column>
               <f:facet name="footer">
                   <rich:datascroller />
               </f:facet>
               </rich:dataTable>
           </rich:panel>
           <rich:panel  id="panelinfo" header="Informations générales">
               <h:panelGrid columns="2"  width="350" >
                   <h:outputText value="Nom   : " />
                   <h:inputText id="nompers" value="#{PersonnelBean.pers.persNom}"disabled="#{PersonnelBean.etat}"  size="25" maxlength="30">
                   </h:inputText>
                   <h:outputText value="Prénom : " />
                   <h:inputText value="#{PersonnelBean.pers.persPrenom}" disabled="#{PersonnelBean.etat}" id="prepers" size="25" maxlength="30" />
                   <h:outputText value="Login : " />
                   <h:inputText id="logpers" value="#{PersonnelBean.pers.persLogin}"disabled="#{PersonnelBean.etat}"  size="25" maxlength="50" />
                   <h:outputText value="Password : " />
                   <h:inputSecret id="pwdpers" value="#{PersonnelBean.pers.persPassword}" disabled="#{PersonnelBean.etat}" size="25" maxlength="50" />
                   <h:outputText value="Droit : " />
                   <h:selectOneRadio id="drpers" value="#{PersonnelBean.pers.persDroit}" disabled="#{PersonnelBean.etat}">
                       <f:selectItem itemLabel="Utilisateur" itemValue="user" />
                       <f:selectItem itemLabel="Administrateur" itemValue="admin" />
                   </h:selectOneRadio>
                   <h:outputText value="Service : " />
                   <rich:comboBox disabled="#{PersonnelBean.etat}" id="servpers" suggestionValues="#{PersonnelBean.service_list}"
                                  defaultLabel="Entrez une valeur" value="#{PersonnelBean.current_service}" >
                   </rich:comboBox>
               </h:panelGrid>
           </rich:panel>
           </h:panelGrid>
           
           <h:panelGrid id="crud_panel" columns="5">
               <a4j:commandButton  action="#{PersonnelBean.viderchamps}" id="nouvpers" value="Nouveau" ajaxSingle="true"
                                   style="width:85px" disabled="#{PersonnelBean.invetat}"reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="modifpers" value="Modifier" style="width:85px" ajaxSingle="true"
                                  disabled="#{PersonnelBean.invetat}" action="#{PersonnelBean.modifier}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="supppers" value="Supprimer" style="width:85px" ajaxSingle="true"
                                  disabled="#{PersonnelBean.invetat}" action="#{PersonnelBean.sipprimer}"reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="validpers" value="Valider" style="width:85px"
                                  disabled="#{PersonnelBean.etat}" action="#{PersonnelBean.create}"reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="annulpers" value="Annuler" style="width:85px" ajaxSingle="true"
                                  disabled="#{PersonnelBean.etat}"action="#{PersonnelBean.annuler}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
           </h:panelGrid>
           </rich:tab>
           </rich:tabPanel>
       </center>
       </h:form>
   </body>
</html>
</f:view>

7-E. Managed Bean pour la Classe Equipement

EquipementBean
Sélectionnez
package Beans;
/**
 * @author Jihed
 */
import Entity.Equipement;
import Entity.Service;
import Interfaces.InterfaceService;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import org.richfaces.component.UIDataTable;
public class EquipementBean extends messageBean implements Serializable {
   private Equipement equip;
   private InterfaceService equipService;
   private InterfaceService servService;
   private List equip_list = new ArrayList();
   private List service_list = new ArrayList();
   private Hashtable servlist = new Hashtable();
   private String current_service;
   private boolean init;
   private Integer index = 0;
   private String message;
   private boolean nouveau;
   private UIDataTable dataTable;
   public void viderchamps() {
       message = "";
       changeretat();
       this.equip = new Equipement();
       nouveau = true;
   }
   public void annuler() {
       message = "";
       equip_list = (List) getEquip_list();
       equip = (Equipement) equip_list.get(index);
       changeretat();
   }
   public void chargercombo() {
       current_service = this.equip.getService().getServCode() + "-" + this.equip.getService().getServLib();
   }
   public boolean isInit() {
       message = "";
       getServlist();
       getEquip_list();
       if (!(equip_list.isEmpty())) {
           equip_list = (List) getEquip_list();
           equip = (Equipement) equip_list.get(0);
           chargercombo();
       }
       etat = true;
       invetat = !etat;
       return init;
   }
   public void setInit(boolean init) {
       this.init = init;
   }
   public EquipementBean() {
       this.equip = new Equipement();
       this.equip.setService(new Service());
   }
   public void create() {
       if (nouveau) {
           try {
               this.equip.setService((Service) servlist.get(current_service));
               this.equipService.save(this.equip);
               message = mess_insert_true;
               style_message = "valid_message";
               chargercombo();
           } catch (Exception hx) {
               hx.printStackTrace();
               message = mess_op_false;
               style_message = "err_message";
           }
       } else {
           try {
               this.equip.setService((Service) servlist.get(current_service));
               this.equipService.modify(equip);
               message = mess_modif_true;
               style_message = "valid_message";
               chargercombo();
           } catch (Exception hx) {
               hx.printStackTrace();
               message = mess_op_false;
               style_message = "err_message";
           }
       }
       changeretat();
   }
   public void modifierligne() {
       this.equip = (Equipement) dataTable.getRowData();
       chargercombo();
       message = "";
       nouveau = false;
       changeretat();
   }
   public void modifier() {
       message = "";
       nouveau = false;
       changeretat();
   }
   public void supprimer() {
       try {
           this.equipService.delete(equip);
           message = mess_del_true;
           style_message = "valid_message";
           if (index > 0) {
               index--;
           }
           equip_list = (List) getEquip_list();
           if (!equip_list.isEmpty()) {
               equip = (Equipement) equip_list.get(index);
               chargercombo();
           } else {
               viderchamps();
               changeretat();
           }
       } catch (Exception hx) {
           hx.printStackTrace();
           message = mess_op_false;
       }
   }
   public Integer getIndex() {
       return index;
   }
   public void setIndex(Integer index) {
       this.index = index;
   }
   public String getMessage() {
       return message;
   }
   public void setMessage(String message) {
       this.message = message;
   }
   public boolean isNouveau() {
       return nouveau;
   }
   public void setNouveau(boolean nouveau) {
       this.nouveau = nouveau;
   }
   public List getEquip_list() {
       equip_list = this.equipService.findAll();
       return equip_list;
   }
   public UIDataTable getDataTable() {
       return dataTable;
   }
   public void setDataTable(UIDataTable dataTable) {
       this.dataTable = dataTable;
   }
   public List getService_list() {
       return service_list;
   }
   public void setService_list(List service_list) {
       this.service_list = service_list;
   }
   public InterfaceService getServService() {
       return servService;
   }
   public void setServService(InterfaceService servService) {
       this.servService = servService;
   }
   public Hashtable getServlist() {
       service_list.clear();
       servlist.clear();
       List l = this.servService.findAll();
       for (Iterator it = l.iterator(); it.hasNext();) {
           Service srv = (Service) l.get(l.indexOf(it.next()));
           service_list.add(srv.getServCode() + "-" + srv.getServLib());
           servlist.put(srv.getServCode() + "-" + srv.getServLib(), srv);
       }
       return servlist;
   }
   public void setServlist(Hashtable servlist) {
       this.servlist = servlist;
   }
   public String getCurrent_service() {
       return current_service;
   }
   public void setCurrent_service(String current_service) {
       this.current_service = current_service;
   }
   public Equipement getEquip() {
       return equip;
   }
   public void setEquip(Equipement equip) {
       this.equip = equip;
   }
   public InterfaceService getEquipService() {
       return equipService;
   }
   public void setEquipService(InterfaceService equipService) {
       this.equipService = equipService;
   }
}
Image non disponible

7-F. Liaison avec la page Equipement

Page equipement
Sélectionnez
<%--
   Document   : Equipement
   Created on : 25 janv. 2010, 23:50:10
   Author     : jihed
--%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
   <head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       <LINK rel="stylesheet" type="text/css" href="commun_styles.css"/>
       <title>Equipement</title>
   </head>
   <body>
       <h:form id="formequipement">
       <a4j:include viewId="Entete.jsp"/>
       <a4j:include viewId="menu.jsp"/>
       <h:inputHidden value="#{EquipementBean.init}"/>
       <rich:spacer height="50px" />
       <center>
           <rich:tabPanel  style="width:500px;">
           <rich:tab label="Equipement">
           <h:panelGrid width="450px"  columns="1">
           <h:outputText id="infomsg" value="#{EquipementBean.message}" styleClass="#{EquipementBean.style_message}"/>
           <rich:panel  header="Liste Equipement" id="tablepanel">
               <rich:dataTable
                   onRowMouseOver="this.style.backgroundColor='#B5CEFD'" binding="#{EquipementBean.dataTable}"
                   onRowMouseOut="this.style.backgroundColor='#{org.richfaces.SKIN.tableBackgroundColor}'"
                   onRowClick="this.style.backgroundColor='#F1F1F1'"
                   rows="8" width="100%" id="tbl"  value="#{EquipementBean.equip_list}" var="equip">
               <rich:column>
                   <f:facet name="header">
                       <h:outputText value="Libellé" />
                   </f:facet>
                   <h:outputText value="#{equip.eqLib}" />
               </rich:column>
               <rich:column >
                   <f:facet name="header">
                       <h:outputText value="Etat" />
                   </f:facet>
                   <h:outputText value="#{equip.eqEtat}" />
               </rich:column>
               <rich:column >
                   <f:facet name="header">
                       <h:outputText value="Service" />
                   </f:facet>
                   <h:outputText value="#{equip.service.servLib}" />
               </rich:column>
               <rich:column style="text-align:center" width="70px" >
                   <f:facet name="header">
                       <h:outputText value="Modifier" />
                   </f:facet>
                   <a4j:commandLink action="#{EquipementBean.modifierligne}" reRender="infomsg,tablepanel,panelinfo,crud_panel">
                       <h:graphicImage  style="border:0"url="/images/ajax/edit16.png" />
                   </a4j:commandLink>
               </rich:column>
               <rich:column style="text-align:center" width="70px">
                   <f:facet name="header">
                       <h:outputText value="Supprimer" />
                   </f:facet>
                   <a4j:commandLink action="#{EquipementBean.supprimer}" ajaxSingle="true" reRender="infomsg,tablepanel,panelinfo,crud_panel">
                       <h:graphicImage style="border:0" url="/images/ajax/delete16.png" />
                   </a4j:commandLink>
               </rich:column>
               <f:facet name="footer">
                   <rich:datascroller />
               </f:facet>
               </rich:dataTable>
           </rich:panel>
           <rich:panel id="panelinfo" header="Informations générales">
               <h:panelGrid columns="2"  width="350" >
                   <h:outputText value="Libellé   : " />
                   <h:inputText id="libquip" value="#{EquipementBean.equip.eqLib}" disabled="#{EquipementBean.etat}" size="25" maxlength="30">
                   </h:inputText>
                   <h:outputText value="Description : " />
                   <h:inputTextarea value="#{EquipementBean.equip.eqDescr}" disabled="#{EquipementBean.etat}" id="descrequip" rows="3" />
                   <h:outputText value="Etat : " />
                   <h:selectOneRadio id="etatequip" disabled="#{EquipementBean.etat}" value="#{EquipementBean.equip.eqEtat}" >
                       <f:selectItem itemLabel="Fonctionnel" itemValue="Fonctionnel" />
                       <f:selectItem itemLabel="En Panne" itemValue="En Panne" />
                   </h:selectOneRadio>
                   <h:outputText value="Service : " />
                   <rich:comboBox id="servequip"  defaultLabel="Entrez une valeur" disabled="#{EquipementBean.etat}"
                                  value="#{EquipementBean.current_service}"  suggestionValues="#{EquipementBean.service_list}" required="true">
                   </rich:comboBox>
               </h:panelGrid>
           </rich:panel>
           </h:panelGrid>
           <h:panelGrid id="crud_panel" columns="5">
               <a4j:commandButton id="nouvequip" value="Nouveau" style="width:85px"ajaxSingle="true"
                                  disabled="#{EquipementBean.invetat}"action="#{EquipementBean.viderchamps}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="modifequip" value="Modifier" style="width:85px"ajaxSingle="true"
                                  disabled="#{EquipementBean.invetat}"action="#{EquipementBean.modifier}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="suppequip" value="Supprimer" style="width:85px"ajaxSingle="true"
                                  disabled="#{EquipementBean.etat}"action="#{EquipementBean.supprimer}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="validequip" value="Valider" style="width:85px"
                                  disabled="#{EquipementBean.etat}"action="#{EquipementBean.create}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="annulequip" value="Annuler" style="width:85px"ajaxSingle="true"
                                  disabled="#{EquipementBean.etat}"action="#{EquipementBean.annuler}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
           </h:panelGrid>
           </rich:tab>
           </rich:tabPanel>
       </center>
       </h:form>
   </body>
</html></f:view>

7-G. Managed Bean pour la Classe Interventions

InterventionsBean
Sélectionnez
package Beans;
import Entity.Interventions;
import Entity.Equipement;
import Entity.Personnel;
import Interfaces.InterfaceService;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import org.richfaces.component.UIDataTable;
/**
 *
 * @author jihed
 */
public class InterventionsBean extends messageBean implements Serializable {
   private Interventions interv;
   private InterfaceService intervService;
   private InterfaceService persService;
   private InterfaceService equipService;
   private List interv_list = new ArrayList();
   private List person_list = new ArrayList();
   private Hashtable perslist = new Hashtable();
   private List equip_list = new ArrayList();
   private Hashtable equiplist = new Hashtable();
   private String current_personnel;
   private String current_equipement;
   private boolean init;
   private Integer index = 0;
   private String message;
   private boolean nouveau;
   private UIDataTable dataTable;
   public void viderchamps() {
       message = "";
       changeretat();
       this.interv = new Interventions();
       nouveau = true;
   }
   public void annuler() {
       message = "";
       interv_list = (List) getEquip_list();
       interv = (Interventions) interv_list.get(index);
       changeretat();
   }
   public void chargercombo() {
       current_personnel = this.interv.getPersonnel().getPersNom() + "-" + this.interv.getPersonnel().getPersPrenom();
       current_equipement = this.interv.getEquipement().getEqLib();
   }
   public boolean isInit() {
       message = "";
       getInterv_list();
       getEquiplist();
       getPerslist();
       if (!(interv_list.isEmpty())) {
           interv_list = (List) getInterv_list();
           interv = (Interventions) interv_list.get(0);
           chargercombo();
       }
       etat = true;
       invetat = !etat;
       return init;
   }
   public void setInit(boolean init) {
       this.init = init;
   }
   public InterventionsBean() {
       this.interv = new Interventions();
       this.interv.setEquipement(new Equipement());
       this.interv.setPersonnel(new Personnel());
   }
   public void create() {
       if (nouveau) {
           try {
               this.interv.setPersonnel((Personnel) perslist.get(current_personnel));
               this.interv.setEquipement((Equipement) equiplist.get(current_equipement));
               this.intervService.save(this.interv);
               message = mess_insert_true;
               style_message = "valid_message";
               chargercombo();
           } catch (Exception hx) {
               hx.printStackTrace();
               message = mess_op_false;
               style_message = "err_message";
           }
       } else {
           try {
               this.interv.setPersonnel((Personnel) perslist.get(current_personnel));
               this.interv.setEquipement((Equipement) equiplist.get(current_equipement));
               this.intervService.modify(interv);
               message = mess_modif_true;
               style_message = "valid_message";
               chargercombo();
           } catch (Exception hx) {
               hx.printStackTrace();
               message = mess_op_false;
               style_message = "err_message";
           }
       }
       changeretat();
   }
   public void modifierligne() {
       this.interv = (Interventions) dataTable.getRowData();
       chargercombo();
       message = "";
       nouveau = false;
       changeretat();
   }
   public void modifier() {
       message = "";
       nouveau = false;
       changeretat();
   }
   public void supprimer() {
       try {
           this.intervService.delete(interv);
           message = mess_del_true;
           style_message = "valid_message";
           if (index > 0) {
               index--;
           }
           interv_list = (List) getEquip_list();
           if (!interv_list.isEmpty()) {
               interv = (Interventions) interv_list.get(index);
               chargercombo();
           } else {
               viderchamps();
               changeretat();
           }
       } catch (Exception hx) {
           hx.printStackTrace();
           message = mess_op_false;
       }
   }
   public Integer getIndex() {
       return index;
   }
   public void setIndex(Integer index) {
       this.index = index;
   }
   public String getMessage() {
       return message;
   }
   public void setMessage(String message) {
       this.message = message;
   }
   public boolean isNouveau() {
       return nouveau;
   }
   public void setNouveau(boolean nouveau) {
       this.nouveau = nouveau;
   }
   public List getInterv_list() {
       interv_list = this.intervService.findAll();
       return interv_list;
   }
   public UIDataTable getDataTable() {
       return dataTable;
   }
   public void setDataTable(UIDataTable dataTable) {
       this.dataTable = dataTable;
   }
   public Hashtable getPerslist() {
       person_list.clear();
       perslist.clear();
       List l = this.persService.findAll();
       for (Iterator it = l.iterator(); it.hasNext();) {
           Personnel pers = (Personnel) l.get(l.indexOf(it.next()));
           person_list.add(pers.getPersNom() + "-" + pers.getPersPrenom());
           perslist.put(pers.getPersNom() + "-" + pers.getPersPrenom(), pers);
       }
       return perslist;
   }
   public String getCurrent_equipement() {
       return current_equipement;
   }
   public void setCurrent_equipement(String current_equipement) {
       this.current_equipement = current_equipement;
   }
   public String getCurrent_personnel() {
       return current_personnel;
   }
   public void setCurrent_personnel(String current_personnel) {
       this.current_personnel = current_personnel;
   }
   public InterfaceService getEquipService() {
       return equipService;
   }
   public void setEquipService(InterfaceService equipService) {
       this.equipService = equipService;
   }
   public List getEquip_list() {
       return equip_list;
   }
   public void setEquip_list(List equip_list) {
       this.equip_list = equip_list;
   }
   public Hashtable getEquiplist() {
       equip_list.clear();
       equiplist.clear();
       List l = this.equipService.findAll();
       for (Iterator it = l.iterator(); it.hasNext();) {
           Equipement equip = (Equipement) l.get(l.indexOf(it.next()));
           equip_list.add(equip.getEqLib());
           equiplist.put(equip.getEqLib(), equip);
       }
       return equiplist;
   }
   public void setEquiplist(Hashtable equiplist) {
       this.equiplist = equiplist;
   }
   public Interventions getInterv() {
       return interv;
   }
   public void setInterv(Interventions interv) {
       this.interv = interv;
   }
   public InterfaceService getIntervService() {
       return intervService;
   }
   public void setIntervService(InterfaceService intervService) {
       this.intervService = intervService;
   }
   public void setInterv_list(List interv_list) {
       this.interv_list = interv_list;
   }
   public InterfaceService getPersService() {
       return persService;
   }
   public void setPersService(InterfaceService persService) {
       this.persService = persService;
   }
   public void setPerslist(Hashtable perslist) {
       this.perslist = perslist;
   }
   public List getPerson_list() {
       return person_list;
   }
   public void setPerson_list(List person_list) {
       this.person_list = person_list;
   }
}
Image non disponible

7-H. Liaison avec la page Interventions

Page Interventions
Sélectionnez
<%--
   Document   : Intervention
   Created on : 25 janv. 2010, 23:50:10
   Author     : jihed
--%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
   <head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       <LINK rel="stylesheet" type="text/css" href="commun_styles.css"/>
       <title>Intervention</title>
   </head>
   <body>
       <h:form id="formintervention">
       <a4j:include viewId="Entete.jsp"/>
       <a4j:include viewId="menu.jsp"/>
       <h:inputHidden value="#{IntervBean.init}"/>
       <rich:spacer height="50px" />
       <center>
           <rich:tabPanel  style="width:500px;">
           <rich:tab label="Intervention">
           <h:panelGrid width="450px"  columns="1">
           <h:outputText id="infomsg" value="#{IntervBean.message}" styleClass="#{IntervBean.style_message}"/>
           <rich:panel  id="tablepanel" header="Liste Interventions" >
               <rich:dataTable
                   onRowMouseOver="this.style.backgroundColor='#B5CEFD'" binding="#{IntervBean.dataTable}"
                   onRowMouseOut="this.style.backgroundColor='#{org.richfaces.SKIN.tableBackgroundColor}'"
                   onRowClick="this.style.backgroundColor='#F1F1F1'"
                   rows="8" width="100%" id="tbl"  value="#{IntervBean.interv_list}" var="interv">
               <rich:column>
                   <f:facet name="header">
                       <h:outputText value="Equipement" />
                   </f:facet>
<h:outputText value="#{interv.equipement.eqLib}" />
               </rich:column>
               <rich:column >
                   <f:facet name="header">
                       <h:outputText value="Intervenant" />
                   </f:facet>
                   <h:outputText value="#{interv.personnel.persNom} #{interv.personnel.persPrenom}" />
               </rich:column>
               <rich:column >
                   <f:facet name="header">
                       <h:outputText value="Date" />
                   </f:facet>
                   <h:outputText value="#{interv.intervDate}" >
                       <f:convertDateTime pattern="dd/MM/yyyy" />
                   </h:outputText>
               </rich:column>
               <rich:column style="text-align:center" width="70px" >
                   <f:facet name="header">
                       <h:outputText value="Modifier" />
                   </f:facet>
                   <a4j:commandLink action="#{IntervBean.modifierligne}" reRender="infomsg,tablepanel,panelinfo,crud_panel">
                       <h:graphicImage  style="border:0"url="/images/ajax/edit16.png" />
                   </a4j:commandLink>
               </rich:column>
               <rich:column style="text-align:center" width="70px">
                   <f:facet name="header">
                       <h:outputText value="Supprimer" />
                   </f:facet>
                   <a4j:commandLink action="#{IntervBean.supprimer}" ajaxSingle="true" reRender="infomsg,tablepanel,panelinfo,crud_panel">
                       <h:graphicImage style="border:0" url="/images/ajax/delete16.png" />
                   </a4j:commandLink>
               </rich:column>
               <f:facet name="footer">
                   <rich:datascroller />
               </f:facet>
               </rich:dataTable>
           </rich:panel>
           <rich:panel  id="panelinfo" header="Informations générales">
               <h:panelGrid columns="2"  width="350" >
                   <h:outputText value="Equipement : " />
                   <rich:comboBox id="eqpinterv"  defaultLabel="Entrez une valeur" required="true" disabled="#{IntervBean.etat}"
                                  value="#{IntervBean.current_equipement}" suggestionValues="#{IntervBean.equip_list}" >
                   </rich:comboBox>
                   <h:outputText value="Intervenant : " />
                   <rich:comboBox id="persinterv"  defaultLabel="Entrez une valeur" disabled="#{IntervBean.etat}"
                                  value="#{IntervBean.current_personnel}" suggestionValues="#{IntervBean.person_list}" required="true">
                   </rich:comboBox>
                   <h:outputText value="Date intervention : " />
                   <rich:calendar id="foFiscal" value="#{IntervBean.interv.intervDate}" popup="true" datePattern="dd/MM/yyyy"
                                  cellWidth="24px" cellHeight="22px" disabled="#{IntervBean.etat}"/>
               </h:panelGrid>
           </rich:panel>
           </h:panelGrid>
           <h:panelGrid id="crud_panel" columns="5">
               <a4j:commandButton id="nouvinterv" value="Nouveau" style="width:85px"ajaxSingle="true"
                                  disabled="#{IntervBean.invetat}"action="#{IntervBean.viderchamps}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="modifinterv" value="Modifier" style="width:85px"ajaxSingle="true"
                                  disabled="#{IntervBean.invetat}"action="#{IntervBean.modifier}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="suppinterv" value="Supprimer" style="width:85px"ajaxSingle="true"
                                  disabled="#{IntervBean.etat}"action="#{IntervBean.supprimer}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="validinterv" value="Valider" style="width:85px"
                                  disabled="#{IntervBean.etat}"action="#{IntervBean.create}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
               <a4j:commandButton id="annulinterv" value="Annuler" style="width:85px"ajaxSingle="true"
                                  disabled="#{IntervBean.etat}"action="#{IntervBean.annuler}" reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
           </h:panelGrid>
           </rich:tab>
           </rich:tabPanel>
       </center>
       </h:form>
   </body>
</html>
</f:view>

7-I. Fichier de configuration « Faces-config »

Fichier faces config
Sélectionnez
<?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="1.2" 
   xmlns="http://java.sun.com/xml/ns/javaee" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
   <application>
       <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
   </application>
      <managed-bean>
       <managed-bean-name>ServiceBean</managed-bean-name>
       <managed-bean-class>Beans.ServiceBean</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       <managed-property>
           <property-name>servService</property-name>
           <value>#{servService}</value>
       </managed-property>
   </managed-bean>
   <managed-bean>
       <managed-bean-name>PersonnelBean</managed-bean-name>
       <managed-bean-class>Beans.PersonnelBean</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       <managed-property>
           <property-name>servService</property-name>
           <value>#{servService}</value>
       </managed-property>
       <managed-property>
           <property-name>persService</property-name>
           <value>#{persService}</value>
       </managed-property>
   </managed-bean>
   <managed-bean>
       <managed-bean-name>EquipementBean</managed-bean-name>
       <managed-bean-class>Beans.EquipementBean</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       <managed-property>
           <property-name>servService</property-name>
           <value>#{servService}</value>
       </managed-property>
       <managed-property>
           <property-name>equipService</property-name>
           <value>#{equipService}</value>
       </managed-property>
   </managed-bean>                              
   <managed-bean>
       <managed-bean-name>IntervBean</managed-bean-name>
       <managed-bean-class>Beans.InterventionsBean</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       <managed-property>
           <property-name>equipService</property-name>
           <value>#{equipService}</value>
       </managed-property>
       <managed-property>
           <property-name>persService</property-name>
           <value>#{persService}</value>
       </managed-property>
       <managed-property>
           <property-name>intervService</property-name>
           <value>#{intervService}</value>
       </managed-property>
   </managed-bean>
</faces-config>

7-J. Diagramme de l'application


précédentsommairesuivant

Les sources présentées sur cette page sont libres de droits et vous pouvez les utiliser à votre convenance. Par contre, la page de présentation constitue une œuvre intellectuelle protégée par les droits d'auteur. Copyright © 2011 DGHAIES Jihed. Aucune reproduction, même partielle, ne peut être faite de ce site ni de l'ensemble de son contenu : textes, documents, images, etc. sans l'autorisation expresse de l'auteur. Sinon vous encourez selon la loi jusqu'à trois ans de prison et jusqu'à 300 000 € de dommages et intérêts.