All pastes #564499 Raw Edit

HForcE

public text v1 · immutable
·published 2007-06-13 16:51 UTC
rendered paste body
/*
 * Moteur.java
 *
 * Created on 25 avril 2007, 13:23
 */

package Application.ApplicationMusee.Moteur;
import Application.ObjetsMusee.*;
import Application.RessourcesHumainesMusee.*;
import Application.ObjetsMusee.Projects.*;
import Application.ObjetsMusee.Flow.*;
import java.util.*;
import java.io.*;
import java.lang.String;
import Application.ApplicationMusee.Dialogues.AfficheUtilisateur;


/**
 *
 * @author  Vince
 */

public class Moteur{
    
     
    //private String utilisateur[];
    //private String password[];
    private String login;
    private String password;
    public Hashtable HMusee;
    public Hashtable HMuseeTemp;
    public Hashtable Hutilisateur; 
    public Hashtable HPersonnel;
    public Hashtable HProjet;
    public Hashtable HProjetTemp;
    public Vector VPersonnes;
    private Properties propLogin;
    public Hashtable HMouvement;
//    static boolean authentifie = false;
    
    
    /** Creates a new instance of Moteur */
    public Moteur() {
        
     //   loadUtilisateur();
       // loadPiecesCollection();
        loadFichierPiece();
        loadPersonnel();
     //   loadProjet();
        loadFichierProjet();
        loadVecteurPers();
        loadFichierPers();
        loadMouvement();
    }
    
    //Utlilisateur et pass temporairement en Hashtable -> fichier properties à implementer
     /*public void  loadUtilisateur()
    {
        int i;
        utilisateur=new String[2];
        password=new String[2];
        Hutilisateur = new Hashtable(10);
        
        utilisateur[0]="vince";
        utilisateur[1]="steph";
      
        password[0]="avince";
        password[1]="asteph";
        for(i=0; i<2 ; i++)
        {
            Hutilisateur.put(utilisateur[i],password[i]);
        }
        
    }*/
     
     //PieceMusee chargée en Hashtable
     public void loadPiecesCollection(){
         String dir = System.getProperty("user.home");
         String separation = System.getProperty("file.separator");
         //Enlever commentaire dans constructeur pour ajouter de nouvelle piece par defaut dans le fichier
         HMuseeTemp = new Hashtable(50);
         
         System.out.println("Hastable" +  HMusee);
         
         //Insert de quelques pieces
         PieceMuseeSciencesNat P1 = new PieceMuseeSciencesNat("AnimalEmpaille",true,false, 2000, "Animale", true, "Canada", "DansLesBois", 'T', "ours.jpg", "animal","Genretest","Especetest","AuteurMoi",1997,"Embranch","ClaaseTest","RegneTest","Viande", "ben comme nous");
         HMuseeTemp.put(P1.GetIdentifiant().GetID(),P1);
         
         PieceMuseeSciencesNat P2 = new PieceMuseeSciencesNat("Plante",true,false, 2001, "Plante", true, "USA", "DansLesBuissons", 'T', "plante.jpg", "vegetal","Genretest2","Especetest2","AuteurMoi2",1997,"Embranch2","ClaaseTest2","RegneTest2","Fleur", "FeuilleComposée");
         HMuseeTemp.put(P2.GetIdentifiant().GetID(),P2);
         
         PieceMuseeSciencesNat P3 = new PieceMuseeSciencesNat("CoquillageDesMers",true,false, 2002, "Coquillage", true, "Canade", "DansLeau", 'T', "coquillage.jpg", "animal","Genretest3","Especetest3","AuteurMoi2",1997,"Embranch2","ClaaseTest2","RegneTest2","Animal", "hermaphrodite");
         HMuseeTemp.put(P3.GetIdentifiant().GetID(),P3);
         
         //Enregistrement dans le fichier PiecesMusee.ser
       
       try
       {
           System.out.println("Ecriture fichier Objet");
           
           FileOutputStream fos = new FileOutputStream(dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "PiecesMusee.ser");
           ObjectOutputStream oos = new ObjectOutputStream(fos);
           
            int cpt =0;
            PieceMuseeSciencesNat p = new PieceMuseeSciencesNat();
            Enumeration E = HMuseeTemp.elements();
            while(E.hasMoreElements())
           {
            cpt++;
            p=(PieceMuseeSciencesNat) E.nextElement();
            oos.writeObject(p);
           }  
            oos.flush();
       }
       catch(FileNotFoundException e)
       {
        System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
       }
       
       catch(IOException e)
       {
        System.err.println("Erreur!? ["+e+"]");   
       }

     }
     
     //Enregistrement des Pieces dans le fichier PieceMusee.ser
     public void SauveFichierPiece(){
         String dir = System.getProperty("user.home");
         String separation = System.getProperty("file.separator");
       try
       {
           System.out.println("Ecriture fichier Objet");
           
           FileOutputStream fos = new FileOutputStream(dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "PiecesMusee.ser");
           ObjectOutputStream oos = new ObjectOutputStream(fos);
           
            int cpt =0;
            PieceMuseeSciencesNat p = new PieceMuseeSciencesNat();
            Enumeration E = HMusee.elements();
            while(E.hasMoreElements())
           {
            cpt++;
            p=(PieceMuseeSciencesNat) E.nextElement();
            oos.writeObject(p);
           }  
            oos.flush();
       }
       catch(FileNotFoundException e)
       {
        System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
       }
       
       catch(IOException e)
       {
        System.err.println("Erreur!? ["+e+"]");   
       }
     }
     
     
     //chargement du fichier de serialisation
     public void loadFichierPiece(){
         
         HMusee = new Hashtable(50);
         PieceMuseeSciencesNat P = new PieceMuseeSciencesNat();
         String dir = System.getProperty("user.home");
         String separation = System.getProperty("file.separator");
         String FichierObjet = dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "PiecesMusee.ser";
         
         //System.out.println("Chemin trouver:" + FichierObjet);
         
       try
       {
           System.out.println("Lecture fichier Objet");
           
           FileInputStream fis = new FileInputStream(FichierObjet);
           ObjectInputStream ois = new ObjectInputStream(fis);
           for(int i=0;i<50;i++) 
           {
               P=(PieceMuseeSciencesNat)  ois.readObject();
               HMusee.put(P.GetIdentifiant().GetID(),P); 
           }
       }
       catch(FileNotFoundException e)
       {
        System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
       }
       
       catch(IOException e)
       {
        System.err.println("Erreur!? ["+e+"]");   
       }
       catch(ClassNotFoundException e)
       {
        System.err.println("Erreur!Classe non trouvée ["+e+"]");   
       }
         
     }
     
    //Ajouter un objet dans la Hashtable 
    public void AjoutPiece(PieceMuseeSciencesNat P)
    {
       HMusee.put(P.GetIdentifiant().GetID(),P);  
    }
  
    //Recherche lengthpass d'un utilisateur en parametre
    /*public String ChercheUtil(String N)
    {
        String nom = null;
        for(int i=0 ; i<utilisateur.length;i++)
        {
            if(N.equals (utilisateur[i]))
            {
                nom = password[i].substring(0,1);
            }
        }
        return(nom);
    }*/
    
    public boolean LoginTest(String nom, String pass){
        /*for(int i=0 ; i<utilisateur.length;i++)
        {
            if(nom.equals (utilisateur[i]))
            {
                if(pass.equals(password[i]))
                {
                     return true;   
                }
            }
        }
        return false;*/
        
        Properties propLogin = new Properties();
        String separation = System.getProperty("file.separator");
        String dir = System.getProperty("user.home");      
        try
        {
            propLogin.load(new FileInputStream (dir + separation + "JAVA" + separation + "Application" + separation + "Login.properties"));
        }
        catch(FileNotFoundException e)
        {
            System.out.println("Fichier properties de login introuvable.");
        }
        catch(IOException e)
        {
            System.out.println("Erreur : " + e.getMessage());
        }
        
        String Password = null;
        Password = propLogin.getProperty(nom);
        //System.out.println(" property = " + Password);
        if(Password != null)
        {
            if(pass.equals(Password))
            {
                setLogin(nom);// login = nom;
                setPassword(Password);//password = Password;
                return true;                
            }
        } 
        return false;
    }
    
    public void loadPersonnel(){
        
        HPersonnel = new Hashtable(50);
       
        //Ajout quelques personnes
        MembrePersonnel m1 = new MembrePersonnel("Vilvens","Claude",45,"aaa","Professeur");
        AjoutMembrePersonnel(m1);
        
        
        MembrePersonnel m2 = new MembrePersonnel("Wagner","Jean-Marc",31,"rrr","Professeur");
        AjoutMembrePersonnel(m2);
        
        
        PersonnelScientifique m3 = new PersonnelScientifique("Defooz","Pierre",36,"ccc","Responsable Réseaux");
        AjoutPersonnelScientifique(m3);
        
        System.out.println("Nombre apres insert perso" +  NombrePersonnel());
    }
    
     public void loadProjet(){
        
         String dir = System.getProperty("user.home");
         String separation = System.getProperty("file.separator");
        HProjetTemp = new Hashtable(50);
        Calendar debut = Calendar.getInstance();
        debut.set(2007,11,20);
        Calendar f = Calendar.getInstance();
        f.set(2008,2,28);
        Personne p = new Personne();
        p=GetPersonnel(1);
        
        ExpoTemporaire ex = new ExpoTemporaire("Aimaux préhistorique",true,debut,f,"Hall Principal",p);
        Conference co = new Conference("L'ethiqueauZoo", false,debut, "Auditoire1", "12.00", "Et l'ethique?",p ,"aucuns");
        HProjetTemp.put(ex.GetIdentifiant().GetID(),ex);  
        //Conference C = new Conference ("Lethique",true,debut,"Auditoire1","12:00","ethique", p ,"aucun");
        try
       {
           System.out.println("Ecriture fichier Projet");
           
           FileOutputStream fos = new FileOutputStream(dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Projets" + separation + "EAimauxpréhistorique20112007.ser");
           ObjectOutputStream oos = new ObjectOutputStream(fos);
            ExpoTemporaire Expo = new ExpoTemporaire();
            Enumeration E = HProjetTemp.elements();
            while(E.hasMoreElements())
           {
            Expo=(ExpoTemporaire) E.nextElement();
            oos.writeObject(Expo);
           }  
            oos.flush();
       }
       catch(FileNotFoundException e)
       {
        System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
       }
       
       catch(IOException e)
       {
        System.err.println("Erreur!? ["+e+"]");   
       }
        try
       {
           System.out.println("Ecriture fichier Projet");
           
           FileOutputStream fos = new FileOutputStream(dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Projets" + separation + "CLethique200112007.ser");
           ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(co);
            oos.flush();
            HProjetTemp.put(co.GetIdentifiant().GetID(),co);  
       }
       catch(FileNotFoundException e)
       {
        System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
       }
       
       catch(IOException e)
       {
        System.err.println("Erreur!? ["+e+"]");   
       }
     }
    
     public void loadFichierProjet(){
     
     String dir = System.getProperty("user.home");
     String separation = System.getProperty("file.separator");
     String path;
     HProjet = new Hashtable(50);
     File directory = new File(dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Projets" + separation); 
     if(!directory.exists())
     { 
        System.out.println("Le fichier/répertoire n'existe pas"); 
     }
     else if(!directory.isDirectory())
     { 
     System.out.println("Le chemin correspond à un fichier et non à un répertoire"); 
     }
     else
     { 
        File[] subfiles = directory.listFiles(); 
        String message = "Le répertoire Projets contient "+ subfiles.length+" fichier"+(subfiles.length>1?"s":""); 
        System.out.println(message); 
        ExpoTemporaire E = new ExpoTemporaire();
        Publication Publi = new Publication();
        Conference Conf = new Conference();
        String fic;
        String premlettre;
        for(int i=0 ; i<subfiles.length; i++)
        {      
            System.out.println(subfiles[i].getName()); 
            fic=subfiles[i].getName().toString();
            premlettre=fic.substring(0,1);
            if(premlettre.compareTo("E")==0)
            {
                 try
                 { 
                    path = dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Projets" + separation + subfiles[i].getName();
                    System.out.println("Path: "+ path);
                    FileInputStream fis = new FileInputStream(path);
                    ObjectInputStream ois = new ObjectInputStream(fis);
                    E=(ExpoTemporaire) ois.readObject();
                    HProjet.put(E.GetIdentifiant().GetID(),E); 
                //    System.out.println("Projetc: "+ E.GetIdentifiant().GetID());
                 }      
                 catch(FileNotFoundException e)
                 {
                     System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
                 }
       
                 catch(IOException e)
                 {
                     System.err.println("Erreur!? ["+e+"]");   
                 }
                 catch(ClassNotFoundException e)
                 {
                     System.err.println("Erreur!Classe non trouvée ["+e+"]");   
                 }
             }
             if(premlettre.compareTo("P")==0)
            {
                 try
                 { 
                    path = dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Projets" + separation + subfiles[i].getName();
                    System.out.println("Path: "+ path);
                    FileInputStream fis = new FileInputStream(path);
                    ObjectInputStream ois = new ObjectInputStream(fis);
                    Publi=(Publication) ois.readObject();
                    HProjet.put(Publi.GetIdentifiant().GetID(),Publi); 
             //       System.out.println("Projetc: "+ Publi.GetIdentifiant().GetID());
                 }      
                 catch(FileNotFoundException e)
                 {
                     System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
                 }
       
                 catch(IOException e)
                 {
                     System.err.println("Erreur!? ["+e+"]");   
                 }
                 catch(ClassNotFoundException e)
                 {
                     System.err.println("Erreur!Classe non trouvée ["+e+"]");   
                 }
             }
             if(premlettre.compareTo("C")==0)
            {
                 try
                 { 
                    path= dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Projets" + separation + subfiles[i].getName();
                    System.out.println("Path: "+ path);
                    FileInputStream fis = new FileInputStream(path);
                    ObjectInputStream ois = new ObjectInputStream(fis);
                    Conf=(Conference) ois.readObject();
                    HProjet.put(Conf.GetIdentifiant().GetID(),Conf); 
             //       System.out.println("Projetc: "+ Conf.GetIdentifiant().GetID());
                 }      
                 catch(FileNotFoundException e)
                 {
                     System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
                 }
       
                 catch(IOException e)
                 {
                     System.err.println("Erreur!? ["+e+"]");   
                 }
                 catch(ClassNotFoundException e)
                 {
                     System.err.println("Erreur!Classe non trouvée ["+e+"]");   
                 }
             }
       }
     }
       
        
      }
     
     public void SauveFichierProjet(){
         
     }
     public void AjoutExpo(ExpoTemporaire e)
    {
       HProjet.put(e.GetIdentifiant().GetID(),e);  
    }
     
    public void AjoutConference(Conference e)
    {
       HProjet.put(e.GetIdentifiant().GetID(),e);  
    }
    
    public void AjoutPublication(Publication e)
    {
       HProjet.put(e.GetIdentifiant().GetID(),e);  
    }
    
     public void AjoutMembrePersonnel(MembrePersonnel P)
    {
       HPersonnel.put(P.GetIdentifiant().GetID(),P);  
    }
     
     public void AjoutPersonnelScientifique(PersonnelScientifique P)
    {
       HPersonnel.put(P.GetIdentifiant().GetID(),P);  
    }
     
     public int NombrePersonnel(){
      
         int n = HPersonnel.size();
         
         return(n);
     }
     
     public Personne GetPersonnel(int position){
        int cpt =0;
        Personne p = new Personne();
        Enumeration E = HPersonnel.elements();
        while(E.hasMoreElements())
        {
            cpt++;
            p=(Personne) E.nextElement();
            if(cpt==position)
            {
              return (p);   
            }
        }  
        p=null;
        return (p); 
    }
     
     public void loadVecteurPers()
    {
        //VPersMembre = new Vector();
        VPersonnes = new Vector();        
    }
    
    public void addPersV(MembrePersonnel pers)
    {
        VPersonnes.addElement(pers);
    }
    
    public void addPersV(PersonnelScientifique pers)
    {
        VPersonnes.addElement(pers);
    }
    
    public void listPersV()
    {
        Enumeration e;
        for(e = VPersonnes.elements(); e.hasMoreElements();)
        {
            System.out.println(e.nextElement());
        }        
    }
    
   /* public void loadLogin()
    {
        Properties propLogin = new Properties();
        String separation = System.getProperty("file.separator");
        String dir = System.getProperty("user.home");       
        
        try
        {
            //propLogin.load(new FileInputStream ("C:\\JAVA.Applic\\Application\\RessourcesHumainesMusee\\Login.properties"));
            //propLogin.load(new FileInputStream (dir + separation + "RessourcesHumainesMusee" + separation + "Login.properties"));
            propLogin.load(new FileInputStream (dir + separation + "JAVA" + separation + "Application" + separation + "Login.properties"));
        }
        catch(FileNotFoundException e)
        {
            System.out.println("Fichier properties de login introuvable.");
        }
        catch(IOException e)
        {
            System.out.println("Erreur : " + e.getMessage());
        }
    }*/
     public void SauveFichierPers()
    {
        //VPersonnes.
        String dir = System.getProperty("user.home");
        String separation = System.getProperty("file.separator");
        try
        {
            System.out.println("Ecriture fichier Objet Personnes");
           
            FileOutputStream fos = new FileOutputStream(dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Personnes.ser");
            ObjectOutputStream oos = new ObjectOutputStream(fos);
           
            int cpt =0;
            
            Enumeration e;
            int test = VPersonnes.size();
            System.out.println(" Count = " + test);
            for(e = VPersonnes.elements(); e.hasMoreElements();)
            {
                Object Obj = e.nextElement();
                Class classe = Obj.getClass();
                System.out.println(" Classe de l'objet courant : " + Obj.getClass());
                //oos.writeObject(e.nextElement());
                oos.writeObject(Obj);
            }    
            
            oos.flush();
            /*
            PieceMuseeSciencesNat p = new PieceMuseeSciencesNat();
            Enumeration E = HMusee.elements();
            while(E.hasMoreElements())
            {
                cpt++;
                p=(PieceMuseeSciencesNat) E.nextElement();
                oos.writeObject(p);
            }  
            oos.flush();*/
        }
        catch(FileNotFoundException e)
        {
            System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
        }
       
        catch(IOException e)
        {
            System.err.println("Erreur ["+e+"]");   
        }
    }
    
    public void loadFichierPers()
    {         
         MembrePersonnel PersM = new MembrePersonnel();
         PersonnelScientifique PersS = new PersonnelScientifique();
         
         String dir = System.getProperty("user.home");
         String separation = System.getProperty("file.separator");
         String FichierObjet = dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Personnes.ser";
         
         //System.out.println("Chemin trouver:" + FichierObjet);
         
       try
       {
           System.out.println("Lecture fichier Objet Personnes");
           boolean eof = false;
           FileInputStream fis = new FileInputStream(FichierObjet);
           ObjectInputStream ois = new ObjectInputStream(fis);
           Object Obj;
           //for(int i=0;i<50;i++) 
           while(!eof)
           {
               Obj = ois.readObject();
               System.out.println(" Obj = " + Obj.getClass().getName());
               
               if(Obj == null)
               {
                   eof = true;
               }
               else
               {
                   VPersonnes.add(Obj);
                   /*if(Obj.getClass().getName().compareTo("Application.RessourcesHumainesMusee.PersonnelScientifique") == 0)
                   {
                       VPersonnes.add(Obj);
                   }
                   else
                       System.out.println(" =((((((( ");*/
               }
                
               //P=(PieceMuseeSciencesNat)  ois.readObject();
               //HMusee.put(P.GetIdentifiant().GetID(),P); 
           }
       }
       catch(FileNotFoundException e)
       {
        System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
       }
       
       catch(IOException e)
       {
        System.err.println("Erreur!? ["+e+"]");   
       }
       catch(ClassNotFoundException e)
       {
        System.err.println("Erreur!Classe non trouvée ["+e+"]");   
       }
         
    }
    
    public void UpdateLogin(String Login, String Pass)
    {
        Properties propLogin = new Properties();
        String separation = System.getProperty("file.separator");
        String dir = System.getProperty("user.home");      
        try
        {
            propLogin.load(new FileInputStream (dir + separation + "JAVA" + separation + "Application" + separation + "Login.properties"));
        }
        catch(FileNotFoundException e)
        {
            System.out.println("Fichier properties de login introuvable.");
        }
        catch(IOException e)
        {
            System.out.println("Erreur : " + e.getMessage());
        }
                
        propLogin.setProperty(Login,Pass);
        try
        {
            propLogin.store(new FileOutputStream (dir + separation + "JAVA" + separation + "Application" + separation + "Login.properties"), "");
        }
        catch(FileNotFoundException e)
        {
            System.out.println("Fichier properties de login introuvable.");
        }
        catch(IOException e)
        {
            System.out.println("Erreur : " + e.getMessage());
        }
    }
    
     public void loadMouvement(){
         
         HMouvement = new Hashtable(50);
         Mouvement m = new Mouvement();
         String dir = System.getProperty("user.home");
         String separation = System.getProperty("file.separator");
         String FichierObjet = dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Mouvement.ser";
         
       try
       {
           System.out.println("Lecture fichier Mouvement");
           
           FileInputStream fis = new FileInputStream(FichierObjet);
           ObjectInputStream ois = new ObjectInputStream(fis);
           for(int i=0;i<50;i++) 
           {
               m=(Mouvement) ois.readObject();
               HMouvement.put(m.GetIdentifiant().GetID(),m); 
           }
       }
       catch(FileNotFoundException e)
       {
        System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
       }
       
       catch(IOException e)
       {
        System.err.println("Erreur!? ["+e+"]");   
       }
       catch(ClassNotFoundException e)
       {
        System.err.println("Erreur!Classe non trouvée ["+e+"]");   
       }
         
     }
     public void AjoutMouvement(Mouvement M){
      
         HMouvement.put(M.GetIdentifiant().GetID(),M);   
     }
     public void SauveFichierMouvement(){
         
         String dir = System.getProperty("user.home");
         String separation = System.getProperty("file.separator");
       try
       {
           System.out.println("Ecriture fichier Objet Mouvement");
           
           FileOutputStream fos = new FileOutputStream(dir + separation + "JAVA" + separation + "Application" + separation + "Data" + separation + "Mouvement.ser");
           ObjectOutputStream oos = new ObjectOutputStream(fos);
           
            Mouvement m = new Mouvement();
            Enumeration E = HMouvement.elements();
            while(E.hasMoreElements())
           {
            m=(Mouvement) E.nextElement();
            oos.writeObject(m);
           }  
            oos.flush();
       }
       catch(FileNotFoundException e)
       {
        System.err.println("Erreur! Fichier non trouvé ["+e+"]");   
       }
       
       catch(IOException e)
       {
        System.err.println("Erreur!? ["+e+"]");   
       }
         
     }
     
     /** Getter for property login.
      * @return Value of property login.
      */
     public java.lang.String getLogin() {
         return login;
     }
     
     /** Setter for property login.
      * @param login New value of property login.
      */
     public void setLogin(java.lang.String login) {
         this.login = login;
     }
     
     /** Getter for property password.
      * @return Value of property password.
      */
     public java.lang.String getPassword() {
         return password;
     }
     
     /** Setter for property password.
      * @param password New value of property password.
      */
     public void setPassword(java.lang.String password) {
         this.password = password;
     }
     
     public Object recherchePers(String ID)
     {
        Enumeration e = VPersonnes.elements();
        String tempo;
        String classe = "null";
        Object obj;
        MembrePersonnel persM = new MembrePersonnel();
        PersonnelScientifique persS = new PersonnelScientifique();
        
        while(e.hasMoreElements())
        {
            obj = e.nextElement();
              
            tempo = ((EstIdentifiable) obj).GetIdentifiant().GetID();
            //System.out.println("boucle ... >> tempo = " + tempo + " - Login = " + getLogin());          
            if(tempo.equals(ID))
            {
                int fin = obj.getClass().getName().length();
                
                if(obj.getClass().getName().substring(36,fin).equals("MembrePersonnel"))
                {
                    persM = (MembrePersonnel) obj;
                    //AfficheUtilisateur affuser = new AfficheUtilisateur(this,persM);
                    //affuser.setVisible(true);
                    System.out.println("On retourne persM : " + persM.GetIdentifiant().GetID());
                    return persM;
                    //AffichePers a = new AffichePers(mot,persM);
                    //a.setVisible(true);
                }
                else
                {                
                    if(obj.getClass().getName().substring(36,fin).equals("PersonnelScientifique"))
                    {
                        persS = (PersonnelScientifique) obj;
                        //AffichePers a = new AffichePers(mot,persS);
                        //a.setVisible(true);
                        //AfficheUtilisateur affuser = new AfficheUtilisateur(this,persS);
                        //affuser.setVisible(true);
                        System.out.println("On retourne persS : " + persS.GetIdentifiant().GetID());                        
                        return persS;
                    }
                    else
                    {
                        System.out.println(">>> MODIFIER dans ListePers pour accueillir de nouvelles classe !! casting necessaire");
                    }
                }
                
                System.out.println("Piece = ID = "+tempo + " Nom : " + persM.getNom() + " Fonction : " + persM.getFonction());
                //AffichePers a = new AffichePers(mot,obj);
                //a.setVisible(true);
            }
        }
        
        System.out.println("ON RETOURNE NULL");
        return null;
     }
     
     public boolean modifierPassword(String ID, String password)
     {
        Enumeration e = VPersonnes.elements();
        String tempo;
        Object obj;
        
        while(e.hasMoreElements())
        {
            obj = e.nextElement();
              
            tempo = ((EstIdentifiable) obj).GetIdentifiant().GetID();
            //System.out.println("boucle ... >> tempo = " + tempo + " - Login = " + getLogin());          
            if(tempo.equals(ID))
            {
                int fin = obj.getClass().getName().length();
                
                if(obj.getClass().getName().substring(36,fin).equals("MembrePersonnel"))
                {
                    MembrePersonnel mp = (MembrePersonnel) obj;
                    mp.setPassword(password);
                    UpdateLogin(ID, password);
                    return true;
                }
                else
                {
                    if(obj.getClass().getName().substring(36,fin).equals("PersonnelScientifique"))
                    {
                        PersonnelScientifique ps = (PersonnelScientifique) obj;
                        ps.setPassword(password);
                        UpdateLogin(ID, password);
                        return true;
                    }
                }                    
            }
        }
        return false;
     }
     
     public boolean trouverCle(String s, String cle)
     {
         s = "BlablablaTESTblablabla";
         
         if(s.contains(cle))
         {
             System.out.println("OK trouvé");
         }         
     }
}











ERROR is : 
Application/ApplicationMusee/Moteur/Moteur.java [895:1] cannot resolve symbol
symbol  : method contains (java.lang.String)
location: class java.lang.String
         if(s.contains(cle))
             ^