Source Code Cross Referenced for SuiteTestInsertImpl.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.Date;
0027:        import java.sql.PreparedStatement;
0028:        import java.sql.SQLException;
0029:        import java.sql.Time;
0030:        import java.util.Properties;
0031:
0032:        import org.objectweb.salome_tmf.api.ApiConstants;
0033:        import org.objectweb.salome_tmf.api.api2db.DataBase;
0034:        import org.objectweb.salome_tmf.api.api2ihm.Utile;
0035:
0036:        /**
0037:         * Fonctions d'insertion relatives à l'aire fonctionnelle "Suites de test"
0038:         */
0039:        public class SuiteTestInsertImpl implements  SuiteTestInsert,
0040:                ApiConstants {
0041:
0042:            /**
0043:             * Base de donnees
0044:             */
0045:            DataBase database;
0046:
0047:            /**
0048:             * Fichier "properties" contenant les requetes SQL relatives aux suites de test
0049:             */
0050:            Properties prop;
0051:
0052:            /**
0053:             * ID du projet SalomeTMF dans lequel on se situe
0054:             */
0055:            int idProject;
0056:
0057:            /**
0058:             * Nom du projet SalomeTMF dans lequel on se situe
0059:             */
0060:            String nameProject;
0061:
0062:            /**
0063:             * Separateur systeme ("/", "\" ...)
0064:             */
0065:            String fs = System.getProperty("file.separator");
0066:
0067:            private boolean special_allow = false;
0068:
0069:            /**
0070:             * Constructeur
0071:             * @param db
0072:             * @param pr
0073:             */
0074:            public SuiteTestInsertImpl(DataBase db, Properties pr) {
0075:                database = db;
0076:                prop = pr;
0077:            }
0078:
0079:            /**
0080:             * Fonction qui fixe le projet SalomeTMF dans lequel l'utilisateur travaille
0081:             * @param projectName
0082:             */
0083:            public void setProject(String projectName) {
0084:                nameProject = projectName;
0085:                idProject = Utile.getIdProject(database, prop, projectName);
0086:            }
0087:
0088:            /**
0089:             * Ajout d'une suite de test
0090:             * @param name
0091:             * @param desc
0092:             * @param family
0093:             * @param order
0094:             */
0095:            public void addSuite(String name, String desc, String family,
0096:                    int order) {
0097:                if (!special_allow) {
0098:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0099:                            .canCreateTest())) {
0100:                        org.objectweb.salome_tmf.api.Api
0101:                                .log("addSuite NOT ALLOW");
0102:                        try {
0103:                            throw new Exception("addSuite NOT ALLOW");
0104:                        } catch (Exception e) {
0105:                            e.printStackTrace();
0106:                            org.objectweb.salome_tmf.api.Api.addException(e);
0107:                        }
0108:                        return;
0109:                    }
0110:                }
0111:                int idFamily = 0;
0112:                int _num = -1;
0113:                try {
0114:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0115:
0116:                    PreparedStatement prep = database.prepareStatement(prop
0117:                            .getProperty("addSuite"));
0118:                    prep.setString(1, name);
0119:                    prep.setString(2, desc);
0120:
0121:                    // Si l'utilisateur ne saisi pas de famille de test pour la suite de test, celle-ci appartiendra par defaut 
0122:                    // a la famille de test "Sans famille"  
0123:                    if ((family == null) || (family == "")) {
0124:                        idFamily = STCommun.getIdFamily(database, prop,
0125:                                idProject, DEFAULT_FAMILY_NAME);
0126:                    } else {
0127:                        idFamily = STCommun.getIdFamily(database, prop,
0128:                                idProject, family);
0129:                    }
0130:                    prep.setInt(3, idFamily);
0131:                    prep.setInt(4, order);
0132:
0133:                    prep.executeUpdate();
0134:                } catch (SQLException E) {
0135:                    E.printStackTrace();
0136:                    org.objectweb.salome_tmf.api.Api.addException("addSuite",
0137:                            null, E);
0138:                } catch (Exception ex) {
0139:                    ex.printStackTrace();
0140:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0141:                            ex);
0142:                }
0143:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0144:            }
0145:
0146:            /**
0147:             * Ajout d'une suite de test
0148:             * @param name
0149:             * @param desc
0150:             * @param familyId
0151:             * @param order
0152:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateTest()
0153:             */
0154:            public void addSuiteUsingID(String name, String desc, int familyId,
0155:                    int order) {
0156:                if (!special_allow) {
0157:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0158:                            .canCreateTest())) {
0159:                        org.objectweb.salome_tmf.api.Api
0160:                                .log("addSuite NOT ALLOW");
0161:                        try {
0162:                            throw new Exception("addSuite NOT ALLOW");
0163:                        } catch (Exception e) {
0164:                            e.printStackTrace();
0165:                            org.objectweb.salome_tmf.api.Api.addException(e);
0166:                        }
0167:                        return;
0168:                    }
0169:                }
0170:                //int idFamily = 0;
0171:                int _num = -1;
0172:                try {
0173:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0174:
0175:                    PreparedStatement prep = database.prepareStatement(prop
0176:                            .getProperty("addSuite"));
0177:                    prep.setString(1, name);
0178:                    prep.setString(2, desc);
0179:                    prep.setInt(3, familyId);
0180:                    prep.setInt(4, order);
0181:
0182:                    prep.executeUpdate();
0183:                } catch (SQLException E) {
0184:                    E.printStackTrace();
0185:                    org.objectweb.salome_tmf.api.Api.addException("addSuite",
0186:                            null, E);
0187:                } catch (Exception ex) {
0188:                    ex.printStackTrace();
0189:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0190:                            ex);
0191:                }
0192:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0193:            }
0194:
0195:            /**
0196:             * Ajout d'une famille de test
0197:             * @param name
0198:             * @param desc
0199:             * @param order
0200:             */
0201:            public void addFamily(String name, String desc, int order) {
0202:                if (!special_allow) {
0203:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0204:                            .canCreateTest())) {
0205:                        org.objectweb.salome_tmf.api.Api
0206:                                .log("addFamily NOT ALLOW");
0207:                        try {
0208:                            throw new Exception("addFamily NOT ALLOW");
0209:                        } catch (Exception e) {
0210:                            e.printStackTrace();
0211:                            org.objectweb.salome_tmf.api.Api.addException(e);
0212:                        }
0213:                        return;
0214:                    }
0215:                }
0216:                int _num = -1;
0217:                try {
0218:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0219:
0220:                    PreparedStatement prep = database.prepareStatement(prop
0221:                            .getProperty("addFamily"));
0222:                    prep.setString(1, name);
0223:                    prep.setInt(2, idProject);
0224:                    prep.setString(3, desc);
0225:                    prep.setInt(4, order);
0226:                    prep.executeUpdate();
0227:                } catch (SQLException E) {
0228:                    E.printStackTrace();
0229:                    org.objectweb.salome_tmf.api.Api.addException("addFamily",
0230:                            null, E);
0231:                } catch (Exception ex) {
0232:                    ex.printStackTrace();
0233:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0234:                            ex);
0235:                }
0236:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0237:            }
0238:
0239:            /**
0240:             * Ajout d'un test a une suite de test
0241:             * @param familyName
0242:             * @param suiteName
0243:             * @param loginPersonne
0244:             * @param testName
0245:             * @param testType
0246:             * @param testDesc
0247:             * @param int order
0248:             * @param extention plugin type if automated
0249:             */
0250:            public void addTest(String familyName, String suiteName,
0251:                    String loginPersonne, String testName, String testType,
0252:                    String testDesc, int order, String extension) {
0253:                if (!special_allow) {
0254:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0255:                            .canCreateTest())) {
0256:                        org.objectweb.salome_tmf.api.Api
0257:                                .log("addTest NOT ALLOW");
0258:                        try {
0259:                            throw new Exception("addTest NOT ALLOW");
0260:                        } catch (Exception e) {
0261:                            e.printStackTrace();
0262:                            org.objectweb.salome_tmf.api.Api.addException(e);
0263:                        }
0264:                        return;
0265:                    }
0266:                }
0267:                int idPers = -1;
0268:                int idSuite = -1;
0269:                int idFamily = -1;
0270:                int _num = -1;
0271:                //	Recherche de la date et l'heure actuelles
0272:                Date dateActuelle = Utile.getCurrentDate();
0273:                Time heureActuelle = Utile.getCurrentTime();
0274:
0275:                try {
0276:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0277:
0278:                    //	Initialisation de l'ID de la personne
0279:                    idPers = Utile.getIdPerson(database, prop, loginPersonne);
0280:
0281:                    // Initialisation de l'ID de la famille de test
0282:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0283:                            familyName);
0284:
0285:                    // Initialisation de l'ID de la suite de test
0286:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
0287:                            suiteName, idFamily);
0288:
0289:                    // Ajout du test a la suite de test
0290:                    PreparedStatement prep = database.prepareStatement(prop
0291:                            .getProperty("addTest"));
0292:
0293:                    prep.setInt(1, idPers);
0294:                    prep.setInt(2, idSuite);
0295:                    prep.setString(3, testName);
0296:                    prep.setDate(4, dateActuelle);
0297:                    prep.setTime(5, heureActuelle);
0298:                    prep.setString(6, testType);
0299:                    prep.setString(7, testDesc);
0300:                    prep.setInt(8, order);
0301:                    prep.setString(9, extension);
0302:
0303:                    prep.executeUpdate();
0304:                } catch (SQLException E) {
0305:                    E.printStackTrace();
0306:                    org.objectweb.salome_tmf.api.Api.addException("addTest",
0307:                            null, E);
0308:                } catch (Exception ex) {
0309:                    ex.printStackTrace();
0310:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0311:                            ex);
0312:                }
0313:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0314:            }
0315:
0316:            /**
0317:             * Ajout d'un test a une suite de test
0318:             * @param suiteId
0319:             * @param loginPersonne
0320:             * @param testName
0321:             * @param testType
0322:             * @param testDesc
0323:             * @param order
0324:             * @param extention plugin type if automated
0325:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateTest()
0326:             */
0327:            public void addTestUsingID(int suiteId, String loginPersonne,
0328:                    String testName, String testType, String testDesc,
0329:                    int order, String extension) {
0330:                if (!special_allow) {
0331:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0332:                            .canCreateTest())) {
0333:                        org.objectweb.salome_tmf.api.Api
0334:                                .log("addTest NOT ALLOW");
0335:                        try {
0336:                            throw new Exception("addTest NOT ALLOW");
0337:                        } catch (Exception e) {
0338:                            e.printStackTrace();
0339:                            org.objectweb.salome_tmf.api.Api.addException(e);
0340:                        }
0341:                        return;
0342:                    }
0343:                }
0344:                int idPers = -1;
0345:                //int idSuite = -1;
0346:                //int idFamily = -1;
0347:                int _num = -1;
0348:                //	Recherche de la date et l'heure actuelles
0349:                Date dateActuelle = Utile.getCurrentDate();
0350:                Time heureActuelle = Utile.getCurrentTime();
0351:
0352:                try {
0353:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0354:
0355:                    //	Initialisation de l'ID de la personne
0356:                    idPers = Utile.getIdPerson(database, prop, loginPersonne);
0357:
0358:                    // Ajout du test a la suite de test
0359:                    PreparedStatement prep = database.prepareStatement(prop
0360:                            .getProperty("addTest"));
0361:
0362:                    prep.setInt(1, idPers);
0363:                    prep.setInt(2, suiteId);
0364:                    prep.setString(3, testName);
0365:                    prep.setDate(4, dateActuelle);
0366:                    prep.setTime(5, heureActuelle);
0367:                    prep.setString(6, testType);
0368:                    prep.setString(7, testDesc);
0369:                    prep.setInt(8, order);
0370:                    prep.setString(9, extension);
0371:
0372:                    prep.executeUpdate();
0373:                } catch (SQLException E) {
0374:                    E.printStackTrace();
0375:                    org.objectweb.salome_tmf.api.Api.addException("addTest",
0376:                            null, E);
0377:                } catch (Exception ex) {
0378:                    ex.printStackTrace();
0379:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0380:                            ex);
0381:                }
0382:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0383:            }
0384:
0385:            /**
0386:             * Ajout d'une action a un test manuel
0387:             * @param familyName
0388:             * @param suiteName
0389:             * @param testName
0390:             * @param actionName
0391:             * @param actionDescription
0392:             * @param actionResAttendu
0393:             * @param actionNum
0394:             */
0395:            public void addAction(String familyName, String suiteName,
0396:                    String testName, String actionName,
0397:                    String actionDescription, String actionResAttendu,
0398:                    int actionNum) {
0399:
0400:                if (!special_allow) {
0401:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0402:                            .canCreateTest())) {
0403:                        org.objectweb.salome_tmf.api.Api
0404:                                .log("addAction NOT ALLOW");
0405:                        try {
0406:                            throw new Exception("addAction NOT ALLOW");
0407:                        } catch (Exception e) {
0408:                            e.printStackTrace();
0409:                            org.objectweb.salome_tmf.api.Api.addException(e);
0410:                        }
0411:                        return;
0412:                    }
0413:                }
0414:                int idFamily = -1;
0415:                int idSuite = -1;
0416:                int idTest = -1;
0417:                int _num = -1;
0418:                try {
0419:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0420:
0421:                    // Initialisation de l'ID de la famille de test
0422:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0423:                            familyName);
0424:
0425:                    // Initialisation de l'ID de la suite de test
0426:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
0427:                            suiteName, idFamily);
0428:
0429:                    //	Initialisation de l'ID du  test manuel
0430:                    idTest = STCommun.getIdTest(database, prop, testName,
0431:                            idSuite);
0432:
0433:                    // Ajout de l'action de test au test manuel
0434:                    PreparedStatement prep = database.prepareStatement(prop
0435:                            .getProperty("addAction"));
0436:
0437:                    prep.setInt(1, idTest);
0438:                    prep.setString(2, actionName);
0439:                    prep.setString(3, actionDescription);
0440:                    prep.setString(4, actionResAttendu);
0441:                    prep.setInt(5, actionNum);
0442:
0443:                    prep.executeUpdate();
0444:                } catch (SQLException E) {
0445:                    E.printStackTrace();
0446:                    org.objectweb.salome_tmf.api.Api.addException("addAction",
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:             * Ajout d'une action a un test manuel
0458:             * @param testId
0459:             * @param actionName
0460:             * @param actionDescription
0461:             * @param actionResAttendu
0462:             * @param actionNum
0463:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateTest()
0464:             */
0465:            public void addActionUsingID(int testId, String actionName,
0466:                    String actionDescription, String actionResAttendu,
0467:                    int actionNum) {
0468:                if (!special_allow) {
0469:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0470:                            .canCreateTest())) {
0471:                        org.objectweb.salome_tmf.api.Api
0472:                                .log("addAction NOT ALLOW");
0473:                        try {
0474:                            throw new Exception("addAction NOT ALLOW");
0475:                        } catch (Exception e) {
0476:                            e.printStackTrace();
0477:                            org.objectweb.salome_tmf.api.Api.addException(e);
0478:                        }
0479:                        return;
0480:                    }
0481:                }
0482:
0483:                int _num = -1;
0484:                try {
0485:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0486:
0487:                    // Ajout de l'action de test au test manuel
0488:                    PreparedStatement prep = database.prepareStatement(prop
0489:                            .getProperty("addAction"));
0490:
0491:                    prep.setInt(1, testId);
0492:                    prep.setString(2, actionName);
0493:                    prep.setString(3, actionDescription);
0494:                    prep.setString(4, actionResAttendu);
0495:                    prep.setInt(5, actionNum);
0496:
0497:                    prep.executeUpdate();
0498:                } catch (SQLException E) {
0499:                    E.printStackTrace();
0500:                    org.objectweb.salome_tmf.api.Api.addException("addAction",
0501:                            null, E);
0502:                } catch (Exception ex) {
0503:                    ex.printStackTrace();
0504:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0505:                            ex);
0506:                }
0507:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0508:            }
0509:
0510:            /**
0511:             * Ajout d'un parametre a un test : signifie que le test UTILISE un parametre deja existant dans le projet
0512:             * @param familyName
0513:             * @param suiteName
0514:             * @param testName
0515:             * @param paramName
0516:             */
0517:            public void addParamToTest(String familyName, String suiteName,
0518:                    String testName, String paramName) {
0519:                if (!special_allow) {
0520:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0521:                            .canCreateTest())
0522:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0523:                                    .canUpdateTest())) {
0524:                        org.objectweb.salome_tmf.api.Api
0525:                                .log("addParamToTest NOT ALLOW");
0526:                        try {
0527:                            throw new Exception("addParamToTest NOT ALLOW");
0528:                        } catch (Exception e) {
0529:                            e.printStackTrace();
0530:                            org.objectweb.salome_tmf.api.Api.addException(e);
0531:                        }
0532:                        return;
0533:                    }
0534:                }
0535:
0536:                int idFamily = -1;
0537:                int idSuite = -1;
0538:                int idTest = -1;
0539:                int idParam = -1;
0540:                int _num = -1;
0541:                try {
0542:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0543:
0544:                    // Initialisation de l'ID de la famille de test
0545:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0546:                            familyName);
0547:                    // Initialisation de l'ID de la suite de test
0548:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
0549:                            suiteName, idFamily);
0550:                    //	Initialisation de l'ID du  test manuel
0551:                    idTest = STCommun.getIdTest(database, prop, testName,
0552:                            idSuite);
0553:                    // Initialisation de l'ID du parametre de test
0554:                    idParam = STCommun.getIdParam(database, prop, paramName,
0555:                            idProject);
0556:
0557:                    // Ajout du parametre de test au test
0558:                    PreparedStatement prep = database.prepareStatement(prop
0559:                            .getProperty("addParamToTest"));
0560:
0561:                    prep.setInt(1, idTest);
0562:                    prep.setInt(2, idParam);
0563:
0564:                    prep.executeUpdate();
0565:                } catch (SQLException E) {
0566:                    E.printStackTrace();
0567:                    org.objectweb.salome_tmf.api.Api.addException(
0568:                            "addParamToTest", null, E);
0569:                } catch (Exception ex) {
0570:                    ex.printStackTrace();
0571:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0572:                            ex);
0573:                }
0574:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0575:            }
0576:
0577:            /**
0578:             * Ajout d'un parametre a un test : signifie que le test UTILISE un parametre deja existant dans le projet
0579:             * @param testId
0580:             * @param paramId
0581:             */
0582:            public void addParamToTestUsingID(int testId, int paramId) {
0583:                if (!special_allow) {
0584:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0585:                            .canCreateTest())
0586:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0587:                                    .canUpdateTest())) {
0588:                        org.objectweb.salome_tmf.api.Api
0589:                                .log("addParamToTest NOT ALLOW");
0590:                        try {
0591:                            throw new Exception("addParamToTest NOT ALLOW");
0592:                        } catch (Exception e) {
0593:                            e.printStackTrace();
0594:                            org.objectweb.salome_tmf.api.Api.addException(e);
0595:                        }
0596:                        return;
0597:                    }
0598:                }
0599:
0600:                int _num = -1;
0601:                try {
0602:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0603:
0604:                    // Ajout du parametre de test au test
0605:                    PreparedStatement prep = database.prepareStatement(prop
0606:                            .getProperty("addParamToTest"));
0607:
0608:                    prep.setInt(1, testId);
0609:                    prep.setInt(2, paramId);
0610:
0611:                    prep.executeUpdate();
0612:                } catch (SQLException E) {
0613:                    E.printStackTrace();
0614:                    org.objectweb.salome_tmf.api.Api.addException(
0615:                            "addParamToTest", null, E);
0616:                } catch (Exception ex) {
0617:                    ex.printStackTrace();
0618:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0619:                            ex);
0620:                }
0621:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0622:            }
0623:
0624:            /**
0625:             * Ajout d'un parametre a une action de test : signifie que l'action de test UTILISE un parametre deja existant dans le projet 
0626:             * @param familyName
0627:             * @param suiteName
0628:             * @param testName
0629:             * @param actionName
0630:             * @param paramName
0631:             */
0632:            public void addParamToAction(String familyName, String suiteName,
0633:                    String testName, String actionName, String paramName) {
0634:                if (!special_allow) {
0635:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0636:                            .canCreateTest())
0637:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0638:                                    .canUpdateTest())) {
0639:                        org.objectweb.salome_tmf.api.Api
0640:                                .log("addParamToAction NOT ALLOW");
0641:                        try {
0642:                            throw new Exception("addParamToAction NOT ALLOW");
0643:                        } catch (Exception e) {
0644:                            e.printStackTrace();
0645:                            org.objectweb.salome_tmf.api.Api.addException(e);
0646:                        }
0647:                        return;
0648:                    }
0649:                }
0650:
0651:                int idFamily = -1;
0652:                int idSuite = -1;
0653:                int idTest = -1;
0654:                int idAction = -1;
0655:                int idParam = -1;
0656:                int _num = -1;
0657:                try {
0658:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0659:                    org.objectweb.salome_tmf.api.Api.log("ADD PARAM TO ACTION");
0660:                    // Initialisation de l'ID de la famille de test
0661:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
0662:                            familyName);
0663:                    // Initialisation de l'ID de la suite de test
0664:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
0665:                            suiteName, idFamily);
0666:                    //	Initialisation de l'ID du  test manuel
0667:                    idTest = STCommun.getIdTest(database, prop, testName,
0668:                            idSuite);
0669:                    // Initialisation de l'ID de l'action de test
0670:                    idAction = STCommun.getIdAction(database, prop, actionName,
0671:                            idTest);
0672:                    // Initialisation de l'ID du parametre de test
0673:                    idParam = STCommun.getIdParam(database, prop, paramName,
0674:                            idProject);
0675:
0676:                    // Ajout du parametre de test au test
0677:                    PreparedStatement prep = database.prepareStatement(prop
0678:                            .getProperty("addParamToAction"));
0679:
0680:                    prep.setInt(1, idAction);
0681:                    prep.setInt(2, idParam);
0682:
0683:                    prep.executeUpdate();
0684:                } catch (SQLException E) {
0685:                    E.printStackTrace();
0686:                    org.objectweb.salome_tmf.api.Api.addException(
0687:                            "addParamToAction", null, E);
0688:                } catch (Exception ex) {
0689:                    ex.printStackTrace();
0690:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0691:                            ex);
0692:                }
0693:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0694:            }
0695:
0696:            /**
0697:             * Ajout d'un parametre a une action de test : signifie que l'action de test UTILISE un parametre deja existant dans le projet 
0698:             * @param actionId
0699:             * @param paramId
0700:             */
0701:            public void addParamToActionUsingID(int actionId, int paramId) {
0702:                if (!special_allow) {
0703:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0704:                            .canCreateTest())
0705:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0706:                                    .canUpdateTest())) {
0707:                        org.objectweb.salome_tmf.api.Api
0708:                                .log("addParamToAction NOT ALLOW");
0709:                        try {
0710:                            throw new Exception("addParamToAction NOT ALLOW");
0711:                        } catch (Exception e) {
0712:                            e.printStackTrace();
0713:                            org.objectweb.salome_tmf.api.Api.addException(e);
0714:                        }
0715:                        return;
0716:                    }
0717:                }
0718:
0719:                int _num = -1;
0720:                try {
0721:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0722:                    org.objectweb.salome_tmf.api.Api.log("ADD PARAM TO ACTION");
0723:
0724:                    // Ajout du parametre de test au test
0725:                    PreparedStatement prep = database.prepareStatement(prop
0726:                            .getProperty("addParamToAction"));
0727:
0728:                    prep.setInt(1, actionId);
0729:                    prep.setInt(2, paramId);
0730:
0731:                    prep.executeUpdate();
0732:                } catch (SQLException E) {
0733:                    E.printStackTrace();
0734:                    org.objectweb.salome_tmf.api.Api.addException(
0735:                            "addParamToAction", null, E);
0736:                } catch (Exception ex) {
0737:                    ex.printStackTrace();
0738:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0739:                            ex);
0740:                }
0741:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0742:            }
0743:
0744:            /**
0745:             * Ajout d'un fichier attachement à une suite de test
0746:             * @param familyName
0747:             * @param suiteName
0748:             * @param filePath
0749:             * @param description
0750:             */
0751:            public void addAttachFileToSuite(String familyName,
0752:                    String suiteName, String filePath, long length, Date date,
0753:                    String description) {
0754:                if (!special_allow) {
0755:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0756:                            .canCreateTest())) {
0757:                        org.objectweb.salome_tmf.api.Api
0758:                                .log("addAttachFileToSuite NOT ALLOW");
0759:                        try {
0760:                            throw new Exception(
0761:                                    "addAttachFileToSuite NOT ALLOW");
0762:                        } catch (Exception e) {
0763:                            e.printStackTrace();
0764:                            org.objectweb.salome_tmf.api.Api.addException(e);
0765:                        }
0766:                        return;
0767:                    }
0768:                }
0769:                int _num = -1;
0770:                try {
0771:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0772:
0773:                    // On ajoute le fichier attachement dans la BdD SalomeTMF
0774:                    STCommun.addFileAttachToDB(database, prop, filePath,
0775:                            length, date, description);
0776:                    // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
0777:                    int fileAttachId = STCommun.getMaxIdAttach(database, prop);
0778:                    // On initialse l'ID de la famille de test
0779:                    int familyId = STCommun.getIdFamily(database, prop,
0780:                            idProject, familyName);
0781:                    // On initialise l'ID de la suite de test
0782:                    int suiteId = STCommun.getIdSuite(database, prop,
0783:                            idProject, suiteName, familyId);
0784:
0785:                    // Appel de la requete a executer
0786:                    PreparedStatement prep = database.prepareStatement(prop
0787:                            .getProperty("addFileAttachToSuite"));
0788:                    prep.setInt(1, suiteId);
0789:                    prep.setInt(2, fileAttachId);
0790:                    prep.executeUpdate();
0791:                } catch (SQLException E) {
0792:                    E.printStackTrace();
0793:                    org.objectweb.salome_tmf.api.Api.addException(
0794:                            "addFileAttachToSuite", null, E);
0795:                } catch (Exception ex) {
0796:                    ex.printStackTrace();
0797:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0798:                            ex);
0799:                }
0800:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0801:            }
0802:
0803:            /**
0804:             * Ajout d'un fichier attachement à une suite de test
0805:             * @param suiteId
0806:             * @param filePath
0807:             * @param description
0808:             */
0809:            public void addAttachFileToSuiteUsingID(int suiteId,
0810:                    String filePath, long length, Date date, String description) {
0811:                if (!special_allow) {
0812:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0813:                            .canCreateTest())) {
0814:                        org.objectweb.salome_tmf.api.Api
0815:                                .log("addAttachFileToSuite NOT ALLOW");
0816:                        try {
0817:                            throw new Exception(
0818:                                    "addAttachFileToSuite NOT ALLOW");
0819:                        } catch (Exception e) {
0820:                            e.printStackTrace();
0821:                            org.objectweb.salome_tmf.api.Api.addException(e);
0822:                        }
0823:                        return;
0824:                    }
0825:                }
0826:                int _num = -1;
0827:                try {
0828:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0829:
0830:                    // On ajoute le fichier attachement dans la BdD SalomeTMF
0831:                    STCommun.addFileAttachToDB(database, prop, filePath,
0832:                            length, date, description);
0833:                    // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
0834:                    int fileAttachId = STCommun.getMaxIdAttach(database, prop);
0835:
0836:                    // Appel de la requete a executer
0837:                    PreparedStatement prep = database.prepareStatement(prop
0838:                            .getProperty("addFileAttachToSuite"));
0839:                    prep.setInt(1, suiteId);
0840:                    prep.setInt(2, fileAttachId);
0841:                    prep.executeUpdate();
0842:                } catch (SQLException E) {
0843:                    E.printStackTrace();
0844:                    org.objectweb.salome_tmf.api.Api.addException(
0845:                            "addFileAttachToSuite", null, E);
0846:                } catch (Exception ex) {
0847:                    ex.printStackTrace();
0848:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0849:                            ex);
0850:                }
0851:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0852:            }
0853:
0854:            /**
0855:             * Ajout d'une URL en attachement à une suite de test
0856:             * @param familyName
0857:             * @param suiteName
0858:             * @param url
0859:             * @param description
0860:             */
0861:            public void addAttachUrlToSuite(String familyName,
0862:                    String suiteName, String url, String description) {
0863:                if (!special_allow) {
0864:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0865:                            .canCreateTest())) {
0866:                        org.objectweb.salome_tmf.api.Api
0867:                                .log("addAttachUrlToSuite NOT ALLOW");
0868:                        try {
0869:                            throw new Exception("addAttachUrlToSuite NOT ALLOW");
0870:                        } catch (Exception e) {
0871:                            e.printStackTrace();
0872:                            org.objectweb.salome_tmf.api.Api.addException(e);
0873:                        }
0874:                        return;
0875:                    }
0876:                }
0877:                int _num = -1;
0878:                try {
0879:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0880:
0881:                    // On ajoute l'URL dans la BdD SalomeTMF
0882:                    STCommun.addUrlAttachToDB(database, prop, url, description);
0883:                    // On initialise l'ID de l'URL (max des ID des attachements de la base)
0884:                    int urlId = STCommun.getMaxIdAttach(database, prop);
0885:                    // On initialise l'ID de la famille de test
0886:                    int familyId = STCommun.getIdFamily(database, prop,
0887:                            idProject, familyName);
0888:                    // On initialise l'ID de la suite de test
0889:                    int suiteId = STCommun.getIdSuite(database, prop,
0890:                            idProject, suiteName, familyId);
0891:
0892:                    // Appel de la requete a executer
0893:                    PreparedStatement prep = database.prepareStatement(prop
0894:                            .getProperty("addUrlAttachToSuite"));
0895:                    prep.setInt(1, suiteId);
0896:                    prep.setInt(2, urlId);
0897:
0898:                    prep.executeUpdate();
0899:                } catch (SQLException E) {
0900:                    E.printStackTrace();
0901:                    org.objectweb.salome_tmf.api.Api.addException(
0902:                            "addUrlAttachToSuite", null, E);
0903:                } catch (Exception ex) {
0904:                    ex.printStackTrace();
0905:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0906:                            ex);
0907:                }
0908:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0909:            }
0910:
0911:            /**
0912:             * Ajout d'une URL en attachement à une suite de test
0913:             * @param suiteId
0914:             * @param url
0915:             * @param description
0916:             */
0917:            public void addAttachUrlToSuiteUsingID(int suiteId, String url,
0918:                    String description) {
0919:                if (!special_allow) {
0920:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0921:                            .canCreateTest())) {
0922:                        org.objectweb.salome_tmf.api.Api
0923:                                .log("addAttachUrlToSuite NOT ALLOW");
0924:                        try {
0925:                            throw new Exception("addAttachUrlToSuite NOT ALLOW");
0926:                        } catch (Exception e) {
0927:                            e.printStackTrace();
0928:                            org.objectweb.salome_tmf.api.Api.addException(e);
0929:                        }
0930:                        return;
0931:                    }
0932:                }
0933:                int _num = -1;
0934:                try {
0935:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0936:
0937:                    // On ajoute l'URL dans la BdD SalomeTMF
0938:                    STCommun.addUrlAttachToDB(database, prop, url, description);
0939:                    // On initialise l'ID de l'URL (max des ID des attachements de la base)
0940:                    int urlId = STCommun.getMaxIdAttach(database, prop);
0941:
0942:                    // Appel de la requete a executer
0943:                    PreparedStatement prep = database.prepareStatement(prop
0944:                            .getProperty("addUrlAttachToSuite"));
0945:                    prep.setInt(1, suiteId);
0946:                    prep.setInt(2, urlId);
0947:
0948:                    prep.executeUpdate();
0949:                } catch (SQLException E) {
0950:                    E.printStackTrace();
0951:                    org.objectweb.salome_tmf.api.Api.addException(
0952:                            "addUrlAttachToSuite", null, E);
0953:                } catch (Exception ex) {
0954:                    ex.printStackTrace();
0955:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0956:                            ex);
0957:                }
0958:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0959:            }
0960:
0961:            /**
0962:             * Ajout d'un fichier attachement à un test
0963:             * @param familyName
0964:             * @param suiteName
0965:             * @param testName
0966:             * @param filePath
0967:             * @param length
0968:             * @param date
0969:             * @param description
0970:             */
0971:            public void addAttachFileToTest(String familyName,
0972:                    String suiteName, String testName, String filePath,
0973:                    long length, Date date, String description) {
0974:                if (!special_allow) {
0975:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0976:                            .canCreateTest())) {
0977:                        org.objectweb.salome_tmf.api.Api
0978:                                .log("addAttachFileToTest NOT ALLOW");
0979:                        try {
0980:                            throw new Exception("addAttachFileToTest NOT ALLOW");
0981:                        } catch (Exception e) {
0982:                            e.printStackTrace();
0983:                            org.objectweb.salome_tmf.api.Api.addException(e);
0984:                        }
0985:                        return;
0986:                    }
0987:                }
0988:                int _num = -1;
0989:                try {
0990:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0991:
0992:                    // On ajoute le fichier attachement dans la BdD SalomeTMF
0993:                    STCommun.addFileAttachToDB(database, prop, filePath,
0994:                            length, date, description);
0995:                    // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
0996:                    int fileAttachId = STCommun.getMaxIdAttach(database, prop);
0997:                    // On initialse l'ID de la famille de test
0998:                    int familyId = STCommun.getIdFamily(database, prop,
0999:                            idProject, familyName);
1000:                    // On initialise l'ID de la suite de test
1001:                    int suiteId = STCommun.getIdSuite(database, prop,
1002:                            idProject, suiteName, familyId);
1003:                    // On initialise l'ID du test
1004:                    int testId = STCommun.getIdTest(database, prop, testName,
1005:                            suiteId);
1006:
1007:                    // Appel de la requete a executer
1008:                    PreparedStatement prep = database.prepareStatement(prop
1009:                            .getProperty("addFileAttachToTest"));
1010:                    prep.setInt(1, testId);
1011:                    prep.setInt(2, fileAttachId);
1012:
1013:                    prep.executeUpdate();
1014:                } catch (SQLException E) {
1015:                    E.printStackTrace();
1016:                    org.objectweb.salome_tmf.api.Api.addException(
1017:                            "addFileAttachToTest", null, E);
1018:                } catch (Exception ex) {
1019:                    ex.printStackTrace();
1020:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1021:                            ex);
1022:                }
1023:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1024:            }
1025:
1026:            /**
1027:             * Ajout d'un fichier attachement à un test
1028:             * @param testId
1029:             * @param filePath
1030:             * @param length
1031:             * @param date
1032:             * @param description
1033:             */
1034:            public void addAttachFileToTestUsingID(int testId, String filePath,
1035:                    long length, Date date, String description) {
1036:                if (!special_allow) {
1037:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1038:                            .canCreateTest())) {
1039:                        org.objectweb.salome_tmf.api.Api
1040:                                .log("addAttachFileToTest NOT ALLOW");
1041:                        try {
1042:                            throw new Exception("addAttachFileToTest NOT ALLOW");
1043:                        } catch (Exception e) {
1044:                            e.printStackTrace();
1045:                            org.objectweb.salome_tmf.api.Api.addException(e);
1046:                        }
1047:                        return;
1048:                    }
1049:                }
1050:                int _num = -1;
1051:                try {
1052:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1053:
1054:                    // On ajoute le fichier attachement dans la BdD SalomeTMF
1055:                    STCommun.addFileAttachToDB(database, prop, filePath,
1056:                            length, date, description);
1057:                    // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1058:                    int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1059:
1060:                    // Appel de la requete a executer
1061:                    PreparedStatement prep = database.prepareStatement(prop
1062:                            .getProperty("addFileAttachToTest"));
1063:                    prep.setInt(1, testId);
1064:                    prep.setInt(2, fileAttachId);
1065:
1066:                    prep.executeUpdate();
1067:                } catch (SQLException E) {
1068:                    E.printStackTrace();
1069:                    org.objectweb.salome_tmf.api.Api.addException(
1070:                            "addFileAttachToTest", null, E);
1071:                } catch (Exception ex) {
1072:                    ex.printStackTrace();
1073:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1074:                            ex);
1075:                }
1076:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1077:            }
1078:
1079:            /**
1080:             * Ajout d'une URL en attachement à un test
1081:             * @param familyName
1082:             * @param suiteName
1083:             * @param testName
1084:             * @param url
1085:             * @param description
1086:             */
1087:            public void addAttachUrlToTest(String familyName, String suiteName,
1088:                    String testName, String url, String description) {
1089:                if (!special_allow) {
1090:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1091:                            .canCreateTest())) {
1092:                        org.objectweb.salome_tmf.api.Api
1093:                                .log("addAttachUrlToTest NOT ALLOW");
1094:                        try {
1095:                            throw new Exception("addAttachUrlToTest NOT ALLOW");
1096:                        } catch (Exception e) {
1097:                            e.printStackTrace();
1098:                            org.objectweb.salome_tmf.api.Api.addException(e);
1099:                        }
1100:                        return;
1101:                    }
1102:                }
1103:                int _num = -1;
1104:                try {
1105:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1106:
1107:                    // On ajoute l'URL dans la BdD SalomeTMF
1108:                    STCommun.addUrlAttachToDB(database, prop, url, description);
1109:                    // On initialise l'ID de l'URL (max des ID des attachements de la base)
1110:                    int urlId = STCommun.getMaxIdAttach(database, prop);
1111:                    // On initialise l'ID de la famille de test
1112:                    int familyId = STCommun.getIdFamily(database, prop,
1113:                            idProject, familyName);
1114:                    // On initialise l'ID de la suite de test
1115:                    int suiteId = STCommun.getIdSuite(database, prop,
1116:                            idProject, suiteName, familyId);
1117:                    // On initialise l'ID du test
1118:                    int testId = STCommun.getIdTest(database, prop, testName,
1119:                            suiteId);
1120:
1121:                    // Appel de la requete a executer
1122:                    PreparedStatement prep = database.prepareStatement(prop
1123:                            .getProperty("addUrlAttachToTest"));
1124:                    prep.setInt(1, testId);
1125:                    prep.setInt(2, urlId);
1126:
1127:                    prep.executeUpdate();
1128:                } catch (SQLException E) {
1129:                    E.printStackTrace();
1130:                    org.objectweb.salome_tmf.api.Api.addException(
1131:                            "addUrlAttachToTest", null, E);
1132:                } catch (Exception ex) {
1133:                    ex.printStackTrace();
1134:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1135:                            ex);
1136:                }
1137:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1138:            }
1139:
1140:            /**
1141:             * Ajout d'une URL en attachement à un test
1142:             * @param testId
1143:             * @param url
1144:             * @param description
1145:             */
1146:            public void addAttachUrlToTestUsingID(int testId, String url,
1147:                    String description) {
1148:                if (!special_allow) {
1149:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1150:                            .canCreateTest())) {
1151:                        org.objectweb.salome_tmf.api.Api
1152:                                .log("addAttachUrlToTest NOT ALLOW");
1153:                        try {
1154:                            throw new Exception("addAttachUrlToTest NOT ALLOW");
1155:                        } catch (Exception e) {
1156:                            e.printStackTrace();
1157:                            org.objectweb.salome_tmf.api.Api.addException(e);
1158:                        }
1159:                        return;
1160:                    }
1161:                }
1162:                int _num = -1;
1163:                try {
1164:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1165:
1166:                    // On ajoute l'URL dans la BdD SalomeTMF
1167:                    STCommun.addUrlAttachToDB(database, prop, url, description);
1168:                    // On initialise l'ID de l'URL (max des ID des attachements de la base)
1169:                    int urlId = STCommun.getMaxIdAttach(database, prop);
1170:
1171:                    // Appel de la requete a executer
1172:                    PreparedStatement prep = database.prepareStatement(prop
1173:                            .getProperty("addUrlAttachToTest"));
1174:                    prep.setInt(1, testId);
1175:                    prep.setInt(2, urlId);
1176:
1177:                    prep.executeUpdate();
1178:                } catch (SQLException E) {
1179:                    E.printStackTrace();
1180:                    org.objectweb.salome_tmf.api.Api.addException(
1181:                            "addUrlAttachToTest", null, E);
1182:                } catch (Exception ex) {
1183:                    ex.printStackTrace();
1184:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1185:                            ex);
1186:                }
1187:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1188:            }
1189:
1190:            /**
1191:             * Ajout d'un fichier attachement à une action
1192:             * @param familyName
1193:             * @param suiteName
1194:             * @param testName
1195:             * @param actionName
1196:             * @param filePath
1197:             * @param length
1198:             * @param date
1199:             * @param description
1200:             */
1201:            public void addAttachFileToAction(String familyName,
1202:                    String suiteName, String testName, String actionName,
1203:                    String filePath, long length, Date date, String description) {
1204:                if (!special_allow) {
1205:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1206:                            .canCreateTest())) {
1207:                        org.objectweb.salome_tmf.api.Api
1208:                                .log("addAttachFileToAction NOT ALLOW");
1209:                        try {
1210:                            throw new Exception(
1211:                                    "addAttachFileToAction NOT ALLOW");
1212:                        } catch (Exception e) {
1213:                            e.printStackTrace();
1214:                            org.objectweb.salome_tmf.api.Api.addException(e);
1215:                        }
1216:                        return;
1217:                    }
1218:                }
1219:                int _num = -1;
1220:                try {
1221:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1222:
1223:                    // On ajoute le fichier attachement dans la BdD SalomeTMF
1224:                    STCommun.addFileAttachToDB(database, prop, filePath,
1225:                            length, date, description);
1226:                    // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1227:                    int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1228:                    // On initialse l'ID de la famille de test
1229:                    int familyId = STCommun.getIdFamily(database, prop,
1230:                            idProject, familyName);
1231:                    // On initialise l'ID de la suite de test
1232:                    int suiteId = STCommun.getIdSuite(database, prop,
1233:                            idProject, suiteName, familyId);
1234:                    // On initialise l'ID du test
1235:                    int testId = STCommun.getIdTest(database, prop, testName,
1236:                            suiteId);
1237:                    // On initialise l'ID de l'action
1238:                    int actionId = STCommun.getIdAction(database, prop,
1239:                            actionName, testId);
1240:
1241:                    // Appel de la requete a executer
1242:                    PreparedStatement prep = database.prepareStatement(prop
1243:                            .getProperty("addFileAttachToAction"));
1244:                    prep.setInt(1, actionId);
1245:                    prep.setInt(2, fileAttachId);
1246:
1247:                    prep.executeUpdate();
1248:                } catch (SQLException E) {
1249:                    E.printStackTrace();
1250:                    org.objectweb.salome_tmf.api.Api.addException(
1251:                            "addFileAttachToAction", null, E);
1252:                } catch (Exception ex) {
1253:                    ex.printStackTrace();
1254:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1255:                            ex);
1256:                }
1257:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1258:            }
1259:
1260:            /**
1261:             * Ajout d'un fichier attachement à une action
1262:             * @param actionId
1263:             * @param filePath
1264:             * @param length
1265:             * @param date
1266:             * @param description
1267:             */
1268:            public void addAttachFileToActionUsingID(int actionId,
1269:                    String filePath, long length, Date date, String description) {
1270:                if (!special_allow) {
1271:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1272:                            .canCreateTest())) {
1273:                        org.objectweb.salome_tmf.api.Api
1274:                                .log("addAttachFileToAction NOT ALLOW");
1275:                        try {
1276:                            throw new Exception(
1277:                                    "addAttachFileToAction NOT ALLOW");
1278:                        } catch (Exception e) {
1279:                            e.printStackTrace();
1280:                            org.objectweb.salome_tmf.api.Api.addException(e);
1281:                        }
1282:                        return;
1283:                    }
1284:                }
1285:                int _num = -1;
1286:                try {
1287:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1288:
1289:                    // On ajoute le fichier attachement dans la BdD SalomeTMF
1290:                    STCommun.addFileAttachToDB(database, prop, filePath,
1291:                            length, date, description);
1292:                    // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1293:                    int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1294:
1295:                    // Appel de la requete a executer
1296:                    PreparedStatement prep = database.prepareStatement(prop
1297:                            .getProperty("addFileAttachToAction"));
1298:                    prep.setInt(1, actionId);
1299:                    prep.setInt(2, fileAttachId);
1300:
1301:                    prep.executeUpdate();
1302:                } catch (SQLException E) {
1303:                    E.printStackTrace();
1304:                    org.objectweb.salome_tmf.api.Api.addException(
1305:                            "addFileAttachToAction", null, E);
1306:                } catch (Exception ex) {
1307:                    ex.printStackTrace();
1308:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1309:                            ex);
1310:                }
1311:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1312:            }
1313:
1314:            /**
1315:             * Ajout d'une URL en attachement à une action
1316:             * @param familyName
1317:             * @param suiteName
1318:             * @param testName
1319:             * @param actionName
1320:             * @param url
1321:             * @param description
1322:             */
1323:            public void addAttachUrlToAction(String familyName,
1324:                    String suiteName, String testName, String actionName,
1325:                    String url, String description) {
1326:                if (!special_allow) {
1327:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1328:                            .canCreateTest())) {
1329:                        org.objectweb.salome_tmf.api.Api
1330:                                .log("addAttachUrlToAction NOT ALLOW");
1331:                        try {
1332:                            throw new Exception(
1333:                                    "addAttachUrlToAction NOT ALLOW");
1334:                        } catch (Exception e) {
1335:                            e.printStackTrace();
1336:                            org.objectweb.salome_tmf.api.Api.addException(e);
1337:                        }
1338:                        return;
1339:                    }
1340:                }
1341:                int _num = -1;
1342:                try {
1343:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1344:
1345:                    // On ajoute l'URL dans la BdD SalomeTMF
1346:                    STCommun.addUrlAttachToDB(database, prop, url, description);
1347:                    // On initialise l'ID de l'URL (max des ID des attachements de la base)
1348:                    int urlId = STCommun.getMaxIdAttach(database, prop);
1349:                    // On initialise l'ID de la famille de test
1350:                    int familyId = STCommun.getIdFamily(database, prop,
1351:                            idProject, familyName);
1352:                    // On initialise l'ID de la suite de test
1353:                    int suiteId = STCommun.getIdSuite(database, prop,
1354:                            idProject, suiteName, familyId);
1355:                    // On initialise l'ID du test
1356:                    int testId = STCommun.getIdTest(database, prop, testName,
1357:                            suiteId);
1358:                    // On initialise l'ID de l'action
1359:                    int actionId = STCommun.getIdAction(database, prop,
1360:                            actionName, testId);
1361:
1362:                    // Appel de la requete a executer
1363:                    PreparedStatement prep = database.prepareStatement(prop
1364:                            .getProperty("addUrlAttachToAction"));
1365:                    prep.setInt(1, actionId);
1366:                    prep.setInt(2, urlId);
1367:
1368:                    prep.executeUpdate();
1369:                } catch (SQLException E) {
1370:                    E.printStackTrace();
1371:                    org.objectweb.salome_tmf.api.Api.addException(
1372:                            "addUrlAttachToAction", null, E);
1373:                } catch (Exception ex) {
1374:                    ex.printStackTrace();
1375:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1376:                            ex);
1377:                }
1378:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1379:            }
1380:
1381:            /**
1382:             * Ajout d'une URL en attachement à une action
1383:             * @param actionId
1384:             * @param url
1385:             * @param description
1386:             */
1387:            public void addAttachUrlToActionUsingID(int actionId, String url,
1388:                    String description) {
1389:                if (!special_allow) {
1390:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1391:                            .canCreateTest())) {
1392:                        org.objectweb.salome_tmf.api.Api
1393:                                .log("addAttachUrlToAction NOT ALLOW");
1394:                        try {
1395:                            throw new Exception(
1396:                                    "addAttachUrlToAction NOT ALLOW");
1397:                        } catch (Exception e) {
1398:                            e.printStackTrace();
1399:                            org.objectweb.salome_tmf.api.Api.addException(e);
1400:                        }
1401:                        return;
1402:                    }
1403:                }
1404:                int _num = -1;
1405:                try {
1406:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1407:
1408:                    // On ajoute l'URL dans la BdD SalomeTMF
1409:                    STCommun.addUrlAttachToDB(database, prop, url, description);
1410:                    // On initialise l'ID de l'URL (max des ID des attachements de la base)
1411:                    int urlId = STCommun.getMaxIdAttach(database, prop);
1412:
1413:                    // Appel de la requete a executer
1414:                    PreparedStatement prep = database.prepareStatement(prop
1415:                            .getProperty("addUrlAttachToAction"));
1416:                    prep.setInt(1, actionId);
1417:                    prep.setInt(2, urlId);
1418:
1419:                    prep.executeUpdate();
1420:                } catch (SQLException E) {
1421:                    E.printStackTrace();
1422:                    org.objectweb.salome_tmf.api.Api.addException(
1423:                            "addUrlAttachToAction", null, E);
1424:                } catch (Exception ex) {
1425:                    ex.printStackTrace();
1426:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1427:                            ex);
1428:                }
1429:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1430:            }
1431:
1432:            /**
1433:             * Ajout d'un script à un test
1434:             * @param familyName
1435:             * @param suiteName
1436:             * @param testName
1437:             * @param scriptPath
1438:             * @param classPath
1439:             * @param classToBeExecuted
1440:             * @param type
1441:             * @param scriptLength
1442:             * @param scriptDate
1443:             */
1444:            public void addScriptToTest(String familyName, String suiteName,
1445:                    String testName, String scriptPath, String classPath,
1446:                    String classToBeExecuted, String type, long scriptLength,
1447:                    Date scriptDate) {
1448:                if (!special_allow) {
1449:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1450:                            .canCreateTest())) {
1451:                        org.objectweb.salome_tmf.api.Api
1452:                                .log("addScriptToTest NOT ALLOW");
1453:                        try {
1454:                            throw new Exception("addScriptToTest NOT ALLOW");
1455:                        } catch (Exception e) {
1456:                            e.printStackTrace();
1457:                            org.objectweb.salome_tmf.api.Api.addException(e);
1458:                        }
1459:                        return;
1460:                    }
1461:                }
1462:                int idFamily = -1;
1463:                int idSuite = -1;
1464:                int idTest = -1;
1465:                //int idParam = -1;
1466:                int _num = -1;
1467:                try {
1468:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1469:
1470:                    // On ajoute le script dans la BdD SalomeTMF
1471:                    STCommun.addScriptToDB(database, prop, scriptPath,
1472:                            classToBeExecuted, classPath, type);
1473:                    // On initialise l'ID du fichier attaché (max des ID des scripts de la base)
1474:                    int scriptId = STCommun.getMaxIdScript(database, prop);
1475:                    // On ajoute le fichier de script dans la BdD SalomeTMF
1476:                    STCommun.addFileAttachToDB(database, prop, scriptPath,
1477:                            scriptLength, scriptDate, "", 1);
1478:                    // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1479:                    int attachId = STCommun.getMaxIdAttach(database, prop);
1480:
1481:                    // Initialisation de l'ID de la famille de test
1482:                    idFamily = STCommun.getIdFamily(database, prop, idProject,
1483:                            familyName);
1484:                    // Initialisation de l'ID de la suite de test
1485:                    idSuite = STCommun.getIdSuite(database, prop, idProject,
1486:                            suiteName, idFamily);
1487:                    //	Initialisation de l'ID du  test manuel
1488:                    idTest = STCommun.getIdTest(database, prop, testName,
1489:                            idSuite);
1490:                    // On ajoute le fichier au script
1491:                    addFileAttachToScript(attachId, scriptId);
1492:                    // On lie le script au test
1493:                    attachScriptToTest(scriptId, idTest);
1494:                } catch (Exception ex) {
1495:                    ex.printStackTrace();
1496:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1497:                            ex);
1498:                }
1499:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1500:            }
1501:
1502:            /**
1503:             * Ajout d'un script à un test
1504:             * @param testId
1505:             * @param scriptPath
1506:             * @param classPath
1507:             * @param classToBeExecuted
1508:             * @param type
1509:             * @param scriptLength
1510:             * @param scriptDate
1511:             */
1512:            public void addScriptToTestUsingID(int testId, String scriptPath,
1513:                    String classPath, String classToBeExecuted, String type,
1514:                    long scriptLength, Date scriptDate) {
1515:                if (!special_allow) {
1516:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1517:                            .canCreateTest())) {
1518:                        org.objectweb.salome_tmf.api.Api
1519:                                .log("addScriptToTest NOT ALLOW");
1520:                        try {
1521:                            throw new Exception("addScriptToTest NOT ALLOW");
1522:                        } catch (Exception e) {
1523:                            e.printStackTrace();
1524:                            org.objectweb.salome_tmf.api.Api.addException(e);
1525:                        }
1526:                        return;
1527:                    }
1528:                }
1529:                int _num = -1;
1530:                try {
1531:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1532:
1533:                    // On ajoute le script dans la BdD SalomeTMF
1534:                    STCommun.addScriptToDB(database, prop, scriptPath,
1535:                            classToBeExecuted, classPath, type);
1536:                    // On initialise l'ID du fichier attaché (max des ID des scripts de la base)
1537:                    int scriptId = STCommun.getMaxIdScript(database, prop);
1538:                    // On ajoute le fichier de script dans la BdD SalomeTMF
1539:                    STCommun.addFileAttachToDB(database, prop, scriptPath,
1540:                            scriptLength, scriptDate, "", 1);
1541:                    // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1542:                    int attachId = STCommun.getMaxIdAttach(database, prop);
1543:
1544:                    // On ajoute le fichier au script
1545:                    addFileAttachToScript(attachId, scriptId);
1546:                    // On lie le script au test
1547:                    attachScriptToTest(scriptId, testId);
1548:                } catch (Exception ex) {
1549:                    ex.printStackTrace();
1550:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1551:                            ex);
1552:                }
1553:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1554:            }
1555:
1556:            /**
1557:             * 
1558:             * @param attachId
1559:             * @param scriptId
1560:             */
1561:            public void addFileAttachToScript(int attachId, int scriptId) {
1562:                if (!special_allow) {
1563:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1564:                            .canCreateTest())) {
1565:                        org.objectweb.salome_tmf.api.Api
1566:                                .log("addFileAttachToScript NOT ALLOW");
1567:                        try {
1568:                            throw new Exception(
1569:                                    "addFileAttachToScript NOT ALLOW");
1570:                        } catch (Exception e) {
1571:                            e.printStackTrace();
1572:                            org.objectweb.salome_tmf.api.Api.addException(e);
1573:                        }
1574:                        return;
1575:                    }
1576:                }
1577:                int _num = -1;
1578:                try {
1579:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1580:
1581:                    // Appel de la requete a executer
1582:                    PreparedStatement prep = database.prepareStatement(prop
1583:                            .getProperty("addFileAttachToScript"));
1584:                    prep.setInt(1, scriptId);
1585:                    prep.setInt(2, attachId);
1586:
1587:                    prep.executeUpdate();
1588:                } catch (SQLException E) {
1589:                    E.printStackTrace();
1590:                    org.objectweb.salome_tmf.api.Api.addException(
1591:                            "addFileAttachToScript", null, E);
1592:                } catch (Exception ex) {
1593:                    ex.printStackTrace();
1594:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1595:                            ex);
1596:                }
1597:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1598:            }
1599:
1600:            /**
1601:             * 
1602:             * @param scriptId
1603:             * @param testId
1604:             */
1605:            public void attachScriptToTest(int scriptId, int testId) {
1606:                if (!special_allow) {
1607:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1608:                            .canCreateTest())) {
1609:                        org.objectweb.salome_tmf.api.Api
1610:                                .log("attachScriptToTest NOT ALLOW");
1611:                        try {
1612:                            throw new Exception("attachScriptToTest NOT ALLOW");
1613:                        } catch (Exception e) {
1614:                            e.printStackTrace();
1615:                            org.objectweb.salome_tmf.api.Api.addException(e);
1616:                        }
1617:                        return;
1618:                    }
1619:                }
1620:                int _num = -1;
1621:                try {
1622:                    // Appel de la requete a executer
1623:                    PreparedStatement prep = database.prepareStatement(prop
1624:                            .getProperty("attachScriptToTest"));
1625:                    prep.setInt(1, scriptId);
1626:                    prep.setInt(2, testId);
1627:
1628:                    prep.executeUpdate();
1629:                } catch (SQLException E) {
1630:                    E.printStackTrace();
1631:                    org.objectweb.salome_tmf.api.Api.addException(
1632:                            "attachScriptToTest", null, E);
1633:                } catch (Exception ex) {
1634:                    ex.printStackTrace();
1635:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1636:                            ex);
1637:                }
1638:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1639:            }
1640:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.