Source Code Cross Referenced for SuiteTestDeleteImpl.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.sql.PreparedStatement;
0027:        import java.sql.SQLException;
0028:        import java.util.Properties;
0029:
0030:        import org.objectweb.salome_tmf.api.api2db.DataBase;
0031:        import org.objectweb.salome_tmf.api.api2db.DataSet;
0032:        import org.objectweb.salome_tmf.api.api2ihm.Utile;
0033:
0034:        /**
0035:         * Fonctions de suppression relatives à l'aire fonctionnelle "Suites de test"
0036:         */
0037:        public class SuiteTestDeleteImpl implements  SuiteTestDelete {
0038:
0039:            /**
0040:             * Base de donnees
0041:             */
0042:            DataBase database;
0043:
0044:            /**
0045:             * Fichier "properties" contenant les requetes SQL relatives aux suites de test
0046:             */
0047:            Properties prop;
0048:
0049:            /**
0050:             * ID du projet SalomeTMF dans lequel on se situe
0051:             */
0052:            int idProject;
0053:
0054:            /**
0055:             * Nom du projet SalomeTMF dans lequel on se situe
0056:             */
0057:            String nameProject;
0058:
0059:            private boolean special_allow = false;
0060:
0061:            /**
0062:             * Constructeur
0063:             * @param db
0064:             * @param pr
0065:             */
0066:            public SuiteTestDeleteImpl(DataBase db, Properties pr) {
0067:                database = db;
0068:                prop = pr;
0069:            }
0070:
0071:            /**
0072:             * Fonction qui fixe le projet SalomeTMF dans lequel l'utilisateur travaille
0073:             * @param projectName
0074:             */
0075:            public void setProject(String projectName) {
0076:                nameProject = projectName;
0077:                idProject = Utile.getIdProject(database, prop, projectName);
0078:            }
0079:
0080:            /**
0081:             * Suppression d'une suite de test
0082:             * @param nameFamily
0083:             * @param nameSuite
0084:             */
0085:            public void deleteSuite(String nameFamily, String nameSuite) {
0086:                if (!special_allow) {
0087:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0088:                            .canDeleteTest())) {
0089:                        org.objectweb.salome_tmf.api.Api
0090:                                .log("deleteSuite NOT ALLOW");
0091:                        try {
0092:                            throw new Exception("deleteSuite NOT ALLOW");
0093:                        } catch (Exception e) {
0094:                            e.printStackTrace();
0095:                            org.objectweb.salome_tmf.api.Api.addException(e);
0096:                        }
0097:                        return;
0098:                    }
0099:                }
0100:
0101:                int idFamily = -1;
0102:                int idSuite = -1;
0103:                //String sql = null;
0104:                int _num = -1;
0105:                try {
0106:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0107:                    // Initialisation de l'ID de la famille de test
0108:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0109:                            nameFamily);
0110:
0111:                    // Suppression de tous les tests de la suite de test
0112:
0113:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
0114:                            nameSuite, idFamily);
0115:                    org.objectweb.salome_tmf.api.Api
0116:                            .log("Suppression de tous les tests de la suite de test "
0117:                                    + nameSuite + " d'id " + idSuite);
0118:                    String testName = null;
0119:                    DataSet DS = STCommun.selectSuiteTests(database, prop,
0120:                            idSuite);
0121:                    while (DS.getResults().next()) {
0122:                        testName = DS.getResults().getString("nom_cas");
0123:                        org.objectweb.salome_tmf.api.Api
0124:                                .log("Suppression du test du test " + testName);
0125:                        deleteTest(nameFamily, nameSuite, testName);
0126:                    }
0127:
0128:                    // Suppression des attachements de la suite
0129:                    org.objectweb.salome_tmf.api.Api
0130:                            .log("Suppression de tous les attachements de la suite de test "
0131:                                    + nameSuite + " d'id " + idSuite);
0132:                    deleteAllAttachFromSuite(idSuite);
0133:
0134:                    // Suppression de la suite de test
0135:                    org.objectweb.salome_tmf.api.Api
0136:                            .log("Suppression de la suite " + nameSuite
0137:                                    + " d'id " + idSuite);
0138:                    PreparedStatement prep = database.prepareStatement(prop
0139:                            .getProperty("deleteSuite"));
0140:                    prep.setString(1, nameSuite);
0141:                    prep.setInt(2, idFamily);
0142:                    prep.executeUpdate();
0143:
0144:                } catch (SQLException E) {
0145:                    E.printStackTrace();
0146:                    org.objectweb.salome_tmf.api.Api.addException(
0147:                            "deleteSuite", null, E);
0148:                } catch (Exception ex) {
0149:                    ex.printStackTrace();
0150:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0151:                            ex);
0152:                }
0153:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0154:            }
0155:
0156:            /**
0157:             * Suppression d'une suite de test
0158:             * @param suiteId
0159:             */
0160:            public void deleteSuiteUsingID(int suiteId) {
0161:                if (!special_allow) {
0162:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0163:                            .canDeleteTest())) {
0164:                        org.objectweb.salome_tmf.api.Api
0165:                                .log("deleteSuite NOT ALLOW");
0166:                        try {
0167:                            throw new Exception("deleteSuite NOT ALLOW");
0168:                        } catch (Exception e) {
0169:                            e.printStackTrace();
0170:                            org.objectweb.salome_tmf.api.Api.addException(e);
0171:                        }
0172:                        return;
0173:                    }
0174:                }
0175:
0176:                int _num = -1;
0177:                try {
0178:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0179:
0180:                    // Suppression de tous les tests de la suite de test
0181:
0182:                    org.objectweb.salome_tmf.api.Api
0183:                            .log("Suppression de tous les tests de la suite d'id "
0184:                                    + suiteId);
0185:                    DataSet DS = STCommun.selectSuiteTests(database, prop,
0186:                            suiteId);
0187:                    while (DS.getResults().next()) {
0188:                        int testId = DS.getResults().getInt("id_cas");
0189:                        org.objectweb.salome_tmf.api.Api
0190:                                .log("Suppression du test d'id " + testId);
0191:                        deleteTestUsingID(testId);
0192:                    }
0193:
0194:                    // Suppression des attachements de la suite
0195:                    org.objectweb.salome_tmf.api.Api
0196:                            .log("Suppression de tous les attachements de la suite de test d'id "
0197:                                    + suiteId);
0198:                    deleteAllAttachFromSuite(suiteId);
0199:
0200:                    // Suppression de la suite de test
0201:                    org.objectweb.salome_tmf.api.Api
0202:                            .log("Suppression de la suite d'id " + suiteId);
0203:                    PreparedStatement prep = database.prepareStatement(prop
0204:                            .getProperty("deleteSuiteUsingID"));
0205:                    prep.setInt(1, suiteId);
0206:                    prep.executeUpdate();
0207:
0208:                } catch (SQLException E) {
0209:                    E.printStackTrace();
0210:                    org.objectweb.salome_tmf.api.Api.addException(
0211:                            "deleteSuite", null, E);
0212:                } catch (Exception ex) {
0213:                    ex.printStackTrace();
0214:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0215:                            ex);
0216:                }
0217:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0218:            }
0219:
0220:            public void deleteFamily(int idFamily, String name) {
0221:                special_allow = true;
0222:                int _num = -1;
0223:                try {
0224:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0225:                    // Suppression de toutes les suite de test appartenant a la famille
0226:                    String suiteName = null;
0227:                    DataSet DS = STCommun.selectFamilySuites(database, prop,
0228:                            idFamily);
0229:                    while (DS.getResults().next()) {
0230:                        suiteName = DS.getResults().getString("nom_suite");
0231:                        deleteSuite(name, suiteName);
0232:                    }
0233:
0234:                    // Suppression de la famille de test
0235:                    PreparedStatement prep = database.prepareStatement(prop
0236:                            .getProperty("deleteFamily"));
0237:                    prep.setString(1, name);
0238:                    prep.setInt(2, idProject);
0239:                    prep.executeUpdate();
0240:                    special_allow = false;
0241:
0242:                } catch (SQLException E) {
0243:                    special_allow = false;
0244:                    E.printStackTrace();
0245:                    org.objectweb.salome_tmf.api.Api.addException(
0246:                            "deleteFamily", null, E);
0247:                } catch (Exception ex) {
0248:                    ex.printStackTrace();
0249:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0250:                            ex);
0251:                }
0252:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0253:            }
0254:
0255:            /**
0256:             * Suppression d'une famille de test
0257:             * @param name
0258:             */
0259:            public void deleteFamily(String name) {
0260:                if (!special_allow) {
0261:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0262:                            .canDeleteTest())) {
0263:                        org.objectweb.salome_tmf.api.Api
0264:                                .log("deleteFamily NOT ALLOW");
0265:                        try {
0266:                            throw new Exception("deleteFamily NOT ALLOW");
0267:                        } catch (Exception e) {
0268:                            e.printStackTrace();
0269:                            org.objectweb.salome_tmf.api.Api.addException(e);
0270:                        }
0271:                        return;
0272:                    }
0273:                }
0274:                int idFamily = 0;
0275:                int _num = -1;
0276:                try {
0277:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0278:                    // Initialisation de l'ID de la famille de test
0279:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0280:                            name);
0281:
0282:                    // Suppression de toutes les suite de test appartenant a la famille
0283:                    String suiteName = null;
0284:                    DataSet DS = STCommun.selectFamilySuites(database, prop,
0285:                            idFamily);
0286:                    while (DS.getResults().next()) {
0287:                        suiteName = DS.getResults().getString("nom_suite");
0288:                        deleteSuite(name, suiteName);
0289:                    }
0290:
0291:                    // Suppression de la famille de test
0292:                    PreparedStatement prep = database.prepareStatement(prop
0293:                            .getProperty("deleteFamily"));
0294:                    prep.setString(1, name);
0295:                    prep.setInt(2, idProject);
0296:                    prep.executeUpdate();
0297:
0298:                } catch (SQLException E) {
0299:                    E.printStackTrace();
0300:                    org.objectweb.salome_tmf.api.Api.addException(
0301:                            "deleteFamily", null, E);
0302:                } catch (Exception ex) {
0303:                    ex.printStackTrace();
0304:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0305:                            ex);
0306:                }
0307:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0308:            }
0309:
0310:            /**
0311:             * Suppression d'une famille de test
0312:             * @param familyId
0313:             */
0314:            public void deleteFamilyUsingID(int familyId) {
0315:                if (!special_allow) {
0316:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0317:                            .canDeleteTest())) {
0318:                        org.objectweb.salome_tmf.api.Api
0319:                                .log("deleteFamily NOT ALLOW");
0320:                        try {
0321:                            throw new Exception("deleteFamily NOT ALLOW");
0322:                        } catch (Exception e) {
0323:                            e.printStackTrace();
0324:                            org.objectweb.salome_tmf.api.Api.addException(e);
0325:                        }
0326:                        return;
0327:                    }
0328:                }
0329:
0330:                int _num = -1;
0331:                try {
0332:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0333:
0334:                    // Suppression de toutes les suite de test appartenant a la famille
0335:                    DataSet DS = STCommun.selectFamilySuites(database, prop,
0336:                            familyId);
0337:                    while (DS.getResults().next()) {
0338:                        int suiteId = DS.getResults().getInt("id_suite");
0339:                        deleteSuiteUsingID(suiteId);
0340:                    }
0341:
0342:                    // Suppression de la famille de test
0343:                    PreparedStatement prep = database.prepareStatement(prop
0344:                            .getProperty("deleteFamilyUsingID"));
0345:                    prep.setInt(1, familyId);
0346:                    prep.executeUpdate();
0347:
0348:                } catch (SQLException E) {
0349:                    E.printStackTrace();
0350:                    org.objectweb.salome_tmf.api.Api.addException(
0351:                            "deleteFamily", null, E);
0352:                } catch (Exception ex) {
0353:                    ex.printStackTrace();
0354:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0355:                            ex);
0356:                }
0357:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0358:            }
0359:
0360:            /**
0361:             * Suppression d'un test d'une suite de test
0362:             * @param nameFamily
0363:             * @param nameSuite
0364:             * @param nameTest
0365:             */
0366:            public void deleteTest(String nameFamily, String nameSuite,
0367:                    String nameTest) {
0368:                if (!special_allow) {
0369:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0370:                            .canDeleteTest())) {
0371:                        org.objectweb.salome_tmf.api.Api
0372:                                .log("deleteTest NOT ALLOW");
0373:                        try {
0374:                            throw new Exception("deleteTest NOT ALLOW");
0375:                        } catch (Exception e) {
0376:                            e.printStackTrace();
0377:                            org.objectweb.salome_tmf.api.Api.addException(e);
0378:                        }
0379:                        return;
0380:                    }
0381:                }
0382:                int idFamily = -1;
0383:                int idSuite = -1;
0384:                int idTest = -1;
0385:                int _num = -1;
0386:                try {
0387:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0388:
0389:                    // Initialisation de l'ID de la famille de test
0390:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0391:                            nameFamily);
0392:
0393:                    // Initialisation de l'ID de la suite de test
0394:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
0395:                            nameSuite, idFamily);
0396:
0397:                    // Initialisation de l'ID du test
0398:                    idTest = STCommun.getIdTest(database, prop, nameTest,
0399:                            idSuite);
0400:
0401:                    //	Suppression de toutes les action de test si c'est un test manuel
0402:                    org.objectweb.salome_tmf.api.Api
0403:                            .log("Suppression de toutes les action de test si c'est un test manuel");
0404:                    String actionName = null;
0405:                    DataSet DS = STCommun.selectTestActions(database, prop,
0406:                            idTest);
0407:                    while (DS.getResults().next()) {
0408:                        actionName = DS.getResults().getString("nom_action");
0409:                        deleteAction(nameFamily, nameSuite, nameTest,
0410:                                actionName);
0411:                    }
0412:
0413:                    // Supression des parametres
0414:                    org.objectweb.salome_tmf.api.Api
0415:                            .log("Supression des parametres du test");
0416:                    deleteAllParamFromTest(idTest);
0417:
0418:                    // Suppression des attachments du test
0419:                    org.objectweb.salome_tmf.api.Api
0420:                            .log("Suppression des attachments du test");
0421:                    deleteAllAttachFromTest(idTest);
0422:
0423:                    //Suppréssion du scprit de test, si test automatique
0424:                    org.objectweb.salome_tmf.api.Api
0425:                            .log("Suppréssion du scprit de test, si test automatique");
0426:                    deleteScriptFromTest(idTest);
0427:
0428:                    // Supprésion du test dans les campagnes de tests
0429:                    org.objectweb.salome_tmf.api.Api
0430:                            .log("Supprésion du test dans les campagnes de tests");
0431:                    org.objectweb.salome_tmf.api.api2ihm.campTest.CampTestDelete ct_d = org.objectweb.salome_tmf.api.Api
0432:                            .getInstanceOfCampTest().getCampTestDelete();
0433:                    ct_d.setProject(nameProject);
0434:                    ct_d.purgeTestFromAllCampaigns(idTest);
0435:
0436:                    // Suppression du test
0437:                    org.objectweb.salome_tmf.api.Api.log("Suppression du test");
0438:                    PreparedStatement prep = database.prepareStatement(prop
0439:                            .getProperty("deleteTest"));
0440:                    prep.setInt(1, idSuite);
0441:                    prep.setString(2, nameTest);
0442:                    prep.executeUpdate();
0443:
0444:                } catch (SQLException E) {
0445:                    E.printStackTrace();
0446:                    org.objectweb.salome_tmf.api.Api.addException("deleteTest",
0447:                            null, E);
0448:                } catch (Exception ex) {
0449:                    ex.printStackTrace();
0450:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0451:                            ex);
0452:                }
0453:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0454:            }
0455:
0456:            /**
0457:             * Suppression d'un test d'une suite de test
0458:             * @param testId
0459:             */
0460:            public void deleteTestUsingID(int testId) {
0461:                if (!special_allow) {
0462:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0463:                            .canDeleteTest())) {
0464:                        org.objectweb.salome_tmf.api.Api
0465:                                .log("deleteTest NOT ALLOW");
0466:                        try {
0467:                            throw new Exception("deleteTest NOT ALLOW");
0468:                        } catch (Exception e) {
0469:                            e.printStackTrace();
0470:                            org.objectweb.salome_tmf.api.Api.addException(e);
0471:                        }
0472:                        return;
0473:                    }
0474:                }
0475:                int _num = -1;
0476:                try {
0477:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0478:
0479:                    //	Suppression de toutes les action de test si c'est un test manuel
0480:                    org.objectweb.salome_tmf.api.Api
0481:                            .log("Suppression de toutes les action de test si c'est un test manuel");
0482:                    DataSet DS = STCommun.selectTestActions(database, prop,
0483:                            testId);
0484:                    while (DS.getResults().next()) {
0485:                        int actionId = DS.getResults().getInt("id_action");
0486:                        deleteActionUsingID(actionId);
0487:                    }
0488:
0489:                    // Supression des parametres
0490:                    org.objectweb.salome_tmf.api.Api
0491:                            .log("Supression des parametres du test");
0492:                    deleteAllParamFromTest(testId);
0493:
0494:                    // Suppression des attachments du test
0495:                    org.objectweb.salome_tmf.api.Api
0496:                            .log("Suppression des attachments du test");
0497:                    deleteAllAttachFromTest(testId);
0498:
0499:                    //Suppréssion du scprit de test, si test automatique
0500:                    org.objectweb.salome_tmf.api.Api
0501:                            .log("Suppréssion du scprit de test, si test automatique");
0502:                    deleteScriptFromTest(testId);
0503:
0504:                    // Supprésion du test dans les campagnes de tests
0505:                    org.objectweb.salome_tmf.api.Api
0506:                            .log("Supprésion du test dans les campagnes de tests");
0507:                    org.objectweb.salome_tmf.api.api2ihm.campTest.CampTestDelete ct_d = org.objectweb.salome_tmf.api.Api
0508:                            .getInstanceOfCampTest().getCampTestDelete();
0509:                    ct_d.setProject(nameProject);
0510:                    ct_d.purgeTestFromAllCampaigns(testId);
0511:
0512:                    // Suppression du test
0513:                    org.objectweb.salome_tmf.api.Api.log("Suppression du test");
0514:                    PreparedStatement prep = database.prepareStatement(prop
0515:                            .getProperty("deleteTestUsingID"));
0516:                    prep.setInt(1, testId);
0517:                    prep.executeUpdate();
0518:
0519:                } catch (SQLException E) {
0520:                    E.printStackTrace();
0521:                    org.objectweb.salome_tmf.api.Api.addException("deleteTest",
0522:                            null, E);
0523:                } catch (Exception ex) {
0524:                    ex.printStackTrace();
0525:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0526:                            ex);
0527:                }
0528:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0529:            }
0530:
0531:            /**
0532:             * Suppression d'une action d'un test manuel
0533:             * @param nameFamily
0534:             * @param nameSuite
0535:             * @param nameTest
0536:             * @param nameAction
0537:             */
0538:            public void deleteAction(String nameFamily, String nameSuite,
0539:                    String nameTest, String nameAction) {
0540:                if (!special_allow) {
0541:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0542:                            .canDeleteTest())) {
0543:                        org.objectweb.salome_tmf.api.Api
0544:                                .log("deleteAction NOT ALLOW");
0545:                        try {
0546:                            throw new Exception("deleteAction NOT ALLOW");
0547:                        } catch (Exception e) {
0548:                            e.printStackTrace();
0549:                            org.objectweb.salome_tmf.api.Api.addException(e);
0550:                        }
0551:                        return;
0552:                    }
0553:                }
0554:                int idFamily = -1;
0555:                int idSuite = -1;
0556:                int idTest = -1;
0557:                int idAction = -1;
0558:                String sql = null;
0559:                DataSet stmtRes = null;
0560:                int _num = -1;
0561:                try {
0562:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0563:
0564:                    // Initialisation de l'ID de la famille de test
0565:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0566:                            nameFamily);
0567:
0568:                    // Initialisation de l'ID de la suite de test
0569:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
0570:                            nameSuite, idFamily);
0571:
0572:                    // Initialisation de l'ID du test manuel
0573:                    idTest = STCommun.getIdTest(database, prop, nameTest,
0574:                            idSuite);
0575:
0576:                    idAction = STCommun.getIdAction(database, prop, nameAction,
0577:                            idTest);
0578:
0579:                    //Suppréssion des attachments
0580:                    deleteAllAttachFromTestAction(idAction);
0581:
0582:                    //Suppréssion des paramatres de l'action
0583:                    sql = "selectActionParams";
0584:                    PreparedStatement prep = database.prepareStatement(prop
0585:                            .getProperty("selectActionParams"));
0586:                    prep.setInt(1, idAction);
0587:                    stmtRes = new DataSet(prep.executeQuery());
0588:                    while (stmtRes.hasMoreElements()) {
0589:                        prep = database.prepareStatement(prop
0590:                                .getProperty("deleteParamFromAction"));
0591:                        int idParam = stmtRes.getResults().getInt(
0592:                                "PARAM_TEST_id_param_test");
0593:                        prep.setInt(1, idAction);
0594:                        prep.setInt(2, idParam);
0595:                        prep.executeUpdate();
0596:                    }
0597:
0598:                    // Suppréssion de l'action
0599:                    sql = "deleteAction";
0600:                    prep = database.prepareStatement(prop
0601:                            .getProperty("deleteAction"));
0602:                    prep.setInt(1, idTest);
0603:                    prep.setString(2, nameAction);
0604:                    prep.executeUpdate();
0605:                } catch (SQLException E) {
0606:                    E.printStackTrace();
0607:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
0608:                } catch (Exception ex) {
0609:                    ex.printStackTrace();
0610:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0611:                            ex);
0612:                }
0613:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0614:            }
0615:
0616:            /**
0617:             * Suppression d'une action d'un test manuel
0618:             * @param actionId
0619:             */
0620:            public void deleteActionUsingID(int actionId) {
0621:                if (!special_allow) {
0622:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0623:                            .canDeleteTest())) {
0624:                        org.objectweb.salome_tmf.api.Api
0625:                                .log("deleteAction NOT ALLOW");
0626:                        try {
0627:                            throw new Exception("deleteAction NOT ALLOW");
0628:                        } catch (Exception e) {
0629:                            e.printStackTrace();
0630:                            org.objectweb.salome_tmf.api.Api.addException(e);
0631:                        }
0632:                        return;
0633:                    }
0634:                }
0635:                String sql = null;
0636:                DataSet stmtRes = null;
0637:                int _num = -1;
0638:                try {
0639:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0640:
0641:                    //Suppréssion des attachments
0642:                    deleteAllAttachFromTestAction(actionId);
0643:
0644:                    //Suppréssion des paramatres de l'action
0645:                    sql = "selectActionParams";
0646:                    PreparedStatement prep = database.prepareStatement(prop
0647:                            .getProperty("selectActionParams"));
0648:                    prep.setInt(1, actionId);
0649:                    stmtRes = new DataSet(prep.executeQuery());
0650:                    while (stmtRes.hasMoreElements()) {
0651:                        prep = database.prepareStatement(prop
0652:                                .getProperty("deleteParamFromAction"));
0653:                        int idParam = stmtRes.getResults().getInt(
0654:                                "PARAM_TEST_id_param_test");
0655:                        prep.setInt(1, actionId);
0656:                        prep.setInt(2, idParam);
0657:                        prep.executeUpdate();
0658:                    }
0659:
0660:                    // Suppréssion de l'action
0661:                    sql = "deleteAction";
0662:                    prep = database.prepareStatement(prop
0663:                            .getProperty("deleteActionUsingID"));
0664:                    prep.setInt(1, actionId);
0665:                    prep.executeUpdate();
0666:                } catch (SQLException E) {
0667:                    E.printStackTrace();
0668:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
0669:                } catch (Exception ex) {
0670:                    ex.printStackTrace();
0671:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0672:                            ex);
0673:                }
0674:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0675:            }
0676:
0677:            /**
0678:             * Suppression des parametres d'un test : N'entraine PAS la suppression du parametre de test du projet
0679:             * @param idTest
0680:             */
0681:            public void deleteAllParamFromTest(int idTest) {
0682:                if (!special_allow) {
0683:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0684:                            .canDeleteTest())) {
0685:                        org.objectweb.salome_tmf.api.Api
0686:                                .log("deleteAllParamFromTest NOT ALLOW");
0687:                        try {
0688:                            throw new Exception(
0689:                                    "deleteAllParamFromTest NOT ALLOW");
0690:                        } catch (Exception e) {
0691:                            e.printStackTrace();
0692:                            org.objectweb.salome_tmf.api.Api.addException(e);
0693:                        }
0694:                        return;
0695:                    }
0696:                }
0697:                int idParam = -1;
0698:                DataSet stmtRes = null;
0699:                DataSet stmtRes2 = null;
0700:                String sql = null;
0701:                int _num = -1;
0702:                try {
0703:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0704:
0705:                    sql = "selectTestParams";
0706:                    PreparedStatement prep = database.prepareStatement(prop
0707:                            .getProperty("selectTestParams"));
0708:                    prep.setInt(1, idTest);
0709:                    stmtRes = new DataSet(prep.executeQuery());
0710:                    while (stmtRes.hasMoreElements()) {
0711:                        // Supprésion du paramètre du tests
0712:                        idParam = stmtRes.getResults().getInt(
0713:                                "PARAM_TEST_id_param_test"); //ou id_param_test 
0714:
0715:                        sql = "selectAllIdAction";
0716:                        prep = database.prepareStatement(prop
0717:                                .getProperty("selectAllIdAction"));
0718:                        prep.setInt(1, idTest);
0719:                        stmtRes2 = new DataSet(prep.executeQuery());
0720:                        while (stmtRes2.hasMoreElements()) {
0721:                            int id_action = stmtRes2.getResults().getInt(
0722:                                    "id_action");
0723:                            org.objectweb.salome_tmf.api.Api
0724:                                    .log("Supprésion du paramètre " + idParam
0725:                                            + " du tests" + idTest
0726:                                            + " dans l'action : " + id_action);
0727:                            sql = "deleteParamFromAction";
0728:                            prep = database.prepareStatement(prop
0729:                                    .getProperty("deleteParamFromAction"));
0730:                            prep.setInt(1, id_action);
0731:                            prep.setInt(2, idParam);
0732:                            prep.executeUpdate();
0733:                        }
0734:
0735:                        org.objectweb.salome_tmf.api.Api
0736:                                .log("Supprésion du paramètre " + idParam
0737:                                        + " du tests" + idTest);
0738:                        sql = "deleteParamFromTest";
0739:                        prep = database.prepareStatement(prop
0740:                                .getProperty("deleteParamFromTest"));
0741:
0742:                        prep.setInt(1, idTest);
0743:                        prep.setInt(2, idParam);
0744:                        prep.executeUpdate();
0745:
0746:                    }
0747:                } catch (SQLException E) {
0748:                    E.printStackTrace();
0749:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
0750:                } catch (Exception ex) {
0751:                    ex.printStackTrace();
0752:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0753:                            ex);
0754:                }
0755:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0756:            }
0757:
0758:            /**
0759:             * Suppression d'un parametre d'un test : N'entraine PAS la suppression du parametre de test du projet
0760:             * @param nameFamily  
0761:             * @param nameSuite
0762:             * @param nameTest
0763:             * @param nameParam
0764:             */
0765:            public void deleteParamFromTest(String nameFamily,
0766:                    String nameSuite, String nameTest, String nameParam) {
0767:                if (!special_allow) {
0768:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0769:                            .canDeleteTest())) {
0770:                        org.objectweb.salome_tmf.api.Api
0771:                                .log("deleteParamFromTest NOT ALLOW");
0772:                        try {
0773:                            throw new Exception("deleteParamFromTest NOT ALLOW");
0774:                        } catch (Exception e) {
0775:                            e.printStackTrace();
0776:                            org.objectweb.salome_tmf.api.Api.addException(e);
0777:                        }
0778:                        return;
0779:                    }
0780:                }
0781:                int idFamily = -1;
0782:                int idSuite = -1;
0783:                int idTest = -1;
0784:                int idParam = -1;
0785:                String sql = null;
0786:                DataSet stmtRes = null;
0787:                int _num = -1;
0788:                try {
0789:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0790:
0791:                    // Initialisation de l'ID de la famille de test
0792:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0793:                            nameFamily);
0794:                    // Initialisation de l'ID de la suite de test
0795:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
0796:                            nameSuite, idFamily);
0797:                    // Initialisation de l'ID du test manuel
0798:                    idTest = STCommun.getIdTest(database, prop, nameTest,
0799:                            idSuite);
0800:                    // Initialisation de l'ID du parametre de test
0801:                    idParam = STCommun.getIdParam(database, prop, nameParam,
0802:                            idProject);
0803:
0804:                    sql = "selectAllIdAction";
0805:                    PreparedStatement prep = database.prepareStatement(prop
0806:                            .getProperty("selectAllIdAction"));
0807:                    prep.setInt(1, idTest);
0808:                    stmtRes = new DataSet(prep.executeQuery());
0809:                    while (stmtRes.hasMoreElements()) {
0810:                        int id_action = stmtRes.getResults()
0811:                                .getInt("id_action");
0812:                        org.objectweb.salome_tmf.api.Api
0813:                                .log("Supprésion du paramètre " + idParam
0814:                                        + " du tests" + idTest
0815:                                        + " dans l'action : " + id_action);
0816:                        sql = "deleteParamFromAction";
0817:                        prep = database.prepareStatement(prop
0818:                                .getProperty("deleteParamFromAction"));
0819:                        prep.setInt(1, id_action);
0820:                        prep.setInt(2, idParam);
0821:                        prep.executeUpdate();
0822:                    }
0823:
0824:                    // Appel de la requete a executer
0825:                    sql = "deleteParamFromTest";
0826:                    prep = database.prepareStatement(prop
0827:                            .getProperty("deleteParamFromTest"));
0828:
0829:                    prep.setInt(1, idTest);
0830:                    prep.setInt(2, idParam);
0831:                    prep.executeUpdate();
0832:                } catch (SQLException E) {
0833:                    E.printStackTrace();
0834:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
0835:                } catch (Exception ex) {
0836:                    ex.printStackTrace();
0837:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0838:                            ex);
0839:                }
0840:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0841:            }
0842:
0843:            /**
0844:             * Suppression d'un parametre d'un test : N'entraine PAS la suppression du parametre de test du projet
0845:             * @param testId
0846:             * @param paramId
0847:             */
0848:            public void deleteParamFromTestUsingID(int testId, int paramId) {
0849:                if (!special_allow) {
0850:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0851:                            .canDeleteTest())) {
0852:                        org.objectweb.salome_tmf.api.Api
0853:                                .log("deleteParamFromTest NOT ALLOW");
0854:                        try {
0855:                            throw new Exception("deleteParamFromTest NOT ALLOW");
0856:                        } catch (Exception e) {
0857:                            e.printStackTrace();
0858:                            org.objectweb.salome_tmf.api.Api.addException(e);
0859:                        }
0860:                        return;
0861:                    }
0862:                }
0863:
0864:                String sql = null;
0865:                DataSet stmtRes = null;
0866:                int _num = -1;
0867:                try {
0868:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0869:
0870:                    sql = "selectAllIdAction";
0871:                    PreparedStatement prep = database.prepareStatement(prop
0872:                            .getProperty("selectAllIdAction"));
0873:                    prep.setInt(1, testId);
0874:                    stmtRes = new DataSet(prep.executeQuery());
0875:                    while (stmtRes.hasMoreElements()) {
0876:                        int id_action = stmtRes.getResults()
0877:                                .getInt("id_action");
0878:                        org.objectweb.salome_tmf.api.Api
0879:                                .log("Supprésion du paramètre " + paramId
0880:                                        + " du test " + testId
0881:                                        + " dans l'action : " + id_action);
0882:                        sql = "deleteParamFromAction";
0883:                        prep = database.prepareStatement(prop
0884:                                .getProperty("deleteParamFromAction"));
0885:                        prep.setInt(1, id_action);
0886:                        prep.setInt(2, paramId);
0887:                        prep.executeUpdate();
0888:                    }
0889:
0890:                    // Appel de la requete a executer
0891:                    sql = "deleteParamFromTest";
0892:                    prep = database.prepareStatement(prop
0893:                            .getProperty("deleteParamFromTest"));
0894:
0895:                    prep.setInt(1, testId);
0896:                    prep.setInt(2, paramId);
0897:                    prep.executeUpdate();
0898:                } catch (SQLException E) {
0899:                    E.printStackTrace();
0900:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
0901:                } catch (Exception ex) {
0902:                    ex.printStackTrace();
0903:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0904:                            ex);
0905:                }
0906:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0907:            }
0908:
0909:            /**
0910:             * Suppression d'un parametre d'une action de test : N'entraine PAS la suppression du parametre de test du projet
0911:             * @param nameFamily
0912:             * @param nameSuite
0913:             * @param nameTest
0914:             * @param nameAction
0915:             * @param nameParam
0916:             */
0917:            public void deleteParamFromAction(String nameFamily,
0918:                    String nameSuite, String nameTest, String nameAction,
0919:                    String nameParam) {
0920:                if (!special_allow) {
0921:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0922:                            .canDeleteTest())) {
0923:                        org.objectweb.salome_tmf.api.Api
0924:                                .log("deleteParamFromAction NOT ALLOW");
0925:                        try {
0926:                            throw new Exception(
0927:                                    "deleteParamFromAction NOT ALLOW");
0928:                        } catch (Exception e) {
0929:                            e.printStackTrace();
0930:                            org.objectweb.salome_tmf.api.Api.addException(e);
0931:                        }
0932:                        return;
0933:                    }
0934:                }
0935:                int idFamily = -1;
0936:                int idSuite = -1;
0937:                int idTest = -1;
0938:                int idAction = -1;
0939:                int idParam = -1;
0940:                int _num = -1;
0941:                try {
0942:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0943:
0944:                    // Initialisation de l'ID de la famille de test
0945:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0946:                            nameFamily);
0947:                    // Initialisation de l'ID de la suite de test
0948:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
0949:                            nameSuite, idFamily);
0950:                    // Initialisation de l'ID du test manuel
0951:                    idTest = STCommun.getIdTest(database, prop, nameTest,
0952:                            idSuite);
0953:                    // Idem pour l'action de test
0954:                    idAction = STCommun.getIdAction(database, prop, nameAction,
0955:                            idTest);
0956:                    // Initialisation de l'ID du parametre de test
0957:                    idParam = STCommun.getIdParam(database, prop, nameParam,
0958:                            idProject);
0959:
0960:                    // Appel de la requete a executer
0961:                    PreparedStatement prep = database.prepareStatement(prop
0962:                            .getProperty("deleteParamFromAction"));
0963:
0964:                    prep.setInt(1, idAction);
0965:                    prep.setInt(2, idParam);
0966:                    prep.executeUpdate();
0967:                } catch (SQLException E) {
0968:                    E.printStackTrace();
0969:                    org.objectweb.salome_tmf.api.Api.addException(
0970:                            "deleteParamFromAction", null, E);
0971:                } catch (Exception ex) {
0972:                    ex.printStackTrace();
0973:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0974:                            ex);
0975:                }
0976:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0977:            }
0978:
0979:            /**
0980:             * Suppression d'un parametre d'une action de test : N'entraine PAS la suppression du parametre de test du projet
0981:             * @param actionId
0982:             * @param paramId
0983:             */
0984:            public void deleteParamFromActionUsingID(int actionId, int paramId) {
0985:                if (!special_allow) {
0986:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0987:                            .canDeleteTest())) {
0988:                        org.objectweb.salome_tmf.api.Api
0989:                                .log("deleteParamFromAction NOT ALLOW");
0990:                        try {
0991:                            throw new Exception(
0992:                                    "deleteParamFromAction NOT ALLOW");
0993:                        } catch (Exception e) {
0994:                            e.printStackTrace();
0995:                            org.objectweb.salome_tmf.api.Api.addException(e);
0996:                        }
0997:                        return;
0998:                    }
0999:                }
1000:
1001:                int _num = -1;
1002:                try {
1003:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1004:
1005:                    // Appel de la requete a executer
1006:                    PreparedStatement prep = database.prepareStatement(prop
1007:                            .getProperty("deleteParamFromAction"));
1008:
1009:                    prep.setInt(1, actionId);
1010:                    prep.setInt(2, paramId);
1011:                    prep.executeUpdate();
1012:                } catch (SQLException E) {
1013:                    E.printStackTrace();
1014:                    org.objectweb.salome_tmf.api.Api.addException(
1015:                            "deleteParamFromAction", null, E);
1016:                } catch (Exception ex) {
1017:                    ex.printStackTrace();
1018:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1019:                            ex);
1020:                }
1021:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1022:            }
1023:
1024:            /**
1025:             * Suppression des fichiers attachés à une suite de test
1026:             * @param idSuite
1027:             */
1028:            public void deleteAllAttachFromSuite(int idSuite) {
1029:                if (!special_allow) {
1030:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1031:                            .canDeleteTest())) {
1032:                        org.objectweb.salome_tmf.api.Api
1033:                                .log("deleteAllAttachFromSuite NOT ALLOW");
1034:                        try {
1035:                            throw new Exception(
1036:                                    "deleteAllAttachFromSuite NOT ALLOW");
1037:                        } catch (Exception e) {
1038:                            e.printStackTrace();
1039:                            org.objectweb.salome_tmf.api.Api.addException(e);
1040:                        }
1041:                        return;
1042:                    }
1043:                }
1044:                DataSet stmtRes = null;
1045:                int _num = -1;
1046:                try {
1047:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1048:
1049:                    org.objectweb.salome_tmf.api.Api
1050:                            .log("Selection des attachements de la suite "
1051:                                    + idSuite);
1052:                    PreparedStatement prep = database.prepareStatement(prop
1053:                            .getProperty("selectSuiteAttachs"));
1054:                    prep.setInt(1, idSuite);
1055:                    stmtRes = new DataSet(prep.executeQuery());
1056:                    while (stmtRes.hasMoreElements()) {
1057:                        int idAttachFile = stmtRes.getResults().getInt(
1058:                                "ATTACHEMENT_id_attach");
1059:                        deleteAttachFromSuite(idSuite, idAttachFile);
1060:                    }
1061:                } catch (SQLException E) {
1062:                    E.printStackTrace();
1063:                    org.objectweb.salome_tmf.api.Api.addException(
1064:                            "selectSuiteAttachs", null, E);
1065:                } catch (Exception ex) {
1066:                    ex.printStackTrace();
1067:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1068:                            ex);
1069:                }
1070:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1071:            }
1072:
1073:            /**
1074:             * Suppression d'un fichier attaché à une suite de test
1075:             * @param idSuite
1076:             * @param idAttachFile
1077:             */
1078:            public void deleteAttachFromSuite(int idSuite, int idAttachFile) {
1079:                if (!special_allow) {
1080:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1081:                            .canDeleteTest())) {
1082:                        org.objectweb.salome_tmf.api.Api
1083:                                .log("deleteAttachFromSuite NOT ALLOW");
1084:                        try {
1085:                            throw new Exception(
1086:                                    "deleteAttachFromSuite NOT ALLOW");
1087:                        } catch (Exception e) {
1088:                            e.printStackTrace();
1089:                            org.objectweb.salome_tmf.api.Api.addException(e);
1090:                        }
1091:                        return;
1092:                    }
1093:                }
1094:                String sql = null;
1095:                int _num = -1;
1096:                try {
1097:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1098:
1099:                    // Suppression de l'attachement de la suite de test
1100:                    org.objectweb.salome_tmf.api.Api
1101:                            .log("Suppression de l'attachement " + idAttachFile
1102:                                    + " de la suite de test" + idSuite);
1103:                    sql = "deleteAttachFromSuite";
1104:                    PreparedStatement prep = database.prepareStatement(prop
1105:                            .getProperty("deleteAttachFromSuite"));
1106:                    prep.setInt(1, idSuite);
1107:                    prep.setInt(2, idAttachFile);
1108:                    prep.executeUpdate();
1109:
1110:                    // Suppression de l'attachement de la BdD
1111:                    org.objectweb.salome_tmf.api.Api
1112:                            .log("Suppression de l'attachement " + idAttachFile
1113:                                    + "dans la BDD");
1114:                    sql = "deleteAttachFromDB";
1115:                    prep = database.prepareStatement(prop
1116:                            .getProperty("deleteAttachFromDB"));
1117:                    prep.setInt(1, idAttachFile);
1118:                    prep.executeUpdate();
1119:                } catch (SQLException E) {
1120:                    E.printStackTrace();
1121:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1122:                } catch (Exception ex) {
1123:                    ex.printStackTrace();
1124:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1125:                            ex);
1126:                }
1127:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1128:            }
1129:
1130:            /**
1131:             * Suppression d'un fichier attaché à une suite de test
1132:             * @param nameFamily
1133:             * @param nameSuite
1134:             * @param fileName
1135:             */
1136:            public void deleteAttachFileFromSuite(String nameFamily,
1137:                    String nameSuite, String fileName) {
1138:                if (!special_allow) {
1139:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1140:                            .canDeleteTest())) {
1141:                        org.objectweb.salome_tmf.api.Api
1142:                                .log("deleteAttachFileFromSuite NOT ALLOW");
1143:                        try {
1144:                            throw new Exception(
1145:                                    "deleteAttachFileFromSuite NOT ALLOW");
1146:                        } catch (Exception e) {
1147:                            e.printStackTrace();
1148:                            org.objectweb.salome_tmf.api.Api.addException(e);
1149:                        }
1150:                        return;
1151:                    }
1152:                }
1153:                int idFamily = 0;
1154:                int idSuite = 0;
1155:                int idAttachFile = 0;
1156:                int _num = -1;
1157:                try {
1158:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1159:
1160:                    // Initialisation de l'ID de la famille de test
1161:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
1162:                            nameFamily);
1163:                    // Initialisation de l'ID de la suite de test
1164:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
1165:                            nameSuite, idFamily);
1166:                    // Idem pour l'attachement
1167:                    idAttachFile = STCommun.getSuiteAttachFileId(database,
1168:                            prop, idSuite, fileName);
1169:
1170:                    deleteAttachFromSuite(idSuite, idAttachFile);
1171:
1172:                } catch (Exception E) {
1173:                    E.printStackTrace();
1174:                    org.objectweb.salome_tmf.api.Api
1175:                            .addException(null, null, E);
1176:                }
1177:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1178:            }
1179:
1180:            /**
1181:             * Suppression d'une URL attachée à une suite de test
1182:             * @param nameFamily
1183:             * @param nameSuite
1184:             * @param url
1185:             */
1186:            public void deleteAttachUrlFromSuite(String nameFamily,
1187:                    String nameSuite, String url) {
1188:                if (!special_allow) {
1189:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1190:                            .canDeleteTest())) {
1191:                        org.objectweb.salome_tmf.api.Api
1192:                                .log("deleteAttachUrlFromSuite NOT ALLOW");
1193:                        try {
1194:                            throw new Exception(
1195:                                    "deleteAttachUrlFromSuite NOT ALLOW");
1196:                        } catch (Exception e) {
1197:                            e.printStackTrace();
1198:                            org.objectweb.salome_tmf.api.Api.addException(e);
1199:                        }
1200:                        return;
1201:                    }
1202:                }
1203:                int idFamily = 0;
1204:                int idSuite = 0;
1205:                int idAttachUrl = 0;
1206:                int _num = -1;
1207:                try {
1208:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1209:
1210:                    // Initialisation de l'ID de la famille de test
1211:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
1212:                            nameFamily);
1213:                    // Initialisation de l'ID de la suite de test
1214:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
1215:                            nameSuite, idFamily);
1216:                    // Idem pour l'attachement
1217:                    idAttachUrl = STCommun.getSuiteAttachUrlId(database, prop,
1218:                            idSuite, url);
1219:
1220:                    deleteAttachFromSuite(idSuite, idAttachUrl);
1221:                    /*
1222:                    // Suppression de l'attachement de la suite de test
1223:                    PreparedStatement prep = database.prepareStatement(prop.getProperty("deleteAttachFromSuite"));
1224:                    prep.setInt(1, idSuite);
1225:                    prep.setInt(2, idAttachUrl);
1226:                    prep.executeUpdate();
1227:                    
1228:                    // Suppression de l'attachement de la BdD
1229:                    prep = database.prepareStatement(prop.getProperty("deleteAttachFromDB"));
1230:                    prep.setInt(1, idAttachUrl);
1231:                    prep.executeUpdate();
1232:                     */
1233:                } catch (Exception E) {
1234:                    E.printStackTrace();
1235:                    org.objectweb.salome_tmf.api.Api
1236:                            .addException(null, null, E);
1237:                }
1238:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1239:            }
1240:
1241:            /**
1242:             * Suppression d'une URL attachée à une suite de test
1243:             * @param suiteId
1244:             * @param AttachId
1245:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
1246:             */
1247:            public void deleteAttachFromSuiteUsingID(int suiteId, int attachId) {
1248:                deleteAttachFromSuite(suiteId, attachId);
1249:            }
1250:
1251:            /**
1252:             * Suppression d'un fichier attaché à un test
1253:             * @param nameFamily
1254:             * @param nameSuite
1255:             * @param testName
1256:             * @param fileName
1257:             */
1258:            public void deleteAttachFileFromTest(String nameFamily,
1259:                    String nameSuite, String testName, String fileName) {
1260:                if (!special_allow) {
1261:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1262:                            .canDeleteTest())) {
1263:                        org.objectweb.salome_tmf.api.Api
1264:                                .log("deleteAttachFileFromTest NOT ALLOW");
1265:                        try {
1266:                            throw new Exception(
1267:                                    "deleteAttachFileFromTest NOT ALLOW");
1268:                        } catch (Exception e) {
1269:                            e.printStackTrace();
1270:                            org.objectweb.salome_tmf.api.Api.addException(e);
1271:                        }
1272:                        return;
1273:                    }
1274:                }
1275:                String sql = null;
1276:                int _num = -1;
1277:                try {
1278:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1279:
1280:                    // Initialisation de l'ID de la famille de test
1281:                    int idFamily = STCommun.getIdFamily(database, prop,
1282:                            idProject, nameFamily);
1283:                    // Initialisation de l'ID de la suite de test
1284:                    int idSuite = STCommun.getIdSuite(database, prop,
1285:                            idProject, nameSuite, idFamily);
1286:                    // Initialisation de l'ID du test
1287:                    int idTest = STCommun.getIdTest(database, prop, testName,
1288:                            idSuite);
1289:                    // Idem pour l'attachement
1290:                    int idAttachFile = STCommun.getTestAttachFileId(database,
1291:                            prop, idTest, fileName);
1292:
1293:                    // Suppression de l'attachement de la suite de test
1294:                    sql = "deleteAttachFromTest";
1295:                    PreparedStatement prep = database.prepareStatement(prop
1296:                            .getProperty("deleteAttachFromTest"));
1297:                    prep.setInt(1, idTest);
1298:                    prep.setInt(2, idAttachFile);
1299:                    prep.executeUpdate();
1300:
1301:                    // Suppression de l'attachement de la BdD
1302:                    sql = "deleteAttachFromDB";
1303:                    prep = database.prepareStatement(prop
1304:                            .getProperty("deleteAttachFromDB"));
1305:                    prep.setInt(1, idAttachFile);
1306:                    prep.executeUpdate();
1307:
1308:                } catch (SQLException E) {
1309:                    E.printStackTrace();
1310:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1311:                } catch (Exception ex) {
1312:                    ex.printStackTrace();
1313:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1314:                            ex);
1315:                }
1316:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1317:            }
1318:
1319:            /**
1320:             * Suppression des fichiers attachés une action
1321:             * @param idTest
1322:             */
1323:
1324:            private void deleteAllAttachFromTestAction(int idAction) {
1325:                if (!special_allow) {
1326:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1327:                            .canDeleteTest())) {
1328:                        org.objectweb.salome_tmf.api.Api
1329:                                .log("deleteAllAttachFromTestAction NOT ALLOW");
1330:                        try {
1331:                            throw new Exception(
1332:                                    "deleteAllAttachFromTestAction NOT ALLOW");
1333:                        } catch (Exception e) {
1334:                            e.printStackTrace();
1335:                            org.objectweb.salome_tmf.api.Api.addException(e);
1336:                        }
1337:                        return;
1338:                    }
1339:                }
1340:                String sql = null;
1341:                int _num = -1;
1342:                try {
1343:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1344:
1345:                    DataSet stmtRes = null;
1346:                    int idAttachFile;
1347:                    sql = "selectTestAllAttachAction";
1348:                    PreparedStatement prep = database.prepareStatement(prop
1349:                            .getProperty("selectTestAllAttachAction"));
1350:                    prep.setInt(1, idAction);
1351:                    stmtRes = new DataSet(prep.executeQuery());
1352:
1353:                    while (stmtRes.hasMoreElements()) {
1354:                        idAttachFile = stmtRes.getResults().getInt(
1355:                                "ATTACHEMENT_id_attach");
1356:                        // Suppression de l'attachement de la suite de test
1357:                        org.objectweb.salome_tmf.api.Api
1358:                                .log("Suppression de l'attachement "
1359:                                        + idAttachFile + " de l'action"
1360:                                        + idAction);
1361:                        sql = "deleteAttachFromAction";
1362:                        prep = database.prepareStatement(prop
1363:                                .getProperty("deleteAttachFromAction"));
1364:                        prep.setInt(1, idAction);
1365:                        prep.setInt(2, idAttachFile);
1366:                        prep.executeUpdate();
1367:
1368:                        // Suppression de l'attachement de la BdD
1369:                        sql = "deleteAttachFromDB";
1370:                        prep = database.prepareStatement(prop
1371:                                .getProperty("deleteAttachFromDB"));
1372:                        prep.setInt(1, idAttachFile);
1373:                        prep.executeUpdate();
1374:                    }
1375:
1376:                } catch (SQLException E) {
1377:                    E.printStackTrace();
1378:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1379:                } catch (Exception ex) {
1380:                    ex.printStackTrace();
1381:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1382:                            ex);
1383:                }
1384:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1385:            }
1386:
1387:            /**
1388:             * Suppression des fichiers attachés à un test
1389:             * @param idTest
1390:             */
1391:
1392:            private void deleteAllAttachFromTest(int idTest) {
1393:
1394:                String sql = null;
1395:                int _num = -1;
1396:                try {
1397:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1398:
1399:                    DataSet stmtRes = null;
1400:                    int idAttachFile;
1401:                    sql = "selectTestAllAttachFiles";
1402:                    PreparedStatement prep = database.prepareStatement(prop
1403:                            .getProperty("selectTestAllAttachFiles"));
1404:                    prep.setInt(1, idTest);
1405:                    stmtRes = new DataSet(prep.executeQuery());
1406:
1407:                    while (stmtRes.hasMoreElements()) {
1408:                        idAttachFile = stmtRes.getResults().getInt(
1409:                                "ATTACHEMENT_id_attach");
1410:                        // Suppression de l'attachement de la suite de test
1411:                        org.objectweb.salome_tmf.api.Api
1412:                                .log("Suppression de l'attachement "
1413:                                        + idAttachFile + " du test " + idTest);
1414:                        sql = "deleteAttachFromTest";
1415:                        prep = database.prepareStatement(prop
1416:                                .getProperty("deleteAttachFromTest"));
1417:                        prep.setInt(1, idTest);
1418:                        prep.setInt(2, idAttachFile);
1419:                        prep.executeUpdate();
1420:
1421:                        // Suppression de l'attachement de la BdD
1422:                        sql = "deleteAttachFromDB";
1423:                        prep = database.prepareStatement(prop
1424:                                .getProperty("deleteAttachFromDB"));
1425:                        prep.setInt(1, idAttachFile);
1426:                        prep.executeUpdate();
1427:                    }
1428:
1429:                } catch (SQLException E) {
1430:                    E.printStackTrace();
1431:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1432:                } catch (Exception ex) {
1433:                    ex.printStackTrace();
1434:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1435:                            ex);
1436:                }
1437:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1438:            }
1439:
1440:            /**
1441:             * Suppression d'une URL attachée à une action
1442:             * @param nameFamily
1443:             * @param nameSuite
1444:             * @param testName
1445:             * @param url
1446:             */
1447:            public void deleteAttachUrlFromTest(String nameFamily,
1448:                    String nameSuite, String testName, String url) {
1449:                if (!special_allow) {
1450:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1451:                            .canDeleteTest())) {
1452:                        org.objectweb.salome_tmf.api.Api
1453:                                .log("deleteAttachUrlFromTest NOT ALLOW");
1454:                        try {
1455:                            throw new Exception(
1456:                                    "deleteAttachUrlFromTest NOT ALLOW");
1457:                        } catch (Exception e) {
1458:                            e.printStackTrace();
1459:                            org.objectweb.salome_tmf.api.Api.addException(e);
1460:                        }
1461:                        return;
1462:                    }
1463:                }
1464:                String sql = null;
1465:                int _num = -1;
1466:                try {
1467:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1468:
1469:                    // Initialisation de l'ID de la famille de test
1470:                    int idFamily = STCommun.getIdFamily(database, prop,
1471:                            idProject, nameFamily);
1472:                    // Initialisation de l'ID de la suite de test
1473:                    int idSuite = STCommun.getIdSuite(database, prop,
1474:                            idProject, nameSuite, idFamily);
1475:                    // Initialisation de l'ID du test
1476:                    int idTest = STCommun.getIdTest(database, prop, testName,
1477:                            idSuite);
1478:                    // Idem pour l'attachement
1479:                    int idAttachUrl = STCommun.getTestAttachUrlId(database,
1480:                            prop, idTest, url);
1481:
1482:                    // Suppression de l'attachement de la suite de test
1483:                    sql = "deleteAttachFromTest";
1484:                    PreparedStatement prep = database.prepareStatement(prop
1485:                            .getProperty("deleteAttachFromTest"));
1486:                    prep.setInt(1, idTest);
1487:                    prep.setInt(2, idAttachUrl);
1488:                    prep.executeUpdate();
1489:
1490:                    // Suppression de l'attachement de la BdD
1491:                    sql = "deleteAttachFromDB";
1492:                    prep = database.prepareStatement(prop
1493:                            .getProperty("deleteAttachFromDB"));
1494:                    prep.setInt(1, idAttachUrl);
1495:                    prep.executeUpdate();
1496:
1497:                } catch (SQLException E) {
1498:                    E.printStackTrace();
1499:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1500:                } catch (Exception ex) {
1501:                    ex.printStackTrace();
1502:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1503:                            ex);
1504:                }
1505:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1506:            }
1507:
1508:            /**
1509:             * Suppression d'une URL attachée à un test
1510:             * @param testId
1511:             * @param attachId
1512:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
1513:             */
1514:            public void deleteAttachFromTestUsingID(int testId, int attachId) {
1515:                if (!special_allow) {
1516:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1517:                            .canDeleteTest())) {
1518:                        org.objectweb.salome_tmf.api.Api
1519:                                .log("deleteAttachUrlFromTest NOT ALLOW");
1520:                        try {
1521:                            throw new Exception(
1522:                                    "deleteAttachUrlFromTest NOT ALLOW");
1523:                        } catch (Exception e) {
1524:                            e.printStackTrace();
1525:                            org.objectweb.salome_tmf.api.Api.addException(e);
1526:                        }
1527:                        return;
1528:                    }
1529:                }
1530:                String sql = null;
1531:                int _num = -1;
1532:                try {
1533:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1534:
1535:                    // Suppression de l'attachement de la suite de test
1536:                    sql = "deleteAttachFromTest";
1537:                    PreparedStatement prep = database.prepareStatement(prop
1538:                            .getProperty("deleteAttachFromTest"));
1539:                    prep.setInt(1, testId);
1540:                    prep.setInt(2, attachId);
1541:                    prep.executeUpdate();
1542:
1543:                    // Suppression de l'attachement de la BdD
1544:                    sql = "deleteAttachFromDB";
1545:                    prep = database.prepareStatement(prop
1546:                            .getProperty("deleteAttachFromDB"));
1547:                    prep.setInt(1, attachId);
1548:                    prep.executeUpdate();
1549:
1550:                } catch (SQLException E) {
1551:                    E.printStackTrace();
1552:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1553:                } catch (Exception ex) {
1554:                    ex.printStackTrace();
1555:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1556:                            ex);
1557:                }
1558:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1559:            }
1560:
1561:            /**
1562:             * Suppression d'un fichier attaché à un test
1563:             * @param nameFamily
1564:             * @param nameSuite
1565:             * @param testName
1566:             * @param actionName
1567:             * @param fileName
1568:             */
1569:            public void deleteAttachFileFromAction(String nameFamily,
1570:                    String nameSuite, String testName, String actionName,
1571:                    String fileName) {
1572:                if (!special_allow) {
1573:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1574:                            .canDeleteTest())) {
1575:                        org.objectweb.salome_tmf.api.Api
1576:                                .log("deleteAttachFileFromAction NOT ALLOW");
1577:                        try {
1578:                            throw new Exception(
1579:                                    "deleteAttachFileFromAction NOT ALLOW");
1580:                        } catch (Exception e) {
1581:                            e.printStackTrace();
1582:                            org.objectweb.salome_tmf.api.Api.addException(e);
1583:                        }
1584:                        return;
1585:                    }
1586:                }
1587:                String sql = null;
1588:                int _num = -1;
1589:                try {
1590:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1591:
1592:                    // Initialisation de l'ID de la famille de test
1593:                    int idFamily = STCommun.getIdFamily(database, prop,
1594:                            idProject, nameFamily);
1595:                    // Initialisation de l'ID de la suite de test
1596:                    int idSuite = STCommun.getIdSuite(database, prop,
1597:                            idProject, nameSuite, idFamily);
1598:                    // Initialisation de l'ID du test
1599:                    int idTest = STCommun.getIdTest(database, prop, testName,
1600:                            idSuite);
1601:                    // Initialisation de l'ID de l'action
1602:                    int idAction = STCommun.getIdAction(database, prop,
1603:                            actionName, idTest);
1604:                    // Idem pour l'attachement
1605:                    int idAttachFile = STCommun.getActionAttachFileId(database,
1606:                            prop, idAction, fileName);
1607:
1608:                    // Suppression de l'attachement de la suite de test
1609:                    sql = "deleteAttachFromAction";
1610:                    PreparedStatement prep = database.prepareStatement(prop
1611:                            .getProperty("deleteAttachFromAction"));
1612:                    prep.setInt(1, idAction);
1613:                    prep.setInt(2, idAttachFile);
1614:                    prep.executeUpdate();
1615:
1616:                    // Suppression de l'attachement de la BdD
1617:                    sql = "deleteAttachFromDB";
1618:                    prep = database.prepareStatement(prop
1619:                            .getProperty("deleteAttachFromDB"));
1620:                    prep.setInt(1, idAttachFile);
1621:                    prep.executeUpdate();
1622:
1623:                } catch (SQLException E) {
1624:                    E.printStackTrace();
1625:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1626:                } catch (Exception ex) {
1627:                    ex.printStackTrace();
1628:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1629:                            ex);
1630:                }
1631:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1632:            }
1633:
1634:            /**
1635:             * Suppression d'une URL attachée à une action
1636:             * @param nameFamily
1637:             * @param nameSuite
1638:             * @param testName
1639:             * @param actionName
1640:             * @param url
1641:             */
1642:            public void deleteAttachUrlFromAction(String nameFamily,
1643:                    String nameSuite, String testName, String actionName,
1644:                    String url) {
1645:                if (!special_allow) {
1646:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1647:                            .canDeleteTest())) {
1648:                        org.objectweb.salome_tmf.api.Api
1649:                                .log("deleteAttachUrlFromAction NOT ALLOW");
1650:                        try {
1651:                            throw new Exception(
1652:                                    "deleteAttachUrlFromAction NOT ALLOW");
1653:                        } catch (Exception e) {
1654:                            e.printStackTrace();
1655:                            org.objectweb.salome_tmf.api.Api.addException(e);
1656:                        }
1657:                        return;
1658:                    }
1659:                }
1660:                String sql = null;
1661:                int _num = -1;
1662:                try {
1663:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1664:
1665:                    // Initialisation de l'ID de la famille de test
1666:                    int idFamily = STCommun.getIdFamily(database, prop,
1667:                            idProject, nameFamily);
1668:                    // Initialisation de l'ID de la suite de test
1669:                    int idSuite = STCommun.getIdSuite(database, prop,
1670:                            idProject, nameSuite, idFamily);
1671:                    // Initialisation de l'ID du test
1672:                    int idTest = STCommun.getIdTest(database, prop, testName,
1673:                            idSuite);
1674:                    // Initialisation de l'ID de l'action
1675:                    int idAction = STCommun.getIdAction(database, prop,
1676:                            actionName, idTest);
1677:                    // Idem pour l'attachement
1678:                    int idAttachUrl = STCommun.getActionAttachUrlId(database,
1679:                            prop, idAction, url);
1680:
1681:                    // Suppression de l'attachement de la suite de test
1682:                    sql = "deleteAttachFromAction";
1683:                    PreparedStatement prep = database.prepareStatement(prop
1684:                            .getProperty("deleteAttachFromAction"));
1685:                    prep.setInt(1, idAction);
1686:                    prep.setInt(2, idAttachUrl);
1687:                    prep.executeUpdate();
1688:
1689:                    // Suppression de l'attachement de la BdD
1690:                    sql = "deleteAttachFromDB";
1691:                    prep = database.prepareStatement(prop
1692:                            .getProperty("deleteAttachFromDB"));
1693:                    prep.setInt(1, idAttachUrl);
1694:                    prep.executeUpdate();
1695:
1696:                } catch (SQLException E) {
1697:                    E.printStackTrace();
1698:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1699:                } catch (Exception ex) {
1700:                    ex.printStackTrace();
1701:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1702:                            ex);
1703:                }
1704:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1705:            }
1706:
1707:            /**
1708:             * Suppression d'une URL attachée à un test
1709:             * @param actionId
1710:             * @param attachId
1711:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
1712:             */
1713:            public void deleteAttachFromActionUsingID(int actionId, int attachId) {
1714:                if (!special_allow) {
1715:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1716:                            .canDeleteTest())) {
1717:                        org.objectweb.salome_tmf.api.Api
1718:                                .log("deleteAttachUrlFromAction NOT ALLOW");
1719:                        try {
1720:                            throw new Exception(
1721:                                    "deleteAttachUrlFromAction NOT ALLOW");
1722:                        } catch (Exception e) {
1723:                            e.printStackTrace();
1724:                            org.objectweb.salome_tmf.api.Api.addException(e);
1725:                        }
1726:                        return;
1727:                    }
1728:                }
1729:                String sql = null;
1730:                int _num = -1;
1731:                try {
1732:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1733:
1734:                    // Suppression de l'attachement de la suite de test
1735:                    sql = "deleteAttachFromAction";
1736:                    PreparedStatement prep = database.prepareStatement(prop
1737:                            .getProperty("deleteAttachFromAction"));
1738:                    prep.setInt(1, actionId);
1739:                    prep.setInt(2, attachId);
1740:                    prep.executeUpdate();
1741:
1742:                    // Suppression de l'attachement de la BdD
1743:                    sql = "deleteAttachFromDB";
1744:                    prep = database.prepareStatement(prop
1745:                            .getProperty("deleteAttachFromDB"));
1746:                    prep.setInt(1, attachId);
1747:                    prep.executeUpdate();
1748:
1749:                } catch (SQLException E) {
1750:                    E.printStackTrace();
1751:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1752:                } catch (Exception ex) {
1753:                    ex.printStackTrace();
1754:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1755:                            ex);
1756:                }
1757:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1758:            }
1759:
1760:            /**
1761:             * Supprime les scripts d'un test
1762:             * @param idTest
1763:             */
1764:            public void deleteScriptFromTest(int idTest) {
1765:                if (!special_allow) {
1766:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1767:                            .canDeleteTest())) {
1768:                        org.objectweb.salome_tmf.api.Api
1769:                                .log("deleteScriptFromTes NOT ALLOW");
1770:                        try {
1771:                            throw new Exception(
1772:                                    "deleteScriptFromTest NOT ALLOW");
1773:                        } catch (Exception e) {
1774:                            e.printStackTrace();
1775:                            org.objectweb.salome_tmf.api.Api.addException(e);
1776:                        }
1777:                        return;
1778:                    }
1779:                }
1780:                DataSet stmtRes = null;
1781:                int scriptId = -1;
1782:                int attachId = -1;
1783:                String sql = null;
1784:                int _num = -1;
1785:                try {
1786:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1787:
1788:                    sql = "selectScriptAttchOfTest";
1789:                    PreparedStatement prep = database.prepareStatement(prop
1790:                            .getProperty("selectScriptAttchOfTest"));
1791:                    prep.setInt(1, idTest);
1792:                    stmtRes = new DataSet(prep.executeQuery());
1793:
1794:                    if (stmtRes.getResults().next()) {
1795:                        scriptId = stmtRes.getResults().getInt(
1796:                                "SCRIPT_id_script");
1797:                        attachId = stmtRes.getResults().getInt(
1798:                                "ATTACHEMENT_id_attach");
1799:
1800:                        // Suppression de l'attachement de la suite de test
1801:                        sql = "deleteAttachFromScript";
1802:                        prep = database.prepareStatement(prop
1803:                                .getProperty("deleteAttachFromScript"));
1804:                        prep.setInt(1, scriptId);
1805:                        prep.setInt(2, attachId);
1806:                        prep.executeUpdate();
1807:
1808:                        // Suppression de l'attachement de la BdD
1809:                        sql = "deleteScriptFileFromDB";
1810:                        prep = database.prepareStatement(prop
1811:                                .getProperty("deleteScriptFileFromDB"));
1812:                        prep.setInt(1, attachId);
1813:                        prep.executeUpdate();
1814:
1815:                        // Suppression de l'attachement de la BdD
1816:                        sql = "deleteScriptFromDB";
1817:                        prep = database.prepareStatement(prop
1818:                                .getProperty("deleteScriptFromDB"));
1819:                        prep.setInt(1, scriptId);
1820:                        prep.executeUpdate();
1821:
1822:                        // Suppression de l'attachement de la suite de test
1823:                        sql = "deleteScriptFromTest";
1824:                        prep = database.prepareStatement(prop
1825:                                .getProperty("deleteScriptFromTest"));
1826:                        prep.setInt(1, idTest);
1827:                        prep.executeUpdate();
1828:                    }
1829:                } catch (SQLException E) {
1830:                    E.printStackTrace();
1831:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1832:                } catch (Exception ex) {
1833:                    ex.printStackTrace();
1834:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1835:                            ex);
1836:                }
1837:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1838:            }
1839:
1840:            /**
1841:             * Supprime un script d'un test
1842:             * @param familyName
1843:             * @param suiteName
1844:             * @param testName
1845:             * @param scriptName
1846:             */
1847:            public void deleteScriptFromTest(String familyName,
1848:                    String suiteName, String testName, String scriptName) {
1849:                if (!special_allow) {
1850:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1851:                            .canDeleteTest())) {
1852:                        org.objectweb.salome_tmf.api.Api
1853:                                .log("deleteScriptFromTest NOT ALLOW");
1854:                        try {
1855:                            throw new Exception(
1856:                                    "deleteScriptFromTest NOT ALLOW");
1857:                        } catch (Exception e) {
1858:                            e.printStackTrace();
1859:                            org.objectweb.salome_tmf.api.Api.addException(e);
1860:                        }
1861:                        return;
1862:                    }
1863:                }
1864:                int _num = -1;
1865:                try {
1866:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1867:                    // Initialisation de l'ID de la famille de test
1868:                    int idFamily = STCommun.getIdFamily(database, prop,
1869:                            idProject, familyName);
1870:                    // Initialisation de l'ID de la suite de test
1871:                    int idSuite = STCommun.getIdSuite(database, prop,
1872:                            idProject, suiteName, idFamily);
1873:                    // Initialisation de l'ID du test
1874:                    int idTest = STCommun.getIdTest(database, prop, testName,
1875:                            idSuite);
1876:
1877:                    // Suppression du script de la BdD
1878:                    deleteScript(scriptName, idTest);
1879:
1880:                    // Suppression de l'attachement de la suite de test
1881:                    PreparedStatement prep = database.prepareStatement(prop
1882:                            .getProperty("deleteScriptFromTest"));
1883:                    prep.setInt(1, idTest);
1884:                    prep.executeUpdate();
1885:
1886:                } catch (SQLException E) {
1887:                    E.printStackTrace();
1888:                    org.objectweb.salome_tmf.api.Api.addException(
1889:                            "deleteScriptFromTest", null, E);
1890:                } catch (Exception ex) {
1891:                    ex.printStackTrace();
1892:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1893:                            ex);
1894:                }
1895:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1896:            }
1897:
1898:            /**
1899:             * Supprime un script d'un test
1900:             * @param testId
1901:             * @param scriptName
1902:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
1903:             */
1904:            public void deleteScriptFromTestUsingID(int testId,
1905:                    String scriptName) {
1906:                if (!special_allow) {
1907:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1908:                            .canDeleteTest())) {
1909:                        org.objectweb.salome_tmf.api.Api
1910:                                .log("deleteScriptFromTest NOT ALLOW");
1911:                        try {
1912:                            throw new Exception(
1913:                                    "deleteScriptFromTest NOT ALLOW");
1914:                        } catch (Exception e) {
1915:                            e.printStackTrace();
1916:                            org.objectweb.salome_tmf.api.Api.addException(e);
1917:                        }
1918:                        return;
1919:                    }
1920:                }
1921:                int _num = -1;
1922:                try {
1923:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1924:
1925:                    // Suppression du script de la BdD
1926:                    deleteScript(scriptName, testId);
1927:
1928:                    // Suppression de l'attachement de la suite de test
1929:                    PreparedStatement prep = database.prepareStatement(prop
1930:                            .getProperty("deleteScriptFromTest"));
1931:                    prep.setInt(1, testId);
1932:                    prep.executeUpdate();
1933:
1934:                } catch (SQLException E) {
1935:                    E.printStackTrace();
1936:                    org.objectweb.salome_tmf.api.Api.addException(
1937:                            "deleteScriptFromTest", null, E);
1938:                } catch (Exception ex) {
1939:                    ex.printStackTrace();
1940:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1941:                            ex);
1942:                }
1943:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1944:            }
1945:
1946:            public void deleteScript(String scriptName, int idTest) {
1947:                String sql = null;
1948:                int _num = -1;
1949:                try {
1950:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1951:                    // Initialisation de l'ID de la famille de test
1952:                    int scriptId = STCommun.getIdScript(database, prop, idTest,
1953:                            scriptName);
1954:                    // Initialisation de l'ID du fichier attaché
1955:                    int attachId = STCommun.getAttachIdScript(database, prop,
1956:                            scriptId, scriptName);
1957:
1958:                    // Suppression de l'attachement de la suite de test
1959:                    sql = "deleteAttachFromScript";
1960:                    PreparedStatement prep = database.prepareStatement(prop
1961:                            .getProperty("deleteAttachFromScript"));
1962:                    prep.setInt(1, scriptId);
1963:                    prep.setInt(2, attachId);
1964:                    prep.executeUpdate();
1965:
1966:                    // Suppression de l'attachement de la BdD
1967:                    sql = "deleteScriptFileFromDB";
1968:                    prep = database.prepareStatement(prop
1969:                            .getProperty("deleteScriptFileFromDB"));
1970:                    prep.setInt(1, attachId);
1971:                    prep.executeUpdate();
1972:
1973:                    // Suppression de l'attachement de la BdD
1974:                    sql = "deleteScriptFromDB";
1975:                    prep = database.prepareStatement(prop
1976:                            .getProperty("deleteScriptFromDB"));
1977:                    prep.setInt(1, scriptId);
1978:                    prep.executeUpdate();
1979:
1980:                } catch (SQLException e) {
1981:                    e.printStackTrace();
1982:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, e);
1983:                } catch (Exception ex) {
1984:                    ex.printStackTrace();
1985:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1986:                            ex);
1987:                }
1988:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1989:            }
1990:
1991:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.