001: /*
002: * SalomeTMF is a Test Management Framework
003: * Copyright (C) 2005 France Telecom R&D
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: *
019: * @author Fayçal SOUGRATI
020: *
021: * Contact: mikael.marche@rd.francetelecom.com
022: */
023:
024: package org.objectweb.salome_tmf.api.api2ihm.adminVT;
025:
026: import java.sql.PreparedStatement;
027: import java.sql.SQLException;
028: import java.util.Properties;
029: import java.util.Vector;
030:
031: import org.objectweb.salome_tmf.api.Api;
032: import org.objectweb.salome_tmf.api.api2db.DataBase;
033: import org.objectweb.salome_tmf.api.api2ihm.AdminProject;
034: import org.objectweb.salome_tmf.api.api2ihm.AdminVT;
035: import org.objectweb.salome_tmf.api.api2ihm.CampTest;
036: import org.objectweb.salome_tmf.api.api2ihm.SuiteTest;
037: import org.objectweb.salome_tmf.api.api2ihm.Utile;
038: import org.objectweb.salome_tmf.api.api2ihm.adminProject.AdminProjectDelete;
039: import org.objectweb.salome_tmf.api.api2ihm.adminProject.AdminProjectSelect;
040: import org.objectweb.salome_tmf.api.api2ihm.campTest.CampTestDelete;
041: import org.objectweb.salome_tmf.api.api2ihm.campTest.CampTestSelect;
042: import org.objectweb.salome_tmf.api.api2ihm.suiteTest.SuiteTestDelete;
043: import org.objectweb.salome_tmf.api.api2ihm.suiteTest.SuiteTestSelect;
044:
045: /**
046: * Fonctions de suppression relatives e l'aire fonctionnelle "Administrer SalomeTMF"
047: */
048:
049: public class AdminVTDeleteImpl implements AdminVTDelete {
050: /**
051: * Base de donnees SalomeTMF
052: */
053: DataBase database;
054:
055: /**
056: * Fichier "properties" contenant les requetes SQL relatives a l'administration
057: */
058: Properties prop;
059:
060: /**
061: * Constructeur
062: * @param db
063: * @param pr
064: */
065: public AdminVTDeleteImpl(DataBase db, Properties pr) {
066: database = db;
067: prop = pr;
068: }
069:
070: /**
071: * Suppression d'un utilisateur de la base SalomeTMF
072: * @param userLogin
073: */
074: public void deleteUserFromVT(String userLogin) {
075: Vector VTProjects = new Vector();
076: AdminVT AVT = Api.getInstanceOfAdminVT();
077: AdminVTSelect AVTS = AVT.getAdminVTSelect();
078: //AdminVTDelete AVTD = AVT.getAdminVTDelete();
079:
080: AdminProject AP = Api.getInstanceOfAdminProject();
081: AdminProjectDelete APD = AP.getAdminProjectDelete();
082:
083: // On supprime l'utilisateur dans tous les projets existants
084: VTProjects = AVTS.getAllVTProjectsName();
085: for (int i = 0; i < VTProjects.size(); i++) {
086: APD.setProject(VTProjects.elementAt(i).toString());
087: APD.deleteUserFromProject(userLogin);
088: }
089:
090: // Ensuite on le supprime de la base SalomeTMF
091: int _num = -1;
092: try {
093: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
094:
095: PreparedStatement prep = database.prepareStatement(prop
096: .getProperty("deleteUserFromVT"));
097: prep.setString(1, userLogin);
098: prep.executeUpdate();
099:
100: } catch (SQLException e) {
101: e.printStackTrace();
102: org.objectweb.salome_tmf.api.Api.addException(
103: "deleteUserFromVT", null, e);
104: } catch (Exception ex) {
105: ex.printStackTrace();
106: org.objectweb.salome_tmf.api.Api.addException(null, null,
107: ex);
108: }
109: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
110: }
111:
112: /**
113: * Suppression d'un projet de la base SalomeTMF
114: * @param projectName
115: */
116: public void deleteProjectFromVT(String projectName) {
117:
118: int projectId = 0;
119:
120: Vector projectGroups = new Vector();
121: Vector projectFamilies = new Vector();
122: Vector projectCampaigns = new Vector();
123: Vector projectEnv = new Vector();
124: Vector projectParam = new Vector();
125:
126: //org.objectweb.salome_tmf.api.Api.getInstanceOfBugzillaAPI().deleteProduct(projectName);
127:
128: AdminProject AP = Api.getInstanceOfAdminProject();
129: AdminProjectSelect APS = AP.getAdminProjectSelect();
130: AdminProjectDelete APD = AP.getAdminProjectDelete();
131:
132: SuiteTest ST = Api.getInstanceOfSuiteTest();
133: SuiteTestSelect STS = ST.getSuiteTestSelect();
134: SuiteTestDelete STD = ST.getSuiteTestDelete();
135:
136: CampTest CT = Api.getInstanceOfCampTest();
137: CampTestSelect CTS = CT.getCampTestSelect();
138: CampTestDelete CTD = CT.getCampTestDelete();
139:
140: int _num = -1;
141: try {
142: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
143:
144: // Initialisation de l'ID du projet
145: projectId = Utile.getIdProject(database, prop, projectName);
146:
147: // Positionnement du projet dans lequel on travaille
148: APS.setProject(projectName);
149: APD.setProject(projectName);
150: STS.setProject(projectName);
151: STD.setProject(projectName);
152: CTS.setProject(projectName);
153: CTD.setProject(projectName);
154:
155: // Suppression de toutes campagnes de test du projet
156: projectCampaigns = CTS.getProjectCampaigns();
157: for (int i = 0; i < projectCampaigns.size(); i++) {
158: CTD.deleteCampaign(projectCampaigns.elementAt(i)
159: .toString());
160: }
161:
162: // Suppression de tous les environnements
163: projectEnv = APS.getProjectEnvsName();
164: for (int i = 0; i < projectEnv.size(); i++) {
165: CTD.deleteEnvFromProject(projectEnv.elementAt(i)
166: .toString());
167: }
168:
169: // Suppression des parametres
170: projectParam = APS.getProjectParamsName();
171: for (int i = 0; i < projectParam.size(); i++) {
172: CTD.deleteParamFromProject(projectParam.elementAt(i)
173: .toString());
174: }
175:
176: // Suppression de toutes les familles de test du projet
177: projectFamilies = STS.getProjectFamilies();
178: for (int i = 0; i < projectFamilies.size(); i++) {
179: STD.deleteFamily(projectFamilies.elementAt(i)
180: .toString());
181: }
182:
183: // Suppression de tous les groupes d'utilisateurs du projet
184: projectGroups = APS.getAllProjectGroupsName();
185: for (int i = 0; i < projectGroups.size(); i++) {
186: APD.deleteGroup(projectGroups.elementAt(i).toString());
187: }
188:
189: // Suppression du projet
190: PreparedStatement prep = database.prepareStatement(prop
191: .getProperty("deleteProjectFromVT"));
192: prep.setInt(1, projectId);
193: prep.executeUpdate();
194:
195: // Suppression des log d'action du projet
196: prep = database.prepareStatement(prop
197: .getProperty("lockAction"));
198: prep.execute();
199: prep = database.prepareStatement(prop
200: .getProperty("deleteLastChange"));
201: prep.setString(1, projectName);
202: prep.executeUpdate();
203:
204: /*// Suppression des donnees de la table "CONNECTION"
205: prep = database.prepareStatement(prop.getProperty("deleteAllConnections"));
206: prep.executeUpdate();
207: */
208:
209: } catch (SQLException e) {
210: e.printStackTrace();
211: org.objectweb.salome_tmf.api.Api.addException(
212: "deleteProjectFromVT", null, e);
213: } catch (Exception ex) {
214: ex.printStackTrace();
215: org.objectweb.salome_tmf.api.Api.addException(null, null,
216: ex);
217: }
218: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
219: }
220:
221: public void sanityCheck() {
222: return;
223: /*
224: DataSet stmtRes = null;
225: DataSet stmtRes2 = null;
226: PreparedStatement prep;
227: PreparedStatement prep2;
228: int nb =0 ;
229:
230: try {
231: // Suppression des familles non liees aux projets
232: prep = database.prepareStatement(prop.getProperty("deleteBadFamilly"));
233: nb = prep.executeUpdate();
234: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadFamilly");
235:
236: // Suppression des suites non liees aux familles
237: prep = database.prepareStatement(prop.getProperty("deleteBadSuite"));
238: nb = prep.executeUpdate();
239: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadSuite");
240:
241: // Suppression des attachements non lies aux suites
242: prep = database.prepareStatement(prop.getProperty("selectBadSuiteAttach"));
243: stmtRes = new DataSet(prep.executeQuery());
244: while (stmtRes.hasMoreElements()) {
245: int id_attach = stmtRes.getResults().getInt("ATTACHEMENT_id_attach");
246: prep = database.prepareStatement(prop.getProperty("deleteAttach"));
247: prep.setInt(1, id_attach);
248: nb = prep.executeUpdate();
249: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
250: }
251: prep = database.prepareStatement(prop.getProperty("deleteBadSuiteAttach"));
252: nb = prep.executeUpdate();
253: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadSuiteAttach");
254:
255: // Suppression des cas non liees aux suites
256: prep = database.prepareStatement(prop.getProperty("deleteBadCas"));
257: nb = prep.executeUpdate();
258: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadCas");
259:
260: // Suppression des attachements non lies aux cas
261: prep = database.prepareStatement(prop.getProperty("selectBadCasAttach"));
262: stmtRes = new DataSet(prep.executeQuery());
263: while (stmtRes.hasMoreElements()) {
264: int id_attach = stmtRes.getResults().getInt("ATTACHEMENT_id_attach");
265: prep = database.prepareStatement(prop.getProperty("deleteAttach"));
266: prep.setInt(1, id_attach);
267: nb = prep.executeUpdate();
268: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
269: }
270: prep = database.prepareStatement(prop.getProperty("deleteBadCasAttach"));
271: nb = prep.executeUpdate();
272: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadCasAttach");
273:
274: //Suppresion des parametres lies aux cas
275: prep = database.prepareStatement(prop.getProperty("deleteBadCasParam"));
276: nb = prep.executeUpdate();
277: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadCasParam");
278:
279: // Suppression des actions non liees aux cas
280: prep = database.prepareStatement(prop.getProperty("deleteBadAction"));
281: nb = prep.executeUpdate();
282: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadAction");
283:
284: // Suppression des attachements non lies aux actions
285: prep = database.prepareStatement(prop.getProperty("selectBadActionAttach"));
286: stmtRes = new DataSet(prep.executeQuery());
287: while (stmtRes.hasMoreElements()) {
288: int id_attach = stmtRes.getResults().getInt("ATTACHEMENT_id_attach");
289: prep = database.prepareStatement(prop.getProperty("deleteAttach"));
290: prep.setInt(1, id_attach);
291: nb = prep.executeUpdate();
292: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
293: }
294: prep = database.prepareStatement(prop.getProperty("deleteBadActionAttach"));
295: nb = prep.executeUpdate();
296: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadActionAttach");
297:
298: // Suppression des parametres utilises dans les actions
299: prep = database.prepareStatement(prop.getProperty("deleteBadActionParam"));
300: nb = prep.executeUpdate();
301: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadActionParam");
302:
303:
304: // Suppression des environnements non utilises dans les projets
305: prep = database.prepareStatement(prop.getProperty("deleteBadEnv"));
306: nb = prep.executeUpdate();
307: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadEnv");
308:
309: // Suppression des Scripts d'environnement non utilises
310: prep = database.prepareStatement(prop.getProperty("selectBadScriptEnv"));
311: stmtRes = new DataSet(prep.executeQuery());
312: while (stmtRes.hasMoreElements()) {
313: int id_script = stmtRes.getResults().getInt("id_script");
314: prep = database.prepareStatement(prop.getProperty("selectAttchScript"));
315: prep.setInt(1, id_script);
316: stmtRes2 = new DataSet(prep.executeQuery());
317: while (stmtRes2.hasMoreElements()) {
318: int id_attach = stmtRes2.getResults().getInt("ATTACHEMENT_id_attach");
319: prep2 = database.prepareStatement(prop.getProperty("deleteAttach"));
320: prep2.setInt(1, id_attach);
321: nb = prep2.executeUpdate();
322: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
323: }
324: }
325: prep = database.prepareStatement(prop.getProperty("deleteBadScriptEnv"));
326: nb = prep.executeUpdate();
327: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadScriptEnv");
328:
329: // Suppression des attachements d'environnements
330: prep = database.prepareStatement(prop.getProperty("selectBadEnvAttach"));
331: stmtRes = new DataSet(prep.executeQuery());
332: while (stmtRes.hasMoreElements()) {
333: int id_attach = stmtRes.getResults().getInt("ATTACHEMENT_id_attach");
334: prep = database.prepareStatement(prop.getProperty("deleteAttach"));
335: prep.setInt(1, id_attach);
336: nb = prep.executeUpdate();
337: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
338: }
339: prep = database.prepareStatement(prop.getProperty("deteleBadEnvAttach"));
340: nb = prep.executeUpdate();
341: org.objectweb.salome_tmf.api.Api.log(nb + " : deteleBadEnvAttach");
342:
343:
344: // Suppression des parametres non utilises dans les projets
345: prep = database.prepareStatement(prop.getProperty("deleteBadParam"));
346: nb = prep.executeUpdate();
347: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadParam");
348:
349: prep = database.prepareStatement(prop.getProperty("deleteBadValueParam"));
350: nb = prep.executeUpdate();
351: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadValueParam");
352:
353: // Suppression des campagnes de tests non liees aux projets
354: prep = database.prepareStatement(prop.getProperty("deleteBadCampagne"));
355: nb = prep.executeUpdate();
356: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadCampagne");
357:
358: // Suppression des cas de tests non liees aux campagnes
359: prep = database.prepareStatement(prop.getProperty("deleteBadCampagneCas1"));
360: nb = prep.executeUpdate();
361: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadCampagneCas1");
362:
363: prep = database.prepareStatement(prop.getProperty("deleteBadCampagneCas2"));
364: nb = prep.executeUpdate();
365: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadCampagneCas2");
366:
367: // Suppression des attachements non lies aux campagnes
368: prep = database.prepareStatement(prop.getProperty("selectBadCampagneAttach"));
369: stmtRes = new DataSet(prep.executeQuery());
370: while (stmtRes.hasMoreElements()) {
371: int id_attach = stmtRes.getResults().getInt("ATTACHEMENT_id_attach");
372: prep = database.prepareStatement(prop.getProperty("deleteAttach"));
373: prep.setInt(1, id_attach);
374: nb = prep.executeUpdate();
375: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
376: }
377: prep = database.prepareStatement(prop.getProperty("deleteBadCampagneAttach"));
378: nb = prep.executeUpdate();
379: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadCampagneAttach");
380:
381: // Suppression des jeux de donnees non lies aux campagnes
382: prep = database.prepareStatement(prop.getProperty("deleteBadData"));
383: nb = prep.executeUpdate();
384: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadData");
385:
386: // Suppression des executions non liees aux C/E/JD
387: prep = database.prepareStatement(prop.getProperty("deleteBadExecCamp1"));
388: nb = prep.executeUpdate();
389: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadExecCamp1");
390:
391: prep = database.prepareStatement(prop.getProperty("deleteBadExecCamp2"));
392: nb = prep.executeUpdate();
393: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadExecCamp2");
394:
395: prep = database.prepareStatement(prop.getProperty("deleteBadExecCamp3"));
396: nb = prep.executeUpdate();
397: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadExecCamp3");
398:
399: //Suppression des attachements d'une exec
400: prep = database.prepareStatement(prop.getProperty("selectBadExecAttach"));
401: stmtRes = new DataSet(prep.executeQuery());
402: while (stmtRes.hasMoreElements()) {
403: int id_attach = stmtRes.getResults().getInt("ATTACHEMENT_id_attach");
404: prep = database.prepareStatement(prop.getProperty("deleteAttach"));
405: prep.setInt(1, id_attach);
406: nb = prep.executeUpdate();
407: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
408: }
409: prep = database.prepareStatement(prop.getProperty("deleteBadExecAttach"));
410: nb = prep.executeUpdate();
411: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadExecAttach");
412:
413: //Suppression des scriptes des executions non liees
414: prep = database.prepareStatement(prop.getProperty("selectBadScriptExec"));
415: stmtRes = new DataSet(prep.executeQuery());
416: while (stmtRes.hasMoreElements()) {
417: int id_script = stmtRes.getResults().getInt("id_script");
418: prep = database.prepareStatement(prop.getProperty("selectAttchScript"));
419: prep.setInt(1, id_script);
420: stmtRes2 = new DataSet(prep.executeQuery());
421: while (stmtRes2.hasMoreElements()) {
422: int id_attach = stmtRes2.getResults().getInt("ATTACHEMENT_id_attach");
423: prep2 = database.prepareStatement(prop.getProperty("deleteAttach"));
424: prep2.setInt(1, id_attach);
425: nb = prep2.executeUpdate();
426: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
427: }
428: }
429: prep = database.prepareStatement(prop.getProperty("deleteBadScriptExec"));
430: nb = prep.executeUpdate();
431: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadScriptExec");
432:
433: //Suppression des resultats d'execution d'une execution
434: prep = database.prepareStatement(prop.getProperty("deleteBadResExecCamp"));
435: nb = prep.executeUpdate();
436: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadResExecCamp");
437:
438: //Suppression des attachements d'un resultat d'exec
439: prep = database.prepareStatement(prop.getProperty("selectBadResExecAttach"));
440: stmtRes = new DataSet(prep.executeQuery());
441: while (stmtRes.hasMoreElements()) {
442: int id_attach = stmtRes.getResults().getInt("ATTACHEMENT_id_attach");
443: prep = database.prepareStatement(prop.getProperty("deleteAttach"));
444: prep.setInt(1, id_attach);
445: nb = prep.executeUpdate();
446: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
447: }
448:
449: prep = database.prepareStatement(prop.getProperty("deleteBadResExecAttach"));
450: nb = prep.executeUpdate();
451: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadResExecAttach");
452:
453: //Suppression des resultats d'execution des cas de tests
454: prep = database.prepareStatement(prop.getProperty("deleteBadResExecCas"));
455: nb = prep.executeUpdate();
456: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadResExecCas");
457:
458: prep = database.prepareStatement(prop.getProperty("deleteBadResExecCas2"));
459: nb = prep.executeUpdate();
460: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadResExecCas2");
461:
462: //Suppression des attachements d'un resultat d'exec de cas de test
463: prep = database.prepareStatement(prop.getProperty("selectBadResExecCasAttach"));
464: stmtRes = new DataSet(prep.executeQuery());
465: while (stmtRes.hasMoreElements()) {
466: int id_attach = stmtRes.getResults().getInt("ATTACHEMENT_id_attach");
467: prep = database.prepareStatement(prop.getProperty("deleteAttach"));
468: prep.setInt(1, id_attach);
469: nb = prep.executeUpdate();
470: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
471: }
472: prep = database.prepareStatement(prop.getProperty("deleteBadResExecCasAttach"));
473: nb = prep.executeUpdate();
474: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadResExecCasAttach");
475:
476: //Suppression des resultats d'execution des actions de tests
477: prep = database.prepareStatement(prop.getProperty("deleteBadResExecAction"));
478: nb = prep.executeUpdate();
479: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadResExecAction");
480:
481: prep = database.prepareStatement(prop.getProperty("deleteBadResExecAction2"));
482: nb = prep.executeUpdate();
483: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadResExecAction2");
484:
485: //Suppression des attachements d'un resultat d'exec d'une action de test
486: prep = database.prepareStatement(prop.getProperty("selectBadResExecActionAttach"));
487: stmtRes = new DataSet(prep.executeQuery());
488: while (stmtRes.hasMoreElements()) {
489: int id_attach = stmtRes.getResults().getInt("ATTACHEMENT_id_attach");
490: prep = database.prepareStatement(prop.getProperty("deleteAttach"));
491: prep.setInt(1, id_attach);
492: nb = prep.executeUpdate();
493: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteAttach");
494: }
495: prep = database.prepareStatement(prop.getProperty("deleteBadResExecActionAttach"));
496: nb = prep.executeUpdate();
497: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadResExecActionAttach");
498:
499: //Suppresion des liasons d'attachement avec les scripts
500: prep = database.prepareStatement(prop.getProperty("deleteBadScriptAttach1"));
501: nb = prep.executeUpdate();
502: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadScriptAttach1");
503:
504: prep = database.prepareStatement(prop.getProperty("deleteBadScriptAttach2"));
505: nb = prep.executeUpdate();
506: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadScriptAttach2");
507:
508: //Suppression des valeurs params non liees
509: prep = database.prepareStatement(prop.getProperty("deleteBadValueParam2"));
510: nb = prep.executeUpdate();
511: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadValueParam2");
512:
513: prep = database.prepareStatement(prop.getProperty("deleteBadValueParam3"));
514: nb = prep.executeUpdate();
515: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadValueParam3");
516:
517: prep = database.prepareStatement(prop.getProperty("deleteBadValueParam4"));
518: nb = prep.executeUpdate();
519: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadValueParam4");
520:
521: prep = database.prepareStatement(prop.getProperty("deleteBadCasParam2"));
522: nb = prep.executeUpdate();
523: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadCasParam2");
524:
525: prep = database.prepareStatement(prop.getProperty("deleteBadActionParam2"));
526: nb = prep.executeUpdate();
527: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadActionParam2");
528:
529:
530: //Suppression des attachements non liees
531: prep = database.prepareStatement(prop.getProperty("deleteBadAttach"));
532: nb = prep.executeUpdate();
533: org.objectweb.salome_tmf.api.Api.log(nb + " : deleteBadAttach");
534:
535: }catch (SQLException e) {
536: e.printStackTrace();
537: }catch (Exception ex) {
538: ex.printStackTrace();
539: }
540: */
541: }
542:
543: /**
544: * Supprime la session id de la table connection
545: */
546: public void deleteSession(int id) {
547: int _num = -1;
548: try {
549: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
550:
551: PreparedStatement prep = database.prepareStatement(prop
552: .getProperty("deleteAConnection"));
553: prep.setInt(1, id);
554: prep.executeUpdate();
555: } catch (SQLException e) {
556: e.printStackTrace();
557: org.objectweb.salome_tmf.api.Api.addException(
558: "deleteAConnection", null, e);
559: } catch (Exception ex) {
560: ex.printStackTrace();
561: org.objectweb.salome_tmf.api.Api.addException(null, null,
562: ex);
563: }
564: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
565: }
566:
567: /**
568: * Supprime les sessions de la table connection
569: */
570: public void deleteAllSession() {
571: int _num = -1;
572: try {
573: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
574:
575: PreparedStatement prep = database.prepareStatement(prop
576: .getProperty("deleteAllConnections"));
577: prep.executeUpdate();
578: } catch (SQLException e) {
579: e.printStackTrace();
580: org.objectweb.salome_tmf.api.Api.addException(
581: "deleteAllConnections", null, e);
582: } catch (Exception ex) {
583: ex.printStackTrace();
584: org.objectweb.salome_tmf.api.Api.addException(null, null,
585: ex);
586: }
587: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
588: }
589: }
|