Ignore:
Timestamp:
04/26/10 19:12:49 (14 years ago)
Author:
cbipsl
Message:

maj eccad V3.2

Location:
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/CatParametreDAOjdbc.java

    r68 r70  
    88import java.util.List; 
    99 
    10 import org.medias.eccad.helpers.LoggerPerso; 
    1110import org.medias.eccad.modele.CatParametre; 
    1211import org.medias.eccad.persistance.dao.CatParametreDAO; 
     
    3332                conn = getConnection(); 
    3433                 
    35                 try {LoggerPerso.log(CatParametreDAOjdbc.class, LoggerPerso.DEBUG, "DAOjdbc youhou!!"); 
     34                try { 
    3635                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    37                         sql = "select distinct id_categorieparametre, fullname_categorieparametre from categorieparametre join parametre using (id_categorieparametre) join grille using (id_param);"; 
    38                          
     36//                      sql = "select distinct id_categorieparametre, fullname_categorieparametre, order_categorieparametre" + 
     37//                                      " from categorieparametre join parametre using (id_categorieparametre)" + 
     38//                                      " join grille using (id_param) order by order_categorieparametre;"; 
     39                        sql = "select distinct id_categorieparametre, fullname_categorieparametre" + 
     40                                        ", order_categorieparametre from categorieparametre" + 
     41                                        " where id_categorieparametre in (select id_categorieparametre from parametre" + 
     42                                        " where id_param in (select id_param from grille)) order by order_categorieparametre;"; 
    3943                        resultat = requete.executeQuery(sql); 
    4044                 
     
    5155                } 
    5256                 
    53                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListCatParametre::taille::"+liste_catParam.size()); 
     57//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListCatParametre::taille::"+liste_catParam.size()); 
    5458 
    5559                return liste_catParam; 
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/CodeDAOjdbc.java

    r68 r70  
    2121                try { 
    2222                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    23                         sql = " select legend_code"  
    24                                 + " from grille join codification using (id_codification)" 
    25                                 + " join code using (id_codification) where id_grille = " + id_grille + " order by id_code;"; 
    26                          
     23//                      sql = " select num_code,legend_code"  
     24//                              + " from grille join codification using (id_codification)" 
     25//                              + " join code using (id_codification) where id_grille = " + id_grille + " order by num_code;"; 
     26                        sql = " select number_code,legend_code"  
     27                        + " from grille left join code on id_grille = num_code" 
     28                        + " where id_grille = " + id_grille + " order by number_code;"; 
     29 
    2730                        ResultSet resultat = requete.executeQuery(sql); 
    28                          
     31                        String legend = ""; 
    2932                        while (resultat.next()) { 
    30                                 code.add(resultat.getString("legend_code").toLowerCase()); 
     33                                legend = resultat.getString("legend_code"); 
     34                                code.add(resultat.getString("number_code")+"-"+legend); 
     35                        } 
     36                        if (code.size() == 1) { 
     37                                code.set(0, "1-"+legend); 
    3138                        } 
    3239                } 
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/ColorTabDAOjdbc.java

    r68 r70  
    99import java.util.List; 
    1010 
    11  
    12 import org.medias.eccad.helpers.LoggerPerso; 
    1311import org.medias.eccad.modele.ColorMap; 
    1412import org.medias.eccad.modele.ColorTab; 
     
    1715 
    1816public class ColorTabDAOjdbc extends GeneriqueDAOjdbc implements ColorTabDAO { 
    19  
    20          
    21          
    22          
    23         public ColorTab getColorMapByGrille(long id_grille) throws PersistanceException { 
     17         
     18        public ColorTab getColorMapByGrille() throws PersistanceException { 
    2419                ColorTab colortab = new ColorTab(); 
    25                 colortab = getTableDefault(id_grille, colortab); 
     20                colortab = getTableDefault(colortab); 
    2621                //colortab = getMinMax(oid, colortab); 
    2722                 
     
    2924        } 
    3025         
    31         public List<ColorMap> getListColorTab() throws PersistanceException { 
    32                 String sql = " select cm_name, "  
    33                            + " from colormap " 
    34                            + " order by cm_id;"; 
    35                            //+ " join grille using (id_param) " 
    36                             
    37                  
    38                 Statement requete = null; 
    39                 ResultSet resultat = null; 
    40                 Connection conn = getConnection(); 
    41                  
    42                 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 
     26        public List<ColorMap> getListClassMap() throws PersistanceException { 
     27                String sql = " select clm_id, clm_name, num_order from class_map order by clm_id";               
     28                 
     29                Statement requete = null; 
     30                ResultSet resultat = null; 
     31                Connection conn = getConnection(); 
     32                 
     33//              LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 
    4334                 
    4435                try { 
     
    5445                try { 
    5546                        while (resultat.next()) { 
    56                                 liste_colormap.add(new ColorMap(resultat.getLong("cm_id"), resultat.getString("cm_name"), resultat.getInt("pc_defaut"))); 
     47                                liste_colormap.add(new ColorMap(resultat.getLong("clm_id"), resultat.getString("clm_name"), resultat.getInt("num_order"))); 
    5748                        } 
    5849                } 
     
    6758        } 
    6859         
    69         public List<ColorMap> getListColorTabByGrille(long id_grille) throws PersistanceException { 
    70                 String sql = " select distinct cm_id, cm_name, pc_defaut"  
     60        public List<ColorMap> getListColorTabByGrille() throws PersistanceException { 
     61                /*String sql = " select distinct cm_id, cm_name, pc_defaut"  
    7162                           + " from colormap join param_color using (cm_id) " 
    7263                           + " join grille using (id_param) " 
    73                            + " where id_grille = " + id_grille + " order by pc_defaut desc;"; 
    74                  
    75                 Statement requete = null; 
    76                 ResultSet resultat = null; 
    77                 Connection conn = getConnection(); 
    78                  
    79                 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 
     64                           + " where id_grille = " + id_grille + " order by pc_defaut desc;";*/ 
     65                 
     66                String sql = " select clm_id as cm_id, clm_name as cm_name, num_order as pc_defaut from class_map order by clm_id"; 
     67                 
     68                Statement requete = null; 
     69                ResultSet resultat = null; 
     70                Connection conn = getConnection(); 
     71                 
     72//              LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 
    8073                 
    8174                try { 
     
    10497        } 
    10598         
    106         private ColorTab getTableDefault(long id_grille, ColorTab colortab) throws PersistanceException { 
    107                 Statement requete = null; 
    108                 String sql = " select distinct col_r, col_g, col_b, ci_min, ci_max"  
     99        private ColorTab getTableDefault(ColorTab colortab) throws PersistanceException { 
     100                Statement requete = null; 
     101                /*String sql = " select distinct col_r, col_g, col_b, ci_min, ci_max"  
    109102                                   + " from color join color_index using (col_id)" 
    110103                                   + " join param_color using (cm_id) " 
    111104                                   + " join grille   using (id_param) " 
    112                                    + " where id_grille = " + id_grille +" and pc_defaut = 1 order by ci_max;"; 
    113                 Connection conn = getConnection(); 
    114                  
    115                 ResultSet resultat = null; 
    116                  
    117                  
    118                 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "*************************************REQUETE = " + sql); 
     105                                   + " where id_grille = " + id_grille +" and pc_defaut = 1 order by ci_max;";*/ 
     106 
     107                String sql = " select distinct col_r, col_g, col_b, class_index.num_order" 
     108                                   + " from color join class_index using (col_id)" 
     109                                   + " join class_map using (clm_id) " 
     110                                   + " where class_map.num_order=1 order by class_index.num_order;"; 
     111                Connection conn = getConnection(); 
     112                 
     113                ResultSet resultat = null; 
     114                 
     115//              LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "*************************************REQUETE = " + sql); 
    119116                try { 
    120117                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
     
    129126                int i=0; 
    130127 
    131                  
     128                float ci_min=-1; 
     129                float ci_max=0; 
    132130                 
    133131                try { 
    134132                        while (resultat.next()) { 
    135133                                liste_couleur.add(new Color(resultat.getInt("col_r"), resultat.getInt("col_g"), resultat.getInt("col_b"))); 
    136                                 liste_min.add(resultat.getFloat("ci_min")); 
    137                                 colortab.setMax(resultat.getFloat("ci_max")); 
     134                                //liste_min.add(resultat.getFloat("ci_min")); 
     135                                //colortab.setMax(resultat.getFloat("ci_max")); 
     136                                 
     137                                liste_min.add(ci_min); 
     138                                colortab.setMax(ci_max); 
     139                                 
     140                                if (ci_min==-1) ci_min=0; 
     141                                else ci_min=ci_min+10; 
     142                                 
     143                                ci_max=ci_max+10; 
    138144                                i++; 
    139145                        } 
     
    164170        } 
    165171 
    166         public ColorTab getColorMapByID(long id) throws PersistanceException { 
     172        public ColorTab getColorMapByID(long id, long idClass) throws PersistanceException { 
    167173                Statement requete = null; 
    168174                ColorTab colortab = new ColorTab(); 
    169175                 
    170                 String sql = " select distinct col_r, col_g, col_b, ci_min, ci_max, cm_name"  
     176                /*String sql = " select distinct col_r, col_g, col_b, ci_min, ci_max, cm_name"  
    171177                                   + " from color join color_index using (col_id) join colormap using (cm_id)" 
    172                                    + " where cm_id = " + id +" order by ci_min;"; 
    173                 Connection conn = getConnection(); 
    174                  
    175                 ResultSet resultat = null; 
    176                  
    177                  
    178                 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "REQUETE = " + sql); 
     178                                   + " where cm_id = " + id +" order by ci_min;";*/ 
     179 
     180                String sql="select distinct col_r, col_g, col_b, clm_name as cm_name, ci.num_order, val_min, val_max"  
     181                        +" from color as co, class_index as ci, class_map as cm, class_distribution as cd"  
     182                        +" where co.col_id=ci.col_id and ci.clm_id=cm.clm_id and cm.clm_id="+id+" and cd.scl_id="+idClass 
     183                        +" and cd.num_order=ci.num_order order by ci.num_order;"; 
     184                Connection conn = getConnection(); 
     185                 
     186                ResultSet resultat = null; 
     187 
     188//              LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "REQUETE = " + sql); 
    179189                try { 
    180190                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
     
    189199                int i=0; 
    190200 
    191                  
    192                  
    193                 try { 
    194                          
     201                try { 
    195202                        while (resultat.next()) { 
    196203                                colortab.setName(resultat.getString("cm_name")); 
    197204                                liste_couleur.add(new Color(resultat.getInt("col_r"), resultat.getInt("col_g"), resultat.getInt("col_b"))); 
    198                                 liste_min.add(resultat.getFloat("ci_min")); 
    199                                 colortab.setMax(resultat.getFloat("ci_max")); 
     205                                liste_min.add(resultat.getFloat("val_min")); 
     206                                colortab.setMax(resultat.getFloat("val_max")); 
     207//                              LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "NAME="+resultat.getString("cm_name")+", RANGE = " +resultat.getFloat("val_min")+" - "+resultat.getFloat("val_max")); 
    200208                                i++; 
    201209                        } 
     
    221229        } 
    222230 
    223         public List<ColorMap> getListColorMapDynamique() throws PersistanceException { 
     231/*      public List<ColorMap> getListColorMapDynamique() throws PersistanceException { 
    224232                String sql = " select distinct clm_id, clm_name"  
    225                            + " from class_map " 
    226                            + " where clm_name ilike '%exponential%' or clm_name ilike '%linear%' or clm_name ilike '%logarithm%' order by clm_name;"; 
    227                  
    228                  
    229                  
    230                 Statement requete = null; 
    231                 ResultSet resultat = null; 
    232                 Connection conn = getConnection(); 
    233                  
    234                 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 
     233                           + " from class_map order by clm_id"; 
     234                           //+ " where clm_name like '%exponential%' or clm_name like '%linear%' or clm_name like '%logarithm%' order by clm_name;"; 
     235                 
     236                 
     237                Statement requete = null; 
     238                ResultSet resultat = null; 
     239                Connection conn = getConnection(); 
     240                 
     241//              LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 
    235242                 
    236243                try { 
     
    246253                try { 
    247254                        while (resultat.next()) { 
    248                                 liste_colormap.add(new ColorMap(resultat.getLong("cm_id"), resultat.getString("cm_name"), 0)); 
     255                                liste_colormap.add(new ColorMap(resultat.getLong("clm_id"), resultat.getString("clm_name"), 0)); 
    249256                        } 
    250257                } 
     
    257264                 
    258265                return liste_colormap; 
    259         } 
     266        }*/ 
    260267 
    261268} 
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/FactoryDAOjdbc.java

    r68 r70  
    44import org.medias.eccad.persistance.dao.GrilleDAO; 
    55import org.medias.eccad.persistance.dao.ParametreDAO; 
     6import org.medias.eccad.persistance.dao.SecteurDAO; 
    67import org.medias.eccad.persistance.dao.ProduitDAO; 
    78 
     
    2425                return new ParametreDAOjdbc(sgbd); 
    2526        } 
     27         
     28        public SecteurDAO getSecteurDAO() { 
     29                return new SecteurDAOjdbc(sgbd); 
     30        } 
    2631 
    2732        public ProduitDAO getProduitDAO() { 
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/GeneriqueDAOjdbc.java

    r68 r70  
    44import java.sql.SQLException; 
    55 
    6  
    7 import org.medias.eccad.helpers.LoggerPerso; 
    86import org.medias.eccad.persistance.exception.PersistanceException; 
    97 
     
    4038                        throw new PersistanceException(sqle, "impossible de se connecter au sgbd :: ParametreDAOjdbc.getListParametre"); 
    4139                } 
    42                 LoggerPerso.log(GeneriqueDAOjdbc.class, LoggerPerso.DEBUG, "-- jdbc connexion -- "); 
    4340                return conn; 
    4441        } 
    4542         
    4643        protected void closeConnection() { 
    47                 LoggerPerso.log(GeneriqueDAOjdbc.class, LoggerPerso.DEBUG, "-- jdbc deconnexion -- "); 
    4844                sgbd.deconnexion(); 
    4945        } 
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/GrilleDAOjdbc.java

    r68 r70  
    22 
    33import java.sql.Connection; 
     4import java.sql.Date; 
    45import java.sql.ResultSet; 
    56import java.sql.SQLException; 
    67import java.sql.Statement; 
     8import java.util.ArrayList; 
     9import java.util.Collections; 
    710import java.util.LinkedList; 
    811import java.util.List; 
    912 
    10  
    1113import org.medias.eccad.helpers.Donnees; 
    12 import org.medias.eccad.helpers.LoggerPerso; 
    1314import org.medias.eccad.modele.Grille; 
    1415import org.medias.eccad.persistance.jdbc.SGBD_jdbc; 
     
    2829        } 
    2930         
    30         public List<Grille> getListGrille(long id_produit,long id_parametre, String date_debut, String date_fin)  throws PersistanceException{ 
     31        public List<Grille> getListGrille(long id_produit,long id_parametre, long id_secteur, long id_rcp, String date_debut, String date_fin, String nomProd, String legend, String typeProd)  throws PersistanceException{ 
     32                Statement requete; 
     33                String sql; 
     34                List<Grille> liste_gril = new LinkedList<Grille>(); 
     35                Connection conn = getConnection(); 
     36 
     37                try { 
     38                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
     39                        sql = "select distinct date_grille, id_grille, legend_code, number_code" + 
     40                                        " from grille" + 
     41                                        " left join code on ((id_grille = num_code) and (grille.id_codification = code.id_codification))" + 
     42                                        " where id_produit = "+id_produit+" and id_param = "+id_parametre; 
     43                        if (nomProd.equals("IPCC")) { 
     44                                if (id_secteur > 0) { 
     45                                        sql+=" and id_secteur="+id_secteur;                                      
     46                                } 
     47                                if (id_rcp > 0 ) { 
     48                                        sql+=" and id_rcp="+id_rcp; 
     49                                } else { 
     50                                        sql+=" and id_rcp is null"; 
     51                                } 
     52                                if (legend != null) { 
     53                                        sql+=" and legend_code = '"+legend+"'"; 
     54                                } 
     55                        } 
     56                        if (date_debut != null) { 
     57                                sql += " and date_grille >= '" + date_debut + "' and date_grille <= '" + date_fin + "'"; 
     58                                if (typeProd.equals("monoplan")) { 
     59                                        sql += " order by id_grille, number_code"; 
     60                                } else { 
     61                                        sql += " order by date_grille, number_code"; 
     62                                } 
     63                        } else { 
     64                                sql += " order by id_grille"; 
     65                        } 
     66                        sql += ";"; 
     67//LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::requete grille :: " + sql); 
     68                        ResultSet resultat = requete.executeQuery(sql); 
     69                         
     70                        Date date; 
     71                        long idGrille, idGrillePrec = 0; 
     72                        String datePrec = ""; 
     73                        int numberCode; 
     74                        // NB: On ne stocke qu'une seule grille : 
     75                        // - par plan (dans le cas d'un produit multiplan) 
     76                        // - par date (dans le cas d'un produit temporel) 
     77                        // - par masque (dans le cas d'un produit monoplan) 
     78                        while (resultat.next()) { 
     79                                date = resultat.getDate("date_grille"); 
     80                                idGrille = resultat.getLong("id_grille"); 
     81                                numberCode = resultat.getInt("number_code"); 
     82                                if (typeProd.equals("multiplan") ||  
     83                                        !date.toString().equals(datePrec) ||  
     84                                        (typeProd.equals("monoplan") && idGrille != idGrillePrec)) { 
     85                                        // Cas monoplan: on place la grille contenant l'ensemble des masques en premiÚre position 
     86//                                      if (typeProd.equals("monoplan") && numberCode == 0) { 
     87//                                              liste_gril.add(0,new Grille(idGrille, date, resultat.getString("legend_code"),numberCode)); 
     88//                                      } else { 
     89                                                liste_gril.add(new Grille(idGrille, date, resultat.getString("legend_code"),numberCode)); 
     90//                                      } 
     91                                } 
     92                                datePrec = date.toString(); 
     93                                idGrillePrec = idGrille; 
     94                        } 
     95                        // Pour un produit monoplan, on trie les grilles par numéro de code 
     96                        if (typeProd.equals("monoplan")) { 
     97                                Collections.sort(liste_gril,new Grille().new ComparatorNumberCode()); 
     98                        } 
     99                } 
     100                catch (SQLException sqle) { 
     101                        throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getListGrille"); 
     102                } 
     103                finally { 
     104                        closeConnection(); 
     105                } 
     106//System.out.println("nbgrilles="+liste_gril.size()); 
     107                return liste_gril; 
     108        } 
     109 
     110        public List<Grille> getListGrille(long id_produit, String date_debut, String date_fin)  throws PersistanceException{ 
    31111                Statement requete; 
    32112                String sql; 
     
    36116                try { 
    37117                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    38                         sql = "select distinct id_grille, valeurs_grille, date_grille, legend_code from grille left join code on ((id_grille = num_code) and (grille.id_codification = code.id_codification)) where id_produit = " + id_produit+" and id_param = "+id_parametre; 
     118                        sql = "select distinct id_grille, valeurs_grille, date_grille, legend_code, number_code from grille" + 
     119//                              " inner join codification using (id_codification)" + 
     120//                              " inner join type_codification using (id_typecodification)" + 
     121                                " left join code on ((id_grille = num_code)" + 
     122                                " and (grille.id_codification = code.id_codification)) where id_produit = " + id_produit; 
     123//                              " inner join codification using (id_codification) left join code using (id_codification)" + 
     124//                              " where id_produit = " + id_produit; 
    39125                         
    40126                        if (date_debut != null) 
    41                                 sql += " and date_grille >= '" + date_debut + "' and date_grille <= '" + date_fin + "' order by date_grille"; 
     127                                sql += " and date_grille >= '" + date_debut + "' and date_grille <= '" + date_fin + "' order by date_grille, number_code"; 
    42128                        else 
    43                                 sql += " order by id_grille"; 
     129                                sql += " order by number_code, id_grille"; 
    44130                         
    45131                        sql += ";"; 
    46132                         
    47                         LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::requete :: " + sql); 
     133//                      LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille2::requete :: " + sql); 
    48134                        ResultSet resultat = requete.executeQuery(sql); 
    49135                         
    50136                        while (resultat.next()) { 
    51                                 liste_param.add(new Grille(resultat.getLong("id_grille"), resultat.getDate("date_grille"), resultat.getString("legend_code"))); 
     137                                liste_param.add(new Grille(resultat.getLong("id_grille"), resultat.getDate("date_grille"), resultat.getString("legend_code"), resultat.getInt("number_code"))); 
    52138                        } 
    53139                } 
     
    58144                        closeConnection(); 
    59145                } 
    60                          
    61                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::taille::"+liste_param.size() + "id_produit::" + id_produit); 
     146 
     147//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::taille::"+liste_param.size() + "id_produit::" + id_produit); 
    62148                return liste_param; 
    63149        } 
    64150 
    65          
    66          
    67         public List<Grille> getListGrille(long id_produit, String date_debut, String date_fin)  throws PersistanceException{ 
    68                 Statement requete; 
    69                 String sql; 
    70                 List<Grille> liste_param = new LinkedList<Grille>(); 
    71                 Connection conn = getConnection(); 
    72                  
    73                 try { 
    74                         requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    75                         sql = "select distinct id_grille, valeurs_grille, date_grille, legend_code from grille left join code on ((id_grille = num_code) and (grille.id_codification = code.id_codification)) where id_produit = " + id_produit; 
    76                          
     151        public List<String> getListAlt(long id_secteur, String date_debut) throws PersistanceException{ 
     152                Statement requete; 
     153                String sql; 
     154                List<String> liste_alt = new LinkedList<String>(); 
     155                Connection conn = getConnection(); 
     156 
     157                try { 
     158                        // On récupÚre les altitudes 
     159                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
     160                        //sql = "select distinct cast(legend_code as decimal) as altitude from grille" + 
     161                        sql = "select distinct legend_code, number_code from grille" + 
     162                                        " left join code on ((id_grille = num_code) and (grille.id_codification = code.id_codification))" + 
     163                                        " where id_secteur = "+id_secteur; 
    77164                        if (date_debut != null) 
    78                                 sql += " and date_grille >= '" + date_debut + "' and date_grille <= '" + date_fin + "' order by date_grille"; 
    79                         else 
    80                                 sql += " order by id_grille"; 
    81                          
    82                         sql += ";"; 
    83                          
    84                         LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::requete :: " + sql); 
    85                         ResultSet resultat = requete.executeQuery(sql); 
    86                          
     165                                sql += " and date_grille = '" + date_debut+"'"; 
     166                        sql += " order by number_code;"; 
     167                        ResultSet resultat = requete.executeQuery(sql); 
    87168                        while (resultat.next()) { 
    88                                 liste_param.add(new Grille(resultat.getLong("id_grille"), resultat.getDate("date_grille"), resultat.getString("legend_code"))); 
    89                         } 
    90                 } 
    91                 catch (SQLException sqle) { 
    92                         throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getListGrille"); 
    93                 } 
    94                 finally { 
    95                         closeConnection(); 
    96                 } 
    97                          
    98                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::taille::"+liste_param.size() + "id_produit::" + id_produit); 
    99                 return liste_param; 
    100         } 
    101  
    102          
    103          
     169                                liste_alt.add(resultat.getString("legend_code")); 
     170                        } 
     171                } 
     172                catch (SQLException sqle) { 
     173                        throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getListAlt"); 
     174                } 
     175                finally { 
     176                        closeConnection(); 
     177                } 
     178                return liste_alt; 
     179        } 
     180 
     181        public List<Grille> getListMasques(String codifMasque) throws PersistanceException{ 
     182                Statement requete; 
     183                String sql; 
     184                List<Grille> liste_reg = new LinkedList<Grille>(); 
     185                Connection conn = getConnection(); 
     186 
     187                try { 
     188                        // On récupÚre les régions 
     189                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
     190                        sql = "select distinct legend_code, number_code, id_grille from grille" + 
     191                        " inner join codification using (id_codification) left join code on (id_grille = num_code)" + 
     192                        " where nom_codification = '"+codifMasque+"' order by id_grille, number_code;"; 
     193                        ResultSet resultat = requete.executeQuery(sql); 
     194                        long idGrille, idGrillePrec = 0; 
     195                        while (resultat.next()) { 
     196                                idGrille = resultat.getLong("id_grille"); 
     197                                if (idGrille != idGrillePrec) { 
     198                                        liste_reg.add(new Grille(idGrille, null, resultat.getString("legend_code"),resultat.getInt("number_code"))); 
     199                                } 
     200                                idGrillePrec = idGrille; 
     201                        } 
     202                        Collections.sort(liste_reg,new Grille().new ComparatorNumberCode()); 
     203                } 
     204                catch (SQLException sqle) { 
     205                        throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getListAlt"); 
     206                } 
     207                finally { 
     208                        closeConnection(); 
     209                } 
     210                return liste_reg; 
     211        } 
    104212         
    105213        public float[][] getGrilleValue(int oid) throws PersistanceException { 
     
    184292                try { 
    185293                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    186                         sql = " select name_typeCodification" +""  
     294                        sql = " select name_typecodification" 
    187295                                + " from grille join codification using (id_codification)" 
    188296                                + " join typecodification using (id_typeCodification) where id_grille = " + id_grille + ";"; 
    189297                         
    190298                        ResultSet resultat = requete.executeQuery(sql); 
    191                         LoggerPerso.log(GrilleDAOjdbc.class, LoggerPerso.DEBUG, "getCodification :: " + sql);    
     299//                      LoggerPerso.log(GrilleDAOjdbc.class, LoggerPerso.DEBUG, "getCodification :: " + sql);    
    192300                        if (resultat.next()) { 
    193301                                codification = resultat.getString("name_typeCodification").toLowerCase(); 
     
    216324                         
    217325                        ResultSet resultat = requete.executeQuery(sql); 
    218                         LoggerPerso.log(GrilleDAOjdbc.class, LoggerPerso.DEBUG, "getCodification :: " + sql);    
     326//                      LoggerPerso.log(GrilleDAOjdbc.class, LoggerPerso.DEBUG, "getCodification :: " + sql);    
    219327                        if (resultat.next()) { 
    220328                                date = resultat.getString("date_grille").toLowerCase(); 
     
    237345 
    238346        public Grille getGrille(long id_grille) throws PersistanceException { 
    239                 String sql = "select * from grille where id_grille = " + id_grille + ";"; 
     347                 
     348                String sql = "select * from grille"; 
     349                sql += " left join code on id_grille = num_code"; 
     350                sql += " where id_grille = " + id_grille + ";"; 
    240351                Statement requete; 
    241352                Connection conn = getConnection(); 
     
    252363                                grille.setId_param(resultat.getLong("id_param")); 
    253364                                grille.setId_produit(resultat.getLong("id_produit")); 
     365                                grille.setId_secteur(resultat.getLong("id_secteur")); 
     366                                grille.setId_rcp(resultat.getLong("id_rcp")); 
     367                                grille.setLegend(resultat.getString("legend_code")); 
    254368                        } 
    255369                } 
     
    275389                        if (resultat.next()) { 
    276390                                resol = (float)360/resultat.getLong("ncol_grille"); 
    277                                 resultat.getLong("nlign_grille"); 
     391                        //      resultat.getLong("nlign_grille"); 
    278392                        } 
    279393                } 
     
    299413                        if (resultat.next()) { 
    300414                                resol = (float)360/resultat.getLong("ncol_grille"); 
    301                                 resultat.getLong("nlign_grille"); 
     415//                              resultat.getLong("nlign_grille"); 
    302416                        } 
    303417                } 
     
    310424                return resol; 
    311425        } 
    312          
    313          
     426 
     427        public String getTypeCodif(long idGrille) throws PersistanceException { 
     428                String sql = "select name_typecodification from grille" + 
     429                                " inner join codification using (id_codification)" + 
     430                                " inner join typecodification using (id_typecodification)" + 
     431                                " where id_grille = " + idGrille + ";"; 
     432                Statement requete; 
     433                Connection conn = getConnection(); 
     434                String typeCodif = null; 
     435                try { 
     436                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
     437                         
     438                         
     439                        ResultSet resultat = requete.executeQuery(sql); 
     440                                 
     441                        if (resultat.next()) { 
     442                                typeCodif = resultat.getString("name_typecodification"); 
     443                        } 
     444                } 
     445                catch (SQLException sqle) { 
     446                        throw new PersistanceException(sqle, "getTypeCodif " + sql); 
     447                } 
     448                finally { 
     449                        closeConnection(); 
     450                } 
     451                return typeCodif; 
     452        } 
     453 
     454        public ArrayList<String> getDates(long idProduit, long idParametre,     long idSecteur, long idRcp, String nomProd) throws PersistanceException { 
     455                Statement requete; 
     456                String sql; 
     457                ArrayList<String> dates = new ArrayList<String>(); 
     458                Connection conn = getConnection(); 
     459 
     460                try { 
     461                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
     462//                      sql = "select min(date_grille) as min, max(date_grille) as max from grille" + 
     463                        sql = "select min(date_grille) as min, (cast(max(date_grille+deltadate_grille) as date)-1) as max, min(deltadate_grille) as delta from grille" + 
     464                                " where id_produit = "+idProduit+" and id_param = "+idParametre; 
     465                        if (nomProd.equals("IPCC")) { 
     466                                if (idSecteur > 0) { 
     467                                        sql+=" and id_secteur="+idSecteur;                                       
     468                                } 
     469                                if (idRcp > 0 ) { 
     470                                        sql+=" and id_rcp="+idRcp; 
     471                                } else { 
     472                                        sql+=" and id_rcp is null"; 
     473                                } 
     474                        } 
     475                        sql += ";"; 
     476                        ResultSet resultat = requete.executeQuery(sql); 
     477                        if (resultat.next()) { 
     478                                dates.add(resultat.getDate("min").toString()); 
     479                                dates.add(resultat.getDate("max").toString()); 
     480                                dates.add(resultat.getString("delta")); 
     481                        } 
     482                } 
     483                catch (SQLException sqle) { 
     484                        throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getDates"); 
     485                } 
     486                finally { 
     487                        closeConnection(); 
     488                } 
     489                return dates; 
     490        } 
    314491} 
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/ParametreDAOjdbc.java

    r68 r70  
    99import java.util.List; 
    1010 
    11  
    12 import org.medias.eccad.helpers.LoggerPerso; 
    1311import org.medias.eccad.modele.Parametre; 
    1412import org.medias.eccad.persistance.jdbc.SGBD_jdbc; 
     
    6260                } 
    6361                 
    64                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size()); 
     62//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size()); 
    6563 
    6664                return liste_param; 
     
    8482                try { 
    8583                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    86                         sql = "select distinct id_param, fullname_param, shortname_param, order_param from parametre join grille using (id_param) join produit using (id_produit) join typeproduit using (id_typeproduit) where id_categorieparametre= "+id_CatParam+" and name_typeproduit not ilike 'array' order by order_param;"; 
    87                          
     84//                      sql = "select distinct id_param, fullname_param, shortname_param, order_param from parametre" + 
     85//                                      " join grille using (id_param) join produit using (id_produit)" + 
     86//                                      " join typeproduit using (id_typeproduit)" + 
     87//                                      " where id_categorieparametre= "+id_CatParam+ 
     88//                                      " and name_typeproduit not ilike 'array' order by order_param;"; 
     89                        sql = "select distinct id_param, fullname_param, shortname_param, order_param from parametre" + 
     90                        " where id_param in (select id_param from grille join produit using (id_produit)" + 
     91                        " join typeproduit using (id_typeproduit)" + 
     92                        " where name_typeproduit not ilike 'array')" + 
     93                        " and id_categorieparametre="+id_CatParam+" order by order_param;"; 
    8894                        resultat = requete.executeQuery(sql); 
    8995                 
    9096                         
    9197                        while (resultat.next()) { 
    92                                 if (resultat.getString("shortname_param").equals("NULL")) 
     98                                if (resultat.getString("shortname_param").equals("NULL") || resultat.getString("shortname_param").equals("")) 
    9399                                        liste_param.add(new Parametre(resultat.getInt("id_param"), resultat.getString("fullname_param"))); 
    94100                                else 
     
    103109                } 
    104110                 
    105                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size()); 
     111//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size()); 
    106112 
    107113                return liste_param; 
     
    126132                try { 
    127133                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    128                         sql = "select distinct id_param, fullname_param, shortname_param, order_param, shortName_unite from parametre join unite using (id_unite) where id_param = " + id_param + " order by order_param;"; 
    129                         LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "sql getParametreById="+sql); 
     134                        sql = "select distinct id_param, fullname_param, shortname_param, order_param, shortName_unite, clm_default_id, scl_default_id" + 
     135                                        " from parametre p" + 
     136                                        " inner join unite using (id_unite)" + 
     137                                        " where id_param = " + id_param + " order by order_param;"; 
    130138                         
    131139                        ResultSet resultat = requete.executeQuery(sql); 
    132140                         
    133141                        if (resultat.next()) { 
    134                                 param = new Parametre(resultat.getInt("id_param"), resultat.getString("fullname_param"), resultat.getString("shortname_param"),resultat.getString("order_param")); 
     142                                param = new Parametre(resultat.getInt("id_param"), resultat.getString("fullname_param") 
     143                                                , resultat.getString("shortname_param"),resultat.getString("order_param")); 
    135144                                param.setUnite(resultat.getString("shortName_unite")); 
     145                                param.setColormapDefault(resultat.getInt("clm_default_id")); 
     146                                param.setClassdisDefault(resultat.getInt("scl_default_id")); 
    136147                        } 
    137148                } 
     
    142153                        closeConnection(); 
    143154                } 
    144                          
    145                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 
     155 
     156//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 
    146157 
    147158                return param; 
     
    159170                try { 
    160171                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    161                         sql = "select distinct id_param, fullname_param, shortname_param, order_param, shortName_unite from parametre join grille using (id_param) join unite using (id_unite) where id_grille = " + id_grille + " order by order_param;"; 
     172                        sql = "select distinct id_param, fullname_param, shortname_param, order_param, shortname_unite from parametre join grille using (id_param) join unite using (id_unite) where id_grille = " + id_grille + " order by order_param;"; 
    162173                         
    163174                        ResultSet resultat = requete.executeQuery(sql); 
     
    168179                                String unite = null; 
    169180                                try { 
    170                                          temp = resultat.getString("shortName_unite").getBytes("ISO-8859-1"); 
    171                                 } catch (UnsupportedEncodingException e) {      } 
     181                                         temp = resultat.getString("shortname_unite").getBytes("ISO-8859-1"); 
     182                                } catch (UnsupportedEncodingException e) {e.printStackTrace();} 
    172183                                 
    173184                                if (temp != null) 
     
    182193                        closeConnection(); 
    183194                } 
    184                          
    185                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 
     195 
     196//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 
    186197 
    187198                return param; 
     
    213224                        closeConnection(); 
    214225                } 
    215                          
    216                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 
     226 
     227//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 
    217228 
    218229                return param; 
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/ProduitDAOjdbc.java

    r68 r70  
    1010 
    1111import org.medias.eccad.helpers.CharactereHelper; 
    12 import org.medias.eccad.helpers.LoggerPerso; 
    1312import org.medias.eccad.modele.Produit; 
    1413import org.medias.eccad.persistance.jdbc.SGBD_jdbc; 
     
    3433                try { 
    3534                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    36                         sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit from produit join grille using (id_produit) where id_param = " + id_param + ";"; 
    37                          
     35                        sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit, order_produit from produit join grille using (id_produit) where id_param = " + id_param + " order by order_produit;"; 
    3836                        ResultSet resultat = requete.executeQuery(sql); 
    3937                         
     
    5553                } 
    5654                 
    57                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListProduit::taille::"+liste_param.size()+"\nSQL::" + sql); 
    5855                return liste_param; 
    5956        } 
     
    8986                try { 
    9087                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    91                         sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit, temporalRes_produit, name_typeproduit from produit join typeproduit using (id_typeproduit) where id_produit = " + id_produit + ";"; 
     88                        sql = "select distinct id_produit, title_produit, begintime_produit" + 
     89                                        ", endtime_produit, header_produit, temporalRes_produit, name_typeproduit" + 
     90                                        ", textcitation_produit, useconst_produit, informpub_produit" + 
     91                                        " from produit join typeproduit using (id_typeproduit)" + 
     92                                        " where id_produit = " + id_produit + ";"; 
    9293                         
    9394                        ResultSet resultat = requete.executeQuery(sql); 
     
    101102                                produit.setTemporalres(CharactereHelper.getEncodage(resultat.getString("temporalRes_produit"), "ISO-8859-1")); 
    102103                                produit.setType(CharactereHelper.getEncodage(resultat.getString("name_typeproduit"), "ISO-8859-1")); 
     104                                produit.setCitation(CharactereHelper.getEncodage(resultat.getString("textcitation_produit"), "ISO-8859-1")); 
     105                                produit.setUseconst(CharactereHelper.getEncodage(resultat.getString("useconst_produit"), "ISO-8859-1")); 
     106                                produit.setInformpub(CharactereHelper.getEncodage(resultat.getString("informpub_produit"), "ISO-8859-1")); 
    103107                        } 
    104108                } 
     
    109113                        closeConnection(); 
    110114                } 
    111                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate()); 
     115//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate()); 
    112116 
    113117                return produit; 
     
    122126                try { 
    123127                        requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 
    124                         sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit from produit join lienproduit using (id_produit) "; 
     128                        sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit from produit join lienproduit using (id_produit)"; 
    125129                         
    126130                        if (id_produit != null) { 
     
    149153                } 
    150154                 
    151                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListProductByLink::taille::"+liste_produit.size()); 
     155//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListProductByLink::taille::"+liste_produit.size()); 
    152156                return liste_produit; 
    153157        } 
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/SGBD_jdbc.java

    r68 r70  
    1616        public SGBD_jdbc(InfoConnectBean n_info) { 
    1717                con = null; 
    18                 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "construction connection"); 
     18//              LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "construction connection"); 
    1919                if (pooling == null) { 
    2020                        info = n_info; 
    21                         LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "creation pooling :: " + info); 
     21//                      LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "creation pooling :: " + info); 
    2222                        pooling = new PGPoolingDataSource(); 
    2323                        pooling.setDatabaseName(info.getDb_name()); 
Note: See TracChangeset for help on using the changeset viewer.