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