| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 
 |  
     protected void validateFileStructure(File file) throws IOException 
    {
            /**********************************************************************/	
             //création d'un flux de caractères en lecture
            //BufferedReader fichierEnLecture=new BufferedReader(null);
            //FileReader fichierEnLecture=new FileReader(file);
            // fichierEnLecture.readLine();
            /**********************************************************************/
            LineIterator lineIterator = FileUtils.lineIterator(file);
            Set<String> idndocs = new HashSet<String>();
            int i= 0;
            int j=0;//compteur
 
 
 
 
 
            /**********************************************************************/
            try{
                 String ligneLue;
                //creation du flux
                LineNumberReader lnr=new LineNumberReader(new FileReader(file));
                 try{
 
                        while((ligneLue=lnr.readLine())!=null)//parcours des lignes
                        {    String tabLigneLue[]=ligneLue.split(";");//split la ligne lue
 
                            /*********************************************************
                             * Vérification du code caisse existant:
                             * codeCaisse saisie en 1ère colonne du fichier de saisie 
                             * si code caisse existe ok sinon on delete la ligne comprenant le code caisse KO
                             * pour ne pas générer de pdf pour cette ligne
                             * *******************************************************/
                            String[] tabCodeCaisse=new String []{"16275","18025","15135","13135","18715","14445","14505","43199","13335","17515","12579",
                                    "11425","11315","13485","18315","12135","13825","14265","16705","12128","19019"};
 
                           boolean contain=false;
                           String valeurATrouve=tabLigneLue[0];//correspond au code caisse de la ligne lue
                           for(i=0;i<tabCodeCaisse.length;i++)
                           {      
                                   LOG.info("i= "+ i + " tabCodeCaisse[i]= "+ tabCodeCaisse[i] +" tabLigneLue= "+ tabLigneLue[0]);      
                                if(tabCodeCaisse[i].equals(valeurATrouve))
                               {
                                   contain=true;
                               }
                           }
                            if(contain)
                                {
                                i=0;
                                LOG.info("");
                                }
                            else 
 
                                LOG.info("Code Caisse "+ valeurATrouve + " inexistant." + " Verifiez la saisie.");
 
                          }//fin du while
                        LOG.info("Validation structure terminée");
                     }//fin du try
                finally
                    { 
                        lnr.close();//libération des ressources**/
 
                    }
            }
            finally {
            }
 
     } | 
Partager