Source Code Cross Referenced for SuiteTestSelectImpl.java in  » Test-Coverage » salome-tmf » org » objectweb » salome_tmf » api » api2ihm » suiteTest » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Test Coverage » salome tmf » org.objectweb.salome_tmf.api.api2ihm.suiteTest 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * SalomeTMF is a Test Management Framework
0003:         * Copyright (C) 2005 France Telecom R&D
0004:         *
0005:         * This library is free software; you can redistribute it and/or
0006:         * modify it under the terms of the GNU Lesser General Public
0007:         * License as published by the Free Software Foundation; either
0008:         * version 2 of the License, or (at your option) any later version.
0009:         *
0010:         * This library is distributed in the hope that it will be useful,
0011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013:         * Lesser General Public License for more details.
0014:         *
0015:         * You should have received a copy of the GNU Lesser General Public
0016:         * License along with this library; if not, write to the Free Software
0017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0018:         *
0019:         * @author Fayçal SOUGRATI
0020:         *
0021:         * Contact: mikael.marche@rd.francetelecom.com
0022:         */
0023:
0024:        package org.objectweb.salome_tmf.api.api2ihm.suiteTest;
0025:
0026:        import java.io.File;
0027:        import java.net.URL;
0028:        import java.sql.Date;
0029:        import java.sql.PreparedStatement;
0030:        import java.sql.SQLException;
0031:        import java.util.Properties;
0032:        import java.util.Vector;
0033:
0034:        import org.objectweb.salome_tmf.api.ApiConstants;
0035:        import org.objectweb.salome_tmf.api.api2db.DataBase;
0036:        import org.objectweb.salome_tmf.api.api2db.DataSet;
0037:        import org.objectweb.salome_tmf.api.api2ihm.Utile;
0038:        import org.objectweb.salome_tmf.api.wrapper.ActionWrapper;
0039:        import org.objectweb.salome_tmf.api.wrapper.AutomaticTestWrapper;
0040:        import org.objectweb.salome_tmf.api.wrapper.FamilyWrapper;
0041:        import org.objectweb.salome_tmf.api.wrapper.FileAttachementWrapper;
0042:        import org.objectweb.salome_tmf.api.wrapper.ManualTestWrapper;
0043:        import org.objectweb.salome_tmf.api.wrapper.ScriptWrapper;
0044:        import org.objectweb.salome_tmf.api.wrapper.SuiteWrapper;
0045:        import org.objectweb.salome_tmf.api.wrapper.TestWrapper;
0046:        import org.objectweb.salome_tmf.api.wrapper.UrlAttachementWrapper;
0047:
0048:        //import org.objectweb.salome_tmf.data.Action;
0049:        //import org.objectweb.salome_tmf.data.AutomaticTest;
0050:        //import org.objectweb.salome_tmf.data.ManualTest;
0051:        //import org.objectweb.salome_tmf.data.FileAttachment;
0052:        //import org.objectweb.salome_tmf.data.Test;
0053:        //import org.objectweb.salome_tmf.data.UrlAttachment;
0054:        //import org.objectweb.salome_tmf.data.UrlAttachment;
0055:        //import org.objectweb.salome_tmf.data.TestData;
0056:        /**
0057:         * Fonctions de sélection relatives à l'aire fonctionnelle "Suites de test"
0058:         */
0059:        public class SuiteTestSelectImpl implements  SuiteTestSelect,
0060:                ApiConstants {
0061:
0062:            /**
0063:             * Base de donnees
0064:             */
0065:            DataBase database;
0066:
0067:            /**
0068:             * Fichier "properties" contenant les requetes SQL relatives aux suites de test
0069:             */
0070:            Properties prop;
0071:
0072:            /**
0073:             * ID du projet SalomeTMF dans lequel on se situe
0074:             */
0075:            int idProject;
0076:
0077:            /**
0078:             * Nom du projet SalomeTMF dans lequel on se situe
0079:             */
0080:            String nameProject;
0081:
0082:            /**
0083:             * Constructeur
0084:             * @param db
0085:             * @param pr
0086:             */
0087:            public SuiteTestSelectImpl(DataBase db, Properties pr) {
0088:                database = db;
0089:                prop = pr;
0090:            }
0091:
0092:            /**
0093:             * Fonction qui fixe le projet SalomeTMF dans lequel l'utilisateur travaille
0094:             * @param projectName
0095:             */
0096:            public void setProject(String projectName) {
0097:                nameProject = projectName;
0098:                idProject = Utile.getIdProject(database, prop, projectName);
0099:                //org.objectweb.salome_tmf.api.Api.getInstanceOfBugzillaAPI().init(projectName);
0100:            }
0101:
0102:            public int getNumberOfFamilyInProject() {
0103:                int result = -1;
0104:                DataSet stmtRes = null;
0105:
0106:                try {
0107:                    //	On execute la requete
0108:                    PreparedStatement prep = database.prepareStatement(prop
0109:                            .getProperty("selectProjectFamilies"));
0110:                    prep.setInt(1, idProject);
0111:                    stmtRes = new DataSet(prep.executeQuery());
0112:                    // Ajoute les element un par un au resultat
0113:                    while (stmtRes.hasMoreElements()) {
0114:                        result++;
0115:                    }
0116:                } catch (SQLException e) {
0117:                    e.printStackTrace();
0118:                    org.objectweb.salome_tmf.api.Api.addException(
0119:                            "selectProjectFamilies", null, e);
0120:                } catch (Exception ex) {
0121:                    ex.printStackTrace();
0122:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0123:                            ex);
0124:                }
0125:
0126:                return result;
0127:
0128:            }
0129:
0130:            /**
0131:             * Selection des noms de toutes les familles de test appartenant a un projet
0132:             * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
0133:             * @return
0134:             */
0135:            public Vector getProjectFamilies() {
0136:                Vector result = new Vector();
0137:                DataSet stmtRes = null;
0138:
0139:                try {
0140:                    //	On execute la requete
0141:                    PreparedStatement prep = database.prepareStatement(prop
0142:                            .getProperty("selectProjectFamilies"));
0143:                    prep.setInt(1, idProject);
0144:                    stmtRes = new DataSet(prep.executeQuery());
0145:                    // Ajoute les element un par un au resultat
0146:                    while (stmtRes.hasMoreElements()) {
0147:                        result.addElement(stmtRes.getResults().getString(
0148:                                "nom_famille"));
0149:                    }
0150:                } catch (SQLException e) {
0151:                    e.printStackTrace();
0152:                    org.objectweb.salome_tmf.api.Api.addException(
0153:                            "selectProjectFamilies", null, e);
0154:                } catch (Exception ex) {
0155:                    ex.printStackTrace();
0156:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0157:                            ex);
0158:                }
0159:
0160:                // On retourne le resultat
0161:                return result;
0162:            }
0163:
0164:            /**
0165:             * Selection de la description d'une famille de test a partir de son nom
0166:             * @param familyName
0167:             * @return
0168:             */
0169:            public String getFamilyDescription(String familyName) {
0170:                String result = null;
0171:                DataSet stmtRes = null;
0172:                try {
0173:                    //	On execute la requete
0174:                    PreparedStatement prep = database.prepareStatement(prop
0175:                            .getProperty("selectFamilyDescription"));
0176:                    prep.setInt(1, idProject);
0177:                    prep.setString(2, familyName);
0178:                    stmtRes = new DataSet(prep.executeQuery());
0179:                    if (stmtRes.getResults().next()) {
0180:                        result = stmtRes.getResults().getString(
0181:                                "description_famille");
0182:                    }
0183:                } catch (SQLException e) {
0184:                    e.printStackTrace();
0185:                    org.objectweb.salome_tmf.api.Api.addException(
0186:                            "selectFamilyDescription", null, e);
0187:                } catch (Exception ex) {
0188:                    ex.printStackTrace();
0189:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0190:                            ex);
0191:                }
0192:
0193:                // On retourne le resultat
0194:                return result;
0195:            }
0196:
0197:            /**
0198:             * Selection des noms de toutes les suites de test appartenant a une famille
0199:             * Retourne un "Vector" (tableau dynamique) d'elements de type "String" 
0200:             * @param familyName
0201:             * @return
0202:             */
0203:            public Vector getFamilySuites(String familyName) {
0204:                Vector result = new Vector();
0205:                DataSet stmtRes = null;
0206:                int familyId = 0;
0207:
0208:                try {
0209:                    // On initialise l'ID de la famille de test
0210:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0211:                            familyName);
0212:                    //On execute la requete
0213:                    PreparedStatement prep = database.prepareStatement(prop
0214:                            .getProperty("selectFamilySuites"));
0215:                    prep.setInt(1, familyId);
0216:                    stmtRes = new DataSet(prep.executeQuery());
0217:                    // Ajoute les element un par un au resultat
0218:                    while (stmtRes.hasMoreElements()) {
0219:                        result.addElement(stmtRes.getResults().getString(
0220:                                "nom_Suite"));
0221:                    }
0222:                } catch (SQLException e) {
0223:                    e.printStackTrace();
0224:                    org.objectweb.salome_tmf.api.Api.addException(
0225:                            "selectFamilySuites", null, e);
0226:                } catch (Exception ex) {
0227:                    ex.printStackTrace();
0228:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0229:                            ex);
0230:                }
0231:
0232:                // On retourne le resultat
0233:                return result;
0234:            }
0235:
0236:            /**
0237:             * Selection de la description d'une suite de test a partir de son nom et de la famille de test 
0238:             * a laquelle elle appartient
0239:             * @param suiteName
0240:             * @param familyName
0241:             * @return
0242:             */
0243:            public String getSuiteDescription(String suiteName,
0244:                    String familyName) {
0245:                int idFamily = 0;
0246:                String result = null;
0247:                DataSet stmtRes = null;
0248:                try {
0249:                    // On initialise l'ID de la famille de test
0250:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0251:                            familyName);
0252:
0253:                    //	On execute la requete
0254:                    PreparedStatement prep = database.prepareStatement(prop
0255:                            .getProperty("selectSuiteDescription"));
0256:                    prep.setString(1, suiteName);
0257:                    prep.setInt(2, idFamily);
0258:                    stmtRes = new DataSet(prep.executeQuery());
0259:                    if (stmtRes.getResults().next()) {
0260:                        result = stmtRes.getResults().getString(
0261:                                "description_suite");
0262:                    }
0263:                } catch (SQLException e) {
0264:                    e.printStackTrace();
0265:                    org.objectweb.salome_tmf.api.Api.addException(
0266:                            "selectSuiteDescription", null, e);
0267:                } catch (Exception ex) {
0268:                    ex.printStackTrace();
0269:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0270:                            ex);
0271:                }
0272:
0273:                // On retourne le resultat
0274:                return result;
0275:            }
0276:
0277:            /**
0278:             * Selection des noms de tous les testsappartenant a une suite de test
0279:             * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
0280:             * @param suiteName
0281:             * @param familyName
0282:             * @return
0283:             */
0284:            public Vector getSuiteTests(String suiteName, String familyName) {
0285:                Vector result = new Vector();
0286:                DataSet stmtRes = null;
0287:                int familyId = 0;
0288:                int suiteId = 0;
0289:
0290:                try {
0291:                    // On initialise l'ID de la famille de test
0292:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0293:                            familyName);
0294:                    // Idem pour l'ID de la suite de test
0295:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0296:                            suiteName, familyId);
0297:                    //	On execute la requete
0298:                    PreparedStatement prep = database.prepareStatement(prop
0299:                            .getProperty("selectSuiteTests"));
0300:                    prep.setInt(1, suiteId);
0301:                    stmtRes = new DataSet(prep.executeQuery());
0302:                    // Ajoute les element un par un au resultat
0303:                    while (stmtRes.hasMoreElements()) {
0304:                        result.addElement(stmtRes.getResults().getString(
0305:                                "nom_cas"));
0306:                    }
0307:                } catch (SQLException e) {
0308:                    e.printStackTrace();
0309:                    org.objectweb.salome_tmf.api.Api.addException(
0310:                            "selectSuiteTests", null, e);
0311:                } catch (Exception ex) {
0312:                    ex.printStackTrace();
0313:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0314:                            ex);
0315:                }
0316:
0317:                // On retourne le resultat
0318:                return result;
0319:            }
0320:
0321:            /**
0322:             * Donne la date de creation d'un test
0323:             * @param testName
0324:             * @param suiteName
0325:             * @param familyName
0326:             * @return
0327:             */
0328:            public Date getTestCreationDate(String testName, String suiteName,
0329:                    String familyName) {
0330:                int familyId = 0;
0331:                int suiteId = 0;
0332:                int testId = 0;
0333:                Date result = null;
0334:                DataSet stmtRes = null;
0335:                try {
0336:                    // On initialise l'ID de la famille de test
0337:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0338:                            familyName);
0339:                    // Idem pour la suite de test
0340:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0341:                            suiteName, familyId);
0342:                    //Idem pour le test
0343:                    testId = STCommun.getIdTest(database, prop, testName,
0344:                            suiteId);
0345:                    //	On execute la requete
0346:                    PreparedStatement prep = database.prepareStatement(prop
0347:                            .getProperty("selectTestFromId"));
0348:                    prep.setInt(1, testId);
0349:                    stmtRes = new DataSet(prep.executeQuery());
0350:                    if (stmtRes.getResults().next()) {
0351:                        result = stmtRes.getResults().getDate(
0352:                                "date_creation_cas");
0353:                    }
0354:                } catch (SQLException e) {
0355:                    e.printStackTrace();
0356:                    org.objectweb.salome_tmf.api.Api.addException(
0357:                            "selectTestFromId", null, e);
0358:                } catch (Exception ex) {
0359:                    ex.printStackTrace();
0360:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0361:                            ex);
0362:                }
0363:
0364:                // On retourne le resultat
0365:                return result;
0366:            }
0367:
0368:            /**
0369:             * Donne le nom et prenom du concepteur d'un test
0370:             * @param testName
0371:             * @param suiteName
0372:             * @param familyName
0373:             * @return
0374:             */
0375:            public String getTestDesigner(String testName, String suiteName,
0376:                    String familyName) {
0377:                int familyId = 0;
0378:                int suiteId = 0;
0379:                int testId = 0;
0380:                String result = null;
0381:                int userId = 0;
0382:                DataSet stmtRes = null;
0383:                String sql = null;
0384:                try {
0385:                    // On initialise l'ID de la famille de test
0386:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0387:                            familyName);
0388:                    // Idem pour la suite de test
0389:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0390:                            suiteName, familyId);
0391:                    //Idem pour le test
0392:                    testId = STCommun.getIdTest(database, prop, testName,
0393:                            suiteId);
0394:                    //	On execute la requete
0395:                    sql = "selectTestFromId";
0396:                    PreparedStatement prep = database.prepareStatement(prop
0397:                            .getProperty("selectTestFromId"));
0398:                    prep.setInt(1, testId);
0399:                    stmtRes = new DataSet(prep.executeQuery());
0400:                    if (stmtRes.getResults().next()) {
0401:                        userId = stmtRes.getResults().getInt(
0402:                                "PERSONNE_id_personne");
0403:                    }
0404:                    sql = "selectUserFromId";
0405:                    prep = database.prepareStatement(prop
0406:                            .getProperty("selectUserFromId"));
0407:                    prep.setInt(1, userId);
0408:                    stmtRes = new DataSet(prep.executeQuery());
0409:                    if (stmtRes.getResults().next()) {
0410:                        result = stmtRes.getResults().getString("nom_personne")
0411:                                + " "
0412:                                + stmtRes.getResults().getString(
0413:                                        "prenom_personne");
0414:                    }
0415:                } catch (SQLException e) {
0416:                    e.printStackTrace();
0417:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, e);
0418:                } catch (Exception ex) {
0419:                    ex.printStackTrace();
0420:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0421:                            ex);
0422:                }
0423:
0424:                // On retourne le resultat
0425:                return result;
0426:            }
0427:
0428:            public String getPersonne(int userId) throws Exception {
0429:                String result = null;
0430:                DataSet stmtRes = null;
0431:                //String sql = null;
0432:
0433:                //sql = "selectUserFromId";
0434:                PreparedStatement prep = database.prepareStatement(prop
0435:                        .getProperty("selectUserFromId"));
0436:                prep.setInt(1, userId);
0437:                stmtRes = new DataSet(prep.executeQuery());
0438:                if (stmtRes.getResults().next()) {
0439:                    result = stmtRes.getResults().getString("nom_personne")
0440:                            + " "
0441:                            + stmtRes.getResults().getString("prenom_personne");
0442:                }
0443:                // On retourne le resultat
0444:                return result;
0445:            }
0446:
0447:            /**
0448:             * Donne le login du concepteur d'un test
0449:             * @param testName
0450:             * @param suiteName
0451:             * @param familyName
0452:             * @return String Login du concepteur
0453:             */
0454:            public String getTestDesignerLogin(String testName,
0455:                    String suiteName, String familyName) {
0456:                int familyId = 0;
0457:                int suiteId = 0;
0458:                int testId = 0;
0459:                String result = null;
0460:                int userId = 0;
0461:                DataSet stmtRes = null;
0462:                String sql = null;
0463:                try {
0464:                    // On initialise l'ID de la famille de test
0465:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0466:                            familyName);
0467:                    // Idem pour la suite de test
0468:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0469:                            suiteName, familyId);
0470:                    //Idem pour le test
0471:                    testId = STCommun.getIdTest(database, prop, testName,
0472:                            suiteId);
0473:                    //	On execute la requete
0474:                    sql = "selectTestFromId";
0475:                    PreparedStatement prep = database.prepareStatement(prop
0476:                            .getProperty("selectTestFromId"));
0477:                    prep.setInt(1, testId);
0478:                    stmtRes = new DataSet(prep.executeQuery());
0479:                    if (stmtRes.getResults().next()) {
0480:                        userId = stmtRes.getResults().getInt(
0481:                                "PERSONNE_id_personne");
0482:                    }
0483:                    sql = "selectUserFromId";
0484:                    prep = database.prepareStatement(prop
0485:                            .getProperty("selectUserFromId"));
0486:                    prep.setInt(1, userId);
0487:                    stmtRes = new DataSet(prep.executeQuery());
0488:                    if (stmtRes.getResults().next()) {
0489:                        result = stmtRes.getResults().getString(
0490:                                "login_personne");
0491:                    }
0492:                } catch (SQLException e) {
0493:                    e.printStackTrace();
0494:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, e);
0495:                } catch (Exception ex) {
0496:                    ex.printStackTrace();
0497:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0498:                            ex);
0499:                }
0500:
0501:                // On retourne le resultat
0502:                return result;
0503:            }
0504:
0505:            /**
0506:             * Donne la description d'un test
0507:             * @param testName
0508:             * @param suiteName
0509:             * @param familyName
0510:             * @return
0511:             */
0512:            public String getTestDescription(String testName, String suiteName,
0513:                    String familyName) {
0514:                int familyId = 0;
0515:                int suiteId = 0;
0516:                int testId = 0;
0517:                String result = null;
0518:                DataSet stmtRes = null;
0519:                try {
0520:                    // On initialise l'ID de la famille de test
0521:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0522:                            familyName);
0523:                    // Idem pour la suite de test
0524:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0525:                            suiteName, familyId);
0526:                    //Idem pour le test
0527:                    testId = STCommun.getIdTest(database, prop, testName,
0528:                            suiteId);
0529:                    //	On execute la requete
0530:                    PreparedStatement prep = database.prepareStatement(prop
0531:                            .getProperty("selectTestFromId"));
0532:                    prep.setInt(1, testId);
0533:                    stmtRes = new DataSet(prep.executeQuery());
0534:                    if (stmtRes.getResults().next()) {
0535:                        result = stmtRes.getResults().getString(
0536:                                "description_cas");
0537:                    }
0538:                } catch (SQLException e) {
0539:                    e.printStackTrace();
0540:                    org.objectweb.salome_tmf.api.Api.addException(
0541:                            "selectTestFromId", null, e);
0542:                } catch (Exception ex) {
0543:                    ex.printStackTrace();
0544:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0545:                            ex);
0546:                }
0547:
0548:                // On retourne le resultat
0549:                return result;
0550:            }
0551:
0552:            /**
0553:             * Donne le type d'un test : "MANUAL" ou "AUTOMATED"
0554:             * @param testName
0555:             * @param suiteName
0556:             * @param familyName
0557:             * @return
0558:             */
0559:            public String getTestType(String testName, String suiteName,
0560:                    String familyName) {
0561:                int familyId = 0;
0562:                int suiteId = 0;
0563:                int testId = 0;
0564:                String result = null;
0565:                DataSet stmtRes = null;
0566:                try {
0567:                    // On initialise l'ID de la famille de test
0568:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0569:                            familyName);
0570:                    // Idem pour la suite de test
0571:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0572:                            suiteName, familyId);
0573:                    //Idem pour le test
0574:                    testId = STCommun.getIdTest(database, prop, testName,
0575:                            suiteId);
0576:                    //	On execute la requete
0577:                    PreparedStatement prep = database.prepareStatement(prop
0578:                            .getProperty("selectTestFromId"));
0579:                    prep.setInt(1, testId);
0580:                    stmtRes = new DataSet(prep.executeQuery());
0581:                    if (stmtRes.getResults().next()) {
0582:                        result = stmtRes.getResults().getString("type_cas");
0583:                    }
0584:                } catch (SQLException e) {
0585:                    e.printStackTrace();
0586:                    org.objectweb.salome_tmf.api.Api.addException(
0587:                            "selectTestFromId", null, e);
0588:                } catch (Exception ex) {
0589:                    ex.printStackTrace();
0590:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0591:                            ex);
0592:                }
0593:
0594:                // On retourne le resultat
0595:                return result;
0596:            }
0597:
0598:            public String getTestExtension(String testName, String suiteName,
0599:                    String familyName) {
0600:                int familyId = 0;
0601:                int suiteId = 0;
0602:                int testId = 0;
0603:                String result = null;
0604:                DataSet stmtRes = null;
0605:                try {
0606:                    // On initialise l'ID de la famille de test
0607:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0608:                            familyName);
0609:                    // Idem pour la suite de test
0610:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0611:                            suiteName, familyId);
0612:                    //Idem pour le test
0613:                    testId = STCommun.getIdTest(database, prop, testName,
0614:                            suiteId);
0615:                    //	On execute la requete
0616:                    PreparedStatement prep = database.prepareStatement(prop
0617:                            .getProperty("selectTestFromId"));
0618:                    prep.setInt(1, testId);
0619:                    stmtRes = new DataSet(prep.executeQuery());
0620:                    if (stmtRes.getResults().next()) {
0621:                        result = stmtRes.getResults().getString("plug_ext");
0622:                    }
0623:                } catch (SQLException e) {
0624:                    e.printStackTrace();
0625:                    org.objectweb.salome_tmf.api.Api.addException(
0626:                            "selectTestFromId", null, e);
0627:                } catch (Exception ex) {
0628:                    ex.printStackTrace();
0629:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0630:                            ex);
0631:                }
0632:
0633:                // On retourne le resultat
0634:                return result;
0635:            }
0636:
0637:            /**
0638:             * Selection des noms de toutes les actions d'un test manuel
0639:             * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
0640:             * @param testName
0641:             * @param suiteName
0642:             * @param familyName
0643:             * @return
0644:             */
0645:            public Vector getAllTestActionsName(String testName,
0646:                    String suiteName, String familyName) {
0647:                int familyId = 0;
0648:                int suiteId = 0;
0649:                int testId = 0;
0650:                Vector result = new Vector();
0651:                DataSet stmtRes = null;
0652:                try {
0653:                    // On initialise l'ID de la famille de test
0654:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0655:                            familyName);
0656:                    // Idem pour la suite de test
0657:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0658:                            suiteName, familyId);
0659:                    //Idem pour le test
0660:                    testId = STCommun.getIdTest(database, prop, testName,
0661:                            suiteId);
0662:                    //	On execute la requete
0663:                    PreparedStatement prep = database.prepareStatement(prop
0664:                            .getProperty("selectTestActions"));
0665:                    prep.setInt(1, testId);
0666:                    stmtRes = new DataSet(prep.executeQuery());
0667:                    // Ajoute les element un par un au resultat
0668:                    while (stmtRes.hasMoreElements()) {
0669:                        result.addElement(stmtRes.getResults().getString(
0670:                                "nom_action"));
0671:                    }
0672:                } catch (SQLException e) {
0673:                    e.printStackTrace();
0674:                    org.objectweb.salome_tmf.api.Api.addException(
0675:                            "selectTestActions", null, e);
0676:                } catch (Exception ex) {
0677:                    ex.printStackTrace();
0678:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0679:                            ex);
0680:                }
0681:
0682:                // On retourne le resultat
0683:                return result;
0684:            }
0685:
0686:            /**
0687:             * Selection des descriptions de toutes les actions d'un test manuel
0688:             * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
0689:             * @param testName
0690:             * @param suiteName
0691:             * @param familyName
0692:             * @return
0693:             */
0694:            public Vector getAllTestActionsDesc(String testName,
0695:                    String suiteName, String familyName) {
0696:                int familyId = 0;
0697:                int suiteId = 0;
0698:                int testId = 0;
0699:                Vector result = new Vector();
0700:                DataSet stmtRes = null;
0701:                try {
0702:                    // On initialise l'ID de la famille de test
0703:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0704:                            familyName);
0705:                    // Idem pour la suite de test
0706:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0707:                            suiteName, familyId);
0708:                    //Idem pour le test
0709:                    testId = STCommun.getIdTest(database, prop, testName,
0710:                            suiteId);
0711:                    //	On execute la requete
0712:                    PreparedStatement prep = database.prepareStatement(prop
0713:                            .getProperty("selectTestActions"));
0714:                    prep.setInt(1, testId);
0715:                    stmtRes = new DataSet(prep.executeQuery());
0716:                    // Ajoute les element un par un au resultat
0717:                    while (stmtRes.hasMoreElements()) {
0718:                        result.addElement(stmtRes.getResults().getString(
0719:                                "description_action"));
0720:                    }
0721:                } catch (SQLException e) {
0722:                    e.printStackTrace();
0723:                    org.objectweb.salome_tmf.api.Api.addException(
0724:                            "selectTestActions", null, e);
0725:                } catch (Exception ex) {
0726:                    ex.printStackTrace();
0727:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0728:                            ex);
0729:                }
0730:
0731:                // On retourne le resultat
0732:                return result;
0733:            }
0734:
0735:            /**
0736:             * Selection des résultats attendus de toutes les actions d'un test manuel
0737:             * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
0738:             * @param testName
0739:             * @param suiteName
0740:             * @param familyName
0741:             * @return
0742:             */
0743:            public Vector getAllTestActionsExpectedRes(String testName,
0744:                    String suiteName, String familyName) {
0745:                int familyId = 0;
0746:                int suiteId = 0;
0747:                int testId = 0;
0748:                Vector result = new Vector();
0749:                DataSet stmtRes = null;
0750:                try {
0751:                    // On initialise l'ID de la famille de test
0752:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0753:                            familyName);
0754:                    // Idem pour la suite de test
0755:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0756:                            suiteName, familyId);
0757:                    //Idem pour le test
0758:                    testId = STCommun.getIdTest(database, prop, testName,
0759:                            suiteId);
0760:                    //	On execute la requete
0761:                    PreparedStatement prep = database.prepareStatement(prop
0762:                            .getProperty("selectTestActions"));
0763:                    prep.setInt(1, testId);
0764:                    stmtRes = new DataSet(prep.executeQuery());
0765:                    // Ajoute les element un par un au resultat
0766:                    while (stmtRes.hasMoreElements()) {
0767:                        result.addElement(stmtRes.getResults().getString(
0768:                                "res_attendu_action"));
0769:                    }
0770:                } catch (SQLException e) {
0771:                    e.printStackTrace();
0772:                    org.objectweb.salome_tmf.api.Api.addException(
0773:                            "selectTestActions", null, e);
0774:                } catch (Exception ex) {
0775:                    ex.printStackTrace();
0776:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0777:                            ex);
0778:                }
0779:
0780:                // On retourne le resultat
0781:                return result;
0782:            }
0783:
0784:            /**
0785:             * Selection de la description d'une action de test
0786:             * @param actionName
0787:             * @param testName
0788:             * @param suiteName
0789:             * @param familyName
0790:             * @return
0791:             */
0792:            public String getActionDescription(String actionName,
0793:                    String testName, String suiteName, String familyName) {
0794:                int familyId = 0;
0795:                int suiteId = 0;
0796:                int testId = 0;
0797:                int actionId = 0;
0798:                String result = null;
0799:                DataSet stmtRes = null;
0800:                try {
0801:                    // On initialise l'ID de la famille de test
0802:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0803:                            familyName);
0804:                    // Idem pour la suite de test
0805:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0806:                            suiteName, familyId);
0807:                    //Idem pour le test
0808:                    testId = STCommun.getIdTest(database, prop, testName,
0809:                            suiteId);
0810:                    // Idem pour l'action de test
0811:                    actionId = STCommun.getIdAction(database, prop, actionName,
0812:                            testId);
0813:                    //	On execute la requete
0814:                    PreparedStatement prep = database.prepareStatement(prop
0815:                            .getProperty("selectActionFromId"));
0816:                    prep.setInt(1, actionId);
0817:                    stmtRes = new DataSet(prep.executeQuery());
0818:                    if (stmtRes.getResults().next()) {
0819:                        result = stmtRes.getResults().getString(
0820:                                "description_action");
0821:                    }
0822:                } catch (SQLException e) {
0823:                    e.printStackTrace();
0824:                    org.objectweb.salome_tmf.api.Api.addException(
0825:                            "selectActionFromId", null, e);
0826:                } catch (Exception ex) {
0827:                    ex.printStackTrace();
0828:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0829:                            ex);
0830:                }
0831:
0832:                // On retourne le resultat
0833:                return result;
0834:            }
0835:
0836:            /**
0837:             * Selection du resultat attendu d'une action de test
0838:             * @param actionName
0839:             * @param testName
0840:             * @param suiteName
0841:             * @param familyName
0842:             * @return
0843:             */
0844:            public String getActionExpectedResult(String actionName,
0845:                    String testName, String suiteName, String familyName) {
0846:                int familyId = 0;
0847:                int suiteId = 0;
0848:                int testId = 0;
0849:                int actionId = 0;
0850:                String result = null;
0851:                DataSet stmtRes = null;
0852:                try {
0853:                    // On initialise l'ID de la famille de test
0854:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0855:                            familyName);
0856:                    // Idem pour la suite de test
0857:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0858:                            suiteName, familyId);
0859:                    //Idem pour le test
0860:                    testId = STCommun.getIdTest(database, prop, testName,
0861:                            suiteId);
0862:                    // Idem pour l'action de test
0863:                    actionId = STCommun.getIdAction(database, prop, actionName,
0864:                            testId);
0865:                    //	On execute la requete
0866:                    PreparedStatement prep = database.prepareStatement(prop
0867:                            .getProperty("selectActionFromId"));
0868:                    prep.setInt(1, actionId);
0869:                    stmtRes = new DataSet(prep.executeQuery());
0870:                    if (stmtRes.getResults().next()) {
0871:                        result = stmtRes.getResults().getString(
0872:                                "res_attendu_action");
0873:                    }
0874:                } catch (SQLException e) {
0875:                    e.printStackTrace();
0876:                    org.objectweb.salome_tmf.api.Api.addException(
0877:                            "selectActionFromId", null, e);
0878:                } catch (Exception ex) {
0879:                    ex.printStackTrace();
0880:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0881:                            ex);
0882:                }
0883:
0884:                // On retourne le resultat
0885:                return result;
0886:            }
0887:
0888:            /**
0889:             * Selection des noms des parametres de test liés à un test donné
0890:             * @param familyName
0891:             * @param suiteName
0892:             * @param testName
0893:             * @return
0894:             */
0895:            public Vector getTestParamsName(String familyName,
0896:                    String suiteName, String testName) {
0897:                int familyId = 0;
0898:                int suiteId = 0;
0899:                int testId = 0;
0900:                Vector result = new Vector();
0901:                DataSet stmtRes = null;
0902:                try {
0903:                    // On initialise l'ID de la famille de test
0904:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0905:                            familyName);
0906:                    // Idem pour la suite de test
0907:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0908:                            suiteName, familyId);
0909:                    //Idem pour le test
0910:                    testId = STCommun.getIdTest(database, prop, testName,
0911:                            suiteId);
0912:
0913:                    //	On execute la requete
0914:                    PreparedStatement prep = database.prepareStatement(prop
0915:                            .getProperty("selectTestParams"));
0916:                    prep.setInt(1, testId);
0917:                    stmtRes = new DataSet(prep.executeQuery());
0918:
0919:                    // Ajoute les element un par un au resultat
0920:                    while (stmtRes.hasMoreElements()) {
0921:                        result.addElement(stmtRes.getResults().getString(
0922:                                "nom_param_test"));
0923:                    }
0924:                } catch (SQLException e) {
0925:                    e.printStackTrace();
0926:                    org.objectweb.salome_tmf.api.Api.addException(
0927:                            "selectTestParams", null, e);
0928:                } catch (Exception ex) {
0929:                    ex.printStackTrace();
0930:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0931:                            ex);
0932:                }
0933:
0934:                // On retourne le resultat
0935:                return result;
0936:            }
0937:
0938:            /**
0939:             * Selection des descriptions des parametres de test liés à un test donné
0940:             * @param familyName
0941:             * @param suiteName
0942:             * @param testName
0943:             * @return
0944:             */
0945:            public Vector getTestParamsDesc(String familyName,
0946:                    String suiteName, String testName) {
0947:                int familyId = 0;
0948:                int suiteId = 0;
0949:                int testId = 0;
0950:                Vector result = new Vector();
0951:                DataSet stmtRes = null;
0952:                try {
0953:                    // On initialise l'ID de la famille de test
0954:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0955:                            familyName);
0956:                    // Idem pour la suite de test
0957:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0958:                            suiteName, familyId);
0959:                    //Idem pour le test
0960:                    testId = STCommun.getIdTest(database, prop, testName,
0961:                            suiteId);
0962:
0963:                    //	On execute la requete
0964:                    PreparedStatement prep = database.prepareStatement(prop
0965:                            .getProperty("selectTestParams"));
0966:                    prep.setInt(1, testId);
0967:                    stmtRes = new DataSet(prep.executeQuery());
0968:
0969:                    // Ajoute les element un par un au resultat
0970:                    while (stmtRes.hasMoreElements()) {
0971:                        result.addElement(stmtRes.getResults().getString(
0972:                                "desc_param_test"));
0973:                    }
0974:                } catch (SQLException e) {
0975:                    e.printStackTrace();
0976:                    org.objectweb.salome_tmf.api.Api.addException(
0977:                            "selectTestParams", null, e);
0978:                } catch (Exception ex) {
0979:                    ex.printStackTrace();
0980:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0981:                            ex);
0982:                }
0983:
0984:                // On retourne le resultat
0985:                return result;
0986:            }
0987:
0988:            /**
0989:             * Selection des noms des parametres lies a une action de test donnee
0990:             * @param familyName
0991:             * @param suiteName
0992:             * @param testName
0993:             * @param actionName
0994:             * @return
0995:             */
0996:            public Vector getActionParamsName(String familyName,
0997:                    String suiteName, String testName, String actionName) {
0998:                int familyId = 0;
0999:                int suiteId = 0;
1000:                int testId = 0;
1001:                int actionId = 0;
1002:                Vector result = new Vector();
1003:                DataSet stmtRes = null;
1004:                try {
1005:                    // On initialise l'ID de la famille de test
1006:                    familyId = STCommun.getIdFamily(database, prop, idProject,
1007:                            familyName);
1008:                    // Idem pour la suite de test
1009:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
1010:                            suiteName, familyId);
1011:                    // Idem pour le test
1012:                    testId = STCommun.getIdTest(database, prop, testName,
1013:                            suiteId);
1014:                    // Idem pour l'action de test
1015:                    actionId = STCommun.getIdAction(database, prop, actionName,
1016:                            testId);
1017:
1018:                    //	On execute la requete
1019:                    PreparedStatement prep = database.prepareStatement(prop
1020:                            .getProperty("selectActionParams"));
1021:                    prep.setInt(1, actionId);
1022:                    stmtRes = new DataSet(prep.executeQuery());
1023:
1024:                    // Ajoute les element un par un au resultat
1025:                    while (stmtRes.hasMoreElements()) {
1026:                        result.addElement(stmtRes.getResults().getString(
1027:                                "nom_param_test"));
1028:                    }
1029:                } catch (SQLException e) {
1030:                    e.printStackTrace();
1031:                    org.objectweb.salome_tmf.api.Api.addException(
1032:                            "selectActionParams", null, e);
1033:                } catch (Exception ex) {
1034:                    ex.printStackTrace();
1035:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1036:                            ex);
1037:                }
1038:
1039:                // On retourne le resultat
1040:                return result;
1041:            }
1042:
1043:            /**
1044:             * Selection des noms des parametres lies a une action de test donnee
1045:             * @param actionId
1046:             * @return
1047:             */
1048:            public Vector getActionParamsNamesUsingID(int actionId) {
1049:
1050:                Vector result = new Vector();
1051:                DataSet stmtRes = null;
1052:                try {
1053:                    //	On execute la requete
1054:                    PreparedStatement prep = database.prepareStatement(prop
1055:                            .getProperty("selectActionParams"));
1056:                    prep.setInt(1, actionId);
1057:                    stmtRes = new DataSet(prep.executeQuery());
1058:
1059:                    // Ajoute les element un par un au resultat
1060:                    while (stmtRes.hasMoreElements()) {
1061:                        result.addElement(stmtRes.getResults().getString(
1062:                                "nom_param_test"));
1063:                    }
1064:                } catch (SQLException e) {
1065:                    e.printStackTrace();
1066:                    org.objectweb.salome_tmf.api.Api.addException(
1067:                            "selectActionParams", null, e);
1068:                } catch (Exception ex) {
1069:                    ex.printStackTrace();
1070:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1071:                            ex);
1072:                }
1073:
1074:                // On retourne le resultat
1075:                return result;
1076:            }
1077:
1078:            /**
1079:             * Selection des descriptions des parametres lies a une action de test donnee
1080:             * @param familyName
1081:             * @param suiteName
1082:             * @param testName
1083:             * @param actionName
1084:             * @return
1085:             */
1086:            public Vector getActionParamsDesc(String familyName,
1087:                    String suiteName, String testName, String actionName) {
1088:                int familyId = 0;
1089:                int suiteId = 0;
1090:                int testId = 0;
1091:                int actionId = 0;
1092:                Vector result = new Vector();
1093:                DataSet stmtRes = null;
1094:                try {
1095:                    // On initialise l'ID de la famille de test
1096:                    familyId = STCommun.getIdFamily(database, prop, idProject,
1097:                            familyName);
1098:                    // Idem pour la suite de test
1099:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
1100:                            suiteName, familyId);
1101:                    // Idem pour le test
1102:                    testId = STCommun.getIdTest(database, prop, testName,
1103:                            suiteId);
1104:                    // Idem pour l'action de test
1105:                    actionId = STCommun.getIdAction(database, prop, actionName,
1106:                            testId);
1107:
1108:                    //	On execute la requete
1109:                    PreparedStatement prep = database.prepareStatement(prop
1110:                            .getProperty("selectActionParams"));
1111:                    prep.setInt(1, actionId);
1112:                    stmtRes = new DataSet(prep.executeQuery());
1113:
1114:                    // Ajoute les element un par un au resultat
1115:                    while (stmtRes.hasMoreElements()) {
1116:                        result.addElement(stmtRes.getResults().getString(
1117:                                "desc_param_test"));
1118:                    }
1119:                } catch (SQLException e) {
1120:                    e.printStackTrace();
1121:                    org.objectweb.salome_tmf.api.Api.addException(
1122:                            "selectActionParams", null, e);
1123:                } catch (Exception ex) {
1124:                    ex.printStackTrace();
1125:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1126:                            ex);
1127:                }
1128:
1129:                // On retourne le resultat
1130:                return result;
1131:            }
1132:
1133:            /**
1134:             * Selection d'un fichier attaché à une suite de test
1135:             * @param familyName
1136:             * @param suiteName
1137:             * @param fileName
1138:             * @return
1139:             */
1140:            public File getSuiteAttachFile(String familyName, String suiteName,
1141:                    String fileName) {
1142:                int suiteId = 0;
1143:                int familyId = 0;
1144:                int fileAttachId = 0;
1145:                File file = null;
1146:                DataSet stmtRes = null;
1147:
1148:                try {
1149:                    // On initialise l'ID de la famille de test
1150:                    familyId = STCommun.getIdFamily(database, prop, idProject,
1151:                            familyName);
1152:                    // Idem pour la suite de test
1153:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
1154:                            suiteName, familyId);
1155:
1156:                    //	On execute la requete
1157:                    PreparedStatement prep = database.prepareStatement(prop
1158:                            .getProperty("selectSuiteAttachFile"));
1159:                    prep.setInt(1, suiteId);
1160:                    prep.setString(2, fileName);
1161:                    stmtRes = new DataSet(prep.executeQuery());
1162:                    if (stmtRes.getResults().next()) {
1163:                        fileAttachId = stmtRes.getResults().getInt("id_attach");
1164:                    }
1165:                    Properties sys = System.getProperties();
1166:                    // Repertoire temporaire système
1167:                    String tmpDir = sys.getProperty("java.io.tmpdir");
1168:                    // On selectionne le fichier attachement
1169:                    file = STCommun.getFileAttachFromDB(database, prop,
1170:                            fileAttachId, tmpDir);
1171:                } catch (SQLException e) {
1172:                    e.printStackTrace();
1173:                    org.objectweb.salome_tmf.api.Api.addException(
1174:                            "selectSuiteAttachFile", null, e);
1175:                } catch (Exception ex) {
1176:                    ex.printStackTrace();
1177:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1178:                            ex);
1179:                }
1180:
1181:                // On retourne le resultat
1182:                return file;
1183:            }
1184:
1185:            /**
1186:             * Selection des fichiers attachés à une suite de test
1187:             * Retourne un vecteur (tableau dynamique) d'objets de type "File"
1188:             * @param familyName
1189:             * @param suiteName
1190:             * @return
1191:             */
1192:            public Vector getSuiteAttachFiles(String familyName,
1193:                    String suiteName) {
1194:                Vector result = new Vector();
1195:                DataSet stmtRes = null;
1196:                int familyId = 0;
1197:                int suiteId = 0;
1198:                File file = null;
1199:
1200:                try {
1201:                    // On initialise l'ID de la famille de test
1202:                    familyId = STCommun.getIdFamily(database, prop, idProject,
1203:                            familyName);
1204:                    // Idem pour l'ID de la suite de test
1205:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
1206:                            suiteName, familyId);
1207:                    //	On execute la requete
1208:                    PreparedStatement prep = database.prepareStatement(prop
1209:                            .getProperty("selectSuiteAttachFiles"));
1210:                    prep.setInt(1, suiteId);
1211:                    stmtRes = new DataSet(prep.executeQuery());
1212:                    // Ajoute les element un par un au resultat
1213:                    while (stmtRes.hasMoreElements()) {
1214:                        file = STCommun.getFileAttachFromDB(database, prop,
1215:                                stmtRes.getResults().getInt("id_attach"));
1216:                        result.addElement(file);
1217:                    }
1218:                } catch (SQLException e) {
1219:                    e.printStackTrace();
1220:                    org.objectweb.salome_tmf.api.Api.addException(
1221:                            "selectSuiteAttachFiles", null, e);
1222:                } catch (Exception ex) {
1223:                    ex.printStackTrace();
1224:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1225:                            ex);
1226:                }
1227:
1228:                // On retourne le resultat
1229:                return result;
1230:            }
1231:
1232:            /**
1233:             * Selection des URL attachés à une suite de test
1234:             * @param familyName
1235:             * Retourne un vecteur (tableau dynamique) d'objets de type "String"
1236:             * @param suiteName
1237:             * @return
1238:             */
1239:            public Vector getSuiteAttachUrls(String familyName, String suiteName) {
1240:                Vector result = new Vector();
1241:                DataSet stmtRes = null;
1242:                int familyId = 0;
1243:                int suiteId = 0;
1244:
1245:                try {
1246:                    // On initialise l'ID de la famille de test
1247:                    familyId = STCommun.getIdFamily(database, prop, idProject,
1248:                            familyName);
1249:                    // Idem pour l'ID de la suite de test
1250:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
1251:                            suiteName, familyId);
1252:                    //	On execute la requete
1253:                    PreparedStatement prep = database.prepareStatement(prop
1254:                            .getProperty("selectSuiteAttachUrls"));
1255:                    prep.setInt(1, suiteId);
1256:                    stmtRes = new DataSet(prep.executeQuery());
1257:                    // Ajoute les element un par un au resultat
1258:                    while (stmtRes.hasMoreElements()) {
1259:                        result.addElement(stmtRes.getResults().getString(
1260:                                "url_attach"));
1261:                    }
1262:                } catch (SQLException e) {
1263:                    e.printStackTrace();
1264:                    org.objectweb.salome_tmf.api.Api.addException(
1265:                            "selectSuiteAttachUrls", null, e);
1266:                } catch (Exception ex) {
1267:                    ex.printStackTrace();
1268:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1269:                            ex);
1270:                }
1271:
1272:                // On retourne le resultat
1273:                return result;
1274:            }
1275:
1276:            /**
1277:             * Selection d'un fichier attaché à un test
1278:             * @param familyName
1279:             * @param suiteName
1280:             * @param testName
1281:             * @param fileName
1282:             * @return
1283:             */
1284:            public File getTestAttachFile(String familyName, String suiteName,
1285:                    String testName, String fileName) {
1286:                int fileAttachId = 0;
1287:                File file = null;
1288:                DataSet stmtRes = null;
1289:
1290:                try {
1291:                    // On initialise l'ID de la famille de test
1292:                    int familyId = STCommun.getIdFamily(database, prop,
1293:                            idProject, familyName);
1294:                    // Idem pour la suite de test
1295:                    int suiteId = STCommun.getIdSuite(database, prop,
1296:                            idProject, suiteName, familyId);
1297:                    // On initialise l'ID pour le test
1298:                    int testId = STCommun.getIdTest(database, prop, testName,
1299:                            suiteId);
1300:                    //	On execute la requete
1301:                    PreparedStatement prep = database.prepareStatement(prop
1302:                            .getProperty("selectTestAttachFile"));
1303:                    prep.setInt(1, testId);
1304:                    prep.setString(2, fileName);
1305:                    stmtRes = new DataSet(prep.executeQuery());
1306:                    if (stmtRes.getResults().next()) {
1307:                        fileAttachId = stmtRes.getResults().getInt("id_attach");
1308:                    }
1309:
1310:                    // On selectionne le fichier attachement
1311:                    file = STCommun.getFileAttachFromDB(database, prop,
1312:                            fileAttachId);
1313:                } catch (SQLException e) {
1314:                    e.printStackTrace();
1315:                    org.objectweb.salome_tmf.api.Api.addException(
1316:                            "selectTestAttachFile", null, e);
1317:                } catch (Exception ex) {
1318:                    ex.printStackTrace();
1319:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1320:                            ex);
1321:                }
1322:
1323:                // On retourne le resultat
1324:                return file;
1325:
1326:            }
1327:
1328:            /**
1329:             * Selection des fichiers attachés à un test
1330:             * Retourne un vecteur (tableau dynamique) d'objets de type "File"
1331:             * @param familyName
1332:             * @param suiteName
1333:             * @param testName
1334:             * @return
1335:             */
1336:            public Vector getTestAttachFiles(String familyName,
1337:                    String suiteName, String testName) {
1338:                Vector result = new Vector();
1339:                DataSet stmtRes = null;
1340:                File file = null;
1341:
1342:                try {
1343:                    // On initialise l'ID de la famille de test
1344:                    int familyId = STCommun.getIdFamily(database, prop,
1345:                            idProject, familyName);
1346:                    // Idem pour l'ID de la suite de test
1347:                    int suiteId = STCommun.getIdSuite(database, prop,
1348:                            idProject, suiteName, familyId);
1349:                    // On initialise l'ID pour le test
1350:                    int testId = STCommun.getIdTest(database, prop, testName,
1351:                            suiteId);
1352:                    //	On execute la requete
1353:                    PreparedStatement prep = database.prepareStatement(prop
1354:                            .getProperty("selectTestAttachFiles"));
1355:                    prep.setInt(1, testId);
1356:                    stmtRes = new DataSet(prep.executeQuery());
1357:                    // Ajoute les element un par un au resultat
1358:                    while (stmtRes.hasMoreElements()) {
1359:                        file = STCommun.getFileAttachFromDB(database, prop,
1360:                                stmtRes.getResults().getInt("id_attach"));
1361:                        result.addElement(file);
1362:                    }
1363:                } catch (SQLException e) {
1364:                    e.printStackTrace();
1365:                    org.objectweb.salome_tmf.api.Api.addException(
1366:                            "selectTestAttachFiles", null, e);
1367:                } catch (Exception ex) {
1368:                    ex.printStackTrace();
1369:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1370:                            ex);
1371:                }
1372:
1373:                // On retourne le resultat
1374:                return result;
1375:            }
1376:
1377:            /**
1378:             * Selection des URL attachés à un test
1379:             * @param familyName
1380:             * @param suiteName
1381:             * @param testName
1382:             * @return Retourne un vecteur (tableau dynamique) d'objets de type "String"
1383:             */
1384:            public Vector getTestAttachUrls(String familyName,
1385:                    String suiteName, String testName) {
1386:                Vector result = new Vector();
1387:                DataSet stmtRes = null;
1388:                try {
1389:                    // On initialise l'ID de la famille de test
1390:                    int familyId = STCommun.getIdFamily(database, prop,
1391:                            idProject, familyName);
1392:                    // Idem pour l'ID de la suite de test
1393:                    int suiteId = STCommun.getIdSuite(database, prop,
1394:                            idProject, suiteName, familyId);
1395:                    // On initialise l'ID pour le test
1396:                    int testId = STCommun.getIdTest(database, prop, testName,
1397:                            suiteId);
1398:                    //	On execute la requete
1399:                    PreparedStatement prep = database.prepareStatement(prop
1400:                            .getProperty("selectTestAttachUrls"));
1401:                    prep.setInt(1, testId);
1402:                    stmtRes = new DataSet(prep.executeQuery());
1403:                    // Ajoute les element un par un au resultat
1404:                    while (stmtRes.hasMoreElements()) {
1405:                        result.addElement(stmtRes.getResults().getString(
1406:                                "url_attach"));
1407:                    }
1408:                } catch (SQLException e) {
1409:                    e.printStackTrace();
1410:                    org.objectweb.salome_tmf.api.Api.addException(
1411:                            "selectTestAttachUrls", null, e);
1412:                } catch (Exception ex) {
1413:                    ex.printStackTrace();
1414:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1415:                            ex);
1416:                }
1417:                // On retourne le resultat
1418:                return result;
1419:            }
1420:
1421:            /**
1422:             * Selection d'un fichier attaché à une action
1423:             * @param familyName
1424:             * @param suiteName
1425:             * @param testName
1426:             * @param actionName
1427:             * @param fileName
1428:             * @return
1429:             */
1430:            public File getActionAttachFile(String familyName,
1431:                    String suiteName, String testName, String actionName,
1432:                    String fileName) {
1433:                int fileAttachId = 0;
1434:                File file = null;
1435:                DataSet stmtRes = null;
1436:
1437:                try {
1438:                    // On initialise l'ID de la famille de test
1439:                    int familyId = STCommun.getIdFamily(database, prop,
1440:                            idProject, familyName);
1441:                    // Idem pour la suite de test
1442:                    int suiteId = STCommun.getIdSuite(database, prop,
1443:                            idProject, suiteName, familyId);
1444:                    // On initialise l'ID pour le test
1445:                    int testId = STCommun.getIdTest(database, prop, testName,
1446:                            suiteId);
1447:                    // On initialise l'ID pour l'action
1448:                    int actionId = STCommun.getIdAction(database, prop,
1449:                            actionName, testId);
1450:                    //	On execute la requete
1451:                    PreparedStatement prep = database.prepareStatement(prop
1452:                            .getProperty("selectActionAttachFile"));
1453:                    prep.setInt(1, actionId);
1454:                    prep.setString(2, fileName);
1455:                    stmtRes = new DataSet(prep.executeQuery());
1456:                    if (stmtRes.getResults().next()) {
1457:                        fileAttachId = stmtRes.getResults().getInt("id_attach");
1458:                    }
1459:
1460:                    // On selectionne le fichier attachement
1461:                    file = STCommun.getFileAttachFromDB(database, prop,
1462:                            fileAttachId);
1463:                } catch (SQLException e) {
1464:                    e.printStackTrace();
1465:                    org.objectweb.salome_tmf.api.Api.addException(
1466:                            "selectActionAttachFile", null, e);
1467:                } catch (Exception ex) {
1468:                    ex.printStackTrace();
1469:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1470:                            ex);
1471:                }
1472:
1473:                // On retourne le resultat
1474:                return file;
1475:            }
1476:
1477:            /**
1478:             * Selection des fichiers attachés à une action
1479:             * Retourne un vecteur (tableau dynamique) d'objets de type "File"
1480:             * @param familyName
1481:             * @param suiteName
1482:             * @param testName
1483:             * @param actionName
1484:             * @return
1485:             */
1486:            public Vector getActionAttachFiles(String familyName,
1487:                    String suiteName, String testName, String actionName) {
1488:                Vector result = new Vector();
1489:                DataSet stmtRes = null;
1490:                File file = null;
1491:
1492:                try {
1493:                    // On initialise l'ID de la famille de test
1494:                    int familyId = STCommun.getIdFamily(database, prop,
1495:                            idProject, familyName);
1496:                    // Idem pour l'ID de la suite de test
1497:                    int suiteId = STCommun.getIdSuite(database, prop,
1498:                            idProject, suiteName, familyId);
1499:                    // On initialise l'ID pour le test
1500:                    int testId = STCommun.getIdTest(database, prop, testName,
1501:                            suiteId);
1502:                    // On initialise l'ID pour l'action
1503:                    int actionId = STCommun.getIdAction(database, prop,
1504:                            actionName, testId);
1505:
1506:                    //	On execute la requete
1507:                    PreparedStatement prep = database.prepareStatement(prop
1508:                            .getProperty("selectActionAttachFiles"));
1509:                    prep.setInt(1, actionId);
1510:                    stmtRes = new DataSet(prep.executeQuery());
1511:                    // Ajoute les element un par un au resultat
1512:                    while (stmtRes.hasMoreElements()) {
1513:                        file = STCommun.getFileAttachFromDB(database, prop,
1514:                                stmtRes.getResults().getInt("id_attach"));
1515:                        result.addElement(file);
1516:                    }
1517:                } catch (SQLException e) {
1518:                    e.printStackTrace();
1519:                    org.objectweb.salome_tmf.api.Api.addException(
1520:                            "selectActionAttachFiles", null, e);
1521:                } catch (Exception ex) {
1522:                    ex.printStackTrace();
1523:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1524:                            ex);
1525:                }
1526:
1527:                // On retourne le resultat
1528:                return result;
1529:            }
1530:
1531:            /**
1532:             * Selection des URL attachés à une action
1533:             * @param familyName
1534:             * @param suiteName
1535:             * @param testName
1536:             * @param actionName
1537:             * @return Retourne un vecteur (tableau dynamique) d'objets de type "String"
1538:             */
1539:            public Vector getActionAttachUrls(String familyName,
1540:                    String suiteName, String testName, String actionName) {
1541:                Vector result = new Vector();
1542:                DataSet stmtRes = null;
1543:                try {
1544:                    // On initialise l'ID de la famille de test
1545:                    int familyId = STCommun.getIdFamily(database, prop,
1546:                            idProject, familyName);
1547:                    // Idem pour l'ID de la suite de test
1548:                    int suiteId = STCommun.getIdSuite(database, prop,
1549:                            idProject, suiteName, familyId);
1550:                    // On initialise l'ID pour le test
1551:                    int testId = STCommun.getIdTest(database, prop, testName,
1552:                            suiteId);
1553:                    // On initialise l'ID pour l'action
1554:                    int actionId = STCommun.getIdAction(database, prop,
1555:                            actionName, testId);
1556:                    //	On execute la requete
1557:                    PreparedStatement prep = database.prepareStatement(prop
1558:                            .getProperty("selectActionAttachUrls"));
1559:                    prep.setInt(1, actionId);
1560:                    stmtRes = new DataSet(prep.executeQuery());
1561:                    // Ajoute les element un par un au resultat
1562:                    while (stmtRes.hasMoreElements()) {
1563:                        result.addElement(stmtRes.getResults().getString(
1564:                                "url_attach"));
1565:                    }
1566:                } catch (SQLException e) {
1567:                    e.printStackTrace();
1568:                    org.objectweb.salome_tmf.api.Api.addException(
1569:                            "selectActionAttachUrls", null, e);
1570:                } catch (Exception ex) {
1571:                    ex.printStackTrace();
1572:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1573:                            ex);
1574:                }
1575:                // On retourne le resultat
1576:                return result;
1577:            }
1578:
1579:            /**
1580:             * Sélection de la description d'une url attachée
1581:             * @param attchName une url
1582:             * @return la description de l'url
1583:             */
1584:            public String getUrlAttachDescription(String attachName) {
1585:                String result = null;
1586:                DataSet stmtRes = null;
1587:                try {
1588:                    // Initialisation de l'ID de l'attachement
1589:                    int attachId = STCommun.getIdUrlAttach(database, prop,
1590:                            attachName);
1591:                    //	On execute la requete
1592:                    PreparedStatement prep = database.prepareStatement(prop
1593:                            .getProperty("selectAttachDescription"));
1594:                    prep.setInt(1, attachId);
1595:                    stmtRes = new DataSet(prep.executeQuery());
1596:                    if (stmtRes.getResults().next()) {
1597:                        result = stmtRes.getResults().getString(
1598:                                "description_attach");
1599:                    }
1600:                } catch (SQLException e) {
1601:                    e.printStackTrace();
1602:                    org.objectweb.salome_tmf.api.Api.addException(
1603:                            "selectAttachDescription", null, e);
1604:                } catch (Exception ex) {
1605:                    ex.printStackTrace();
1606:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1607:                            ex);
1608:                }
1609:                // On retourne le resultat
1610:                return result;
1611:            }
1612:
1613:            /**
1614:             * Sélection de la description d'un fichier attaché
1615:             * @param attchName une url
1616:             * @return la description de l'url
1617:             */
1618:            public String getFileAttachDescription(String attachName) {
1619:                String result = null;
1620:                DataSet stmtRes = null;
1621:                try {
1622:                    // Initialisation de l'ID de l'attachement
1623:                    int attachId = STCommun.getIdFileAttach(database, prop,
1624:                            attachName);
1625:                    //	On execute la requete
1626:                    PreparedStatement prep = database.prepareStatement(prop
1627:                            .getProperty("selectAttachDescription"));
1628:                    prep.setInt(1, attachId);
1629:                    stmtRes = new DataSet(prep.executeQuery());
1630:                    if (stmtRes.getResults().next()) {
1631:                        result = stmtRes.getResults().getString(
1632:                                "description_attach");
1633:                    }
1634:                } catch (SQLException e) {
1635:                    e.printStackTrace();
1636:                    org.objectweb.salome_tmf.api.Api.addException(
1637:                            "selectAttachDescription", null, e);
1638:                } catch (Exception ex) {
1639:                    ex.printStackTrace();
1640:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1641:                            ex);
1642:                }
1643:                // On retourne le resultat
1644:                return result;
1645:            }
1646:
1647:            /**
1648:             * Sélection de la taille d'un fichier attaché
1649:             * @param attachName le nom du fichier
1650:             * @return la taille d'un fichier attaché
1651:             */
1652:            public long getFileAttachLength(String attachName) {
1653:                long result = 0;
1654:                DataSet stmtRes = null;
1655:                try {
1656:                    // Initialisation de l'ID de l'attachement
1657:                    int attachId = STCommun.getIdFileAttach(database, prop,
1658:                            attachName);
1659:                    //	On execute la requete
1660:                    PreparedStatement prep = database.prepareStatement(prop
1661:                            .getProperty("selectAttachLength"));
1662:                    prep.setInt(1, attachId);
1663:                    stmtRes = new DataSet(prep.executeQuery());
1664:                    if (stmtRes.getResults().next()) {
1665:                        result = stmtRes.getResults().getLong(
1666:                                "taille_attachement");
1667:                    }
1668:                } catch (SQLException e) {
1669:                    e.printStackTrace();
1670:                    org.objectweb.salome_tmf.api.Api.addException(
1671:                            "selectAttachLength", null, e);
1672:                } catch (Exception ex) {
1673:                    ex.printStackTrace();
1674:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1675:                            ex);
1676:                }
1677:                // On retourne le resultat
1678:                return result;
1679:            }
1680:
1681:            /**
1682:             * Sélection de la date d'un fichier attaché
1683:             * @param attachName le nom d'un fichier
1684:             * @return la date d'un fichier attaché
1685:             */
1686:            public Date getFileAttachDate(String attachName) {
1687:                Date result = null;
1688:                DataSet stmtRes = null;
1689:                try {
1690:                    // Initialisation de l'ID de l'attachement
1691:                    int attachId = STCommun.getIdFileAttach(database, prop,
1692:                            attachName);
1693:                    //	On execute la requete
1694:                    PreparedStatement prep = database.prepareStatement(prop
1695:                            .getProperty("selectAttachDate"));
1696:                    prep.setInt(1, attachId);
1697:                    stmtRes = new DataSet(prep.executeQuery());
1698:                    if (stmtRes.getResults().next()) {
1699:                        result = stmtRes.getResults().getDate(
1700:                                "date_attachement");
1701:                    }
1702:                } catch (SQLException e) {
1703:                    e.printStackTrace();
1704:                    org.objectweb.salome_tmf.api.Api.addException(
1705:                            "selectAttachDate", null, e);
1706:                } catch (Exception ex) {
1707:                    ex.printStackTrace();
1708:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1709:                            ex);
1710:                }
1711:                // On retourne le resultat
1712:                return result;
1713:            }
1714:
1715:            /**
1716:             * Selection des noms de fichiers attachés à une suite de test
1717:             * Retourne un vecteur (tableau dynamique) d'objets de type <code>String</code>
1718:             * @param familyName
1719:             * @param suiteName
1720:             * @return
1721:             */
1722:            public Vector getSuiteAttachFileNames(String familyName,
1723:                    String suiteName) {
1724:                Vector result = new Vector();
1725:                DataSet stmtRes = null;
1726:                int familyId = 0;
1727:                int suiteId = 0;
1728:                String fileName = null;
1729:
1730:                try {
1731:                    // On initialise l'ID de la famille de test
1732:                    familyId = STCommun.getIdFamily(database, prop, idProject,
1733:                            familyName);
1734:                    // Idem pour l'ID de la suite de test
1735:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
1736:                            suiteName, familyId);
1737:                    //	On execute la requete
1738:                    PreparedStatement prep = database.prepareStatement(prop
1739:                            .getProperty("selectSuiteAttachFiles"));
1740:                    prep.setInt(1, suiteId);
1741:                    stmtRes = new DataSet(prep.executeQuery());
1742:                    // Ajoute les element un par un au resultat
1743:                    while (stmtRes.hasMoreElements()) {
1744:                        fileName = STCommun.getFileAttachNameFromDB(database,
1745:                                prop, stmtRes.getResults().getInt("id_attach"));
1746:                        result.addElement(fileName);
1747:                    }
1748:                } catch (SQLException e) {
1749:                    e.printStackTrace();
1750:                    org.objectweb.salome_tmf.api.Api.addException(
1751:                            "selectSuiteAttachFiles", null, e);
1752:                } catch (Exception ex) {
1753:                    ex.printStackTrace();
1754:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1755:                            ex);
1756:                }
1757:
1758:                // On retourne le resultat
1759:                return result;
1760:            }
1761:
1762:            /**
1763:             * Selection des noms de fichiers attachés à un test
1764:             * Retourne un vecteur (tableau dynamique) d'objets de type "File"
1765:             * @param familyName
1766:             * @param suiteName
1767:             * @param testName
1768:             * @return
1769:             */
1770:            public Vector getTestAttachFileNames(String familyName,
1771:                    String suiteName, String testName) {
1772:                Vector result = new Vector();
1773:                DataSet stmtRes = null;
1774:                String fileName = null;
1775:
1776:                try {
1777:                    // On initialise l'ID de la famille de test
1778:                    int familyId = STCommun.getIdFamily(database, prop,
1779:                            idProject, familyName);
1780:                    // Idem pour l'ID de la suite de test
1781:                    int suiteId = STCommun.getIdSuite(database, prop,
1782:                            idProject, suiteName, familyId);
1783:                    // On initialise l'ID pour le test
1784:                    int testId = STCommun.getIdTest(database, prop, testName,
1785:                            suiteId);
1786:                    //	On execute la requete
1787:                    PreparedStatement prep = database.prepareStatement(prop
1788:                            .getProperty("selectTestAttachFiles"));
1789:                    prep.setInt(1, testId);
1790:                    stmtRes = new DataSet(prep.executeQuery());
1791:                    // Ajoute les element un par un au resultat
1792:                    while (stmtRes.hasMoreElements()) {
1793:                        fileName = STCommun.getFileAttachNameFromDB(database,
1794:                                prop, stmtRes.getResults().getInt("id_attach"));
1795:                        result.addElement(fileName);
1796:                    }
1797:                } catch (SQLException e) {
1798:                    e.printStackTrace();
1799:                    org.objectweb.salome_tmf.api.Api.addException(
1800:                            "selectTestAttachFiles", null, e);
1801:                } catch (Exception ex) {
1802:                    ex.printStackTrace();
1803:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1804:                            ex);
1805:                }
1806:
1807:                // On retourne le resultat
1808:                return result;
1809:
1810:            }
1811:
1812:            /**
1813:             * Selection des noms de fichiers attachés à une action
1814:             * Retourne un vecteur (tableau dynamique) d'objets de type "File"
1815:             * @param familyName
1816:             * @param suiteName
1817:             * @param testName
1818:             * @param actionName
1819:             * @return
1820:             */
1821:            public Vector getActionAttachFileNames(String familyName,
1822:                    String suiteName, String testName, String actionName) {
1823:                Vector result = new Vector();
1824:                DataSet stmtRes = null;
1825:                String fileName = null;
1826:                try {
1827:                    // On initialise l'ID de la famille de test
1828:                    int familyId = STCommun.getIdFamily(database, prop,
1829:                            idProject, familyName);
1830:                    // Idem pour l'ID de la suite de test
1831:                    int suiteId = STCommun.getIdSuite(database, prop,
1832:                            idProject, suiteName, familyId);
1833:                    // On initialise l'ID pour le test
1834:                    int testId = STCommun.getIdTest(database, prop, testName,
1835:                            suiteId);
1836:                    // On initialise l'ID pour l'action
1837:                    int actionId = STCommun.getIdAction(database, prop,
1838:                            actionName, testId);
1839:
1840:                    //	On execute la requete
1841:                    PreparedStatement prep = database.prepareStatement(prop
1842:                            .getProperty("selectActionAttachFiles"));
1843:                    prep.setInt(1, actionId);
1844:                    stmtRes = new DataSet(prep.executeQuery());
1845:                    // Ajoute les element un par un au resultat
1846:                    while (stmtRes.hasMoreElements()) {
1847:                        fileName = STCommun.getFileAttachNameFromDB(database,
1848:                                prop, stmtRes.getResults().getInt("id_attach"));
1849:                        result.addElement(fileName);
1850:                    }
1851:                } catch (SQLException e) {
1852:                    e.printStackTrace();
1853:                    org.objectweb.salome_tmf.api.Api.addException(
1854:                            "selectActionAttachFiles", null, e);
1855:                } catch (Exception ex) {
1856:                    ex.printStackTrace();
1857:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1858:                            ex);
1859:                }
1860:
1861:                // On retourne le resultat
1862:                return result;
1863:            }
1864:
1865:            /**
1866:             * 
1867:             * @param scriptName
1868:             * @return
1869:             */
1870:            public File getScriptOfTest(String familyName, String suiteName,
1871:                    String testName, String scriptName) {
1872:                int fileAttachId = 0;
1873:                File file = null;
1874:                DataSet stmtRes = null;
1875:
1876:                try {
1877:                    // On initialise l'ID de la famille de test
1878:                    int familyId = STCommun.getIdFamily(database, prop,
1879:                            idProject, familyName);
1880:                    // Idem pour la suite de test
1881:                    int suiteId = STCommun.getIdSuite(database, prop,
1882:                            idProject, suiteName, familyId);
1883:                    // On initialise l'ID pour le test
1884:                    int testId = STCommun.getIdTest(database, prop, testName,
1885:                            suiteId);
1886:                    // On initialise l'ID pour l'action
1887:                    int scriptId = STCommun.getIdScript(database, prop, testId,
1888:                            scriptName);
1889:
1890:                    //	On execute la requete
1891:                    PreparedStatement prep = database.prepareStatement(prop
1892:                            .getProperty("selectScriptAttachId"));
1893:                    prep.setInt(1, scriptId);
1894:
1895:                    stmtRes = new DataSet(prep.executeQuery());
1896:                    if (stmtRes.getResults().next()) {
1897:                        fileAttachId = stmtRes.getResults().getInt(
1898:                                "ATTACHEMENT_id_attach");
1899:                    }
1900:
1901:                    // On selectionne le fichier attachement
1902:                    file = STCommun.getFileAttachFromDB(database, prop,
1903:                            fileAttachId);
1904:                } catch (SQLException e) {
1905:                    e.printStackTrace();
1906:                    org.objectweb.salome_tmf.api.Api.addException(
1907:                            "selectScriptAttachId", null, e);
1908:                } catch (Exception ex) {
1909:                    ex.printStackTrace();
1910:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1911:                            ex);
1912:                }
1913:
1914:                // On retourne le resultat
1915:                return file;
1916:            }
1917:
1918:            /**
1919:             * 
1920:             * @param scriptName
1921:             * @return
1922:             */
1923:            public File getTestScriptUsingID(int testId, String scriptName) {
1924:                int fileAttachId = 0;
1925:                File file = null;
1926:                DataSet stmtRes = null;
1927:
1928:                try {
1929:
1930:                    // On initialise l'ID pour l'action
1931:                    int scriptId = STCommun.getIdScript(database, prop, testId,
1932:                            scriptName);
1933:
1934:                    //	On execute la requete
1935:                    PreparedStatement prep = database.prepareStatement(prop
1936:                            .getProperty("selectScriptAttachId"));
1937:                    prep.setInt(1, scriptId);
1938:
1939:                    stmtRes = new DataSet(prep.executeQuery());
1940:                    if (stmtRes.getResults().next()) {
1941:                        fileAttachId = stmtRes.getResults().getInt(
1942:                                "ATTACHEMENT_id_attach");
1943:                    }
1944:
1945:                    // On selectionne le fichier attachement
1946:                    file = STCommun.getFileAttachFromDB(database, prop,
1947:                            fileAttachId);
1948:                } catch (SQLException e) {
1949:                    e.printStackTrace();
1950:                    org.objectweb.salome_tmf.api.Api.addException(
1951:                            "selectScriptAttachId", null, e);
1952:                } catch (Exception ex) {
1953:                    ex.printStackTrace();
1954:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1955:                            ex);
1956:                }
1957:
1958:                // On retourne le resultat
1959:                return file;
1960:            }
1961:
1962:            /**
1963:             * 
1964:             * @param scriptName
1965:             * @param pathName
1966:             * @return
1967:             */
1968:            public File getScriptOfTest(String familyName, String suiteName,
1969:                    String testName, String scriptName, String pathName) {
1970:                int fileAttachId = 0;
1971:                File file = null;
1972:                DataSet stmtRes = null;
1973:
1974:                try {
1975:                    // On initialise l'ID de la famille de test
1976:                    int familyId = STCommun.getIdFamily(database, prop,
1977:                            idProject, familyName);
1978:                    // Idem pour la suite de test
1979:                    int suiteId = STCommun.getIdSuite(database, prop,
1980:                            idProject, suiteName, familyId);
1981:                    // On initialise l'ID pour le test
1982:                    int testId = STCommun.getIdTest(database, prop, testName,
1983:                            suiteId);
1984:                    // On initialise l'ID pour l'action
1985:                    int scriptId = STCommun.getIdScript(database, prop, testId,
1986:                            scriptName);
1987:
1988:                    //	On execute la requete
1989:                    PreparedStatement prep = database.prepareStatement(prop
1990:                            .getProperty("selectScriptAttachId"));
1991:                    prep.setInt(1, scriptId);
1992:
1993:                    stmtRes = new DataSet(prep.executeQuery());
1994:                    if (stmtRes.getResults().next()) {
1995:                        fileAttachId = stmtRes.getResults().getInt(
1996:                                "ATTACHEMENT_id_attach");
1997:                    }
1998:
1999:                    // On selectionne le fichier attachement
2000:                    file = STCommun.getFileAttachFromDB(database, prop,
2001:                            fileAttachId, pathName);
2002:                } catch (SQLException e) {
2003:                    e.printStackTrace();
2004:                    org.objectweb.salome_tmf.api.Api.addException(
2005:                            "selectScriptAttachId", null, e);
2006:                } catch (Exception ex) {
2007:                    ex.printStackTrace();
2008:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2009:                            ex);
2010:                }
2011:
2012:                // On retourne le resultat
2013:                return file;
2014:            }
2015:
2016:            /**
2017:             * 
2018:             * @param scriptName
2019:             * @return
2020:             */
2021:            public String getScriptClassPath(String familyName,
2022:                    String suiteName, String testName, String scriptName) {
2023:                String result = null;
2024:                DataSet stmtRes = null;
2025:                try {
2026:                    // On initialise l'ID de la famille de test
2027:                    int familyId = STCommun.getIdFamily(database, prop,
2028:                            idProject, familyName);
2029:                    // Idem pour l'ID de la suite de test
2030:                    int suiteId = STCommun.getIdSuite(database, prop,
2031:                            idProject, suiteName, familyId);
2032:                    // On initialise l'ID pour le test
2033:                    int testId = STCommun.getIdTest(database, prop, testName,
2034:                            suiteId);
2035:
2036:                    // Initialisation de l'ID de l'attachement
2037:                    int scriptId = STCommun.getIdScript(database, prop, testId,
2038:                            scriptName);
2039:                    //	On execute la requete
2040:                    PreparedStatement prep = database.prepareStatement(prop
2041:                            .getProperty("selectClassPathScript"));
2042:                    prep.setInt(1, scriptId);
2043:                    stmtRes = new DataSet(prep.executeQuery());
2044:                    if (stmtRes.getResults().next()) {
2045:                        result = stmtRes.getResults().getString(
2046:                                "classpath_script");
2047:                    }
2048:                } catch (SQLException e) {
2049:                    e.printStackTrace();
2050:                    org.objectweb.salome_tmf.api.Api.addException(
2051:                            "selectClassPathScript", null, e);
2052:                } catch (Exception ex) {
2053:                    ex.printStackTrace();
2054:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2055:                            ex);
2056:                }
2057:                // On retourne le resultat
2058:                return result;
2059:
2060:            }
2061:
2062:            /**
2063:             * 
2064:             * @param scriptName
2065:             * @return
2066:             */
2067:            public String getScriptPlugArg(String familyName, String suiteName,
2068:                    String testName, String scriptName) {
2069:                String result = null;
2070:                DataSet stmtRes = null;
2071:                try {
2072:                    // On initialise l'ID de la famille de test
2073:                    int familyId = STCommun.getIdFamily(database, prop,
2074:                            idProject, familyName);
2075:                    // Idem pour l'ID de la suite de test
2076:                    int suiteId = STCommun.getIdSuite(database, prop,
2077:                            idProject, suiteName, familyId);
2078:                    // On initialise l'ID pour le test
2079:                    int testId = STCommun.getIdTest(database, prop, testName,
2080:                            suiteId);
2081:
2082:                    // Initialisation de l'ID de l'attachement
2083:                    int scriptId = STCommun.getIdScript(database, prop, testId,
2084:                            scriptName);
2085:                    //	On execute la requete
2086:                    PreparedStatement prep = database.prepareStatement(prop
2087:                            .getProperty("selectClassToBeExecutedScript"));
2088:                    prep.setInt(1, scriptId);
2089:                    stmtRes = new DataSet(prep.executeQuery());
2090:                    if (stmtRes.getResults().next()) {
2091:                        result = stmtRes.getResults().getString(
2092:                                "classe_autom_script");
2093:                    }
2094:                } catch (SQLException e) {
2095:                    e.printStackTrace();
2096:                    org.objectweb.salome_tmf.api.Api.addException(
2097:                            "selectClassToBeExecutedScript", null, e);
2098:                } catch (Exception ex) {
2099:                    ex.printStackTrace();
2100:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2101:                            ex);
2102:                }
2103:                // On retourne le resultat
2104:                return result;
2105:
2106:            }
2107:
2108:            /**
2109:             * 
2110:             * @param scriptType
2111:             * @return
2112:             */
2113:            public String getScriptType(String familyName, String suiteName,
2114:                    String testName, String scriptName) {
2115:                String result = null;
2116:                DataSet stmtRes = null;
2117:                try {
2118:                    // On initialise l'ID de la famille de test
2119:                    int familyId = STCommun.getIdFamily(database, prop,
2120:                            idProject, familyName);
2121:                    // Idem pour l'ID de la suite de test
2122:                    int suiteId = STCommun.getIdSuite(database, prop,
2123:                            idProject, suiteName, familyId);
2124:                    // On initialise l'ID pour le test
2125:                    int testId = STCommun.getIdTest(database, prop, testName,
2126:                            suiteId);
2127:
2128:                    // Initialisation de l'ID de l'attachement
2129:                    int scriptId = STCommun.getIdScript(database, prop, testId,
2130:                            scriptName);
2131:                    //	On execute la requete
2132:                    PreparedStatement prep = database.prepareStatement(prop
2133:                            .getProperty("selectTypeScript"));
2134:                    prep.setInt(1, scriptId);
2135:                    stmtRes = new DataSet(prep.executeQuery());
2136:                    if (stmtRes.getResults().next()) {
2137:                        result = stmtRes.getResults().getString("type_script");
2138:                    }
2139:                } catch (SQLException e) {
2140:                    e.printStackTrace();
2141:                    org.objectweb.salome_tmf.api.Api.addException(
2142:                            "selectTypeScript", null, e);
2143:                } catch (Exception ex) {
2144:                    ex.printStackTrace();
2145:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2146:                            ex);
2147:                }
2148:                // On retourne le resultat
2149:                return result;
2150:
2151:            }
2152:
2153:            /**
2154:             * 
2155:             * @param familyName
2156:             * @param suiteName
2157:             * @param testName
2158:             * @return
2159:             */
2160:            public String getScriptName(String familyName, String suiteName,
2161:                    String testName) {
2162:                String result = null;
2163:                DataSet stmtRes = null;
2164:
2165:                try {
2166:                    // On initialise l'ID de la famille de test
2167:                    int familyId = STCommun.getIdFamily(database, prop,
2168:                            idProject, familyName);
2169:                    // Idem pour l'ID de la suite de test
2170:                    int suiteId = STCommun.getIdSuite(database, prop,
2171:                            idProject, suiteName, familyId);
2172:                    // On initialise l'ID pour le test
2173:                    int testId = STCommun.getIdTest(database, prop, testName,
2174:                            suiteId);
2175:
2176:                    //	On execute la requete
2177:                    PreparedStatement prep = database.prepareStatement(prop
2178:                            .getProperty("selectTestScriptName"));
2179:                    prep.setInt(1, testId);
2180:
2181:                    stmtRes = new DataSet(prep.executeQuery());
2182:                    if (stmtRes.getResults().next()) {
2183:                        result = stmtRes.getResults().getString("url_script");
2184:                    }
2185:
2186:                } catch (SQLException e) {
2187:                    e.printStackTrace();
2188:                    org.objectweb.salome_tmf.api.Api.addException(
2189:                            "selectTestScriptName", null, e);
2190:                } catch (Exception ex) {
2191:                    ex.printStackTrace();
2192:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2193:                            ex);
2194:                }
2195:                return result;
2196:
2197:            }
2198:
2199:            /**
2200:             * Retourne l'identifiant de la famille dont le nom est passé en paramètre 
2201:             * @param familyName
2202:             * @return
2203:             */
2204:            public int getFamilyId(String familyName) {
2205:                return STCommun.getIdFamily(database, prop, idProject,
2206:                        familyName);
2207:            }
2208:
2209:            /**
2210:             * Retourne l'identifiant de la suite dont le nom est passé en paramètre
2211:             * @param suiteName
2212:             * @param familyName
2213:             * @return
2214:             */
2215:            public int getSuiteId(String suiteName, String familyName) {
2216:                // On initialise l'ID de la famille de test
2217:                int familyId = STCommun.getIdFamily(database, prop, idProject,
2218:                        familyName);
2219:                return STCommun.getIdSuite(database, prop, idProject,
2220:                        suiteName, familyId);
2221:            }
2222:
2223:            /**
2224:             * Retourne l'identifiant du test dont le nom est passé en paramètre
2225:             * @param testName
2226:             * @param suiteName
2227:             * @param familyName
2228:             * @return
2229:             */
2230:            public int getTestId(String testName, String suiteName,
2231:                    String familyName) {
2232:                // On initialise l'ID de la famille de test
2233:                int familyId = STCommun.getIdFamily(database, prop, idProject,
2234:                        familyName);
2235:                // Idem pour l'ID de la suite de test
2236:                int suiteId = STCommun.getIdSuite(database, prop, idProject,
2237:                        suiteName, familyId);
2238:                return STCommun.getIdTest(database, prop, testName, suiteId);
2239:            }
2240:
2241:            /**
2242:             * Retourne l'identifiant de l'action dont le nom est passé en paramètre
2243:             * @param actionName
2244:             * @param testName
2245:             * @param suiteName
2246:             * @param familyName
2247:             * @return
2248:             */
2249:            public int getActionId(String actionName, String testName,
2250:                    String suiteName, String familyName) {
2251:                // On initialise l'ID de la famille de test
2252:                int familyId = STCommun.getIdFamily(database, prop, idProject,
2253:                        familyName);
2254:                // Idem pour l'ID de la suite de test
2255:                int suiteId = STCommun.getIdSuite(database, prop, idProject,
2256:                        suiteName, familyId);
2257:                // On initialise l'ID pour le test
2258:                int testId = STCommun.getIdTest(database, prop, testName,
2259:                        suiteId);
2260:                return STCommun.getIdAction(database, prop, actionName, testId);
2261:            }
2262:
2263:            /**
2264:             * Retourne l'identifiant de l'action dont le nom est passé en paramètre
2265:             * @param id_test identifiant du test auquel appartient l'action
2266:             * @param actionName nom de l'action
2267:             * @return identifiant de l'action
2268:             */
2269:            public int getActionIdUsingID(String actionName, int id_test) {
2270:                return STCommun
2271:                        .getIdAction(database, prop, actionName, id_test);
2272:            }
2273:
2274:            public FamilyWrapper getProjectFamilyByOrder(int order) {
2275:                DataSet stmtRes = null;
2276:                FamilyWrapper pFamily = null;
2277:                try {
2278:                    //	On execute la requete
2279:                    PreparedStatement prep = database.prepareStatement(prop
2280:                            .getProperty("selectFamilyByOrder"));
2281:                    prep.setInt(1, idProject);
2282:                    prep.setInt(2, order);
2283:                    stmtRes = new DataSet(prep.executeQuery());
2284:                    // Ajoute les element un par un au resultat
2285:                    if (stmtRes.hasMoreElements()) {
2286:                        pFamily = new FamilyWrapper();
2287:                        pFamily.setName(stmtRes.getResults().getString(
2288:                                "nom_famille"));
2289:                        pFamily.setDescription(stmtRes.getResults().getString(
2290:                                "description_famille"));
2291:                        pFamily.setIdBDD(stmtRes.getResults().getInt(
2292:                                "id_famille"));
2293:                        pFamily.setOrder(stmtRes.getResults().getInt(
2294:                                "ordre_famille"));
2295:                    }
2296:                } catch (SQLException e) {
2297:                    e.printStackTrace();
2298:                    org.objectweb.salome_tmf.api.Api.addException(
2299:                            "selectProjectFamilies", null, e);
2300:                } catch (Exception ex) {
2301:                    ex.printStackTrace();
2302:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2303:                            ex);
2304:                }
2305:
2306:                // On retourne le resultat
2307:                return pFamily;
2308:            }
2309:
2310:            public FamilyWrapper getProjectFamilyUsingID(int id) {
2311:                DataSet stmtRes = null;
2312:                FamilyWrapper pFamily = null;
2313:                try {
2314:                    //	On execute la requete
2315:                    PreparedStatement prep = database.prepareStatement(prop
2316:                            .getProperty("selectFamilyUsingID"));
2317:                    prep.setInt(1, id);
2318:                    stmtRes = new DataSet(prep.executeQuery());
2319:                    // Ajoute les element un par un au resultat
2320:                    if (stmtRes.hasMoreElements()) {
2321:                        pFamily = new FamilyWrapper();
2322:                        pFamily.setName(stmtRes.getResults().getString(
2323:                                "nom_famille"));
2324:                        pFamily.setDescription(stmtRes.getResults().getString(
2325:                                "description_famille"));
2326:                        pFamily.setIdBDD(stmtRes.getResults().getInt(
2327:                                "id_famille"));
2328:                        pFamily.setOrder(stmtRes.getResults().getInt(
2329:                                "ordre_famille"));
2330:                    }
2331:                } catch (SQLException e) {
2332:                    e.printStackTrace();
2333:                    org.objectweb.salome_tmf.api.Api.addException(
2334:                            "selectProjectFamilies", null, e);
2335:                } catch (Exception ex) {
2336:                    ex.printStackTrace();
2337:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2338:                            ex);
2339:                }
2340:
2341:                // On retourne le resultat
2342:                return pFamily;
2343:            }
2344:
2345:            public Vector getAllProjectFamilies() {
2346:                Vector result = new Vector();
2347:                DataSet stmtRes = null;
2348:
2349:                try {
2350:                    //	On execute la requete
2351:                    PreparedStatement prep = database.prepareStatement(prop
2352:                            .getProperty("selectProjectFamilies"));
2353:                    prep.setInt(1, idProject);
2354:                    stmtRes = new DataSet(prep.executeQuery());
2355:                    // Ajoute les element un par un au resultat
2356:                    while (stmtRes.hasMoreElements()) {
2357:                        /*Family pFamily = new Family();
2358:                        pFamily.setName(stmtRes.getResults().getString("nom_famille"));
2359:                        pFamily.setDescription(stmtRes.getResults().getString("description_famille"));
2360:                        pFamily.setIdBdd(stmtRes.getResults().getInt("id_famille"));
2361:                         */
2362:                        FamilyWrapper pFamily = new FamilyWrapper();
2363:                        pFamily.setName(stmtRes.getResults().getString(
2364:                                "nom_famille"));
2365:                        pFamily.setDescription(stmtRes.getResults().getString(
2366:                                "description_famille"));
2367:                        pFamily.setIdBDD(stmtRes.getResults().getInt(
2368:                                "id_famille"));
2369:                        pFamily.setOrder(stmtRes.getResults().getInt(
2370:                                "ordre_famille"));
2371:                        result.addElement(pFamily);
2372:                        //result.addElement(stmtRes.getResults().getString("nom_famille"));
2373:                    }
2374:                } catch (SQLException e) {
2375:                    e.printStackTrace();
2376:                    org.objectweb.salome_tmf.api.Api.addException(
2377:                            "selectProjectFamilies", null, e);
2378:                } catch (Exception ex) {
2379:                    ex.printStackTrace();
2380:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2381:                            ex);
2382:                }
2383:
2384:                // On retourne le resultat
2385:                return result;
2386:            }
2387:
2388:            public int getNumberOfSuitInFamily(int familyId) {
2389:                int result = -1;
2390:                DataSet stmtRes = null;
2391:                try {
2392:                    PreparedStatement prep = database.prepareStatement(prop
2393:                            .getProperty("selectFamilySuites"));
2394:                    prep.setInt(1, familyId);
2395:                    stmtRes = new DataSet(prep.executeQuery());
2396:                    while (stmtRes.hasMoreElements()) {
2397:                        result++;
2398:                    }
2399:                } catch (SQLException e) {
2400:                    e.printStackTrace();
2401:                    org.objectweb.salome_tmf.api.Api.addException(
2402:                            "selectFamilySuites", null, e);
2403:                } catch (Exception ex) {
2404:                    ex.printStackTrace();
2405:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2406:                            ex);
2407:                }
2408:                return result;
2409:            }
2410:
2411:            public Vector getFamilySuites(int familyId) {
2412:                Vector result = new Vector();
2413:                DataSet stmtRes = null;
2414:                try {
2415:                    // On initialise l'ID de la famille de test
2416:                    //familyId = STCommun.getIdFamily(database,prop,idProject,familyName);
2417:                    //	On execute la requete
2418:                    PreparedStatement prep = database.prepareStatement(prop
2419:                            .getProperty("selectFamilySuites"));
2420:                    prep.setInt(1, familyId);
2421:                    stmtRes = new DataSet(prep.executeQuery());
2422:                    // Ajoute les element un par un au resultat
2423:                    while (stmtRes.hasMoreElements()) {
2424:                        /*TestList pTestList = new TestList();
2425:                        pTestList.setIdBdd(stmtRes.getResults().getInt("id_suite"));
2426:                        pTestList.setDescription(stmtRes.getResults().getString("description_suite"));
2427:                        pTestList.setName(stmtRes.getResults().getString("nom_Suite"));
2428:                         */
2429:                        SuiteWrapper pTestList = new SuiteWrapper();
2430:                        pTestList.setIdBDD(stmtRes.getResults().getInt(
2431:                                "id_suite"));
2432:                        pTestList.setDescription(stmtRes.getResults()
2433:                                .getString("description_suite"));
2434:                        pTestList.setName(stmtRes.getResults().getString(
2435:                                "nom_Suite"));
2436:                        pTestList.setOrder(stmtRes.getResults().getInt(
2437:                                "ordre_suite"));
2438:                        pTestList.setIdFamille(stmtRes.getResults().getInt(
2439:                                "FAMILLE_TEST_id_famille"));
2440:                        result.addElement(pTestList);
2441:                        //result.addElement(stmtRes.getResults().getString("nom_Suite"));
2442:                    }
2443:                } catch (SQLException e) {
2444:                    e.printStackTrace();
2445:                    org.objectweb.salome_tmf.api.Api.addException(
2446:                            "selectFamilySuites", null, e);
2447:                } catch (Exception ex) {
2448:                    ex.printStackTrace();
2449:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2450:                            ex);
2451:                }
2452:
2453:                // On retourne le resultat
2454:                return result;
2455:            }
2456:
2457:            public Vector getSuiteAttachFile(int suiteID) {
2458:                Vector result = new Vector();
2459:                DataSet stmtRes = null;
2460:                //int familyId = 0;
2461:                //int suiteId = 0;
2462:                //String fileName = null;
2463:
2464:                try {
2465:                    // On initialise l'ID de la famille de test
2466:                    //familyId = STCommun.getIdFamily(database,prop,idProject,familyName);
2467:                    // Idem pour l'ID de la suite de test
2468:                    //suiteId = STCommun.getIdSuite(database,prop,idProject,suiteName,familyId);
2469:                    //	On execute la requete
2470:                    PreparedStatement prep = database.prepareStatement(prop
2471:                            .getProperty("selectSuiteAttachFiles"));
2472:                    prep.setInt(1, suiteID);
2473:                    stmtRes = new DataSet(prep.executeQuery());
2474:                    // Ajoute les element un par un au resultat
2475:                    while (stmtRes.hasMoreElements()) {
2476:                        /*FileAttachment fileAttach = new FileAttachment();
2477:                        fileAttach.setName(stmtRes.getResults().getString("nom_attach")); 
2478:                        fileAttach.setLocalisation("");
2479:                        fileAttach.setDate(stmtRes.getResults().getDate("date_attachement"));
2480:                        fileAttach.setSize(new Long(stmtRes.getResults().getLong("taille_attachement")));
2481:                        fileAttach.setDescription(stmtRes.getResults().getString("description_attach"));
2482:                        fileAttach.setIdBdd(stmtRes.getResults().getInt("id_attach"));
2483:                         */
2484:                        FileAttachementWrapper fileAttach = new FileAttachementWrapper();
2485:                        fileAttach.setName(stmtRes.getResults().getString(
2486:                                "nom_attach"));
2487:                        fileAttach.setLocalisation("");
2488:                        fileAttach.setDate(stmtRes.getResults().getDate(
2489:                                "date_attachement"));
2490:                        fileAttach.setSize(new Long(stmtRes.getResults()
2491:                                .getLong("taille_attachement")));
2492:                        fileAttach.setDescription(stmtRes.getResults()
2493:                                .getString("description_attach"));
2494:                        fileAttach.setIdBDD(stmtRes.getResults().getInt(
2495:                                "id_attach"));
2496:
2497:                        result.addElement(fileAttach);
2498:
2499:                        //fileName = STCommun.getFileAttachNameFromDB(database,prop,stmtRes.getResults().getInt("id_attach"));
2500:                        //result.addElement(fileName);
2501:
2502:                    }
2503:                } catch (SQLException e) {
2504:                    e.printStackTrace();
2505:                    org.objectweb.salome_tmf.api.Api.addException(
2506:                            "selectSuiteAttachFiles", null, e);
2507:                } catch (Exception ex) {
2508:                    ex.printStackTrace();
2509:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2510:                            ex);
2511:                }
2512:
2513:                // On retourne le resultat
2514:                return result;
2515:            }
2516:
2517:            public Vector getSuiteAttachUrls(int suiteId) {
2518:                Vector result = new Vector();
2519:                DataSet stmtRes = null;
2520:                //int familyId = 0;
2521:                //int suiteId = 0;
2522:
2523:                try {
2524:                    // On initialise l'ID de la famille de test
2525:                    //familyId = STCommun.getIdFamily(database,prop,idProject,familyName);
2526:                    // Idem pour l'ID de la suite de test
2527:                    //suiteId = STCommun.getIdSuite(database,prop,idProject,suiteName,familyId);
2528:                    //	On execute la requete
2529:                    PreparedStatement prep = database.prepareStatement(prop
2530:                            .getProperty("selectSuiteAttachUrls"));
2531:                    prep.setInt(1, suiteId);
2532:                    stmtRes = new DataSet(prep.executeQuery());
2533:                    // Ajoute les element un par un au resultat
2534:                    while (stmtRes.hasMoreElements()) {
2535:                        /*UrlAttachment pUrlAttachment = new UrlAttachment();
2536:                        String url = stmtRes.getResults().getString("url_attach");
2537:                        pUrlAttachment.setUrl(new URL(url));
2538:                        pUrlAttachment.setName(url);
2539:                        pUrlAttachment.setDescription(stmtRes.getResults().getString("description_attach"));;
2540:                        pUrlAttachment.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
2541:                        UrlAttachementWrapper pUrlAttachment = new UrlAttachementWrapper();
2542:                        String url = stmtRes.getResults().getString(
2543:                                "url_attach");
2544:                        pUrlAttachment.setUrl(new URL(url));
2545:                        pUrlAttachment.setName(url);
2546:                        pUrlAttachment.setDescription(stmtRes.getResults()
2547:                                .getString("description_attach"));
2548:                        ;
2549:                        pUrlAttachment.setIdBDD(stmtRes.getResults().getInt(
2550:                                "id_attach"));
2551:
2552:                        result.addElement(pUrlAttachment);
2553:                    }
2554:                } catch (SQLException e) {
2555:                    e.printStackTrace();
2556:                    org.objectweb.salome_tmf.api.Api.addException(
2557:                            "selectSuiteAttachUrls", null, e);
2558:                } catch (Exception ex) {
2559:                    ex.printStackTrace();
2560:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2561:                            ex);
2562:                }
2563:
2564:                // On retourne le resultat
2565:                return result;
2566:            }
2567:
2568:            public int getNumberOfTestInSuite(int suiteId) {
2569:                int result = -1;
2570:                DataSet stmtRes = null;
2571:                try {
2572:                    PreparedStatement prep = database.prepareStatement(prop
2573:                            .getProperty("selectSuiteTests"));
2574:                    prep.setInt(1, suiteId);
2575:                    stmtRes = new DataSet(prep.executeQuery());
2576:                    // Ajoute les element un par un au resultat
2577:                    while (stmtRes.hasMoreElements()) {
2578:                        result++;
2579:                    }
2580:                } catch (SQLException e) {
2581:                    e.printStackTrace();
2582:                    org.objectweb.salome_tmf.api.Api.addException(
2583:                            "selectSuiteTests", null, e);
2584:                } catch (Exception ex) {
2585:                    ex.printStackTrace();
2586:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2587:                            ex);
2588:                }
2589:
2590:                // On retourne le resultat
2591:                return result;
2592:            }
2593:
2594:            public Vector getSuiteTests(int suiteId) {
2595:                Vector result = new Vector();
2596:                DataSet stmtRes = null;
2597:
2598:                try {
2599:                    PreparedStatement prep = database.prepareStatement(prop
2600:                            .getProperty("selectSuiteTests"));
2601:                    prep.setInt(1, suiteId);
2602:                    stmtRes = new DataSet(prep.executeQuery());
2603:                    // Ajoute les element un par un au resultat
2604:                    while (stmtRes.hasMoreElements()) {
2605:                        /*Test test;
2606:                        String type_test = stmtRes.getResults().getString("type_cas");
2607:                        if (type_test.equals("MANUAL")){
2608:                             test = new ManualTest();
2609:                        } else {
2610:                            test = new AutomaticTest(stmtRes.getResults().getString("plug_ext"));
2611:                        }
2612:                        
2613:                        test.setName(stmtRes.getResults().getString("nom_cas"));
2614:                        test.setDescription(stmtRes.getResults().getString("description_cas"));
2615:                        test.setConceptor(getPersonne(stmtRes.getResults().getInt("PERSONNE_id_personne")));
2616:                        test.setCreationDate(stmtRes.getResults().getDate("date_creation_cas"));
2617:                        test.setIdBDD(stmtRes.getResults().getInt("id_cas"));
2618:                         */
2619:                        TestWrapper test;
2620:                        String type_test = stmtRes.getResults().getString(
2621:                                "type_cas");
2622:                        if (type_test.equals(MANUAL)) {
2623:                            test = new ManualTestWrapper();
2624:                        } else {
2625:                            test = new AutomaticTestWrapper();
2626:                            ((AutomaticTestWrapper) test)
2627:                                    .setTestExtension(stmtRes.getResults()
2628:                                            .getString("plug_ext"));
2629:                        }
2630:
2631:                        test.setName(stmtRes.getResults().getString("nom_cas"));
2632:                        test.setDescription(stmtRes.getResults().getString(
2633:                                "description_cas"));
2634:                        test.setConceptor(getPersonne(stmtRes.getResults()
2635:                                .getInt("PERSONNE_id_personne")));
2636:                        test.setCreationDate(stmtRes.getResults().getDate(
2637:                                "date_creation_cas"));
2638:                        test.setIdBDD(stmtRes.getResults().getInt("id_cas"));
2639:                        test.setOrder(stmtRes.getResults().getInt("ordre_cas"));
2640:                        test.setIdSuite(stmtRes.getResults().getInt(
2641:                                "SUITE_TEST_id_suite"));
2642:                        result.addElement(test);
2643:                    }
2644:                } catch (SQLException e) {
2645:                    e.printStackTrace();
2646:                    org.objectweb.salome_tmf.api.Api.addException(
2647:                            "selectSuiteTests", null, e);
2648:                } catch (Exception ex) {
2649:                    ex.printStackTrace();
2650:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2651:                            ex);
2652:                }
2653:
2654:                // On retourne le resultat
2655:                return result;
2656:            }
2657:
2658:            public Vector getTestParamsName(int testId) {
2659:
2660:                Vector result = new Vector();
2661:                DataSet stmtRes = null;
2662:                try {
2663:                    //	On execute la requete
2664:                    PreparedStatement prep = database.prepareStatement(prop
2665:                            .getProperty("selectTestParams"));
2666:                    prep.setInt(1, testId);
2667:                    stmtRes = new DataSet(prep.executeQuery());
2668:
2669:                    // Ajoute les element un par un au resultat
2670:                    while (stmtRes.hasMoreElements()) {
2671:                        result.addElement(stmtRes.getResults().getString(
2672:                                "nom_param_test"));
2673:                    }
2674:                } catch (SQLException e) {
2675:                    e.printStackTrace();
2676:                    org.objectweb.salome_tmf.api.Api.addException(
2677:                            "selectTestParams", null, e);
2678:                } catch (Exception ex) {
2679:                    ex.printStackTrace();
2680:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2681:                            ex);
2682:                }
2683:
2684:                // On retourne le resultat
2685:                return result;
2686:            }
2687:
2688:            public int getNumberOfTestAction(int testId) {
2689:                int result = -1;
2690:                DataSet stmtRes = null;
2691:                try {
2692:                    PreparedStatement prep = database.prepareStatement(prop
2693:                            .getProperty("selectTestActions"));
2694:                    prep.setInt(1, testId);
2695:                    stmtRes = new DataSet(prep.executeQuery());
2696:                    while (stmtRes.hasMoreElements()) {
2697:                        result++;
2698:                    }
2699:                } catch (SQLException e) {
2700:                    e.printStackTrace();
2701:                    org.objectweb.salome_tmf.api.Api.addException(
2702:                            "selectTestActions", null, e);
2703:                } catch (Exception ex) {
2704:                    ex.printStackTrace();
2705:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2706:                            ex);
2707:                }
2708:
2709:                // On retourne le resultat
2710:                return result;
2711:            }
2712:
2713:            public Vector getAllTestActions(int testId) {
2714:
2715:                Vector result = new Vector();
2716:                DataSet stmtRes = null;
2717:                try {
2718:                    PreparedStatement prep = database.prepareStatement(prop
2719:                            .getProperty("selectTestActions"));
2720:                    prep.setInt(1, testId);
2721:                    stmtRes = new DataSet(prep.executeQuery());
2722:                    // Ajoute les element un par un au resultat
2723:                    while (stmtRes.hasMoreElements()) {
2724:                        /*Action pAction = new Action();
2725:                        pAction.setName(stmtRes.getResults().getString("nom_action"));
2726:                        pAction.setDescription(stmtRes.getResults().getString("description_action"));
2727:                        pAction.setAwaitedResult(stmtRes.getResults().getString("res_attendu_action"));
2728:                        pAction.setOrderIndex(stmtRes.getResults().getInt("num_step_action"));
2729:                        pAction.setIdBdd(stmtRes.getResults().getInt("id_action"));
2730:                         */
2731:                        ActionWrapper pAction = new ActionWrapper();
2732:                        pAction.setName(stmtRes.getResults().getString(
2733:                                "nom_action"));
2734:                        pAction.setDescription(stmtRes.getResults().getString(
2735:                                "description_action"));
2736:                        pAction.setAwaitedResult(stmtRes.getResults()
2737:                                .getString("res_attendu_action"));
2738:                        pAction.setOrderIndex(stmtRes.getResults().getInt(
2739:                                "num_step_action"));
2740:                        pAction.setIdBDD(stmtRes.getResults().getInt(
2741:                                "id_action"));
2742:                        pAction.setOrder(stmtRes.getResults().getInt(
2743:                                "num_step_action"));
2744:                        pAction.setIdTest(stmtRes.getResults().getInt(
2745:                                "CAS_TEST_id_cas"));
2746:                        result.addElement(pAction);
2747:                    }
2748:                } catch (SQLException e) {
2749:                    e.printStackTrace();
2750:                    org.objectweb.salome_tmf.api.Api.addException(
2751:                            "selectTestActions", null, e);
2752:                } catch (Exception ex) {
2753:                    ex.printStackTrace();
2754:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2755:                            ex);
2756:                }
2757:
2758:                // On retourne le resultat
2759:                return result;
2760:            }
2761:
2762:            public Vector getActionAttachFile(int actionId) {
2763:                Vector result = new Vector();
2764:                DataSet stmtRes = null;
2765:                //File file = null;
2766:
2767:                try {
2768:                    //On execute la requete
2769:                    PreparedStatement prep = database.prepareStatement(prop
2770:                            .getProperty("selectActionAttachFiles"));
2771:                    prep.setInt(1, actionId);
2772:                    stmtRes = new DataSet(prep.executeQuery());
2773:                    // Ajoute les element un par un au resultat
2774:                    while (stmtRes.hasMoreElements()) {
2775:                        /*FileAttachment fileAttach = new FileAttachment();
2776:                        fileAttach.setName(stmtRes.getResults().getString("nom_attach"));
2777:                        fileAttach.setLocalisation("");
2778:                        fileAttach.setDate(stmtRes.getResults().getDate("date_attachement"));
2779:                        fileAttach.setSize(new Long(stmtRes.getResults().getLong("taille_attachement")));
2780:                        fileAttach.setDescription(stmtRes.getResults().getString("description_attach"));
2781:                        fileAttach.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
2782:                        FileAttachementWrapper fileAttach = new FileAttachementWrapper();
2783:                        fileAttach.setName(stmtRes.getResults().getString(
2784:                                "nom_attach"));
2785:                        fileAttach.setLocalisation("");
2786:                        fileAttach.setDate(stmtRes.getResults().getDate(
2787:                                "date_attachement"));
2788:                        fileAttach.setSize(new Long(stmtRes.getResults()
2789:                                .getLong("taille_attachement")));
2790:                        fileAttach.setDescription(stmtRes.getResults()
2791:                                .getString("description_attach"));
2792:                        fileAttach.setIdBDD(stmtRes.getResults().getInt(
2793:                                "id_attach"));
2794:                        result.addElement(fileAttach);
2795:
2796:                        //file = STCommun.getFileAttachFromDB(database,prop,stmtRes.getResults().getInt("id_attach"));
2797:                        //result.addElement(file);
2798:                    }
2799:                } catch (SQLException e) {
2800:                    e.printStackTrace();
2801:                    org.objectweb.salome_tmf.api.Api.addException(
2802:                            "selectActionAttachFiles", null, e);
2803:                } catch (Exception ex) {
2804:                    ex.printStackTrace();
2805:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2806:                            ex);
2807:                }
2808:
2809:                // On retourne le resultat
2810:                return result;
2811:            }
2812:
2813:            public Vector getActionAttachUrls(int actionId) {
2814:                Vector result = new Vector();
2815:                DataSet stmtRes = null;
2816:                try {
2817:
2818:                    //	On execute la requete
2819:                    PreparedStatement prep = database.prepareStatement(prop
2820:                            .getProperty("selectActionAttachUrls"));
2821:                    prep.setInt(1, actionId);
2822:                    stmtRes = new DataSet(prep.executeQuery());
2823:                    // Ajoute les element un par un au resultat
2824:                    while (stmtRes.hasMoreElements()) {
2825:                        /*UrlAttachment pUrlAttachment = new UrlAttachment();
2826:                        String url = stmtRes.getResults().getString("url_attach");
2827:                        pUrlAttachment.setUrl(new URL(url));
2828:                        pUrlAttachment.setName(url);
2829:                        pUrlAttachment.setDescription(stmtRes.getResults().getString("description_attach"));;
2830:                        pUrlAttachment.setIdBdd(stmtRes.getResults().getInt("id_attach"));
2831:                         */
2832:                        UrlAttachementWrapper pUrlAttachment = new UrlAttachementWrapper();
2833:                        String url = stmtRes.getResults().getString(
2834:                                "url_attach");
2835:                        pUrlAttachment.setUrl(new URL(url));
2836:                        pUrlAttachment.setName(url);
2837:                        pUrlAttachment.setDescription(stmtRes.getResults()
2838:                                .getString("description_attach"));
2839:                        ;
2840:                        pUrlAttachment.setIdBDD(stmtRes.getResults().getInt(
2841:                                "id_attach"));
2842:                        result.addElement(pUrlAttachment);
2843:                    }
2844:                } catch (SQLException e) {
2845:                    e.printStackTrace();
2846:                    org.objectweb.salome_tmf.api.Api.addException(
2847:                            "selectActionAttachUrls", null, e);
2848:                } catch (Exception ex) {
2849:                    ex.printStackTrace();
2850:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2851:                            ex);
2852:                }
2853:                // On retourne le resultat
2854:                return result;
2855:            }
2856:
2857:            //public Script getTestScript(int testId) {
2858:            public ScriptWrapper getTestScript(int testId) {
2859:                //Script pScript = null;
2860:                ScriptWrapper pScript = null;
2861:                DataSet stmtRes = null;
2862:
2863:                try {
2864:                    //On execute la requete
2865:                    PreparedStatement prep = database.prepareStatement(prop
2866:                            .getProperty("SelectTestScript"));
2867:                    prep.setInt(1, testId);
2868:
2869:                    stmtRes = new DataSet(prep.executeQuery());
2870:                    if (stmtRes.getResults().next()) {
2871:                        /*pScript = new Script();
2872:                        pScript.setName(stmtRes.getResults().getString("url_script"));
2873:                        pScript.setScriptExtension(stmtRes.getResults().getString("classpath_script"));
2874:                        pScript.setPlugArg(stmtRes.getResults().getString("classe_autom_script"));
2875:                        pScript.setType(stmtRes.getResults().getString("type_script"));
2876:                        pScript.setIdBdd(stmtRes.getResults().getInt("id_script"));*/
2877:                        pScript = new ScriptWrapper();
2878:                        pScript.setName(stmtRes.getResults().getString(
2879:                                "url_script"));
2880:                        pScript.setScriptExtension(stmtRes.getResults()
2881:                                .getString("classpath_script"));
2882:                        pScript.setPlugArg(stmtRes.getResults().getString(
2883:                                "classe_autom_script"));
2884:                        pScript.setType(stmtRes.getResults().getString(
2885:                                "type_script"));
2886:                        pScript.setIdBDD(stmtRes.getResults().getInt(
2887:                                "id_script"));
2888:                    }
2889:
2890:                } catch (SQLException e) {
2891:                    e.printStackTrace();
2892:                    org.objectweb.salome_tmf.api.Api.addException(
2893:                            "selectEnvironmentScriptName", null, e);
2894:                } catch (Exception ex) {
2895:                    ex.printStackTrace();
2896:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2897:                            ex);
2898:                }
2899:                return pScript;
2900:            }
2901:
2902:            public Vector getTestAttachFiles(int testId) {
2903:                Vector result = new Vector();
2904:                DataSet stmtRes = null;
2905:                //File file = null;
2906:
2907:                try {
2908:                    //	On execute la requete
2909:                    PreparedStatement prep = database.prepareStatement(prop
2910:                            .getProperty("selectTestAttachFiles"));
2911:                    prep.setInt(1, testId);
2912:                    stmtRes = new DataSet(prep.executeQuery());
2913:                    // Ajoute les element un par un au resultat
2914:                    while (stmtRes.hasMoreElements()) {
2915:                        /*FileAttachment fileAttach = new FileAttachment();
2916:                        fileAttach.setName(stmtRes.getResults().getString("nom_attach"));
2917:                        fileAttach.setLocalisation("");
2918:                        fileAttach.setDate(stmtRes.getResults().getDate("date_attachement"));
2919:                        fileAttach.setSize(new Long(stmtRes.getResults().getLong("taille_attachement")));
2920:                        fileAttach.setDescription(stmtRes.getResults().getString("description_attach"));
2921:                        fileAttach.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
2922:                        FileAttachementWrapper fileAttach = new FileAttachementWrapper();
2923:                        fileAttach.setName(stmtRes.getResults().getString(
2924:                                "nom_attach"));
2925:                        fileAttach.setLocalisation("");
2926:                        fileAttach.setDate(stmtRes.getResults().getDate(
2927:                                "date_attachement"));
2928:                        fileAttach.setSize(new Long(stmtRes.getResults()
2929:                                .getLong("taille_attachement")));
2930:                        fileAttach.setDescription(stmtRes.getResults()
2931:                                .getString("description_attach"));
2932:                        fileAttach.setIdBDD(stmtRes.getResults().getInt(
2933:                                "id_attach"));
2934:                        result.addElement(fileAttach);
2935:                    }
2936:                } catch (SQLException e) {
2937:                    e.printStackTrace();
2938:                    org.objectweb.salome_tmf.api.Api.addException(
2939:                            "selectTestAttachFiles", null, e);
2940:                } catch (Exception ex) {
2941:                    ex.printStackTrace();
2942:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2943:                            ex);
2944:                }
2945:
2946:                // On retourne le resultat
2947:                return result;
2948:            }
2949:
2950:            public Vector getTestAttachUrls(int testId) {
2951:                Vector result = new Vector();
2952:                DataSet stmtRes = null;
2953:                try {
2954:                    // On initialise l'ID de la famille de test
2955:                    //	On execute la requete
2956:                    PreparedStatement prep = database.prepareStatement(prop
2957:                            .getProperty("selectTestAttachUrls"));
2958:                    prep.setInt(1, testId);
2959:                    stmtRes = new DataSet(prep.executeQuery());
2960:                    // Ajoute les element un par un au resultat
2961:                    while (stmtRes.hasMoreElements()) {
2962:                        /*UrlAttachment pUrlAttachment = new UrlAttachment();
2963:                        String url = stmtRes.getResults().getString("url_attach");
2964:                        pUrlAttachment.setUrl(new URL(url));
2965:                        pUrlAttachment.setName(url);
2966:                        pUrlAttachment.setDescription(stmtRes.getResults().getString("description_attach"));;
2967:                        pUrlAttachment.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
2968:                        UrlAttachementWrapper pUrlAttachment = new UrlAttachementWrapper();
2969:                        String url = stmtRes.getResults().getString(
2970:                                "url_attach");
2971:                        pUrlAttachment.setUrl(new URL(url));
2972:                        pUrlAttachment.setName(url);
2973:                        pUrlAttachment.setDescription(stmtRes.getResults()
2974:                                .getString("description_attach"));
2975:                        ;
2976:                        pUrlAttachment.setIdBDD(stmtRes.getResults().getInt(
2977:                                "id_attach"));
2978:                        result.addElement(pUrlAttachment);
2979:                    }
2980:                } catch (SQLException e) {
2981:                    e.printStackTrace();
2982:                    org.objectweb.salome_tmf.api.Api.addException(
2983:                            "selectTestAttachUrls", null, e);
2984:                } catch (Exception ex) {
2985:                    ex.printStackTrace();
2986:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2987:                            ex);
2988:                }
2989:                // On retourne le resultat
2990:                return result;
2991:            }
2992:
2993:            public int getLastAttachID() {
2994:                return STCommun.getMaxIdAttach(database, prop);
2995:            }
2996:
2997:            public int getLastScriptID() {
2998:                return STCommun.getMaxIdScript(database, prop);
2999:            }
3000:
3001:            /**
3002:             * Selection d'un fichier attaché
3003:             * @param int fileAttachId l'id de l'attachement
3004:             * @return
3005:             */
3006:            public File getAttachFile(int fileAttachId) {
3007:                File file = null;
3008:                //DataSet stmtRes = null;
3009:
3010:                try {
3011:                    // On selectionne le fichier attachement
3012:                    file = STCommun.getFileAttachFromDB(database, prop,
3013:                            fileAttachId);
3014:                } catch (Exception e) {
3015:                    e.printStackTrace();
3016:                    org.objectweb.salome_tmf.api.Api.addException(
3017:                            "selectSuiteAttachFile", null, e);
3018:                }
3019:                // On retourne le resultat
3020:                return file;
3021:            }
3022:
3023:            /**
3024:             * Selection d'un fichier attaché
3025:             * @param int fileAttachId l'id de l'attachement
3026:             * @param pathName
3027:             * @return
3028:             */
3029:            public File getAttachFile(int fileAttachId, String pathName) {
3030:                File file = null;
3031:                //DataSet stmtRes = null;
3032:
3033:                try {
3034:                    // On selectionne le fichier attachement
3035:                    file = STCommun.getFileAttachFromDB(database, prop,
3036:                            fileAttachId, pathName);
3037:                } catch (Exception e) {
3038:                    e.printStackTrace();
3039:                    org.objectweb.salome_tmf.api.Api.addException(
3040:                            "selectSuiteAttachFile", null, e);
3041:                }
3042:
3043:                // On retourne le resultat
3044:                return file;
3045:            }
3046:
3047:            /**
3048:             * Récupération de l'id d'une Url attachée à une suite
3049:             * @param suiteId id de la suite
3050:             * @param url url de l'attachement
3051:             * @return id de l'attachement
3052:             */
3053:            public int getSuiteAttachUrlId(int suiteId, String url) {
3054:                return STCommun.getSuiteAttachUrlId(database, prop, suiteId,
3055:                        url);
3056:            }
3057:
3058:            /**
3059:             * Récupération de l'id d'un fichier attaché à une suite
3060:             * @param suiteId id de la suite
3061:             * @param fileName nom du fichier
3062:             * @return id de l'attachement
3063:             */
3064:            public int getSuiteAttachFileId(int suiteId, String fileName) {
3065:                return STCommun.getSuiteAttachFileId(database, prop, suiteId,
3066:                        fileName);
3067:            }
3068:
3069:            /**
3070:             * Récupération de l'id d'une url attachée à un test
3071:             * @param testId id du test
3072:             * @param url url de l'attachement
3073:             * @return id de l'attachement
3074:             */
3075:            public int getTestAttachUrlId(int testId, String url) {
3076:                return STCommun.getTestAttachUrlId(database, prop, testId, url);
3077:            }
3078:
3079:            /**
3080:             * Récupération de l'id d'un fichier attaché au test
3081:             * @param testId id du test
3082:             * @param fileName nom du fichier attaché
3083:             * @return id du fichier
3084:             */
3085:            public int getTestAttachFileId(int testId, String fileName) {
3086:                return STCommun.getTestAttachFileId(database, prop, testId,
3087:                        fileName);
3088:            }
3089:
3090:            /**
3091:             * Récupération de l'id d'une url attachée à une action
3092:             * @param actionId id de l'action
3093:             * @param url url de l'attachement
3094:             * @return id de l'url
3095:             */
3096:            public int getActionAttachUrlId(int actionId, String url) {
3097:                return STCommun.getActionAttachUrlId(database, prop, actionId,
3098:                        url);
3099:            }
3100:
3101:            /**
3102:             * Récupération de l'id d'un fichier attaché à une action
3103:             * @param actionId id de l'action
3104:             * @param fileName nom du fichier attaché
3105:             * @return id du fichier
3106:             */
3107:            public int getActionAttachFileId(int actionId, String fileName) {
3108:                return STCommun.getActionAttachFileId(database, prop, actionId,
3109:                        fileName);
3110:            }
3111:
3112:            /**
3113:             * Récupération de l'id du script attaché à un test automatique
3114:             * @param testId id du test automatique
3115:             * @param scriptName nom du script
3116:             * @return id du script
3117:             */
3118:            public int getTestScriptId(int testId, String scriptName) {
3119:                return STCommun.getIdScript(database, prop, testId, scriptName);
3120:            }
3121:
3122:            /**
3123:             * Récupération de l'id de l'attachement d'un script
3124:             * @param scriptId id du script
3125:             * @param scriptName nom du script
3126:             * @return id de l'attachement du script
3127:             */
3128:            public int getAttachIdScript(int scriptId, String scriptName) {
3129:                return STCommun.getAttachIdScript(database, prop, scriptId,
3130:                        scriptName);
3131:            }
3132:
3133:            public SuiteWrapper getSuiteByOrder(int IdFamaly, int order_suite) {
3134:                DataSet stmtRes = null;
3135:                SuiteWrapper pSuite = null;
3136:                try {
3137:                    //	On execute la requete
3138:                    PreparedStatement prep = database.prepareStatement(prop
3139:                            .getProperty("selectSuiteByOrder"));
3140:                    prep.setInt(1, IdFamaly);
3141:                    prep.setInt(2, order_suite);
3142:                    stmtRes = new DataSet(prep.executeQuery());
3143:                    // Ajoute les element un par un au resultat
3144:                    if (stmtRes.hasMoreElements()) {
3145:                        pSuite = new SuiteWrapper();
3146:                        pSuite.setName(stmtRes.getResults().getString(
3147:                                "nom_suite"));
3148:                        pSuite.setDescription(stmtRes.getResults().getString(
3149:                                "description_suite"));
3150:                        pSuite
3151:                                .setIdBDD(stmtRes.getResults().getInt(
3152:                                        "id_suite"));
3153:                        pSuite.setOrder(stmtRes.getResults().getInt(
3154:                                "ordre_suite"));
3155:                        pSuite.setIdFamille(stmtRes.getResults().getInt(
3156:                                "FAMILLE_TEST_id_famille"));
3157:                    }
3158:                } catch (SQLException e) {
3159:                    e.printStackTrace();
3160:                    org.objectweb.salome_tmf.api.Api.addException(
3161:                            "selectSuiteByOrder", null, e);
3162:                } catch (Exception ex) {
3163:                    ex.printStackTrace();
3164:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3165:                            ex);
3166:                }
3167:
3168:                // On retourne le resultat
3169:                return pSuite;
3170:            }
3171:
3172:            public SuiteWrapper getSuiteUsingID(int IdSuite) {
3173:                DataSet stmtRes = null;
3174:                SuiteWrapper pSuite = null;
3175:                try {
3176:                    //	On execute la requete
3177:                    PreparedStatement prep = database.prepareStatement(prop
3178:                            .getProperty("selectSuiteUsingID"));
3179:                    prep.setInt(1, IdSuite);
3180:                    stmtRes = new DataSet(prep.executeQuery());
3181:                    // Ajoute les element un par un au resultat
3182:                    if (stmtRes.hasMoreElements()) {
3183:                        pSuite = new SuiteWrapper();
3184:                        pSuite.setName(stmtRes.getResults().getString(
3185:                                "nom_suite"));
3186:                        pSuite.setDescription(stmtRes.getResults().getString(
3187:                                "description_suite"));
3188:                        pSuite
3189:                                .setIdBDD(stmtRes.getResults().getInt(
3190:                                        "id_suite"));
3191:                        pSuite.setOrder(stmtRes.getResults().getInt(
3192:                                "ordre_suite"));
3193:                        pSuite.setIdFamille(stmtRes.getResults().getInt(
3194:                                "FAMILLE_TEST_id_famille"));
3195:                    }
3196:                } catch (SQLException e) {
3197:                    e.printStackTrace();
3198:                    org.objectweb.salome_tmf.api.Api.addException(
3199:                            "selectSuiteUsingID", null, e);
3200:                } catch (Exception ex) {
3201:                    ex.printStackTrace();
3202:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3203:                            ex);
3204:                }
3205:
3206:                // On retourne le resultat
3207:                return pSuite;
3208:            }
3209:
3210:            public TestWrapper getTestByOrder(int IdSuite, int order_test) {
3211:                DataSet stmtRes = null;
3212:                TestWrapper pTest = null;
3213:                try {
3214:                    //	On execute la requete
3215:                    PreparedStatement prep = database.prepareStatement(prop
3216:                            .getProperty("selectTestByOrder"));
3217:                    prep.setInt(1, IdSuite);
3218:                    prep.setInt(2, order_test);
3219:                    stmtRes = new DataSet(prep.executeQuery());
3220:                    // Ajoute les element un par un au resultat
3221:                    if (stmtRes.hasMoreElements()) {
3222:                        pTest = new TestWrapper();
3223:                        pTest
3224:                                .setName(stmtRes.getResults().getString(
3225:                                        "nom_cas"));
3226:                        pTest.setDescription(stmtRes.getResults().getString(
3227:                                "description_cas"));
3228:                        pTest.setIdBDD(stmtRes.getResults().getInt("id_cas"));
3229:                        pTest
3230:                                .setOrder(stmtRes.getResults().getInt(
3231:                                        "ordre_cas"));
3232:                        pTest.setIdSuite(stmtRes.getResults().getInt(
3233:                                "SUITE_TEST_id_suite"));
3234:                    }
3235:                } catch (SQLException e) {
3236:                    e.printStackTrace();
3237:                    org.objectweb.salome_tmf.api.Api.addException(
3238:                            "selectTestByOrder", null, e);
3239:                } catch (Exception ex) {
3240:                    ex.printStackTrace();
3241:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3242:                            ex);
3243:                }
3244:
3245:                // On retourne le resultat
3246:                return pTest;
3247:            }
3248:
3249:            public TestWrapper getTestUsingID(int IdTest) {
3250:                DataSet stmtRes = null;
3251:                TestWrapper pTest = null;
3252:                try {
3253:                    //	On execute la requete
3254:                    PreparedStatement prep = database.prepareStatement(prop
3255:                            .getProperty("selectTestUsingID"));
3256:                    prep.setInt(1, IdTest);
3257:                    stmtRes = new DataSet(prep.executeQuery());
3258:                    // Ajoute les element un par un au resultat
3259:                    if (stmtRes.hasMoreElements()) {
3260:                        pTest = new TestWrapper();
3261:                        pTest
3262:                                .setName(stmtRes.getResults().getString(
3263:                                        "nom_cas"));
3264:                        pTest.setDescription(stmtRes.getResults().getString(
3265:                                "description_cas"));
3266:                        pTest.setIdBDD(stmtRes.getResults().getInt("id_cas"));
3267:                        pTest
3268:                                .setOrder(stmtRes.getResults().getInt(
3269:                                        "ordre_cas"));
3270:                        pTest.setIdSuite(stmtRes.getResults().getInt(
3271:                                "SUITE_TEST_id_suite"));
3272:                    }
3273:                } catch (SQLException e) {
3274:                    e.printStackTrace();
3275:                    org.objectweb.salome_tmf.api.Api.addException(
3276:                            "selectTestUsingID", null, e);
3277:                } catch (Exception ex) {
3278:                    ex.printStackTrace();
3279:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3280:                            ex);
3281:                }
3282:
3283:                // On retourne le resultat
3284:                return pTest;
3285:            }
3286:
3287:            public ActionWrapper getActionByOrder(int IdTest, int order_action) {
3288:                DataSet stmtRes = null;
3289:                ActionWrapper pAction = null;
3290:                try {
3291:                    //	On execute la requete
3292:                    PreparedStatement prep = database.prepareStatement(prop
3293:                            .getProperty("selectActionByOrder"));
3294:                    prep.setInt(1, IdTest);
3295:                    prep.setInt(2, order_action);
3296:                    stmtRes = new DataSet(prep.executeQuery());
3297:                    // Ajoute les element un par un au resultat
3298:                    if (stmtRes.hasMoreElements()) {
3299:                        pAction = new ActionWrapper();
3300:                        pAction.setName(stmtRes.getResults().getString(
3301:                                "nom_action"));
3302:                        pAction.setDescription(stmtRes.getResults().getString(
3303:                                "description_action"));
3304:                        pAction.setIdBDD(stmtRes.getResults().getInt(
3305:                                "id_action"));
3306:                        pAction.setOrder(stmtRes.getResults().getInt(
3307:                                "num_step_action"));
3308:                    }
3309:                } catch (SQLException e) {
3310:                    e.printStackTrace();
3311:                    org.objectweb.salome_tmf.api.Api.addException(
3312:                            "selectActionByOrder", null, e);
3313:                } catch (Exception ex) {
3314:                    ex.printStackTrace();
3315:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3316:                            ex);
3317:                }
3318:
3319:                // On retourne le resultat
3320:                return pAction;
3321:            }
3322:
3323:            public ActionWrapper getActionUsingID(int IdAction) {
3324:                DataSet stmtRes = null;
3325:                ActionWrapper pAction = null;
3326:                try {
3327:                    //	On execute la requete
3328:                    PreparedStatement prep = database.prepareStatement(prop
3329:                            .getProperty("selectActionUsingID"));
3330:                    prep.setInt(1, IdAction);
3331:                    stmtRes = new DataSet(prep.executeQuery());
3332:                    // Ajoute les element un par un au resultat
3333:                    if (stmtRes.hasMoreElements()) {
3334:                        pAction = new ActionWrapper();
3335:                        pAction.setName(stmtRes.getResults().getString(
3336:                                "nom_action"));
3337:                        pAction.setDescription(stmtRes.getResults().getString(
3338:                                "description_action"));
3339:                        pAction.setIdBDD(stmtRes.getResults().getInt(
3340:                                "id_action"));
3341:                        pAction.setOrder(stmtRes.getResults().getInt(
3342:                                "num_step_action"));
3343:                    }
3344:                } catch (SQLException e) {
3345:                    e.printStackTrace();
3346:                    org.objectweb.salome_tmf.api.Api.addException(
3347:                            "selectActionUsingID", null, e);
3348:                } catch (Exception ex) {
3349:                    ex.printStackTrace();
3350:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3351:                            ex);
3352:                }
3353:
3354:                // On retourne le resultat
3355:                return pAction;
3356:            }
3357:        } // Fin de la classe
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.