Source Code Cross Referenced for CampTestUpdateImpl.java in  » Test-Coverage » salome-tmf » org » objectweb » salome_tmf » api » api2ihm » campTest » 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.campTest 
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.campTest;
0025:
0026:        import java.io.BufferedInputStream;
0027:        import java.io.File;
0028:        import java.io.FileInputStream;
0029:        import java.io.FileNotFoundException;
0030:        import java.sql.Date;
0031:        import java.sql.PreparedStatement;
0032:        import java.sql.SQLException;
0033:        import java.util.Properties;
0034:
0035:        import org.objectweb.salome_tmf.api.api2db.DataBase;
0036:        import org.objectweb.salome_tmf.api.api2db.DataSet;
0037:        import org.objectweb.salome_tmf.api.api2ihm.Utile;
0038:        import org.objectweb.salome_tmf.api.api2ihm.adminProject.APCommun;
0039:        import org.objectweb.salome_tmf.api.api2ihm.suiteTest.STCommun;
0040:
0041:        /**
0042:         * Fonctions de mise e jour relatives e l'aire fonctionnelle "campagnes de test"
0043:         */
0044:        public class CampTestUpdateImpl implements  CampTestUpdate {
0045:            /**
0046:             * Base de donnees
0047:             */
0048:            DataBase database;
0049:
0050:            /**
0051:             * Fichier "properties" contenant les requetes SQL relatives aux campagnes de test
0052:             */
0053:            Properties prop;
0054:
0055:            /**
0056:             * ID du projet SalomeTMF dans lequel on se situe
0057:             */
0058:            int idProject;
0059:
0060:            /**
0061:             * Nom du projet SalomeTMF dans lequel on se situe
0062:             */
0063:            String nameProject;
0064:
0065:            private boolean special_allow = false;
0066:
0067:            /**
0068:             * Constructeur
0069:             * @param db
0070:             * @param pr
0071:             */
0072:            public CampTestUpdateImpl(DataBase db, Properties pr) {
0073:                database = db;
0074:                prop = pr;
0075:            }
0076:
0077:            /**
0078:             * Fonction qui fixe le projet SalomeTMF dans lequel l'utilisateur travaille
0079:             * @param projectName
0080:             */
0081:            public void setProject(String projectName) {
0082:                nameProject = projectName;
0083:                idProject = Utile.getIdProject(database, prop, projectName);
0084:            }
0085:
0086:            /**
0087:             * Changer le contenu d'un fichier attache e une campagne
0088:             * @param camapignName
0089:             * @param filePath
0090:             */
0091:            public void updateFileForCampaign(String campaignName,
0092:                    String filePath) throws FileNotFoundException {
0093:                if (!special_allow) {
0094:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0095:                            .canUpdateCamp())) {
0096:                        org.objectweb.salome_tmf.api.Api
0097:                                .log("updateFileForCampaign NOT ALLOW");
0098:                        try {
0099:                            throw new Exception(
0100:                                    "updateFileForCampaign NOT ALLOW");
0101:                        } catch (Exception e) {
0102:                            e.printStackTrace();
0103:                            org.objectweb.salome_tmf.api.Api.addException(e);
0104:                        }
0105:                        return;
0106:                    }
0107:                }
0108:                int _num = -1;
0109:                try {
0110:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0111:                    // On cree le fichier e partir de l'URL
0112:                    File file = new File(filePath);
0113:                    // On recupere le nom du fichier
0114:                    String fileName = file.getName();
0115:                    // On enregistre le flux du fichier
0116:                    FileInputStream fis = new FileInputStream(file);
0117:                    BufferedInputStream bis = new BufferedInputStream(fis);
0118:
0119:                    // On initialse l'ID de la campagne
0120:                    int campaignId = CTCommun.getIdCamp(database, prop,
0121:                            idProject, campaignName);
0122:                    // On initialise l'ID de l'attachement
0123:                    int fileAttachId = CTCommun.getCampaignAttachFileId(
0124:                            database, prop, campaignId, fileName);
0125:
0126:                    // Appel de la requete a executer
0127:                    PreparedStatement prep = database.prepareStatement(prop
0128:                            .getProperty("updateFileAttach"));
0129:                    prep.setBinaryStream(1, bis, bis.available());
0130:                    prep.setInt(2, fileAttachId);
0131:
0132:                    prep.executeUpdate();
0133:                    bis.close();
0134:                } catch (SQLException sqle) {
0135:                    sqle.printStackTrace();
0136:                    org.objectweb.salome_tmf.api.Api.addException(
0137:                            "updateFileAttach", null, sqle);
0138:                } catch (Exception e) {
0139:                    org.objectweb.salome_tmf.api.Api
0140:                            .addException(null, null, e);
0141:                    e.printStackTrace();
0142:                    if (e instanceof  FileNotFoundException) {
0143:                        org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0144:                        throw new FileNotFoundException();
0145:                    }
0146:                }
0147:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0148:            }
0149:
0150:            /**
0151:             * Changer le contenu d'un fichier attache e un environnement
0152:             * @param envName
0153:             * @param filePath
0154:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
0155:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteCamp()
0156:             */
0157:            public void updateFileForEnvironment(String envName, String filePath)
0158:                    throws FileNotFoundException {
0159:                if (!special_allow) {
0160:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0161:                            .canUpdateCamp())) {
0162:                        org.objectweb.salome_tmf.api.Api
0163:                                .log("updateFileForEnvironment NOT ALLOW");
0164:                        try {
0165:                            throw new Exception(
0166:                                    "updateFileForEnvironment NOT ALLOW");
0167:                        } catch (Exception e) {
0168:                            e.printStackTrace();
0169:                            org.objectweb.salome_tmf.api.Api.addException(e);
0170:                        }
0171:                        return;
0172:                    }
0173:                }
0174:                int _num = -1;
0175:                try {
0176:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0177:                    // On cree le fichier e partir de l'URL
0178:                    File file = new File(filePath);
0179:                    // On recupere le nom du fichier
0180:                    String fileName = file.getName();
0181:                    // On enregistre le flux du fichier
0182:                    FileInputStream fis = new FileInputStream(file);
0183:                    BufferedInputStream bis = new BufferedInputStream(fis);
0184:
0185:                    // On initialse l'ID de l'environnement
0186:                    int envId = CTCommun.getIdEnv(database, prop, idProject,
0187:                            envName);
0188:                    // On initialise l'ID de l'attachement
0189:                    int fileAttachId = CTCommun.getEnvAttachFileId(database,
0190:                            prop, envId, fileName);
0191:
0192:                    // Appel de la requete a executer
0193:                    PreparedStatement prep = database.prepareStatement(prop
0194:                            .getProperty("updateFileAttach"));
0195:                    prep.setBinaryStream(1, bis, bis.available());
0196:                    prep.setInt(2, fileAttachId);
0197:
0198:                    prep.executeUpdate();
0199:                    bis.close();
0200:                } catch (SQLException sqle) {
0201:                    sqle.printStackTrace();
0202:                    org.objectweb.salome_tmf.api.Api.addException(
0203:                            "updateFileAttach", null, sqle);
0204:                } catch (Exception e) {
0205:                    org.objectweb.salome_tmf.api.Api
0206:                            .addException(null, null, e);
0207:                    e.printStackTrace();
0208:                    if (e instanceof  FileNotFoundException) {
0209:                        org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0210:                        throw new FileNotFoundException();
0211:                    }
0212:                }
0213:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0214:            }
0215:
0216:            /**
0217:             * Changer le contenu d'un fichier attache e une execution
0218:             * @param campaignName
0219:             * @param execName
0220:             * @param filePath
0221:             */
0222:            public void updateFileForExecution(String campaignName,
0223:                    String execName, String filePath)
0224:                    throws FileNotFoundException {
0225:                if (!special_allow) {
0226:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0227:                            .canUpdateCamp())
0228:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0229:                                    .canExecutCamp())) {
0230:                        org.objectweb.salome_tmf.api.Api
0231:                                .log("updateFileForExecution NOT ALLOW");
0232:                        try {
0233:                            throw new Exception(
0234:                                    "updateFileForExecution NOT ALLOW");
0235:                        } catch (Exception e) {
0236:                            e.printStackTrace();
0237:                            org.objectweb.salome_tmf.api.Api.addException(e);
0238:                        }
0239:                        return;
0240:                    }
0241:                }
0242:                int _num = -1;
0243:                try {
0244:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0245:                    // On cree le fichier e partir de l'URL
0246:                    File file = new File(filePath);
0247:                    // On recupere le nom du fichier
0248:                    String fileName = file.getName();
0249:                    // On enregistre le flux du fichier
0250:                    FileInputStream fis = new FileInputStream(file);
0251:                    BufferedInputStream bis = new BufferedInputStream(fis);
0252:
0253:                    // On initialse l'ID de la campagne
0254:                    //int campaignId = CTCommun.getIdCamp(database,prop,idProject,campaignName);
0255:                    //On initialise l'ID de l'execution
0256:                    int execId = CTCommun.getIdExecCamp(database, prop,
0257:                            idProject, campaignName, execName);
0258:                    // On initialise l'ID de l'attachement
0259:                    int fileAttachId = CTCommun.getExecAttachFileId(database,
0260:                            prop, execId, fileName);
0261:
0262:                    // Appel de la requete a executer
0263:                    PreparedStatement prep = database.prepareStatement(prop
0264:                            .getProperty("updateFileAttach"));
0265:                    prep.setBinaryStream(1, bis, bis.available());
0266:                    prep.setInt(2, fileAttachId);
0267:
0268:                    prep.executeUpdate();
0269:                    bis.close();
0270:                } catch (SQLException sqle) {
0271:                    sqle.printStackTrace();
0272:                    org.objectweb.salome_tmf.api.Api.addException(
0273:                            "updateFileAttach", null, sqle);
0274:                } catch (Exception e) {
0275:                    org.objectweb.salome_tmf.api.Api
0276:                            .addException(null, null, e);
0277:                    e.printStackTrace();
0278:                    if (e instanceof  FileNotFoundException) {
0279:                        org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0280:                        throw new FileNotFoundException();
0281:                    }
0282:                }
0283:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0284:            }
0285:
0286:            /**
0287:             * Changer le numero d'ordre d'une campagne
0288:             * @param campaignName
0289:             * @param order
0290:             */
0291:            public void updateCampaignOrder(String campaignName, int order) {
0292:                if (!special_allow) {
0293:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0294:                            .canUpdateCamp())) {
0295:                        org.objectweb.salome_tmf.api.Api
0296:                                .log("updateCampaignOrder NOT ALLOW");
0297:                        try {
0298:                            throw new Exception("updateCampaignOrder NOT ALLOW");
0299:                        } catch (Exception e) {
0300:                            e.printStackTrace();
0301:                            org.objectweb.salome_tmf.api.Api.addException(e);
0302:                        }
0303:                        return;
0304:                    }
0305:                }
0306:                int _num = -1;
0307:                try {
0308:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0309:                    //	Initialisation de l'ID de la campagne
0310:                    int idCampaign = CTCommun.getIdCamp(database, prop,
0311:                            idProject, campaignName);
0312:
0313:                    // Mise a jour de l'ordre de la campagne
0314:                    PreparedStatement prep = database.prepareStatement(prop
0315:                            .getProperty("updateCampaignOrder"));
0316:                    prep.setInt(1, order);
0317:                    prep.setInt(2, idCampaign);
0318:                    prep.executeUpdate();
0319:                } catch (SQLException E) {
0320:                    E.printStackTrace();
0321:                    org.objectweb.salome_tmf.api.Api.addException(
0322:                            "updateCampaignOrder", null, E);
0323:                } catch (Exception ex) {
0324:                    ex.printStackTrace();
0325:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0326:                            ex);
0327:                }
0328:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0329:            }
0330:
0331:            /**
0332:             * Changer le numero d'ordre d'une campagne
0333:             * @param campaignId
0334:             * @param order
0335:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteCamp()
0336:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
0337:             */
0338:            public void updateCampaignOrderUsingID(int campId, int order) {
0339:                if (!special_allow) {
0340:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0341:                            .canUpdateCamp())) {
0342:                        org.objectweb.salome_tmf.api.Api
0343:                                .log("updateCampaignOrder NOT ALLOW");
0344:                        try {
0345:                            throw new Exception("updateCampaignOrder NOT ALLOW");
0346:                        } catch (Exception e) {
0347:                            e.printStackTrace();
0348:                            org.objectweb.salome_tmf.api.Api.addException(e);
0349:                        }
0350:                        return;
0351:                    }
0352:                }
0353:                int _num = -1;
0354:                try {
0355:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0356:                    // Mise a jour de l'ordre de la campagne
0357:                    PreparedStatement prep = database.prepareStatement(prop
0358:                            .getProperty("updateCampaignOrder"));
0359:                    prep.setInt(1, order);
0360:                    prep.setInt(2, campId);
0361:                    prep.executeUpdate();
0362:                } catch (SQLException E) {
0363:                    E.printStackTrace();
0364:                    org.objectweb.salome_tmf.api.Api.addException(
0365:                            "updateCampaignOrder", null, E);
0366:                } catch (Exception ex) {
0367:                    ex.printStackTrace();
0368:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0369:                            ex);
0370:                }
0371:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0372:            }
0373:
0374:            /**
0375:             * Changer le numero d'ordre d'un test dans une campagne
0376:             * @param familyName
0377:             * @param suiteName
0378:             * @param testName
0379:             * @param campaignName
0380:             * @param order
0381:             */
0382:            public void updateTestCampaignOrder(String familyName,
0383:                    String suiteName, String testName, String campaignName,
0384:                    int order) {
0385:                if (!special_allow) {
0386:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0387:                            .canUpdateCamp())) {
0388:                        org.objectweb.salome_tmf.api.Api
0389:                                .log("updateTestCampaignOrder NOT ALLOW");
0390:                        try {
0391:                            throw new Exception(
0392:                                    " updateTestCampaignOrder NOT ALLOW");
0393:                        } catch (Exception e) {
0394:                            e.printStackTrace();
0395:                            org.objectweb.salome_tmf.api.Api.addException(e);
0396:                        }
0397:                        return;
0398:                    }
0399:                }
0400:                int _num = -1;
0401:                try {
0402:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0403:                    //	Initialisation de l'ID de la campagne
0404:                    int idCampaign = CTCommun.getIdCamp(database, prop,
0405:                            idProject, campaignName);
0406:                    //Initialisation de l'ID de la famille
0407:                    int idFamily = STCommun.getIdFamily(database, prop,
0408:                            idProject, familyName);
0409:                    // Initialisation de l'ID de la suite de test
0410:                    int idSuite = STCommun.getIdSuite(database, prop,
0411:                            idProject, suiteName, idFamily);
0412:                    // Initialisation de l'ID du test
0413:                    int idTest = STCommun.getIdTest(database, prop, testName,
0414:                            idSuite);
0415:
0416:                    // Mise a jour de l'ordre du test dans la suite de test
0417:                    PreparedStatement prep = database.prepareStatement(prop
0418:                            .getProperty("updateTestCampaignOrder"));
0419:                    prep.setInt(1, order);
0420:                    prep.setInt(2, idCampaign);
0421:                    prep.setInt(3, idTest);
0422:                    prep.executeUpdate();
0423:                } catch (SQLException E) {
0424:                    E.printStackTrace();
0425:                    org.objectweb.salome_tmf.api.Api.addException(
0426:                            "updateTestCampaignOrder", null, E);
0427:                } catch (Exception ex) {
0428:                    ex.printStackTrace();
0429:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0430:                            ex);
0431:                }
0432:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0433:
0434:            }
0435:
0436:            /**
0437:             * Changer le numero d'ordre d'un test dans une campagne
0438:             * @param testId
0439:             * @param campaignId
0440:             * @param order
0441:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteCamp()
0442:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
0443:             */
0444:            public void updateTestCampaignOrderUsingID(int testId, int campId,
0445:                    int order) {
0446:                if (!special_allow) {
0447:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0448:                            .canUpdateCamp())) {
0449:                        org.objectweb.salome_tmf.api.Api
0450:                                .log("updateTestCampaignOrder NOT ALLOW");
0451:                        try {
0452:                            throw new Exception(
0453:                                    " updateTestCampaignOrder NOT ALLOW");
0454:                        } catch (Exception e) {
0455:                            e.printStackTrace();
0456:                            org.objectweb.salome_tmf.api.Api.addException(e);
0457:                        }
0458:                        return;
0459:                    }
0460:                }
0461:                int _num = -1;
0462:                try {
0463:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0464:
0465:                    // Mise a jour de l'ordre du test dans la suite de test
0466:                    PreparedStatement prep = database.prepareStatement(prop
0467:                            .getProperty("updateTestCampaignOrder"));
0468:                    prep.setInt(1, order);
0469:                    prep.setInt(2, campId);
0470:                    prep.setInt(3, testId);
0471:                    prep.executeUpdate();
0472:                } catch (SQLException E) {
0473:                    E.printStackTrace();
0474:                    org.objectweb.salome_tmf.api.Api.addException(
0475:                            "updateTestCampaignOrder", null, E);
0476:                } catch (Exception ex) {
0477:                    ex.printStackTrace();
0478:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0479:                            ex);
0480:                }
0481:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0482:            }
0483:
0484:            /**
0485:             * Changer les caracteristiques d'une campagne
0486:             * @param oldName
0487:             * @param newName
0488:             * @param newDescription
0489:             */
0490:            public void updateCampaign(String oldName, String newName,
0491:                    String newDescription) {
0492:                if (!special_allow) {
0493:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0494:                            .canUpdateCamp())) {
0495:                        org.objectweb.salome_tmf.api.Api
0496:                                .log("updateCampaign NOT ALLOW");
0497:                        try {
0498:                            throw new Exception("updateCampaign NOT ALLOW");
0499:                        } catch (Exception e) {
0500:                            e.printStackTrace();
0501:                            org.objectweb.salome_tmf.api.Api.addException(e);
0502:                        }
0503:                        return;
0504:                    }
0505:                }
0506:                int _num = -1;
0507:                try {
0508:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0509:                    // Initialisation de l'ID de la campagne
0510:                    int idCampaign = CTCommun.getIdCamp(database, prop,
0511:                            idProject, oldName);
0512:
0513:                    // Mise a jour de la suite de test
0514:                    PreparedStatement prep = database.prepareStatement(prop
0515:                            .getProperty("updateCampaign"));
0516:                    prep.setString(1, newName);
0517:                    prep.setString(2, newDescription);
0518:                    prep.setInt(3, idCampaign);
0519:                    prep.executeUpdate();
0520:
0521:                } catch (SQLException E) {
0522:                    E.printStackTrace();
0523:                    org.objectweb.salome_tmf.api.Api.addException(
0524:                            "updateCampaign", null, E);
0525:                } catch (Exception ex) {
0526:                    ex.printStackTrace();
0527:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0528:                            ex);
0529:                }
0530:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0531:
0532:            }
0533:
0534:            /**
0535:             * Changer les caracteristiques d'une campagne
0536:             * @param campId
0537:             * @param newName
0538:             * @param newDescription
0539:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteCamp()
0540:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
0541:             */
0542:            public void updateCampaignUsingID(int campId, String newName,
0543:                    String newDescription) {
0544:                if (!special_allow) {
0545:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0546:                            .canUpdateCamp())) {
0547:                        org.objectweb.salome_tmf.api.Api
0548:                                .log("updateCampaign NOT ALLOW");
0549:                        try {
0550:                            throw new Exception("updateCampaign NOT ALLOW");
0551:                        } catch (Exception e) {
0552:                            e.printStackTrace();
0553:                            org.objectweb.salome_tmf.api.Api.addException(e);
0554:                        }
0555:                        return;
0556:                    }
0557:                }
0558:                int _num = -1;
0559:                try {
0560:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0561:                    // Mise a jour de la suite de test
0562:                    PreparedStatement prep = database.prepareStatement(prop
0563:                            .getProperty("updateCampaign"));
0564:                    prep.setString(1, newName);
0565:                    prep.setString(2, newDescription);
0566:                    prep.setInt(3, campId);
0567:                    prep.executeUpdate();
0568:
0569:                } catch (SQLException E) {
0570:                    E.printStackTrace();
0571:                    org.objectweb.salome_tmf.api.Api.addException(
0572:                            "updateCampaign", null, E);
0573:                } catch (Exception ex) {
0574:                    ex.printStackTrace();
0575:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0576:                            ex);
0577:                }
0578:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0579:            }
0580:
0581:            /**
0582:             * Changer la date de dernier lancement d'une execution
0583:             * @param campaignName nom de campagne
0584:             * @param execName nom d'excution
0585:             * @param newDate nouvelle date
0586:             */
0587:            public void updateExcutionLastDate(String campaignName,
0588:                    String execName, Date newDate) {
0589:                if (!special_allow) {
0590:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0591:                            .canExecutCamp())) {
0592:                        org.objectweb.salome_tmf.api.Api
0593:                                .log("updateExcutionLastDate NOT ALLOW");
0594:                        try {
0595:                            throw new Exception(
0596:                                    "updateExcutionLastDate NOT ALLOW");
0597:                        } catch (Exception e) {
0598:                            e.printStackTrace();
0599:                            org.objectweb.salome_tmf.api.Api.addException(e);
0600:                        }
0601:                        return;
0602:                    }
0603:                }
0604:                int _num = -1;
0605:                try {
0606:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0607:                    //Initialisation de l'ID de l'execution
0608:                    int idExec = CTCommun.getIdExecCamp(database, prop,
0609:                            idProject, campaignName, execName);
0610:
0611:                    // Mise a jour de l'ordre du test dans la suite de test
0612:                    PreparedStatement prep = database.prepareStatement(prop
0613:                            .getProperty("updateExecutionLastDate"));
0614:                    prep.setDate(1, newDate);
0615:                    prep.setInt(2, idExec);
0616:                    prep.executeUpdate();
0617:                } catch (SQLException E) {
0618:                    E.printStackTrace();
0619:                    org.objectweb.salome_tmf.api.Api.addException(
0620:                            "updateExecutionLastDate", null, E);
0621:                } catch (Exception ex) {
0622:                    ex.printStackTrace();
0623:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0624:                            ex);
0625:                }
0626:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0627:            }
0628:
0629:            /**
0630:             * Changer la date de dernier lancement d'une execution
0631:             * @param execId ID de l'excution
0632:             * @param newDate nouvelle date
0633:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
0634:             */
0635:            public void updateExcutionLastDateUsingID(int execId, Date newDate) {
0636:                if (!special_allow) {
0637:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0638:                            .canExecutCamp())) {
0639:                        org.objectweb.salome_tmf.api.Api
0640:                                .log("updateExcutionLastDate NOT ALLOW");
0641:                        try {
0642:                            throw new Exception(
0643:                                    "updateExcutionLastDate NOT ALLOW");
0644:                        } catch (Exception e) {
0645:                            e.printStackTrace();
0646:                            org.objectweb.salome_tmf.api.Api.addException(e);
0647:                        }
0648:                        return;
0649:                    }
0650:                }
0651:                int _num = -1;
0652:                try {
0653:                    // Mise a jour de l'ordre du test dans la suite de test
0654:                    PreparedStatement prep = database.prepareStatement(prop
0655:                            .getProperty("updateExecutionLastDate"));
0656:                    prep.setDate(1, newDate);
0657:                    prep.setInt(2, execId);
0658:                    prep.executeUpdate();
0659:                } catch (SQLException E) {
0660:                    E.printStackTrace();
0661:                    org.objectweb.salome_tmf.api.Api.addException(
0662:                            "updateExecutionLastDate", null, E);
0663:                } catch (Exception ex) {
0664:                    ex.printStackTrace();
0665:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0666:                            ex);
0667:                }
0668:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0669:            }
0670:
0671:            /**
0672:             * Change le resultat effectif d'une action pour une execution
0673:             * d'un test
0674:             * @param campName
0675:             * @param execCampName
0676:             * @param resExecCampName
0677:             * @param familyName
0678:             * @param suiteName
0679:             * @param testName
0680:             * @param actionName
0681:             * @param effectivResult
0682:             * @return
0683:             */
0684:            public void updateActionEffetivResult(String campName,
0685:                    String execCampName, String resExecCampName,
0686:                    String familyName, String suiteName, String testName,
0687:                    String actionName, String effectivResult) {
0688:
0689:                //String description_action, String res_attendu_action) {
0690:                if (!special_allow) {
0691:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0692:                            .canExecutCamp())) {
0693:                        org.objectweb.salome_tmf.api.Api
0694:                                .log("updateActionEffetivResult NOT ALLOW");
0695:                        try {
0696:                            throw new Exception(
0697:                                    "updateActionEffetivResult NOT ALLOW");
0698:                        } catch (Exception e) {
0699:                            e.printStackTrace();
0700:                            org.objectweb.salome_tmf.api.Api.addException(e);
0701:                        }
0702:                        return;
0703:                    }
0704:                }
0705:                int resExecTestId = -1;
0706:                int familyId = -1;
0707:                int suiteId = -1;
0708:                int testId = -1;
0709:                int actionId = -1;
0710:
0711:                int _num = -1;
0712:                try {
0713:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0714:                    // On initialise l'ID de l'action de test
0715:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0716:                            familyName);
0717:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0718:                            suiteName, familyId);
0719:                    testId = STCommun.getIdTest(database, prop, testName,
0720:                            suiteId);
0721:                    actionId = STCommun.getIdAction(database, prop, actionName,
0722:                            testId);
0723:                    // On initialise l'ID du resultat de l'execution du test
0724:                    resExecTestId = CTCommun.getIdResExecCas(database, prop,
0725:                            idProject, campName, execCampName, resExecCampName,
0726:                            testId);
0727:
0728:                    //	On execute la requete
0729:                    PreparedStatement prep = database.prepareStatement(prop
0730:                            .getProperty("updateActionEffectivResult"));
0731:                    prep.setString(1, effectivResult);
0732:                    prep.setInt(2, resExecTestId);
0733:                    prep.setInt(3, actionId);
0734:                    //prep.setString(4, description_action);
0735:                    //prep.setString(5, res_attendu_action);
0736:                    prep.executeUpdate();
0737:                } catch (SQLException e) {
0738:                    e.printStackTrace();
0739:                    org.objectweb.salome_tmf.api.Api.addException(
0740:                            "updateActionEffectivResult", null, e);
0741:                } catch (Exception ex) {
0742:                    ex.printStackTrace();
0743:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0744:                            ex);
0745:                }
0746:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0747:            }
0748:
0749:            /**
0750:             * Change le resultat effectif d'une action pour une execution d'un test
0751:             * @param resExecCampId
0752:             * @param testId
0753:             * @param actionId
0754:             * @param effectivResult
0755:             * @return
0756:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
0757:             */
0758:            public void updateActionEffetivResultUsingID(int resExecCampId,
0759:                    int testId, int actionId, String effectivResult) {
0760:                if (!special_allow) {
0761:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0762:                            .canExecutCamp())) {
0763:                        org.objectweb.salome_tmf.api.Api
0764:                                .log("updateActionEffetivResult NOT ALLOW");
0765:                        try {
0766:                            throw new Exception(
0767:                                    "updateActionEffetivResult NOT ALLOW");
0768:                        } catch (Exception e) {
0769:                            e.printStackTrace();
0770:                            org.objectweb.salome_tmf.api.Api.addException(e);
0771:                        }
0772:                        return;
0773:                    }
0774:                }
0775:                int resExecTestId = -1;
0776:
0777:                int _num = -1;
0778:                try {
0779:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0780:
0781:                    // On initialise l'ID du resultat de l'execution du test
0782:                    resExecTestId = CTCommun.getIdResExecCasUsingID(database,
0783:                            prop, resExecCampId, testId);
0784:
0785:                    //	On execute la requete
0786:                    PreparedStatement prep = database.prepareStatement(prop
0787:                            .getProperty("updateActionEffectivResult"));
0788:                    prep.setString(1, effectivResult);
0789:                    prep.setInt(2, resExecTestId);
0790:                    prep.setInt(3, actionId);
0791:
0792:                    prep.executeUpdate();
0793:                } catch (SQLException e) {
0794:                    e.printStackTrace();
0795:                    org.objectweb.salome_tmf.api.Api.addException(
0796:                            "updateActionEffectivResult", null, e);
0797:                } catch (Exception ex) {
0798:                    ex.printStackTrace();
0799:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
0800:                            ex);
0801:                }
0802:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0803:            }
0804:
0805:            /**
0806:             * Changer le contenu d'un fichier attache e un resultat d'execution
0807:             * @param campaignName
0808:             * @param execName
0809:             * @param executionResultName
0810:             * @param filePath
0811:             */
0812:            public void updateFileForExecutionResult(String campaignName,
0813:                    String execName, String executionResultName, String filePath)
0814:                    throws FileNotFoundException {
0815:                if (!special_allow) {
0816:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0817:                            .canExecutCamp())) {
0818:                        org.objectweb.salome_tmf.api.Api
0819:                                .log("updateFileForExecutionResult NOT ALLOW");
0820:                        try {
0821:                            throw new Exception(
0822:                                    "updateFileForExecutionResult NOT ALLOW");
0823:                        } catch (Exception e) {
0824:                            e.printStackTrace();
0825:                            org.objectweb.salome_tmf.api.Api.addException(e);
0826:                        }
0827:                        return;
0828:                    }
0829:                }
0830:                int _num = -1;
0831:                try {
0832:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0833:                    // On cree le fichier e partir de l'URL
0834:                    File file = new File(filePath);
0835:                    // On recupere le nom du fichier
0836:                    String fileName = file.getName();
0837:                    // On enregistre le flux du fichier
0838:                    FileInputStream fis = new FileInputStream(file);
0839:                    BufferedInputStream bis = new BufferedInputStream(fis);
0840:
0841:                    //On initialise l'ID du resultat d'execution
0842:                    int execResultId = CTCommun.getIdResExecCamp(database,
0843:                            prop, idProject, campaignName, execName,
0844:                            executionResultName);
0845:                    // On initialise l'ID de l'attachement
0846:                    int fileAttachId = CTCommun.getExecResultAttachFileId(
0847:                            database, prop, execResultId, fileName);
0848:
0849:                    // Appel de la requete a executer
0850:                    PreparedStatement prep = database.prepareStatement(prop
0851:                            .getProperty("updateFileAttach"));
0852:                    prep.setBinaryStream(1, bis, bis.available());
0853:                    prep.setInt(2, fileAttachId);
0854:
0855:                    prep.executeUpdate();
0856:                    bis.close();
0857:                } catch (SQLException sqle) {
0858:                    sqle.printStackTrace();
0859:                    org.objectweb.salome_tmf.api.Api.addException("addSuite",
0860:                            null, sqle);
0861:                } catch (Exception e) {
0862:                    org.objectweb.salome_tmf.api.Api
0863:                            .addException(null, null, e);
0864:                    e.printStackTrace();
0865:                    if (e instanceof  FileNotFoundException) {
0866:                        org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0867:                        throw new FileNotFoundException();
0868:                    }
0869:                }
0870:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0871:            }
0872:
0873:            /**
0874:             * Changer le contenu d'un fichier attache e un resultat d'execution de test
0875:             * @param familyName
0876:             * @param suiteName
0877:             * @param testName
0878:             * @param campaignName
0879:             * @param execName
0880:             * @param executionResultName
0881:             * @param filePath
0882:             * @throws FileNotFoundException
0883:             */
0884:            public void updateFileForExecutionTestResult(String familyName,
0885:                    String suiteName, String testName, String campaignName,
0886:                    String execName, String executionResultName, String filePath)
0887:                    throws FileNotFoundException {
0888:                if (!special_allow) {
0889:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0890:                            .canExecutCamp())) {
0891:                        org.objectweb.salome_tmf.api.Api
0892:                                .log("updateFileForExecutionTestResult NOT ALLOW");
0893:                        try {
0894:                            throw new Exception(
0895:                                    "updateFileForExecutionTestResult NOT ALLOW");
0896:                        } catch (Exception e) {
0897:                            e.printStackTrace();
0898:                            org.objectweb.salome_tmf.api.Api.addException(e);
0899:                        }
0900:                        return;
0901:                    }
0902:                }
0903:                int _num = -1;
0904:                try {
0905:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0906:                    // On cree le fichier e partir de l'URL
0907:                    File file = new File(filePath);
0908:                    // On recupere le nom du fichier
0909:                    String fileName = file.getName();
0910:                    // On enregistre le flux du fichier
0911:                    FileInputStream fis = new FileInputStream(file);
0912:                    BufferedInputStream bis = new BufferedInputStream(fis);
0913:
0914:                    //On initialise l'ID du resultat d'execution
0915:                    //int execResultId = CTCommun.getIdResExecCamp(database, prop, idProject, campaignName, execName, executionResultName);
0916:                    // Initialisation de l'ID du test
0917:                    int familyId = STCommun.getIdFamily(database, prop,
0918:                            idProject, familyName);
0919:                    int suiteId = STCommun.getIdSuite(database, prop,
0920:                            idProject, suiteName, familyId);
0921:                    int testId = STCommun.getIdTest(database, prop, testName,
0922:                            suiteId);
0923:                    // Initialisation de l'ID du resultat de test
0924:                    int execTestResultId = CTCommun.getIdResExecCas(database,
0925:                            prop, idProject, campaignName, execName,
0926:                            executionResultName, testId);
0927:
0928:                    // On initialise l'ID de l'attachement
0929:                    int fileAttachId = CTCommun.getExecTestResultAttachFileId(
0930:                            database, prop, execTestResultId, fileName);
0931:
0932:                    // Appel de la requete a executer
0933:                    PreparedStatement prep = database.prepareStatement(prop
0934:                            .getProperty("updateFileAttach"));
0935:                    prep.setBinaryStream(1, bis, bis.available());
0936:                    prep.setInt(2, fileAttachId);
0937:
0938:                    prep.executeUpdate();
0939:                    bis.close();
0940:                } catch (SQLException sqle) {
0941:                    sqle.printStackTrace();
0942:                    org.objectweb.salome_tmf.api.Api.addException(
0943:                            "updateFileAttach", null, sqle);
0944:                } catch (Exception e) {
0945:                    org.objectweb.salome_tmf.api.Api
0946:                            .addException(null, null, e);
0947:                    e.printStackTrace();
0948:                    if (e instanceof  FileNotFoundException) {
0949:                        org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0950:                        throw new FileNotFoundException();
0951:                    }
0952:                }
0953:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0954:
0955:            }
0956:
0957:            /**
0958:             * Changer le resultat d'un test dans un resultat d'execution
0959:             * @param familyName
0960:             * @param suiteName
0961:             * @param testName
0962:             * @param campaignName
0963:             * @param execName
0964:             * @param executionResultName
0965:             * @param newStatus
0966:             */
0967:            public void updateTestStatusForExecResult(String familyName,
0968:                    String suiteName, String testName, String campaignName,
0969:                    String execName, String executionResultName,
0970:                    String newStatus) {
0971:                if (!special_allow) {
0972:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0973:                            .canExecutCamp())) {
0974:                        org.objectweb.salome_tmf.api.Api
0975:                                .log("updateTestStatusForExecResult NOT ALLOW");
0976:                        try {
0977:                            throw new Exception(
0978:                                    "updateTestStatusForExecResult NOT ALLOW");
0979:                        } catch (Exception e) {
0980:                            e.printStackTrace();
0981:                            org.objectweb.salome_tmf.api.Api.addException(e);
0982:                        }
0983:                        return;
0984:                    }
0985:                }
0986:                int resExecTestId = -1;
0987:                int familyId = -1;
0988:                int suiteId = -1;
0989:                int testId = -1;
0990:                //int actionId = -1;
0991:
0992:                int _num = -1;
0993:                try {
0994:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0995:                    // On initialise l'ID de l'action de test
0996:                    familyId = STCommun.getIdFamily(database, prop, idProject,
0997:                            familyName);
0998:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
0999:                            suiteName, familyId);
1000:                    testId = STCommun.getIdTest(database, prop, testName,
1001:                            suiteId);
1002:
1003:                    // On initialise l'ID du resultat de l'execution du test
1004:                    resExecTestId = CTCommun.getIdResExecCas(database, prop,
1005:                            idProject, campaignName, execName,
1006:                            executionResultName, testId);
1007:
1008:                    //	On execute la requete
1009:                    PreparedStatement prep = database.prepareStatement(prop
1010:                            .getProperty("updateTestStatusForExecResult"));
1011:                    prep.setString(1, newStatus);
1012:                    prep.setInt(2, resExecTestId);
1013:                    prep.setInt(3, testId);
1014:                    prep.executeUpdate();
1015:                } catch (SQLException e) {
1016:                    e.printStackTrace();
1017:                    org.objectweb.salome_tmf.api.Api.addException(
1018:                            "updateTestStatusForExecResult", null, e);
1019:                } catch (Exception ex) {
1020:                    ex.printStackTrace();
1021:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1022:                            ex);
1023:                }
1024:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1025:
1026:            }
1027:
1028:            public void updateTestStatusForExecResultUsingID(int execResCampId,
1029:                    int testId, String newStatus) {
1030:                if (!special_allow) {
1031:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1032:                            .canExecutCamp())) {
1033:                        org.objectweb.salome_tmf.api.Api
1034:                                .log("updateTestStatusForExecResult NOT ALLOW");
1035:                        try {
1036:                            throw new Exception(
1037:                                    "updateTestStatusForExecResult NOT ALLOW");
1038:                        } catch (Exception e) {
1039:                            e.printStackTrace();
1040:                            org.objectweb.salome_tmf.api.Api.addException(e);
1041:                        }
1042:                        return;
1043:                    }
1044:                }
1045:                //int resExecTestId = -1;
1046:
1047:                int _num = -1;
1048:                try {
1049:                    System.out
1050:                            .println("updateTestStatusForExecResultUsingID status is "
1051:                                    + newStatus
1052:                                    + ",id = "
1053:                                    + execResCampId
1054:                                    + " : " + testId);
1055:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1056:                    //	On execute la requete
1057:                    PreparedStatement prep = database.prepareStatement(prop
1058:                            .getProperty("updateTestStatusForExecResult2"));
1059:                    prep.setString(1, newStatus);
1060:                    prep.setInt(2, execResCampId);
1061:                    prep.setInt(3, testId);
1062:                    prep.executeUpdate();
1063:                } catch (SQLException e) {
1064:                    e.printStackTrace();
1065:                    org.objectweb.salome_tmf.api.Api.addException(
1066:                            "updateTestStatusForExecResult", null, e);
1067:                } catch (Exception ex) {
1068:                    ex.printStackTrace();
1069:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1070:                            ex);
1071:                }
1072:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1073:
1074:            }
1075:
1076:            /**
1077:             * Changer le resultat d'une action dans un resultat d'execution
1078:             * @param familyName
1079:             * @param suiteName
1080:             * @param testName
1081:             * @param actionName
1082:             * @param campaignName
1083:             * @param execName
1084:             * @param executionResultName
1085:             * @param newStatus
1086:             */
1087:            public void updateActionStatusForExecResult(String familyName,
1088:                    String suiteName, String testName, String actionName,
1089:                    String campaignName, String execName,
1090:                    String executionResultName, String newStatus) {
1091:                if (!special_allow) {
1092:                    if (org.objectweb.salome_tmf.api.api2ihm.AdminProject
1093:                            .canExecutCamp()) {
1094:                        org.objectweb.salome_tmf.api.Api
1095:                                .log("updateActionStatusForExecResult NOT ALLOW");
1096:                        try {
1097:                            throw new Exception(
1098:                                    "updateActionStatusForExecResult NOT ALLOW");
1099:                        } catch (Exception e) {
1100:                            e.printStackTrace();
1101:                            org.objectweb.salome_tmf.api.Api.addException(e);
1102:                        }
1103:                        return;
1104:                    }
1105:                }
1106:                int resExecTestId = -1;
1107:                int familyId = -1;
1108:                int suiteId = -1;
1109:                int testId = -1;
1110:                int actionId = -1;
1111:
1112:                int _num = -1;
1113:                try {
1114:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1115:                    // On initialise l'ID de l'action de test
1116:                    familyId = STCommun.getIdFamily(database, prop, idProject,
1117:                            familyName);
1118:                    suiteId = STCommun.getIdSuite(database, prop, idProject,
1119:                            suiteName, familyId);
1120:                    testId = STCommun.getIdTest(database, prop, testName,
1121:                            suiteId);
1122:                    actionId = STCommun.getIdAction(database, prop, actionName,
1123:                            testId);
1124:                    // On initialise l'ID du resultat de l'execution du test
1125:                    resExecTestId = CTCommun.getIdResExecCas(database, prop,
1126:                            idProject, campaignName, execName,
1127:                            executionResultName, testId);
1128:
1129:                    //	On execute la requete
1130:                    PreparedStatement prep = database.prepareStatement(prop
1131:                            .getProperty("updateActionStatusForExecResult"));
1132:                    prep.setString(1, newStatus);
1133:                    prep.setInt(2, resExecTestId);
1134:                    prep.setInt(3, actionId);
1135:                    prep.executeUpdate();
1136:                } catch (SQLException e) {
1137:                    e.printStackTrace();
1138:                    org.objectweb.salome_tmf.api.Api.addException(
1139:                            "updateActionStatusForExecResult", null, e);
1140:                } catch (Exception ex) {
1141:                    ex.printStackTrace();
1142:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1143:                            ex);
1144:                }
1145:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1146:            }
1147:
1148:            /**
1149:             * Changer le status d'un resultat d'execution
1150:             * @param campaignName
1151:             * @param execName
1152:             * @param execResultName
1153:             * @param newStatus
1154:             */
1155:            public void updateExecutionResultStatus(String campaignName,
1156:                    String execName, String execResultName, String newStatus) {
1157:                if (!special_allow) {
1158:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1159:                            .canExecutCamp())) {
1160:                        org.objectweb.salome_tmf.api.Api
1161:                                .log("updateExecutionResultStatus NOT ALLOW");
1162:                        try {
1163:                            throw new Exception(
1164:                                    "updateExecutionResultStatus NOT ALLOW");
1165:                        } catch (Exception e) {
1166:                            e.printStackTrace();
1167:                            org.objectweb.salome_tmf.api.Api.addException(e);
1168:                        }
1169:                        return;
1170:                    }
1171:                }
1172:                int _num = -1;
1173:                try {
1174:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1175:                    //On initialise l'ID du resultat d'execution
1176:                    int execResultId = CTCommun.getIdResExecCamp(database,
1177:                            prop, idProject, campaignName, execName,
1178:                            execResultName);
1179:                    //	On execute la requete
1180:                    PreparedStatement prep = database.prepareStatement(prop
1181:                            .getProperty("updateExecResultStatus"));
1182:                    prep.setString(1, newStatus);
1183:                    prep.setInt(2, execResultId);
1184:                    prep.executeUpdate();
1185:                } catch (SQLException e) {
1186:                    e.printStackTrace();
1187:                    org.objectweb.salome_tmf.api.Api.addException(
1188:                            "updateExecResultStatus", null, e);
1189:                } catch (Exception ex) {
1190:                    ex.printStackTrace();
1191:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1192:                            ex);
1193:                }
1194:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1195:            }
1196:
1197:            public void updateExecutionResultStatusUsingID(int execResultId,
1198:                    String userLogin, String desc, String status, String res) {
1199:                if (!special_allow) {
1200:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1201:                            .canExecutCamp())) {
1202:                        org.objectweb.salome_tmf.api.Api
1203:                                .log("updateExecutionResultStatus NOT ALLOW");
1204:                        try {
1205:                            throw new Exception(
1206:                                    "updateExecutionResultStatus NOT ALLOW");
1207:                        } catch (Exception e) {
1208:                            e.printStackTrace();
1209:                            org.objectweb.salome_tmf.api.Api.addException(e);
1210:                        }
1211:                        return;
1212:                    }
1213:                }
1214:                int _num = -1;
1215:                try {
1216:                    // Initialisation de l'ID de l'utilisateur
1217:                    int userId = Utile.getIdPerson(database, prop, userLogin);
1218:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1219:                    System.out.println("Update : " + execResultId + " with : "
1220:                            + res);
1221:                    //	On execute la requete
1222:                    PreparedStatement prep = database.prepareStatement(prop
1223:                            .getProperty("updateExecResultStatusUsingID"));
1224:                    prep.setInt(1, userId);
1225:                    prep.setString(2, desc);
1226:                    prep.setString(3, status);
1227:                    prep.setString(4, res);
1228:                    prep.setInt(5, execResultId);
1229:                    prep.executeUpdate();
1230:                } catch (SQLException e) {
1231:                    e.printStackTrace();
1232:                    org.objectweb.salome_tmf.api.Api.addException(
1233:                            "updateExecResultStatusUsingID", null, e);
1234:                } catch (Exception ex) {
1235:                    ex.printStackTrace();
1236:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1237:                            ex);
1238:                }
1239:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1240:            }
1241:
1242:            public void updateScriptToEnvironment(String environmentName,
1243:                    String scriptPath, String classPath,
1244:                    String classToBeExecuted, String type, long scriptLength,
1245:                    Date scriptDate) {
1246:                if (!special_allow) {
1247:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1248:                            .canUpdateCamp())
1249:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1250:                                    .canExecutCamp())) {
1251:                        org.objectweb.salome_tmf.api.Api
1252:                                .log("updateScriptToEnvironment NOT ALLOW");
1253:                        try {
1254:                            throw new Exception(
1255:                                    "updateScriptToEnvironment NOT ALLOW");
1256:                        } catch (Exception e) {
1257:                            e.printStackTrace();
1258:                            org.objectweb.salome_tmf.api.Api.addException(e);
1259:                        }
1260:                        return;
1261:                    }
1262:                }
1263:                String sql = null;
1264:                int _num = -1;
1265:                try {
1266:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1267:                    int envId = APCommun.getIdEnv(database, prop, idProject,
1268:                            environmentName);
1269:                    // On ajoute le fichier de script dans la BdD SalomeTMF
1270:                    STCommun.addFileAttachToDB(database, prop, scriptPath,
1271:                            scriptLength, scriptDate, "");
1272:                    // On initialise l'ID du fichier attache (max des ID des attachements de la base)
1273:                    int attachId = STCommun.getMaxIdAttach(database, prop);
1274:                    // On cree le fichier e partir de l'URL
1275:                    File file = new File(scriptPath);
1276:                    // On initialise le nom du fichier
1277:                    String scriptName = file.getName();
1278:
1279:                    // On supprime l'ancien scripte
1280:                    org.objectweb.salome_tmf.api.api2ihm.campTest.CampTestDelete ap_d = org.objectweb.salome_tmf.api.Api
1281:                            .getInstanceOfCampTest().getCampTestDelete();
1282:                    ap_d.deleteScriptFromEnv(envId);
1283:
1284:                    // On ajoute le nouveau
1285:                    sql = "attachScriptToEnvironment";
1286:                    PreparedStatement prep = database.prepareStatement(prop
1287:                            .getProperty("attachScriptToEnvironment"));
1288:                    prep.setString(1, scriptName);
1289:                    prep.setString(2, classToBeExecuted);
1290:                    prep.setString(3, classPath);
1291:                    prep.setString(4, type);
1292:                    prep.setInt(5, envId);
1293:
1294:                    prep.executeUpdate();
1295:
1296:                    int scriptId = CTCommun.getMaxIdScript(database, prop);
1297:                    // On ajoute le fichier au script
1298:                    sql = "addFileAttachToScript";
1299:                    prep = database.prepareStatement(prop
1300:                            .getProperty("addFileAttachToScript"));
1301:                    prep.setInt(1, scriptId);
1302:                    prep.setInt(2, attachId);
1303:
1304:                    prep.executeUpdate();
1305:
1306:                } catch (SQLException e) {
1307:                    e.printStackTrace();
1308:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, e);
1309:                } catch (Exception ex) {
1310:                    ex.printStackTrace();
1311:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1312:                            ex);
1313:                }
1314:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1315:            }
1316:
1317:            /**
1318:             * Mise e jour d'une valeur d'un parametre e un environnement
1319:             * @param paramName
1320:             * @param paramValue
1321:             * @param description
1322:             */
1323:            public void updateParamValueToEnv(String envName, String paramName,
1324:                    String paramValue, String description) {
1325:                if (!special_allow) {
1326:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1327:                            .canUpdateCamp())
1328:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1329:                                    .canExecutCamp())) {
1330:                        org.objectweb.salome_tmf.api.Api
1331:                                .log("updateParamValueToEnv NOT ALLOW");
1332:                        try {
1333:                            throw new Exception(
1334:                                    "updateParamValueToEnv NOT ALLOW");
1335:                        } catch (Exception e) {
1336:                            e.printStackTrace();
1337:                            org.objectweb.salome_tmf.api.Api.addException(e);
1338:                        }
1339:                        return;
1340:                    }
1341:                }
1342:                int idEnv = -1;
1343:                int idParam = -1;
1344:
1345:                int _num = -1;
1346:                try {
1347:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1348:                    // Initialisation de l'ID de l'environnement
1349:                    idEnv = APCommun.getIdEnv(database, prop, idProject,
1350:                            envName);
1351:                    // Initialisation de l'ID du parametre de test
1352:                    idParam = STCommun.getIdParam(database, prop, paramName,
1353:                            idProject);
1354:                    // Ajout du parametre de test au test
1355:                    PreparedStatement prep = database.prepareStatement(prop
1356:                            .getProperty("updateParamValueToEnv"));
1357:                    prep.setString(1, paramValue);
1358:                    prep.setString(2, description);
1359:                    prep.setInt(3, idEnv);
1360:                    prep.setInt(4, idParam);
1361:                    prep.executeUpdate();
1362:                } catch (SQLException E) {
1363:                    E.printStackTrace();
1364:                    org.objectweb.salome_tmf.api.Api.addException(
1365:                            "updateParamValueToEnv", null, E);
1366:                } catch (Exception ex) {
1367:                    ex.printStackTrace();
1368:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1369:                            ex);
1370:                }
1371:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1372:            }
1373:
1374:            /**
1375:             * Mise e jour d'une valeur d'un parametre e un environnement
1376:             * @param envId
1377:             * @param paramId
1378:             * @param paramValue
1379:             * @param description
1380:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteCamp()
1381:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
1382:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1383:             */
1384:            public void updateParamValueToEnvUsingID(int envId, int paramId,
1385:                    String paramValue, String description) {
1386:                if (!special_allow) {
1387:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1388:                            .canUpdateCamp())
1389:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1390:                                    .canExecutCamp())) {
1391:                        org.objectweb.salome_tmf.api.Api
1392:                                .log("updateParamValueToEnv NOT ALLOW");
1393:                        try {
1394:                            throw new Exception(
1395:                                    "updateParamValueToEnv NOT ALLOW");
1396:                        } catch (Exception e) {
1397:                            e.printStackTrace();
1398:                            org.objectweb.salome_tmf.api.Api.addException(e);
1399:                        }
1400:                        return;
1401:                    }
1402:                }
1403:                //int idEnv = -1;
1404:                //int idParam = -1;
1405:
1406:                int _num = -1;
1407:                try {
1408:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1409:
1410:                    // Ajout du parametre de test au test
1411:                    PreparedStatement prep = database.prepareStatement(prop
1412:                            .getProperty("updateParamValueToEnv"));
1413:                    prep.setString(1, paramValue);
1414:                    prep.setString(2, description);
1415:                    prep.setInt(3, envId);
1416:                    prep.setInt(4, paramId);
1417:                    prep.executeUpdate();
1418:                } catch (SQLException E) {
1419:                    E.printStackTrace();
1420:                    org.objectweb.salome_tmf.api.Api.addException(
1421:                            "updateParamValueToEnv", null, E);
1422:                } catch (Exception ex) {
1423:                    ex.printStackTrace();
1424:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1425:                            ex);
1426:                }
1427:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1428:            }
1429:
1430:            /**
1431:             * Mise e jour du nom et description d'un environnement sous test
1432:             * @param old_envName
1433:             * @param new_envName
1434:             * @param envDescription
1435:             */
1436:            public void updateEnvironment(String old_envName,
1437:                    String new_envName, String envDescription) {
1438:                if (!special_allow) {
1439:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1440:                            .canUpdateCamp())
1441:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1442:                                    .canExecutCamp())) {
1443:                        org.objectweb.salome_tmf.api.Api
1444:                                .log("updateEnvironment NOT ALLOW");
1445:                        try {
1446:                            throw new Exception("updateEnvironment NOT ALLOW");
1447:                        } catch (Exception e) {
1448:                            e.printStackTrace();
1449:                            org.objectweb.salome_tmf.api.Api.addException(e);
1450:                        }
1451:                        return;
1452:                    }
1453:                }
1454:
1455:                // Insertion d'un environnement sous test
1456:                int _num = -1;
1457:                try {
1458:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1459:                    // Appel de la requete
1460:                    PreparedStatement prep = database.prepareStatement(prop
1461:                            .getProperty("updateEnvironment"));
1462:                    prep.setString(1, new_envName);
1463:                    prep.setString(2, envDescription);
1464:                    prep.setInt(3, idProject);
1465:                    prep.setString(4, old_envName);
1466:                    prep.executeUpdate();
1467:                    //org.objectweb.salome_tmf.api.Api.getInstanceOfBugzillaAPI().updateComponent(old_envName, new_envName, envDescription);
1468:                } catch (SQLException E) {
1469:                    E.printStackTrace();
1470:                    org.objectweb.salome_tmf.api.Api.addException(
1471:                            "updateEnvironment", null, E);
1472:                } catch (Exception ex) {
1473:                    ex.printStackTrace();
1474:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1475:                            ex);
1476:                }
1477:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1478:            }
1479:
1480:            /**
1481:             * Mise e jour du nom et description d'un environnement sous test
1482:             * @param envId
1483:             * @param new_envName
1484:             * @param envDescription
1485:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteCamp()
1486:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
1487:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1488:             */
1489:            public void updateEnvironmentUsingID(int envId, String new_envName,
1490:                    String envDescription) {
1491:                if (!special_allow) {
1492:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1493:                            .canUpdateCamp())
1494:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1495:                                    .canExecutCamp())) {
1496:                        org.objectweb.salome_tmf.api.Api
1497:                                .log("updateEnvironment NOT ALLOW");
1498:                        try {
1499:                            throw new Exception("updateEnvironment NOT ALLOW");
1500:                        } catch (Exception e) {
1501:                            e.printStackTrace();
1502:                            org.objectweb.salome_tmf.api.Api.addException(e);
1503:                        }
1504:                        return;
1505:                    }
1506:                }
1507:
1508:                // Insertion d'un environnement sous test
1509:                int _num = -1;
1510:                try {
1511:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1512:                    // Appel de la requete
1513:                    PreparedStatement prep = database.prepareStatement(prop
1514:                            .getProperty("updateEnvironmentUsingID"));
1515:                    prep.setString(1, new_envName);
1516:                    prep.setString(2, envDescription);
1517:                    prep.setInt(3, idProject);
1518:                    prep.setInt(4, envId);
1519:                    prep.executeUpdate();
1520:
1521:                } catch (SQLException E) {
1522:                    E.printStackTrace();
1523:                    org.objectweb.salome_tmf.api.Api.addException(
1524:                            "updateEnvironment", null, E);
1525:                } catch (Exception ex) {
1526:                    ex.printStackTrace();
1527:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1528:                            ex);
1529:                }
1530:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1531:            }
1532:
1533:            /**
1534:             * Mise e jour d'un parametre de projet
1535:             * @param paramName
1536:             * @param description
1537:             */
1538:            public void updateParamInProject(String paramName,
1539:                    String description) {
1540:                if (!special_allow) {
1541:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1542:                            .canUpdateCamp())
1543:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1544:                                    .canExecutCamp())) {
1545:                        org.objectweb.salome_tmf.api.Api
1546:                                .log("updateParamInProject NOT ALLOW");
1547:                        try {
1548:                            throw new Exception(
1549:                                    "updateParamInProject NOT ALLOW");
1550:                        } catch (Exception e) {
1551:                            e.printStackTrace();
1552:                            org.objectweb.salome_tmf.api.Api.addException(e);
1553:                        }
1554:                        return;
1555:                    }
1556:                }
1557:                int _num = -1;
1558:                try {
1559:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1560:                    PreparedStatement prep = database.prepareStatement(prop
1561:                            .getProperty("updateParamProject"));
1562:                    prep.setString(1, paramName);
1563:                    prep.setString(2, description);
1564:                    prep.setInt(3, idProject);
1565:                    prep.setString(4, paramName);
1566:                    prep.executeUpdate();
1567:                } catch (SQLException E) {
1568:                    E.printStackTrace();
1569:                    org.objectweb.salome_tmf.api.Api.addException(
1570:                            "updateParamProject", null, E);
1571:                } catch (Exception ex) {
1572:                    ex.printStackTrace();
1573:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1574:                            ex);
1575:                }
1576:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1577:            }
1578:
1579:            /**
1580:             * Mise e jour d'un parametre du projet actif
1581:             * @param paramId
1582:             * @param description
1583:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteCamp()
1584:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
1585:             */
1586:            public void updateParamInProjectUsingID(int paramId,
1587:                    String description) {
1588:                if (!special_allow) {
1589:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1590:                            .canUpdateCamp())
1591:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1592:                                    .canExecutCamp())) {
1593:                        org.objectweb.salome_tmf.api.Api
1594:                                .log("updateParamInProject NOT ALLOW");
1595:                        try {
1596:                            throw new Exception(
1597:                                    "updateParamInProject NOT ALLOW");
1598:                        } catch (Exception e) {
1599:                            e.printStackTrace();
1600:                            org.objectweb.salome_tmf.api.Api.addException(e);
1601:                        }
1602:                        return;
1603:                    }
1604:                }
1605:                int _num = -1;
1606:                try {
1607:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1608:                    PreparedStatement prep = database.prepareStatement(prop
1609:                            .getProperty("updateParamProjectUsingID"));
1610:                    prep.setString(1, description);
1611:                    prep.setInt(2, paramId);
1612:                    prep.executeUpdate();
1613:                } catch (SQLException E) {
1614:                    E.printStackTrace();
1615:                    org.objectweb.salome_tmf.api.Api.addException(
1616:                            "updateParamProject", null, E);
1617:                } catch (Exception ex) {
1618:                    ex.printStackTrace();
1619:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1620:                            ex);
1621:                }
1622:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1623:            }
1624:
1625:            /**
1626:             * Mise e jour d'un parametre de projet
1627:             * @param oldName
1628:             * @param newName
1629:             * @param description
1630:             */
1631:            public void updateJeuDonneProject(String campaignName,
1632:                    String oldName, String newName, String description) {
1633:                if (!special_allow) {
1634:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1635:                            .canUpdateCamp())
1636:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1637:                                    .canExecutCamp())) {
1638:                        org.objectweb.salome_tmf.api.Api
1639:                                .log("updateJeuDonneProject NOT ALLOW");
1640:                        try {
1641:                            throw new Exception(
1642:                                    "updateJeuDonneProject NOT ALLOW");
1643:                        } catch (Exception e) {
1644:                            e.printStackTrace();
1645:                            org.objectweb.salome_tmf.api.Api.addException(e);
1646:                        }
1647:                        return;
1648:                    }
1649:                }
1650:                int _num = -1;
1651:                try {
1652:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1653:                    int campId = CTCommun.getIdCamp(database, prop, idProject,
1654:                            campaignName);
1655:
1656:                    PreparedStatement prep = database.prepareStatement(prop
1657:                            .getProperty("updateJeuDonneeProject"));
1658:                    prep.setString(1, newName);
1659:                    prep.setString(2, description);
1660:                    prep.setInt(3, campId);
1661:                    prep.setString(4, oldName);
1662:                    prep.executeUpdate();
1663:                } catch (SQLException E) {
1664:                    E.printStackTrace();
1665:                    org.objectweb.salome_tmf.api.Api.addException(
1666:                            "updateJeuDonneeProject", null, E);
1667:                } catch (Exception ex) {
1668:                    ex.printStackTrace();
1669:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1670:                            ex);
1671:                }
1672:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1673:
1674:            }
1675:
1676:            /**
1677:             * Mise e jour d'un jeu de donnees du projet actif
1678:             * @param datasetId
1679:             * @param newName
1680:             * @param description
1681:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteCamp()
1682:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
1683:             */
1684:            public void updateJeuDonneProjectUsingID(int datasetId,
1685:                    String newName, String description) {
1686:                if (!special_allow) {
1687:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1688:                            .canUpdateCamp())
1689:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1690:                                    .canExecutCamp())) {
1691:                        org.objectweb.salome_tmf.api.Api
1692:                                .log("updateJeuDonneProject NOT ALLOW");
1693:                        try {
1694:                            throw new Exception(
1695:                                    "updateJeuDonneProject NOT ALLOW");
1696:                        } catch (Exception e) {
1697:                            e.printStackTrace();
1698:                            org.objectweb.salome_tmf.api.Api.addException(e);
1699:                        }
1700:                        return;
1701:                    }
1702:                }
1703:                int _num = -1;
1704:                try {
1705:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1706:
1707:                    PreparedStatement prep = database.prepareStatement(prop
1708:                            .getProperty("updateJeuDonneeUsingID"));
1709:                    prep.setString(1, newName);
1710:                    prep.setString(2, description);
1711:                    prep.setInt(3, datasetId);
1712:                    prep.executeUpdate();
1713:                } catch (SQLException E) {
1714:                    E.printStackTrace();
1715:                    org.objectweb.salome_tmf.api.Api.addException(
1716:                            "updateJeuDonneeProject", null, E);
1717:                } catch (Exception ex) {
1718:                    ex.printStackTrace();
1719:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1720:                            ex);
1721:                }
1722:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1723:            }
1724:
1725:            /**
1726:             * Mise e jour d'un parametre de test dans un jeu de donnees
1727:             * @param campName
1728:             * @param jeuDonneesName
1729:             * @param paramName
1730:             * @param paramValue
1731:             */
1732:            public void updateParamInJeuDonnees(String campName,
1733:                    String jeuDonneesName, String paramName, String paramValue,
1734:                    String description) {
1735:                if (!special_allow) {
1736:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1737:                            .canUpdateCamp())
1738:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1739:                                    .canExecutCamp())) {
1740:                        org.objectweb.salome_tmf.api.Api
1741:                                .log("updateJeuDonneProject NOT ALLOW");
1742:                        try {
1743:                            throw new Exception(
1744:                                    "updateParamInJeuDonnees NOT ALLOW");
1745:                        } catch (Exception e) {
1746:                            e.printStackTrace();
1747:                            org.objectweb.salome_tmf.api.Api.addException(e);
1748:                        }
1749:                        return;
1750:                    }
1751:                }
1752:                int idJeuDonnees = -1;
1753:                int idParam = -1;
1754:                DataSet stmtRes = null;
1755:                String sql = null;
1756:                int _num = -1;
1757:                try {
1758:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1759:                    sql = "selectParamFromDataSet";
1760:                    PreparedStatement prep = database.prepareStatement(prop
1761:                            .getProperty("selectParamFromDataSet"));
1762:                    prep.setString(1, jeuDonneesName);
1763:                    prep.setString(2, campName);
1764:                    prep.setString(3, paramName);
1765:                    prep.setInt(4, idProject);
1766:                    stmtRes = new DataSet(prep.executeQuery());
1767:                    if (stmtRes.hasMoreElements()) {
1768:                        idJeuDonnees = stmtRes.getResults().getInt(
1769:                                "id_jeu_donnees");
1770:                        idParam = stmtRes.getResults().getInt("id_param_test");
1771:                        // Appel de la requete
1772:                        sql = "updateParamValueToJeuDonnees";
1773:                        prep = database.prepareStatement(prop
1774:                                .getProperty("updateParamValueToJeuDonnees"));
1775:                        prep.setString(1, paramValue);
1776:                        prep.setString(2, description);
1777:                        prep.setInt(3, idJeuDonnees);
1778:                        prep.setInt(4, idParam);
1779:                        prep.executeUpdate();
1780:                    } else {
1781:                        System.err.println("No param found for dataset "
1782:                                + jeuDonneesName + ",id : " + idJeuDonnees
1783:                                + ", on param " + paramName + ", id : "
1784:                                + idParam + " on project id : " + idProject
1785:                                + ", name : " + nameProject + "in campagne "
1786:                                + campName);
1787:                    }
1788:
1789:                } catch (SQLException E) {
1790:                    E.printStackTrace();
1791:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1792:                } catch (Exception ex) {
1793:                    ex.printStackTrace();
1794:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1795:                            ex);
1796:                }
1797:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1798:            }
1799:
1800:            /**
1801:             * Mise e jour d'un parametre de test dans un jeu de donnees
1802:             * @param datasetId
1803:             * @param paramId
1804:             * @param paramValue
1805:             * @param description
1806:             */
1807:            public void updateParamInJeuDonneesUsingID(int datasetId,
1808:                    int paramId, String paramValue, String description) {
1809:                if (!special_allow) {
1810:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1811:                            .canUpdateCamp())
1812:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1813:                                    .canExecutCamp())) {
1814:                        org.objectweb.salome_tmf.api.Api
1815:                                .log("updateJeuDonneProject NOT ALLOW");
1816:                        try {
1817:                            throw new Exception(
1818:                                    "updateParamInJeuDonnees NOT ALLOW");
1819:                        } catch (Exception e) {
1820:                            e.printStackTrace();
1821:                            org.objectweb.salome_tmf.api.Api.addException(e);
1822:                        }
1823:                        return;
1824:                    }
1825:                }
1826:
1827:                //DataSet stmtRes = null;
1828:                String sql = null;
1829:                int _num = -1;
1830:                try {
1831:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1832:
1833:                    // Appel de la requete
1834:                    sql = "updateParamValueToJeuDonnees";
1835:                    PreparedStatement prep = database.prepareStatement(prop
1836:                            .getProperty("updateParamValueToJeuDonnees"));
1837:                    prep.setString(1, paramValue);
1838:                    prep.setString(2, description);
1839:                    prep.setInt(3, datasetId);
1840:                    prep.setInt(4, paramId);
1841:                    prep.executeUpdate();
1842:                } catch (SQLException E) {
1843:                    E.printStackTrace();
1844:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1845:                } catch (Exception ex) {
1846:                    ex.printStackTrace();
1847:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1848:                            ex);
1849:                }
1850:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1851:            }
1852:
1853:            /**
1854:             * Mise e jour du nom d'une execution
1855:             * @param old_name
1856:             * @param new_name
1857:             * @param campName
1858:             */
1859:            public void updateExecutionName(String old_name, String new_name,
1860:                    String campName) {
1861:                if (!special_allow) {
1862:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1863:                            .canUpdateCamp())
1864:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1865:                                    .canExecutCamp())) {
1866:                        org.objectweb.salome_tmf.api.Api
1867:                                .log("updateExecutionName NOT ALLOW");
1868:                        try {
1869:                            throw new Exception("updateExecutionName NOT ALLOW");
1870:                        } catch (Exception e) {
1871:                            e.printStackTrace();
1872:                            org.objectweb.salome_tmf.api.Api.addException(e);
1873:                        }
1874:                        return;
1875:                    }
1876:                }
1877:                int _num = -1;
1878:                try {
1879:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1880:                    // On initialse l'ID de la campagne
1881:                    int campaignId = CTCommun.getIdCamp(database, prop,
1882:                            idProject, campName);
1883:                    PreparedStatement prep = database.prepareStatement(prop
1884:                            .getProperty("updataExecCampagne"));
1885:                    prep.setString(1, new_name);
1886:                    prep.setInt(2, campaignId);
1887:                    prep.setString(3, old_name);
1888:                    prep.executeUpdate();
1889:                } catch (SQLException E) {
1890:                    E.printStackTrace();
1891:                    org.objectweb.salome_tmf.api.Api.addException(
1892:                            "updataExecCampagne", null, E);
1893:                } catch (Exception ex) {
1894:                    ex.printStackTrace();
1895:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1896:                            ex);
1897:                }
1898:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1899:            }
1900:
1901:            /**
1902:             * Mise e jour du nom d'une execution
1903:             * @param execId
1904:             * @param new_name
1905:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteCamp()
1906:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
1907:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1908:             */
1909:            public void updateExecutionNameUsingID(int execId, String new_name) {
1910:                if (!special_allow) {
1911:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1912:                            .canUpdateCamp())
1913:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1914:                                    .canExecutCamp())) {
1915:                        org.objectweb.salome_tmf.api.Api
1916:                                .log("updateExecutionName NOT ALLOW");
1917:                        try {
1918:                            throw new Exception("updateExecutionName NOT ALLOW");
1919:                        } catch (Exception e) {
1920:                            e.printStackTrace();
1921:                            org.objectweb.salome_tmf.api.Api.addException(e);
1922:                        }
1923:                        return;
1924:                    }
1925:                }
1926:                int _num = -1;
1927:                try {
1928:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1929:                    PreparedStatement prep = database.prepareStatement(prop
1930:                            .getProperty("updateExecCampagneUsingID"));
1931:                    prep.setString(1, new_name);
1932:                    prep.setInt(2, execId);
1933:                    prep.executeUpdate();
1934:                } catch (SQLException E) {
1935:                    E.printStackTrace();
1936:                    org.objectweb.salome_tmf.api.Api.addException(
1937:                            "updataExecCampagne", 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:            /**
1947:             * Changer la description d'un fichier attache
1948:             * @param fileName
1949:             * @param newDescription
1950:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
1951:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
1952:             */
1953:            public void updateFileAttachDescriptionForCampaign(
1954:                    String campaignName, String fileName, String newDescription) {
1955:                if (!special_allow) {
1956:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1957:                            .canUpdateCamp())) {
1958:                        org.objectweb.salome_tmf.api.Api
1959:                                .log("updateFileAttachDescriptionForCampaign NOT ALLOW");
1960:                        try {
1961:                            throw new Exception(
1962:                                    "updateFileAttachDescriptionForCampaign NOT ALLOW");
1963:                        } catch (Exception e) {
1964:                            e.printStackTrace();
1965:                            org.objectweb.salome_tmf.api.Api.addException(e);
1966:                        }
1967:                        return;
1968:                    }
1969:                }
1970:
1971:                int _num = -1;
1972:                try {
1973:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1974:                    // On initialse l'ID de la famille de test
1975:                    int campId = CTCommun.getIdCamp(database, prop, idProject,
1976:                            campaignName);
1977:
1978:                    int idFileAttach = CTCommun.getCampaignAttachFileId(
1979:                            database, prop, campId, fileName);
1980:
1981:                    // Mise a jour de la suite de test
1982:                    PreparedStatement prep = database.prepareStatement(prop
1983:                            .getProperty("updateAttachDescription"));
1984:                    org.objectweb.salome_tmf.api.Api.log(prop
1985:                            .getProperty("updateScriptClassPath"));
1986:                    prep.setString(1, newDescription);
1987:                    prep.setInt(2, idFileAttach);
1988:
1989:                    prep.executeUpdate();
1990:
1991:                } catch (SQLException E) {
1992:                    E.printStackTrace();
1993:                    org.objectweb.salome_tmf.api.Api.addException(
1994:                            "updateAttachDescription", null, E);
1995:                } catch (Exception ex) {
1996:                    ex.printStackTrace();
1997:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
1998:                            ex);
1999:                }
2000:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2001:            }
2002:
2003:            /**
2004:             * Changer la description d'une url attachee
2005:             * @param urlName
2006:             * @param newDescription
2007:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2008:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2009:             */
2010:            public void updateUrlAttachDescriptionForCampaign(
2011:                    String campaignName, String urlName, String newDescription) {
2012:                if (!special_allow) {
2013:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2014:                            .canUpdateCamp())) {
2015:                        org.objectweb.salome_tmf.api.Api
2016:                                .log("updateUrlAttachDescriptionForCampaign NOT ALLOW");
2017:                        try {
2018:                            throw new Exception(
2019:                                    "updateUrlAttachDescriptionForCampaign NOT ALLOW");
2020:                        } catch (Exception e) {
2021:                            e.printStackTrace();
2022:                            org.objectweb.salome_tmf.api.Api.addException(e);
2023:                        }
2024:                        return;
2025:                    }
2026:                }
2027:
2028:                int _num = -1;
2029:                try {
2030:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2031:                    // On initialse l'ID de la famille de test
2032:                    int campId = CTCommun.getIdCamp(database, prop, idProject,
2033:                            campaignName);
2034:
2035:                    int idFileAttach = CTCommun.getCampaignAttachUrlId(
2036:                            database, prop, campId, urlName);
2037:
2038:                    // Mise a jour de la suite de test
2039:                    PreparedStatement prep = database.prepareStatement(prop
2040:                            .getProperty("updateAttachDescription"));
2041:                    org.objectweb.salome_tmf.api.Api
2042:                            .log(prop
2043:                                    .getProperty("updateUrlAttachDescriptionForCampaign"));
2044:                    prep.setString(1, newDescription);
2045:                    prep.setInt(2, idFileAttach);
2046:
2047:                    prep.executeUpdate();
2048:
2049:                } catch (SQLException E) {
2050:                    E.printStackTrace();
2051:                    org.objectweb.salome_tmf.api.Api.addException(
2052:                            "updateAttachDescription", null, E);
2053:                } catch (Exception ex) {
2054:                    ex.printStackTrace();
2055:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2056:                            ex);
2057:                }
2058:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2059:
2060:            }
2061:
2062:            /**
2063:             * Changer la longueur d'un fichier attache
2064:             * @param fileName un nom de fichier
2065:             * @param length la longueur du fichier
2066:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2067:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2068:             */
2069:            public void updateFileAttachLengthForCampaign(String campaignName,
2070:                    String fileName, long length) {
2071:                if (!special_allow) {
2072:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2073:                            .canUpdateCamp())) {
2074:                        org.objectweb.salome_tmf.api.Api
2075:                                .log("updateUrlAttachDescriptionForCampaign NOT ALLOW");
2076:                        try {
2077:                            throw new Exception(
2078:                                    "updateFileAttachLengthForCampaign NOT ALLOW");
2079:                        } catch (Exception e) {
2080:                            e.printStackTrace();
2081:                            org.objectweb.salome_tmf.api.Api.addException(e);
2082:                        }
2083:                        return;
2084:                    }
2085:                }
2086:
2087:                int _num = -1;
2088:                try {
2089:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2090:                    // On initialse l'ID de la famille de test
2091:                    int campId = CTCommun.getIdCamp(database, prop, idProject,
2092:                            campaignName);
2093:
2094:                    int idFileAttach = CTCommun.getCampaignAttachFileId(
2095:                            database, prop, campId, fileName);
2096:
2097:                    // Mise a jour de la suite de test
2098:                    PreparedStatement prep = database.prepareStatement(prop
2099:                            .getProperty("updateFileAttachLength"));
2100:                    org.objectweb.salome_tmf.api.Api
2101:                            .log(prop
2102:                                    .getProperty("updateUrlAttachDescriptionForCampaign"));
2103:                    prep.setLong(1, length);
2104:                    prep.setInt(2, idFileAttach);
2105:
2106:                    prep.executeUpdate();
2107:
2108:                } catch (SQLException E) {
2109:                    E.printStackTrace();
2110:                    org.objectweb.salome_tmf.api.Api.addException(
2111:                            "updateFileAttachLength", null, E);
2112:                } catch (Exception ex) {
2113:                    ex.printStackTrace();
2114:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2115:                            ex);
2116:                }
2117:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2118:
2119:            }
2120:
2121:            /**
2122:             * Changer la date d'un fichier
2123:             * @param fileName le nom du fichier
2124:             * @param date la date du fichier
2125:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2126:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2127:             */
2128:            public void updateFileAttachDateForCampaign(String campaignName,
2129:                    String fileName, Date date) {
2130:                if (!special_allow) {
2131:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2132:                            .canUpdateCamp())) {
2133:                        org.objectweb.salome_tmf.api.Api
2134:                                .log("updateFileAttachDateForCampaign NOT ALLOW");
2135:                        try {
2136:                            throw new Exception(
2137:                                    "updateFileAttachDateForCampaign NOT ALLOW");
2138:                        } catch (Exception e) {
2139:                            e.printStackTrace();
2140:                            org.objectweb.salome_tmf.api.Api.addException(e);
2141:                        }
2142:                        return;
2143:                    }
2144:                }
2145:
2146:                int _num = -1;
2147:                try {
2148:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2149:                    // On initialse l'ID de la famille de test
2150:                    int campId = CTCommun.getIdCamp(database, prop, idProject,
2151:                            campaignName);
2152:
2153:                    int idFileAttach = CTCommun.getCampaignAttachFileId(
2154:                            database, prop, campId, fileName);
2155:
2156:                    // Mise a jour de la suite de test
2157:                    PreparedStatement prep = database.prepareStatement(prop
2158:                            .getProperty("updateFileAttachDate"));
2159:                    org.objectweb.salome_tmf.api.Api.log(prop
2160:                            .getProperty("updateFileAttachDateForCampaign"));
2161:                    prep.setDate(1, date);
2162:                    prep.setInt(2, idFileAttach);
2163:
2164:                    prep.executeUpdate();
2165:
2166:                } catch (SQLException E) {
2167:                    E.printStackTrace();
2168:                    org.objectweb.salome_tmf.api.Api.addException(
2169:                            "updateFileAttachDate", null, E);
2170:                } catch (Exception ex) {
2171:                    ex.printStackTrace();
2172:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2173:                            ex);
2174:                }
2175:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2176:
2177:            }
2178:
2179:            /**
2180:             * Changer la date d'un fichier
2181:             * @param fileName le nom du fichier
2182:             * @param date la date du fichier
2183:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2184:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2185:             */
2186:            public void updateFileAttachDateForEnv(String envName,
2187:                    String fileName, Date date) {
2188:                if (!special_allow) {
2189:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2190:                            .canUpdateCamp())) {
2191:                        org.objectweb.salome_tmf.api.Api
2192:                                .log("updateFileAttachDateForEnv NOT ALLOW");
2193:                        try {
2194:                            throw new Exception(
2195:                                    "updateFileAttachDateForEnv NOT ALLOW");
2196:                        } catch (Exception e) {
2197:                            e.printStackTrace();
2198:                            org.objectweb.salome_tmf.api.Api.addException(e);
2199:                        }
2200:                        return;
2201:                    }
2202:                }
2203:
2204:                int _num = -1;
2205:                try {
2206:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2207:                    // On initialse l'ID de la famille de test
2208:                    int envId = CTCommun.getIdEnv(database, prop, idProject,
2209:                            envName);
2210:
2211:                    int idFileAttach = CTCommun.getEnvAttachFileId(database,
2212:                            prop, envId, fileName);
2213:
2214:                    // Mise a jour de la suite de test
2215:                    PreparedStatement prep = database.prepareStatement(prop
2216:                            .getProperty("updateFileAttachDate"));
2217:                    org.objectweb.salome_tmf.api.Api.log(prop
2218:                            .getProperty("updateFileAttachDateForEnv"));
2219:                    prep.setDate(1, date);
2220:                    prep.setInt(2, idFileAttach);
2221:
2222:                    prep.executeUpdate();
2223:
2224:                } catch (SQLException E) {
2225:                    E.printStackTrace();
2226:                    org.objectweb.salome_tmf.api.Api.addException(
2227:                            "updateFileAttachDate", null, E);
2228:                } catch (Exception ex) {
2229:                    ex.printStackTrace();
2230:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2231:                            ex);
2232:                }
2233:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2234:            }
2235:
2236:            /**
2237:             * Changer la longueur d'un fichier attache
2238:             * @param fileName un nom de fichier
2239:             * @param length la longueur du fichier
2240:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2241:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2242:             */
2243:            public void updateFileAttachLengthForEnv(String envName,
2244:                    String fileName, long length) {
2245:                if (!special_allow) {
2246:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2247:                            .canUpdateCamp())) {
2248:                        org.objectweb.salome_tmf.api.Api
2249:                                .log("updateUrlAttachDescriptionForEnv NOT ALLOW");
2250:                        try {
2251:                            throw new Exception(
2252:                                    "updateFileAttachLengthForEnv NOT ALLOW");
2253:                        } catch (Exception e) {
2254:                            e.printStackTrace();
2255:                            org.objectweb.salome_tmf.api.Api.addException(e);
2256:                        }
2257:                        return;
2258:                    }
2259:                }
2260:
2261:                int _num = -1;
2262:                try {
2263:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2264:                    // On initialse l'ID de l'environnement
2265:                    int envId = CTCommun.getIdEnv(database, prop, idProject,
2266:                            envName);
2267:
2268:                    int idFileAttach = CTCommun.getEnvAttachFileId(database,
2269:                            prop, envId, fileName);
2270:
2271:                    // Mise a jour de la suite de test
2272:                    PreparedStatement prep = database.prepareStatement(prop
2273:                            .getProperty("updateFileAttachLength"));
2274:                    org.objectweb.salome_tmf.api.Api.log(prop
2275:                            .getProperty("updateUrlAttachDescriptionForEnv"));
2276:                    prep.setLong(1, length);
2277:                    prep.setInt(2, idFileAttach);
2278:
2279:                    prep.executeUpdate();
2280:
2281:                } catch (SQLException E) {
2282:                    E.printStackTrace();
2283:                    org.objectweb.salome_tmf.api.Api.addException(
2284:                            "updateFileAttachLength", null, E);
2285:                } catch (Exception ex) {
2286:                    ex.printStackTrace();
2287:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2288:                            ex);
2289:                }
2290:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2291:            }
2292:
2293:            /**
2294:             * Changer la description d'un fichier attache
2295:             * @param fileName
2296:             * @param newDescription
2297:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2298:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2299:             */
2300:            public void updateFileAttachDescriptionForExecution(
2301:                    String campaignName, String execName, String fileName,
2302:                    String newDescription) {
2303:                if (!special_allow) {
2304:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2305:                            .canUpdateCamp())
2306:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2307:                                    .canExecutCamp())) {
2308:                        org.objectweb.salome_tmf.api.Api
2309:                                .log("updateFileAttachDescriptionForExecution NOT ALLOW");
2310:                        try {
2311:                            throw new Exception(
2312:                                    "updateFileAttachDescriptionForExecution NOT ALLOW");
2313:                        } catch (Exception e) {
2314:                            e.printStackTrace();
2315:                            org.objectweb.salome_tmf.api.Api.addException(e);
2316:                        }
2317:                        return;
2318:                    }
2319:                }
2320:
2321:                int _num = -1;
2322:                try {
2323:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2324:                    // On initialse l'ID de la famille de test
2325:                    int execId = CTCommun.getIdExecCamp(database, prop,
2326:                            idProject, campaignName, execName);
2327:                    int idFileAttach = CTCommun.getExecAttachFileId(database,
2328:                            prop, execId, fileName);
2329:
2330:                    // Mise a jour de la suite de test
2331:                    PreparedStatement prep = database.prepareStatement(prop
2332:                            .getProperty("updateAttachDescription"));
2333:                    prep.setString(1, newDescription);
2334:                    prep.setInt(2, idFileAttach);
2335:
2336:                    prep.executeUpdate();
2337:
2338:                } catch (SQLException E) {
2339:                    E.printStackTrace();
2340:                    org.objectweb.salome_tmf.api.Api.addException(
2341:                            "updateAttachDescription", null, E);
2342:                } catch (Exception ex) {
2343:                    ex.printStackTrace();
2344:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2345:                            ex);
2346:                }
2347:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2348:            }
2349:
2350:            /**
2351:             * Changer la description d'une url attachee
2352:             * @param urlName
2353:             * @param newDescription
2354:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2355:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2356:             */
2357:            public void updateUrlAttachDescriptionForExecution(
2358:                    String campaignName, String execName, String urlName,
2359:                    String newDescription) {
2360:                if (!special_allow) {
2361:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2362:                            .canUpdateCamp())
2363:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2364:                                    .canExecutCamp())) {
2365:                        org.objectweb.salome_tmf.api.Api
2366:                                .log("updateUrlAttachDescriptionForExecution NOT ALLOW");
2367:                        try {
2368:                            throw new Exception(
2369:                                    "updateUrlAttachDescriptionForExecution NOT ALLOW");
2370:                        } catch (Exception e) {
2371:                            e.printStackTrace();
2372:                            org.objectweb.salome_tmf.api.Api.addException(e);
2373:                        }
2374:                        return;
2375:                    }
2376:                }
2377:
2378:                int _num = -1;
2379:                try {
2380:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2381:                    // On initialse l'ID de la famille de test
2382:                    int execId = CTCommun.getIdExecCamp(database, prop,
2383:                            idProject, campaignName, execName);
2384:                    int idFileAttach = CTCommun.getExecAttachUrlId(database,
2385:                            prop, execId, urlName);
2386:
2387:                    // Mise a jour de la suite de test
2388:                    PreparedStatement prep = database.prepareStatement(prop
2389:                            .getProperty("updateAttachDescription"));
2390:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateUrlAttachDescriptionForExecution"));
2391:                    prep.setString(1, newDescription);
2392:                    prep.setInt(2, idFileAttach);
2393:
2394:                    prep.executeUpdate();
2395:
2396:                } catch (SQLException E) {
2397:                    E.printStackTrace();
2398:                    org.objectweb.salome_tmf.api.Api.addException(
2399:                            "updateAttachDescription", null, E);
2400:                } catch (Exception ex) {
2401:                    ex.printStackTrace();
2402:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2403:                            ex);
2404:                }
2405:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2406:
2407:            }
2408:
2409:            /**
2410:             * Changer la longueur d'un fichier attache
2411:             * @param fileName un nom de fichier
2412:             * @param length la longueur du fichier
2413:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2414:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2415:             */
2416:            public void updateFileAttachLengthForExecution(String campaignName,
2417:                    String execName, String fileName, long length) {
2418:                if (!special_allow) {
2419:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2420:                            .canUpdateCamp())
2421:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2422:                                    .canExecutCamp())) {
2423:                        org.objectweb.salome_tmf.api.Api
2424:                                .log("updateFileAttachLengthForExecution NOT ALLOW");
2425:                        try {
2426:                            throw new Exception(
2427:                                    "updateFileAttachLengthForExecution NOT ALLOW");
2428:                        } catch (Exception e) {
2429:                            e.printStackTrace();
2430:                            org.objectweb.salome_tmf.api.Api.addException(e);
2431:                        }
2432:                        return;
2433:                    }
2434:                }
2435:
2436:                int _num = -1;
2437:                try {
2438:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2439:                    // On initialse l'ID de la famille de test
2440:                    int execId = CTCommun.getIdExecCamp(database, prop,
2441:                            idProject, campaignName, execName);
2442:                    int idFileAttach = CTCommun.getExecAttachFileId(database,
2443:                            prop, execId, fileName);
2444:
2445:                    // Mise a jour de la suite de test
2446:                    PreparedStatement prep = database.prepareStatement(prop
2447:                            .getProperty("updateFileAttachLength"));
2448:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachLengthForExecution"));
2449:                    prep.setLong(1, length);
2450:                    prep.setInt(2, idFileAttach);
2451:
2452:                    prep.executeUpdate();
2453:
2454:                } catch (SQLException E) {
2455:                    E.printStackTrace();
2456:                    org.objectweb.salome_tmf.api.Api.addException(
2457:                            "updateFileAttachLength", null, E);
2458:                } catch (Exception ex) {
2459:                    ex.printStackTrace();
2460:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2461:                            ex);
2462:                }
2463:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2464:            }
2465:
2466:            /**
2467:             * Changer la date d'un fichier
2468:             * @param fileName le nom du fichier
2469:             * @param date la date du fichier
2470:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2471:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2472:             */
2473:            public void updateFileAttachDateForExecution(String campaignName,
2474:                    String execName, String fileName, Date date) {
2475:                if (!special_allow) {
2476:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2477:                            .canUpdateCamp())
2478:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2479:                                    .canExecutCamp())) {
2480:                        org.objectweb.salome_tmf.api.Api
2481:                                .log("updateFileAttachDateForExecution NOT ALLOW");
2482:                        try {
2483:                            throw new Exception(
2484:                                    "updateFileAttachDateForExecution NOT ALLOW");
2485:                        } catch (Exception e) {
2486:                            e.printStackTrace();
2487:                            org.objectweb.salome_tmf.api.Api.addException(e);
2488:                        }
2489:                        return;
2490:                    }
2491:                }
2492:
2493:                int _num = -1;
2494:                try {
2495:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2496:                    // On initialse l'ID de la famille de test
2497:                    int execId = CTCommun.getIdExecCamp(database, prop,
2498:                            idProject, campaignName, execName);
2499:                    int idFileAttach = CTCommun.getExecAttachFileId(database,
2500:                            prop, execId, fileName);
2501:
2502:                    // Mise a jour de la suite de test
2503:                    PreparedStatement prep = database.prepareStatement(prop
2504:                            .getProperty("updateFileAttachDate"));
2505:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachDateForExecution"));
2506:                    prep.setDate(1, date);
2507:                    prep.setInt(2, idFileAttach);
2508:
2509:                    prep.executeUpdate();
2510:
2511:                } catch (SQLException E) {
2512:                    E.printStackTrace();
2513:                    org.objectweb.salome_tmf.api.Api.addException(
2514:                            "updateFileAttachDate", null, E);
2515:                } catch (Exception ex) {
2516:                    ex.printStackTrace();
2517:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2518:                            ex);
2519:                }
2520:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2521:
2522:            }
2523:
2524:            /**
2525:             * Changer la description d'un fichier attache
2526:             * @param fileName
2527:             * @param newDescription
2528:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2529:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2530:             */
2531:            public void updateFileAttachDescriptionForExecResult(
2532:                    String campaignName, String execName,
2533:                    String execResultName, String fileName,
2534:                    String newDescription) {
2535:                if (!special_allow) {
2536:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2537:                            .canExecutCamp())) {
2538:                        org.objectweb.salome_tmf.api.Api
2539:                                .log("updateFileAttachDescriptionForExecution NOT ALLOW");
2540:                        try {
2541:                            throw new Exception(
2542:                                    "updateFileAttachDescriptionForExecResult NOT ALLOW");
2543:                        } catch (Exception e) {
2544:                            e.printStackTrace();
2545:                            org.objectweb.salome_tmf.api.Api.addException(e);
2546:                        }
2547:                        return;
2548:                    }
2549:                }
2550:
2551:                int _num = -1;
2552:                try {
2553:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2554:                    // On initialse l'ID de la famille de test
2555:
2556:                    int execResultId = CTCommun.getIdResExecCamp(database,
2557:                            prop, idProject, campaignName, execName,
2558:                            execResultName);
2559:                    int idFileAttach = CTCommun.getExecResultAttachFileId(
2560:                            database, prop, execResultId, fileName);
2561:
2562:                    // Mise a jour de la suite de test
2563:                    PreparedStatement prep = database.prepareStatement(prop
2564:                            .getProperty("updateAttachDescription"));
2565:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachDescriptionForExecution"));
2566:                    prep.setString(1, newDescription);
2567:                    prep.setInt(2, idFileAttach);
2568:
2569:                    prep.executeUpdate();
2570:
2571:                } catch (SQLException E) {
2572:                    E.printStackTrace();
2573:                    org.objectweb.salome_tmf.api.Api.addException(
2574:                            "updateAttachDescription", null, E);
2575:                } catch (Exception ex) {
2576:                    ex.printStackTrace();
2577:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2578:                            ex);
2579:                }
2580:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2581:
2582:            }
2583:
2584:            /**
2585:             * Changer la description d'une url attachee
2586:             * @param urlName
2587:             * @param newDescription
2588:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2589:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2590:             */
2591:            public void updateUrlAttachDescriptionForExecResult(
2592:                    String campaignName, String execName,
2593:                    String execResultName, String urlName, String newDescription) {
2594:                if (!special_allow) {
2595:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2596:                            .canExecutCamp())) {
2597:                        org.objectweb.salome_tmf.api.Api
2598:                                .log("updateFileAttachDescriptionForExecution NOT ALLOW");
2599:                        try {
2600:                            throw new Exception(
2601:                                    "updateUrlAttachDescriptionForExecResult NOT ALLOW");
2602:                        } catch (Exception e) {
2603:                            e.printStackTrace();
2604:                            org.objectweb.salome_tmf.api.Api.addException(e);
2605:                        }
2606:                        return;
2607:                    }
2608:                }
2609:
2610:                int _num = -1;
2611:                try {
2612:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2613:                    // On initialse l'ID de la famille de test
2614:
2615:                    int execResultId = CTCommun.getIdResExecCamp(database,
2616:                            prop, idProject, campaignName, execName,
2617:                            execResultName);
2618:                    int idFileAttach = CTCommun.getExecResultAttachUrlId(
2619:                            database, prop, execResultId, urlName);
2620:
2621:                    // Mise a jour de la suite de test
2622:                    PreparedStatement prep = database.prepareStatement(prop
2623:                            .getProperty("updateAttachDescription"));
2624:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachDescriptionForExecution"));
2625:                    prep.setString(1, newDescription);
2626:                    prep.setInt(2, idFileAttach);
2627:
2628:                    prep.executeUpdate();
2629:
2630:                } catch (SQLException E) {
2631:                    E.printStackTrace();
2632:                    org.objectweb.salome_tmf.api.Api.addException(
2633:                            "updateAttachDescription", null, E);
2634:                } catch (Exception ex) {
2635:                    ex.printStackTrace();
2636:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2637:                            ex);
2638:                }
2639:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2640:
2641:            }
2642:
2643:            /**
2644:             * Changer la longueur d'un fichier attache
2645:             * @param fileName un nom de fichier
2646:             * @param length la longueur du fichier
2647:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2648:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2649:             */
2650:            public void updateFileAttachLengthForExecResult(
2651:                    String campaignName, String execName,
2652:                    String execResultName, String fileName, long length) {
2653:                if (!special_allow) {
2654:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2655:                            .canExecutCamp())) {
2656:                        org.objectweb.salome_tmf.api.Api
2657:                                .log("updateFileAttachLengthForExecResult NOT ALLOW");
2658:                        try {
2659:                            throw new Exception(
2660:                                    "updateFileAttachLengthForExecResult NOT ALLOW");
2661:                        } catch (Exception e) {
2662:                            e.printStackTrace();
2663:                            org.objectweb.salome_tmf.api.Api.addException(e);
2664:                        }
2665:                        return;
2666:                    }
2667:                }
2668:
2669:                int _num = -1;
2670:                try {
2671:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2672:                    // On initialse l'ID de la famille de test
2673:
2674:                    int execResultId = CTCommun.getIdResExecCamp(database,
2675:                            prop, idProject, campaignName, execName,
2676:                            execResultName);
2677:                    int idFileAttach = CTCommun.getExecResultAttachUrlId(
2678:                            database, prop, execResultId, fileName);
2679:
2680:                    // Mise a jour de la suite de test
2681:                    PreparedStatement prep = database.prepareStatement(prop
2682:                            .getProperty("updateFileAttachLength"));
2683:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachLengthForExecResult"));
2684:                    prep.setLong(1, length);
2685:                    prep.setInt(2, idFileAttach);
2686:
2687:                    prep.executeUpdate();
2688:
2689:                } catch (SQLException E) {
2690:                    E.printStackTrace();
2691:                    org.objectweb.salome_tmf.api.Api.addException(
2692:                            "updateFileAttachLength", null, E);
2693:                } catch (Exception ex) {
2694:                    ex.printStackTrace();
2695:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2696:                            ex);
2697:                }
2698:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2699:            }
2700:
2701:            /**
2702:             * Changer la date d'un fichier
2703:             * @param fileName le nom du fichier
2704:             * @param date la date du fichier
2705:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2706:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2707:             */
2708:            public void updateFileAttachDateForExecResult(String campaignName,
2709:                    String execName, String execResultName, String fileName,
2710:                    Date date) {
2711:                if (!special_allow) {
2712:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2713:                            .canExecutCamp())) {
2714:                        org.objectweb.salome_tmf.api.Api
2715:                                .log("updateFileAttachDateForExecResult NOT ALLOW");
2716:                        try {
2717:                            throw new Exception(
2718:                                    "updateFileAttachDateForExecResult NOT ALLOW");
2719:                        } catch (Exception e) {
2720:                            e.printStackTrace();
2721:                            org.objectweb.salome_tmf.api.Api.addException(e);
2722:                        }
2723:                        return;
2724:                    }
2725:                }
2726:
2727:                int _num = -1;
2728:                try {
2729:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2730:                    // On initialse l'ID de la famille de test
2731:
2732:                    int execResultId = CTCommun.getIdResExecCamp(database,
2733:                            prop, idProject, campaignName, execName,
2734:                            execResultName);
2735:                    int idFileAttach = CTCommun.getExecResultAttachUrlId(
2736:                            database, prop, execResultId, fileName);
2737:
2738:                    // Mise a jour de la suite de test
2739:                    PreparedStatement prep = database.prepareStatement(prop
2740:                            .getProperty("updateFileAttachDate"));
2741:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachDateForExecResult"));
2742:                    prep.setDate(1, date);
2743:                    prep.setInt(2, idFileAttach);
2744:
2745:                    prep.executeUpdate();
2746:
2747:                } catch (SQLException E) {
2748:                    E.printStackTrace();
2749:                    org.objectweb.salome_tmf.api.Api.addException(
2750:                            "updateFileAttachDate", null, E);
2751:                } catch (Exception ex) {
2752:                    ex.printStackTrace();
2753:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2754:                            ex);
2755:                }
2756:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2757:
2758:            }
2759:
2760:            /**
2761:             * Changer la description d'un fichier attache
2762:             * @param fileName
2763:             * @param newDescription
2764:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2765:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2766:             */
2767:            public void updateFileAttachDescriptionForExecResultTest(
2768:                    String campaignName, String execName,
2769:                    String execResultName, String familyName, String suiteName,
2770:                    String testName, String fileName, String newDescription) {
2771:                if (!special_allow) {
2772:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2773:                            .canExecutCamp())) {
2774:                        org.objectweb.salome_tmf.api.Api
2775:                                .log("updateFileAttachDescriptionForExecResultTest NOT ALLOW");
2776:                        try {
2777:                            throw new Exception(
2778:                                    "updateFileAttachDescriptionForExecResultTest NOT ALLOW");
2779:                        } catch (Exception e) {
2780:                            e.printStackTrace();
2781:                            org.objectweb.salome_tmf.api.Api.addException(e);
2782:                        }
2783:                        return;
2784:                    }
2785:                }
2786:
2787:                int _num = -1;
2788:                try {
2789:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2790:                    // On initialse l'ID de la famille de test
2791:                    int familyId = STCommun.getIdFamily(database, prop,
2792:                            idProject, familyName);
2793:                    // On initialise l'ID de la suite de test
2794:                    int suiteId = STCommun.getIdSuite(database, prop,
2795:                            idProject, suiteName, familyId);
2796:                    // On initialise l'ID du test
2797:                    int testId = STCommun.getIdTest(database, prop, testName,
2798:                            suiteId);
2799:
2800:                    int execResultTestId = CTCommun.getIdResExecCas(database,
2801:                            prop, idProject, campaignName, execName,
2802:                            execResultName, testId);
2803:                    int idFileAttach = CTCommun.getExecTestResultAttachFileId(
2804:                            database, prop, execResultTestId, fileName);
2805:
2806:                    // Mise a jour de la suite de test
2807:                    PreparedStatement prep = database.prepareStatement(prop
2808:                            .getProperty("updateAttachDescription"));
2809:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachDescriptionForExecResultTest"));
2810:                    prep.setString(1, newDescription);
2811:                    prep.setInt(2, idFileAttach);
2812:
2813:                    prep.executeUpdate();
2814:
2815:                } catch (SQLException E) {
2816:                    E.printStackTrace();
2817:                    org.objectweb.salome_tmf.api.Api.addException(
2818:                            "updateAttachDescription", null, E);
2819:                } catch (Exception ex) {
2820:                    ex.printStackTrace();
2821:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2822:                            ex);
2823:                }
2824:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2825:            }
2826:
2827:            /**
2828:             * Changer la description d'une url attachee
2829:             * @param urlName
2830:             * @param newDescription
2831:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2832:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2833:             */
2834:            public void updateUrlAttachDescriptionForExecResultTest(
2835:                    String campaignName, String execName,
2836:                    String execResultName, String familyName, String suiteName,
2837:                    String testName, String urlName, String newDescription) {
2838:                if (!special_allow) {
2839:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2840:                            .canExecutCamp())) {
2841:                        org.objectweb.salome_tmf.api.Api
2842:                                .log("updateFileAttachDescriptionForExecResultTest NOT ALLOW");
2843:                        try {
2844:                            throw new Exception(
2845:                                    "updateUrlAttachDescriptionForExecResultTest NOT ALLOW");
2846:                        } catch (Exception e) {
2847:                            e.printStackTrace();
2848:                            org.objectweb.salome_tmf.api.Api.addException(e);
2849:                        }
2850:                        return;
2851:                    }
2852:                }
2853:
2854:                int _num = -1;
2855:                try {
2856:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2857:
2858:                    // On initialse l'ID de la famille de test
2859:                    int familyId = STCommun.getIdFamily(database, prop,
2860:                            idProject, familyName);
2861:                    // On initialise l'ID de la suite de test
2862:                    int suiteId = STCommun.getIdSuite(database, prop,
2863:                            idProject, suiteName, familyId);
2864:                    // On initialise l'ID du test
2865:                    int testId = STCommun.getIdTest(database, prop, testName,
2866:                            suiteId);
2867:
2868:                    int execResultTestId = CTCommun.getIdResExecCas(database,
2869:                            prop, idProject, campaignName, execName,
2870:                            execResultName, testId);
2871:                    int idFileAttach = CTCommun.getExecTestResultAttachUrlId(
2872:                            database, prop, execResultTestId, urlName);
2873:
2874:                    // Mise a jour de la suite de test
2875:                    PreparedStatement prep = database.prepareStatement(prop
2876:                            .getProperty("updateAttachDescription"));
2877:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachDescriptionForExecResultTest"));
2878:                    prep.setString(1, newDescription);
2879:                    prep.setInt(2, idFileAttach);
2880:
2881:                    prep.executeUpdate();
2882:
2883:                } catch (SQLException E) {
2884:                    E.printStackTrace();
2885:                    org.objectweb.salome_tmf.api.Api.addException(
2886:                            "updateAttachDescription", null, E);
2887:                } catch (Exception ex) {
2888:                    ex.printStackTrace();
2889:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2890:                            ex);
2891:                }
2892:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2893:
2894:            }
2895:
2896:            /**
2897:             * Changer la longueur d'un fichier attache
2898:             * @param fileName un nom de fichier
2899:             * @param length la longueur du fichier
2900:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2901:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2902:             */
2903:            public void updateFileAttachLengthForExecResultTest(
2904:                    String campaignName, String execName,
2905:                    String execResultName, String familyName, String suiteName,
2906:                    String testName, String fileName, long length) {
2907:                if (!special_allow) {
2908:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2909:                            .canExecutCamp())) {
2910:                        org.objectweb.salome_tmf.api.Api
2911:                                .log("updateFileAttachLengthForExecResultTest NOT ALLOW");
2912:                        try {
2913:                            throw new Exception(
2914:                                    "updateFileAttachLengthForExecResultTest NOT ALLOW");
2915:                        } catch (Exception e) {
2916:                            e.printStackTrace();
2917:                            org.objectweb.salome_tmf.api.Api.addException(e);
2918:                        }
2919:                        return;
2920:                    }
2921:                }
2922:
2923:                int _num = -1;
2924:                try {
2925:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2926:
2927:                    // On initialse l'ID de la famille de test
2928:                    int familyId = STCommun.getIdFamily(database, prop,
2929:                            idProject, familyName);
2930:                    // On initialise l'ID de la suite de test
2931:                    int suiteId = STCommun.getIdSuite(database, prop,
2932:                            idProject, suiteName, familyId);
2933:                    // On initialise l'ID du test
2934:                    int testId = STCommun.getIdTest(database, prop, testName,
2935:                            suiteId);
2936:
2937:                    int execResultTestId = CTCommun.getIdResExecCas(database,
2938:                            prop, idProject, campaignName, execName,
2939:                            execResultName, testId);
2940:                    int idFileAttach = CTCommun.getExecTestResultAttachFileId(
2941:                            database, prop, execResultTestId, fileName);
2942:
2943:                    // Mise a jour de la suite de test
2944:                    PreparedStatement prep = database.prepareStatement(prop
2945:                            .getProperty("updateFileAttachLength"));
2946:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachLengthForExecResultTest"));
2947:                    prep.setLong(1, length);
2948:                    prep.setInt(2, idFileAttach);
2949:
2950:                    prep.executeUpdate();
2951:
2952:                } catch (SQLException E) {
2953:                    E.printStackTrace();
2954:                    org.objectweb.salome_tmf.api.Api.addException(
2955:                            "updateFileAttachLength", null, E);
2956:                } catch (Exception ex) {
2957:                    ex.printStackTrace();
2958:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
2959:                            ex);
2960:                }
2961:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2962:
2963:            }
2964:
2965:            /**
2966:             * Changer la date d'un fichier
2967:             * @param fileName le nom du fichier
2968:             * @param date la date du fichier
2969:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
2970:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
2971:             */
2972:            public void updateFileAttachDateForExecResultTest(
2973:                    String campaignName, String execName,
2974:                    String execResultName, String familyName, String suiteName,
2975:                    String testName, String fileName, Date date) {
2976:                if (!special_allow) {
2977:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2978:                            .canExecutCamp())) {
2979:                        org.objectweb.salome_tmf.api.Api
2980:                                .log("updateFileAttachDateForExecResultTest NOT ALLOW");
2981:                        try {
2982:                            throw new Exception(
2983:                                    "updateFileAttachDateForExecResultTest NOT ALLOW");
2984:                        } catch (Exception e) {
2985:                            e.printStackTrace();
2986:                            org.objectweb.salome_tmf.api.Api.addException(e);
2987:                        }
2988:                        return;
2989:                    }
2990:                }
2991:
2992:                int _num = -1;
2993:                try {
2994:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2995:
2996:                    // On initialse l'ID de la famille de test
2997:                    int familyId = STCommun.getIdFamily(database, prop,
2998:                            idProject, familyName);
2999:                    // On initialise l'ID de la suite de test
3000:                    int suiteId = STCommun.getIdSuite(database, prop,
3001:                            idProject, suiteName, familyId);
3002:                    // On initialise l'ID du test
3003:                    int testId = STCommun.getIdTest(database, prop, testName,
3004:                            suiteId);
3005:
3006:                    int execResultTestId = CTCommun.getIdResExecCas(database,
3007:                            prop, idProject, campaignName, execName,
3008:                            execResultName, testId);
3009:                    int idFileAttach = CTCommun.getExecTestResultAttachFileId(
3010:                            database, prop, execResultTestId, fileName);
3011:
3012:                    // Mise a jour de la suite de test
3013:                    PreparedStatement prep = database.prepareStatement(prop
3014:                            .getProperty("updateFileAttachDate"));
3015:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateFileAttachDateForExecResultTest"));
3016:                    prep.setDate(1, date);
3017:                    prep.setInt(2, idFileAttach);
3018:
3019:                    prep.executeUpdate();
3020:
3021:                } catch (SQLException E) {
3022:                    E.printStackTrace();
3023:                    org.objectweb.salome_tmf.api.Api.addException(
3024:                            "updateFileAttachDate", null, E);
3025:                } catch (Exception ex) {
3026:                    ex.printStackTrace();
3027:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3028:                            ex);
3029:                }
3030:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3031:            }
3032:
3033:            /**
3034:             *
3035:             * @param familyName
3036:             * @param suiteName
3037:             * @param testName
3038:             * @param filePath
3039:             * @throws FileNotFoundException
3040:             */
3041:            public void updateScriptForEnvironment(String envName,
3042:                    String filePath) throws FileNotFoundException {
3043:                if (!special_allow) {
3044:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3045:                            .canUpdateCamp())
3046:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3047:                                    .canExecutCamp())) {
3048:                        org.objectweb.salome_tmf.api.Api
3049:                                .log("updateScriptForEnvironment NOT ALLOW");
3050:                        try {
3051:                            throw new Exception(
3052:                                    "updateScriptForEnvironment NOT ALLOW");
3053:                        } catch (Exception e) {
3054:                            e.printStackTrace();
3055:                            org.objectweb.salome_tmf.api.Api.addException(e);
3056:                        }
3057:                        return;
3058:                    }
3059:                }
3060:                int _num = -1;
3061:                try {
3062:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3063:                    // On cree le fichier e partir de l'URL
3064:                    File file = new File(filePath);
3065:                    // On recupere le nom du fichier
3066:                    String fileName = file.getName();
3067:                    // On enregistre le flux du fichier
3068:                    FileInputStream fis = new FileInputStream(file);
3069:                    BufferedInputStream bis = new BufferedInputStream(fis);
3070:
3071:                    int idEnv = APCommun.getIdEnv(database, prop, idProject,
3072:                            envName);
3073:
3074:                    int scriptId = CTCommun.getIdScriptEnvironment(database,
3075:                            prop, idEnv, fileName);
3076:                    // On initialise l'ID de l'attachement
3077:                    int scriptAttachId = CTCommun.getAttachIdScript(database,
3078:                            prop, scriptId, fileName);
3079:
3080:                    // Appel de la requete a executer
3081:                    PreparedStatement prep = database.prepareStatement(prop
3082:                            .getProperty("updateFileAttach"));
3083:                    prep.setBinaryStream(1, bis, bis.available());
3084:                    prep.setInt(2, scriptAttachId);
3085:
3086:                    prep.executeUpdate();
3087:                    bis.close();
3088:                } catch (SQLException sqle) {
3089:                    sqle.printStackTrace();
3090:                    org.objectweb.salome_tmf.api.Api.addException(
3091:                            "updateFileAttach", null, sqle);
3092:                } catch (Exception e) {
3093:                    org.objectweb.salome_tmf.api.Api
3094:                            .addException(null, null, e);
3095:                    e.printStackTrace();
3096:                    if (e instanceof  FileNotFoundException) {
3097:                        org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3098:                        throw new FileNotFoundException();
3099:                    }
3100:                }
3101:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3102:            }
3103:
3104:            /**
3105:             *
3106:             * @param familyName
3107:             * @param suiteName
3108:             * @param testName
3109:             * @param scriptName
3110:             * @param newClassPath
3111:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
3112:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
3113:             */
3114:            public void updateScriptPlugExtForEnvironment(String envName,
3115:                    String scriptName, String newClassPath) {
3116:                if (!special_allow) {
3117:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3118:                            .canUpdateCamp())
3119:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3120:                                    .canExecutCamp())) {
3121:                        org.objectweb.salome_tmf.api.Api
3122:                                .log("updateScriptClassPathForEnvironment NOT ALLOW");
3123:                        try {
3124:                            throw new Exception(
3125:                                    "updateScriptClassPathForEnvironment NOT ALLOW");
3126:                        } catch (Exception e) {
3127:                            e.printStackTrace();
3128:                            org.objectweb.salome_tmf.api.Api.addException(e);
3129:                        }
3130:                        return;
3131:                    }
3132:                }
3133:
3134:                int _num = -1;
3135:                try {
3136:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3137:                    int idEnv = APCommun.getIdEnv(database, prop, idProject,
3138:                            envName);
3139:                    // Initialisation de l'ID du script
3140:                    int scriptId = CTCommun.getIdScriptEnvironment(database,
3141:                            prop, idEnv, scriptName);
3142:
3143:                    // Mise a jour de la suite de test
3144:                    PreparedStatement prep = database.prepareStatement(prop
3145:                            .getProperty("updateScriptClassPath"));
3146:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateScriptClassPathForEnvironment"));
3147:                    prep.setString(1, newClassPath);
3148:                    prep.setInt(2, scriptId);
3149:
3150:                    prep.executeUpdate();
3151:
3152:                } catch (SQLException E) {
3153:                    E.printStackTrace();
3154:                    org.objectweb.salome_tmf.api.Api.addException(
3155:                            "updateScriptClassPath", null, E);
3156:                } catch (Exception ex) {
3157:                    ex.printStackTrace();
3158:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3159:                            ex);
3160:                }
3161:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3162:
3163:            }
3164:
3165:            /**
3166:             *
3167:             * @param familyName
3168:             * @param suiteName
3169:             * @param testName
3170:             * @param scriptName
3171:             * @param newClassToBeExecuted
3172:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
3173:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
3174:             */
3175:            public void updateScriptPlugArgForEnvironment(String envName,
3176:                    String scriptName, String newClassToBeExecuted) {
3177:                if (!special_allow) {
3178:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3179:                            .canUpdateCamp())
3180:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3181:                                    .canExecutCamp())) {
3182:                        org.objectweb.salome_tmf.api.Api
3183:                                .log("updateScriptClassPathForEnvironment NOT ALLOW");
3184:                        try {
3185:                            throw new Exception(
3186:                                    "updateScriptClassToBeExecutedForEnvironment NOT ALLOW");
3187:                        } catch (Exception e) {
3188:                            e.printStackTrace();
3189:                            org.objectweb.salome_tmf.api.Api.addException(e);
3190:                        }
3191:                        return;
3192:                    }
3193:                }
3194:
3195:                int _num = -1;
3196:                try {
3197:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3198:                    int idEnv = APCommun.getIdEnv(database, prop, idProject,
3199:                            envName);
3200:                    // Initialisation de l'ID du script
3201:                    int scriptId = CTCommun.getIdScriptEnvironment(database,
3202:                            prop, idEnv, scriptName);
3203:
3204:                    // Mise a jour de la suite de test
3205:                    PreparedStatement prep = database.prepareStatement(prop
3206:                            .getProperty("updateScriptClassToBeExecuted"));
3207:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateScriptClassPathForEnvironment"));
3208:                    prep.setString(1, newClassToBeExecuted);
3209:                    prep.setInt(2, scriptId);
3210:
3211:                    prep.executeUpdate();
3212:
3213:                } catch (SQLException E) {
3214:                    E.printStackTrace();
3215:                    org.objectweb.salome_tmf.api.Api.addException(
3216:                            "updateScriptClassToBeExecuted", null, E);
3217:                } catch (Exception ex) {
3218:                    ex.printStackTrace();
3219:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3220:                            ex);
3221:                }
3222:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3223:
3224:            }
3225:
3226:            /**
3227:             *
3228:             * @param familyName
3229:             * @param suiteName
3230:             * @param testName
3231:             * @param scriptName
3232:             * @param date
3233:             */
3234:            public void updateScriptDateForEnvironment(String envName,
3235:                    String scriptName, Date date) {
3236:                if (!special_allow) {
3237:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3238:                            .canUpdateCamp())
3239:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3240:                                    .canExecutCamp())) {
3241:                        org.objectweb.salome_tmf.api.Api
3242:                                .log("updateScriptDateForEnvironment NOT ALLOW");
3243:                        try {
3244:                            throw new Exception(
3245:                                    "updateScriptDateForEnvironment NOT ALLOW");
3246:                        } catch (Exception e) {
3247:                            e.printStackTrace();
3248:                            org.objectweb.salome_tmf.api.Api.addException(e);
3249:                        }
3250:                        return;
3251:                    }
3252:                }
3253:
3254:                int _num = -1;
3255:                try {
3256:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3257:                    int idEnv = APCommun.getIdEnv(database, prop, idProject,
3258:                            envName);
3259:                    // Initialisation de l'ID du script
3260:                    int scriptId = CTCommun.getIdScriptEnvironment(database,
3261:                            prop, idEnv, scriptName);
3262:                    // On initialise l'ID de l'attachement
3263:                    int scriptAttachId = CTCommun.getAttachIdScript(database,
3264:                            prop, scriptId, scriptName);
3265:
3266:                    // Mise a jour de la suite de test
3267:                    PreparedStatement prep = database.prepareStatement(prop
3268:                            .getProperty("updateFileAttachDate"));
3269:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateScriptDateForEnvironment"));
3270:                    prep.setDate(1, date);
3271:                    prep.setInt(2, scriptAttachId);
3272:
3273:                    prep.executeUpdate();
3274:
3275:                } catch (SQLException E) {
3276:                    E.printStackTrace();
3277:                    org.objectweb.salome_tmf.api.Api.addException(
3278:                            "updateFileAttachDate", null, E);
3279:                } catch (Exception ex) {
3280:                    ex.printStackTrace();
3281:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3282:                            ex);
3283:                }
3284:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3285:
3286:            }
3287:
3288:            /**
3289:             *
3290:             * @param familyName
3291:             * @param suiteName
3292:             * @param testName
3293:             * @param scriptName
3294:             * @param length
3295:             */
3296:            public void updateScriptLengthForEnvironment(String envName,
3297:                    String scriptName, long length) {
3298:                if (!special_allow) {
3299:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3300:                            .canUpdateCamp())
3301:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3302:                                    .canExecutCamp())) {
3303:                        org.objectweb.salome_tmf.api.Api
3304:                                .log("updateScriptDateForEnvironment NOT ALLOW");
3305:                        try {
3306:                            throw new Exception(
3307:                                    "updateScriptLengthForEnvironment NOT ALLOW");
3308:                        } catch (Exception e) {
3309:                            e.printStackTrace();
3310:                            org.objectweb.salome_tmf.api.Api.addException(e);
3311:                        }
3312:                        return;
3313:                    }
3314:                }
3315:
3316:                int _num = -1;
3317:                try {
3318:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3319:                    int idEnv = APCommun.getIdEnv(database, prop, idProject,
3320:                            envName);
3321:                    // Initialisation de l'ID du script
3322:                    int scriptId = CTCommun.getIdScriptEnvironment(database,
3323:                            prop, idEnv, scriptName);
3324:                    // On initialise l'ID de l'attachement
3325:                    int scriptAttachId = CTCommun.getAttachIdScript(database,
3326:                            prop, scriptId, scriptName);
3327:
3328:                    // Mise a jour de la suite de test
3329:                    PreparedStatement prep = database.prepareStatement(prop
3330:                            .getProperty("updateFileAttachLength"));
3331:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateScriptDateForEnvironment"));
3332:                    prep.setLong(1, length);
3333:                    prep.setInt(2, scriptAttachId);
3334:
3335:                    prep.executeUpdate();
3336:
3337:                } catch (SQLException E) {
3338:                    E.printStackTrace();
3339:                    org.objectweb.salome_tmf.api.Api.addException(
3340:                            "updateFileAttachLength", null, E);
3341:                } catch (Exception ex) {
3342:                    ex.printStackTrace();
3343:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3344:                            ex);
3345:                }
3346:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3347:
3348:            }
3349:
3350:            /**
3351:             *
3352:             * @param familyName
3353:             * @param suiteName
3354:             * @param testName
3355:             * @param filePath
3356:             * @throws FileNotFoundException
3357:             */
3358:            public void updateScriptForExecution(String campaignName,
3359:                    String execName, String type, String filePath)
3360:                    throws FileNotFoundException {
3361:                if (!special_allow) {
3362:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3363:                            .canUpdateCamp())
3364:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3365:                                    .canExecutCamp())) {
3366:                        org.objectweb.salome_tmf.api.Api
3367:                                .log("updateScriptForEnvironment NOT ALLOW");
3368:                        try {
3369:                            throw new Exception(
3370:                                    "updateScriptForExecution NOT ALLOW");
3371:                        } catch (Exception e) {
3372:                            e.printStackTrace();
3373:                            org.objectweb.salome_tmf.api.Api.addException(e);
3374:                        }
3375:                        return;
3376:                    }
3377:                }
3378:                int _num = -1;
3379:                try {
3380:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3381:                    // On cree le fichier e partir de l'URL
3382:                    File file = new File(filePath);
3383:                    // On recupere le nom du fichier
3384:                    String fileName = file.getName();
3385:                    // On enregistre le flux du fichier
3386:                    FileInputStream fis = new FileInputStream(file);
3387:                    BufferedInputStream bis = new BufferedInputStream(fis);
3388:
3389:                    int idExec = CTCommun.getIdExecCamp(database, prop,
3390:                            idProject, campaignName, execName);
3391:
3392:                    int scriptId = CTCommun.getIdScriptExecution(database,
3393:                            prop, idExec, fileName, type);
3394:                    // On initialise l'ID de l'attachement
3395:                    int scriptAttachId = CTCommun.getAttachIdScript(database,
3396:                            prop, scriptId, fileName);
3397:
3398:                    // Appel de la requete a executer
3399:                    PreparedStatement prep = database.prepareStatement(prop
3400:                            .getProperty("updateFileAttach"));
3401:                    prep.setBinaryStream(1, bis, bis.available());
3402:                    prep.setInt(2, scriptAttachId);
3403:
3404:                    prep.executeUpdate();
3405:                    bis.close();
3406:                } catch (SQLException sqle) {
3407:                    sqle.printStackTrace();
3408:                    org.objectweb.salome_tmf.api.Api.addException(
3409:                            "updateFileAttach", null, sqle);
3410:                } catch (Exception e) {
3411:                    org.objectweb.salome_tmf.api.Api
3412:                            .addException(null, null, e);
3413:                    if (e instanceof  FileNotFoundException) {
3414:                        org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3415:                        e.printStackTrace();
3416:                        throw new FileNotFoundException();
3417:                    }
3418:                }
3419:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3420:            }
3421:
3422:            /**
3423:             *
3424:             * @param familyName
3425:             * @param suiteName
3426:             * @param testName
3427:             * @param scriptName
3428:             * @param newClassPath
3429:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
3430:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
3431:             */
3432:            public void updateScriptPlugExtForExecution(String campaignName,
3433:                    String execName, String type, String scriptName,
3434:                    String newClassPath) {
3435:                if (!special_allow) {
3436:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3437:                            .canUpdateCamp())
3438:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3439:                                    .canExecutCamp())) {
3440:                        org.objectweb.salome_tmf.api.Api
3441:                                .log("updateScriptClassPathForExecution NOT ALLOW");
3442:                        try {
3443:                            throw new Exception(
3444:                                    "updateScriptClassPathForExecution NOT ALLOW");
3445:                        } catch (Exception e) {
3446:                            e.printStackTrace();
3447:                            org.objectweb.salome_tmf.api.Api.addException(e);
3448:                        }
3449:                        return;
3450:                    }
3451:                }
3452:
3453:                int _num = -1;
3454:                try {
3455:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3456:                    int idExec = CTCommun.getIdExecCamp(database, prop,
3457:                            idProject, campaignName, execName);
3458:                    // Initialisation de l'ID du script
3459:                    int scriptId = CTCommun.getIdScriptExecution(database,
3460:                            prop, idExec, scriptName, type);
3461:
3462:                    // Mise a jour de la suite de test
3463:                    PreparedStatement prep = database.prepareStatement(prop
3464:                            .getProperty("updateScriptClassPath"));
3465:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateScriptClassPathForExecution"));
3466:                    prep.setString(1, newClassPath);
3467:                    prep.setInt(2, scriptId);
3468:
3469:                    prep.executeUpdate();
3470:
3471:                } catch (SQLException E) {
3472:                    E.printStackTrace();
3473:                    org.objectweb.salome_tmf.api.Api.addException(
3474:                            "updateScriptClassPath", null, E);
3475:                } catch (Exception ex) {
3476:                    ex.printStackTrace();
3477:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3478:                            ex);
3479:                }
3480:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3481:
3482:            }
3483:
3484:            /**
3485:             *
3486:             * @param familyName
3487:             * @param suiteName
3488:             * @param testName
3489:             * @param scriptName
3490:             * @param newClassToBeExecuted
3491:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
3492:             * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
3493:             */
3494:            public void updateScriptPlugArgForExecution(String campaignName,
3495:                    String execName, String type, String scriptName,
3496:                    String plugArg) {
3497:                if (!special_allow) {
3498:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3499:                            .canUpdateCamp())
3500:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3501:                                    .canExecutCamp())) {
3502:                        org.objectweb.salome_tmf.api.Api
3503:                                .log("updateScriptClassToBeExecutedForExecution NOT ALLOW");
3504:                        try {
3505:                            throw new Exception(
3506:                                    "updateScriptClassToBeExecutedForExecution NOT ALLOW");
3507:                        } catch (Exception e) {
3508:                            e.printStackTrace();
3509:                            org.objectweb.salome_tmf.api.Api.addException(e);
3510:                        }
3511:                        return;
3512:                    }
3513:                }
3514:
3515:                int _num = -1;
3516:                try {
3517:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3518:                    int idExec = CTCommun.getIdExecCamp(database, prop,
3519:                            idProject, campaignName, execName);
3520:                    // Initialisation de l'ID du script
3521:                    int scriptId = CTCommun.getIdScriptExecution(database,
3522:                            prop, idExec, scriptName, type);
3523:
3524:                    // Mise a jour de la suite de test
3525:                    PreparedStatement prep = database.prepareStatement(prop
3526:                            .getProperty("updateScriptClassToBeExecuted"));
3527:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateScriptClassToBeExecutedForExecution"));
3528:                    prep.setString(1, plugArg);
3529:                    prep.setInt(2, scriptId);
3530:
3531:                    prep.executeUpdate();
3532:
3533:                } catch (SQLException E) {
3534:                    E.printStackTrace();
3535:                    org.objectweb.salome_tmf.api.Api.addException(
3536:                            "updateScriptClassToBeExecuted", null, E);
3537:                } catch (Exception ex) {
3538:                    ex.printStackTrace();
3539:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3540:                            ex);
3541:                }
3542:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3543:
3544:            }
3545:
3546:            /**
3547:             *
3548:             * @param familyName
3549:             * @param suiteName
3550:             * @param testName
3551:             * @param scriptName
3552:             * @param date
3553:             */
3554:            public void updateScriptDateForExecution(String campaignName,
3555:                    String execName, String type, String scriptName, Date date) {
3556:                if (!special_allow) {
3557:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3558:                            .canUpdateCamp())
3559:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3560:                                    .canExecutCamp())) {
3561:                        org.objectweb.salome_tmf.api.Api
3562:                                .log("updateScriptDateForEnvironment NOT ALLOW");
3563:                        try {
3564:                            throw new Exception(
3565:                                    "updateScriptDateForExecution NOT ALLOW");
3566:                        } catch (Exception e) {
3567:                            e.printStackTrace();
3568:                            org.objectweb.salome_tmf.api.Api.addException(e);
3569:                        }
3570:                        return;
3571:                    }
3572:                }
3573:
3574:                int _num = -1;
3575:                try {
3576:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3577:                    int idExec = CTCommun.getIdExecCamp(database, prop,
3578:                            idProject, campaignName, execName);
3579:                    // Initialisation de l'ID du script
3580:                    int scriptId = CTCommun.getIdScriptExecution(database,
3581:                            prop, idExec, scriptName, type);
3582:                    // On initialise l'ID de l'attachement
3583:                    int scriptAttachId = CTCommun.getAttachIdScript(database,
3584:                            prop, scriptId, scriptName);
3585:
3586:                    // Mise a jour de la suite de test
3587:                    PreparedStatement prep = database.prepareStatement(prop
3588:                            .getProperty("updateFileAttachDate"));
3589:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateScriptDateForEnvironment"));
3590:                    prep.setDate(1, date);
3591:                    prep.setInt(2, scriptAttachId);
3592:
3593:                    prep.executeUpdate();
3594:
3595:                } catch (SQLException E) {
3596:                    E.printStackTrace();
3597:                    org.objectweb.salome_tmf.api.Api.addException("addSuite",
3598:                            null, E);
3599:                } catch (Exception ex) {
3600:                    ex.printStackTrace();
3601:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3602:                            ex);
3603:                }
3604:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3605:
3606:            }
3607:
3608:            /**
3609:             *
3610:             * @param familyName
3611:             * @param suiteName
3612:             * @param testName
3613:             * @param scriptName
3614:             * @param length
3615:             */
3616:            public void updateScriptLengthForExecution(String campaignName,
3617:                    String execName, String type, String scriptName, long length) {
3618:                if (!special_allow) {
3619:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3620:                            .canUpdateCamp())
3621:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3622:                                    .canExecutCamp())) {
3623:                        org.objectweb.salome_tmf.api.Api
3624:                                .log("updateScriptDateForEnvironment NOT ALLOW");
3625:                        try {
3626:                            throw new Exception(
3627:                                    "updateScriptLengthForExecution NOT ALLOW");
3628:                        } catch (Exception e) {
3629:                            e.printStackTrace();
3630:                            org.objectweb.salome_tmf.api.Api.addException(e);
3631:                        }
3632:                        return;
3633:                    }
3634:                }
3635:
3636:                int _num = -1;
3637:                try {
3638:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3639:                    int idExec = CTCommun.getIdExecCamp(database, prop,
3640:                            idProject, campaignName, execName);
3641:                    // Initialisation de l'ID du script
3642:                    int scriptId = CTCommun.getIdScriptExecution(database,
3643:                            prop, idExec, scriptName, type);
3644:                    // On initialise l'ID de l'attachement
3645:                    int scriptAttachId = CTCommun.getAttachIdScript(database,
3646:                            prop, scriptId, scriptName);
3647:
3648:                    // Mise a jour de la suite de test
3649:                    PreparedStatement prep = database.prepareStatement(prop
3650:                            .getProperty("updateScriptLength"));
3651:                    //org.objectweb.salome_tmf.api.Api.log(prop.getProperty("updateScriptDateForEnvironment"));
3652:                    prep.setLong(1, length);
3653:                    prep.setInt(2, scriptAttachId);
3654:
3655:                    prep.executeUpdate();
3656:
3657:                } catch (SQLException E) {
3658:                    E.printStackTrace();
3659:                    org.objectweb.salome_tmf.api.Api.addException(
3660:                            "updateScriptLength", null, E);
3661:                } catch (Exception ex) {
3662:                    ex.printStackTrace();
3663:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3664:                            ex);
3665:                }
3666:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3667:
3668:            }
3669:
3670:            /**
3671:             * Mise e jour du jeu de donnees lie e une execution de campagne de test
3672:             * @param idExec ID unique de l'execution dans la BdD
3673:             * @param idDataSet ID unique du jeu de donnees dans la BdD
3674:             */
3675:            public void updateDataSetForExecCamp(int idExec, int idDataSet) {
3676:                if (!special_allow) {
3677:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3678:                            .canUpdateCamp())
3679:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3680:                                    .canExecutCamp())) {
3681:                        org.objectweb.salome_tmf.api.Api
3682:                                .log("updateDataSetForExecCamp NOT ALLOW");
3683:                        try {
3684:                            throw new Exception(
3685:                                    "updateDataSetForExecCamp NOT ALLOW");
3686:                        } catch (Exception e) {
3687:                            e.printStackTrace();
3688:                            org.objectweb.salome_tmf.api.Api.addException(e);
3689:                        }
3690:                        return;
3691:                    }
3692:                }
3693:
3694:                int _num = -1;
3695:                try {
3696:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3697:                    // Mise a jour de la suite de test
3698:                    PreparedStatement prep = database.prepareStatement(prop
3699:                            .getProperty("updateDataSetForExec"));
3700:                    prep.setInt(1, idDataSet);
3701:                    prep.setInt(2, idExec);
3702:
3703:                    prep.executeUpdate();
3704:
3705:                } catch (SQLException E) {
3706:                    E.printStackTrace();
3707:                    org.objectweb.salome_tmf.api.Api.addException(
3708:                            "updateDataSetForExecCamp", null, E);
3709:                } catch (Exception ex) {
3710:                    ex.printStackTrace();
3711:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3712:                            ex);
3713:                }
3714:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3715:            }
3716:
3717:            /**
3718:             * Mise e jour de l'environnement lie e une execution de campagne de test
3719:             * @param idExec ID unique de l'execution dans la BdD
3720:             * @param idEnv ID unique de l'environnement dans la BdD
3721:             */
3722:            public void updateEnvForExecCamp(int idExec, int idEnv) {
3723:                if (!special_allow) {
3724:                    if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3725:                            .canUpdateCamp())
3726:                            && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
3727:                                    .canExecutCamp())) {
3728:                        org.objectweb.salome_tmf.api.Api
3729:                                .log("updateEnvForExecCamp NOT ALLOW");
3730:                        try {
3731:                            throw new Exception(
3732:                                    "updateEnvForExecCamp NOT ALLOW");
3733:                        } catch (Exception e) {
3734:                            e.printStackTrace();
3735:                            org.objectweb.salome_tmf.api.Api.addException(e);
3736:                        }
3737:                        return;
3738:                    }
3739:                }
3740:
3741:                int _num = -1;
3742:                try {
3743:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
3744:                    // Mise a jour de la suite de test
3745:                    PreparedStatement prep = database.prepareStatement(prop
3746:                            .getProperty("updateEnvForExec"));
3747:                    prep.setInt(1, idEnv);
3748:                    prep.setInt(2, idExec);
3749:
3750:                    prep.executeUpdate();
3751:
3752:                } catch (SQLException E) {
3753:                    E.printStackTrace();
3754:                    org.objectweb.salome_tmf.api.Api.addException(
3755:                            "updateEnvForExecCamp", null, E);
3756:                } catch (Exception ex) {
3757:                    ex.printStackTrace();
3758:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
3759:                            ex);
3760:                }
3761:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
3762:            }
3763:
3764:        } // fin de la classe
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.