0001: /*
0002: * SalomeTMF is a Test Management Framework
0003: * Copyright (C) 2005 France Telecom R&D
0004: *
0005: * This library is free software; you can redistribute it and/or
0006: * modify it under the terms of the GNU Lesser General Public
0007: * License as published by the Free Software Foundation; either
0008: * version 2 of the License, or (at your option) any later version.
0009: *
0010: * This library is distributed in the hope that it will be useful,
0011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013: * Lesser General Public License for more details.
0014: *
0015: * You should have received a copy of the GNU Lesser General Public
0016: * License along with this library; if not, write to the Free Software
0017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0018: *
0019: * @author Fayçal SOUGRATI
0020: *
0021: * Contact: mikael.marche@rd.francetelecom.com
0022: */
0023:
0024: package org.objectweb.salome_tmf.api.api2ihm.campTest;
0025:
0026: import java.io.File;
0027: import java.sql.Date;
0028: import java.sql.PreparedStatement;
0029: import java.sql.SQLException;
0030: import java.sql.Time;
0031: import java.util.Properties;
0032:
0033: import org.objectweb.salome_tmf.api.Api;
0034: import org.objectweb.salome_tmf.api.api2db.DataBase;
0035: import org.objectweb.salome_tmf.api.api2db.DataSet;
0036: import org.objectweb.salome_tmf.api.api2ihm.Utile;
0037: import org.objectweb.salome_tmf.api.api2ihm.adminProject.APCommun;
0038: import org.objectweb.salome_tmf.api.api2ihm.suiteTest.STCommun;
0039:
0040: /**
0041: * Fonctions de suppression relatives à l'aire fonctionnelle "campagnes de test"
0042: * @author Fayçal SOUGRATI
0043: */
0044: public class CampTestInsertImpl implements CampTestInsert {
0045: /**
0046: * Base de donnees
0047: */
0048: DataBase database;
0049:
0050: /**
0051: * Fichier "properties" contenant les requetes SQL relatives aux campagnes de test
0052: */
0053: Properties prop;
0054:
0055: /**
0056: * ID du projet SalomeTMF dans lequel on se situe
0057: */
0058: int idProject;
0059:
0060: /**
0061: * Nom du projet SalomeTMF dans lequel on se situe
0062: */
0063: String nameProject;
0064:
0065: private boolean special_allow = false;
0066:
0067: /**
0068: * Constructeur
0069: * @param db
0070: * @param pr
0071: */
0072: public CampTestInsertImpl(DataBase db, Properties pr) {
0073: database = db;
0074: prop = pr;
0075: }
0076:
0077: /**
0078: * Fonction qui fixe le projet SalomeTMF dans lequel l'utilisateur travaille
0079: * @param projectName
0080: */
0081: public void setProject(String projectName) {
0082: nameProject = projectName;
0083: idProject = Utile.getIdProject(database, prop, projectName);
0084: }
0085:
0086: /**
0087: * Insertion d'une campagne de test
0088: * @param campName
0089: * @param campDesc
0090: * @param designerLogin
0091: */
0092: public void addCampaign(String campName, String campDesc,
0093: String designerLogin, int order) {
0094: if (!special_allow) {
0095: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0096: .canCreateCamp())) {
0097: org.objectweb.salome_tmf.api.Api
0098: .log("addCampaign NOT ALLOW");
0099: try {
0100: throw new Exception("addCampaign NOT ALLOW");
0101: } catch (Exception e) {
0102: e.printStackTrace();
0103: org.objectweb.salome_tmf.api.Api.addException(e);
0104: }
0105: return;
0106: }
0107: }
0108: int personId = -1;
0109: int num = -1;
0110: // Recherche de la date et l'heure actuelles
0111: Date dateActuelle = Utile.getCurrentDate();
0112: Time heureActuelle = Utile.getCurrentTime();
0113: try {
0114: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0115:
0116: // Initialisation de l'ID du concepteur
0117: personId = Utile.getIdPerson(database, prop, designerLogin);
0118: // Appel de la requete
0119: PreparedStatement prep = database.prepareStatement(prop
0120: .getProperty("addCampaign"));
0121: prep.setString(1, campName);
0122: prep.setDate(2, dateActuelle);
0123: prep.setTime(3, heureActuelle);
0124: prep.setString(4, campDesc);
0125: prep.setInt(5, personId);
0126: prep.setInt(6, idProject);
0127: prep.setInt(7, order);
0128: prep.executeUpdate();
0129: } catch (SQLException E) {
0130: E.printStackTrace();
0131: org.objectweb.salome_tmf.api.Api.addException(
0132: "addCampaign", null, E);
0133: } catch (Exception ex) {
0134: ex.printStackTrace();
0135: org.objectweb.salome_tmf.api.Api.addException(null, null,
0136: ex);
0137: }
0138: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0139:
0140: }
0141:
0142: /**
0143: * Ajout d'un test a une campagne de test (en donnant le nom du test, la suite de test a laquelle il appartient et la famille a
0144: * laquelle appartient la suite)
0145: * @param testName
0146: * @param suiteName
0147: * @param familyName
0148: * @param campaignName
0149: */
0150: public void addTestToCampaign(String testName, String suiteName,
0151: String familyName, String campaignName, int order) {
0152: if (!special_allow) {
0153: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0154: .canCreateCamp())) {
0155: org.objectweb.salome_tmf.api.Api
0156: .log("addTestToCampaign NOT ALLOW");
0157: try {
0158: throw new Exception("addTestToCampaign NOT ALLOW");
0159: } catch (Exception e) {
0160: e.printStackTrace();
0161: org.objectweb.salome_tmf.api.Api.addException(e);
0162: }
0163: return;
0164: }
0165: }
0166: int familyId = -1;
0167: int suiteId = -1;
0168: int testId = -1;
0169: int campId = -1;
0170: int num = -1;
0171: try {
0172: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0173:
0174: // Initialisation de l'ID de la famille de test
0175: familyId = STCommun.getIdFamily(database, prop, idProject,
0176: familyName);
0177: // Initialisation de l'ID de la suite de test
0178: suiteId = STCommun.getIdSuite(database, prop, idProject,
0179: suiteName, familyId);
0180: // Initialisation de l'ID du test
0181: testId = STCommun.getIdTest(database, prop, testName,
0182: suiteId);
0183: // Initialisation de l'ID de la famille de test
0184: campId = CTCommun.getIdCamp(database, prop, idProject,
0185: campaignName);
0186: // Appel de la requete
0187: PreparedStatement prep = database.prepareStatement(prop
0188: .getProperty("addTestToCamp"));
0189: prep.setInt(1, campId);
0190: prep.setInt(2, testId);
0191: prep.setInt(3, order);
0192: prep.executeUpdate();
0193: } catch (SQLException E) {
0194: E.printStackTrace();
0195: org.objectweb.salome_tmf.api.Api.addException(
0196: "addTestToCamp", null, E);
0197: } catch (Exception ex) {
0198: ex.printStackTrace();
0199: org.objectweb.salome_tmf.api.Api.addException(null, null,
0200: ex);
0201: }
0202: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0203:
0204: }
0205:
0206: /**
0207: * Ajout d'un test a une campagne de test (en donnant le nom du test, la suite de test a laquelle il appartient et la famille a
0208: * laquelle appartient la suite)
0209: * @param testId
0210: * @param campaignId
0211: * @param order
0212: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
0213: */
0214: public void addTestToCampaignUsingID(int testId, int campaignId) {
0215: if (!special_allow) {
0216: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0217: .canCreateCamp())) {
0218: org.objectweb.salome_tmf.api.Api
0219: .log("addTestToCampaign NOT ALLOW");
0220: try {
0221: throw new Exception("addTestToCampaign NOT ALLOW");
0222: } catch (Exception e) {
0223: e.printStackTrace();
0224: org.objectweb.salome_tmf.api.Api.addException(e);
0225: }
0226: return;
0227: }
0228: }
0229:
0230: int num = -1;
0231: try {
0232: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0233: CampTestSelect pCampTestSelect = Api
0234: .getInstanceOfCampTest().getCampTestSelect();
0235: int order = pCampTestSelect
0236: .getNumberOfTestInCampaign(campaignId);
0237: order++;
0238: // Appel de la requete
0239: PreparedStatement prep = database.prepareStatement(prop
0240: .getProperty("addTestToCamp"));
0241: prep.setInt(1, campaignId);
0242: prep.setInt(2, testId);
0243: prep.setInt(3, order);
0244: prep.executeUpdate();
0245: } catch (SQLException E) {
0246: E.printStackTrace();
0247: org.objectweb.salome_tmf.api.Api.addException(
0248: "addTestToCamp", null, E);
0249: } catch (Exception ex) {
0250: ex.printStackTrace();
0251: org.objectweb.salome_tmf.api.Api.addException(null, null,
0252: ex);
0253: }
0254: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0255: }
0256:
0257: /**
0258: * Ajout d'une suite a une campagne de test (en donnant le nom la suite de test et la famille a laquelle elle appartient)
0259: * @param suiteName
0260: * @param familyName
0261: * @param campaignName
0262: */
0263: public void addSuiteToCampaign(String suiteName, String familyName,
0264: String campaignName) {
0265: if (!special_allow) {
0266: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0267: .canCreateCamp())) {
0268: org.objectweb.salome_tmf.api.Api
0269: .log("addSuiteToCampaign NOT ALLOW");
0270: try {
0271: throw new Exception("addSuiteToCampaign NOT ALLOW");
0272: } catch (Exception e) {
0273: e.printStackTrace();
0274: org.objectweb.salome_tmf.api.Api.addException(e);
0275: }
0276: return;
0277: }
0278: }
0279: DataSet stmtRes = null;
0280: int familyId = -1;
0281: int suiteId = -1;
0282: int num = -1;
0283: try {
0284: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0285:
0286: // On initialise l'ID de la famille de test
0287: familyId = STCommun.getIdFamily(database, prop, idProject,
0288: familyName);
0289: // Idem pour l'ID de la suite de test
0290: suiteId = STCommun.getIdSuite(database, prop, idProject,
0291: suiteName, familyId);
0292: // On cherche tous les tests appartenent a la suite de test
0293: PreparedStatement prep = database.prepareStatement(prop
0294: .getProperty("selectSuiteTests"));
0295: prep.setInt(1, suiteId);
0296: stmtRes = new DataSet(prep.executeQuery());
0297: // On ajoute chaque test de la suite a la campagne de test
0298: int i = 0;
0299: while (stmtRes.hasMoreElements()) {
0300: addTestToCampaign(stmtRes.getResults().getString(
0301: "nom_cas"), suiteName, familyName,
0302: campaignName, i);
0303: i++;
0304: }
0305: } catch (SQLException e) {
0306: e.printStackTrace();
0307: org.objectweb.salome_tmf.api.Api.addException(
0308: "selectSuiteTests", null, e);
0309: } catch (Exception ex) {
0310: ex.printStackTrace();
0311: org.objectweb.salome_tmf.api.Api.addException(null, null,
0312: ex);
0313: }
0314: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0315:
0316: }
0317:
0318: /**
0319: * Ajout d'une suite a une campagne de test (en donnant le nom la suite de test et la famille a laquelle elle appartient)
0320: * @param suiteId
0321: * @param campaignId
0322: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
0323: */
0324: public void addSuiteToCampaignUsingID(int suiteId, int campId) {
0325: if (!special_allow) {
0326: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0327: .canCreateCamp())) {
0328: org.objectweb.salome_tmf.api.Api
0329: .log("addSuiteToCampaign NOT ALLOW");
0330: try {
0331: throw new Exception("addSuiteToCampaign NOT ALLOW");
0332: } catch (Exception e) {
0333: e.printStackTrace();
0334: org.objectweb.salome_tmf.api.Api.addException(e);
0335: }
0336: return;
0337: }
0338: }
0339: DataSet stmtRes = null;
0340: int num = -1;
0341: try {
0342: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0343:
0344: // On cherche tous les tests appartenent a la suite de test
0345: PreparedStatement prep = database.prepareStatement(prop
0346: .getProperty("selectSuiteTests"));
0347: prep.setInt(1, suiteId);
0348: stmtRes = new DataSet(prep.executeQuery());
0349: // On ajoute chaque test de la suite a la campagne de tes
0350: while (stmtRes.hasMoreElements()) {
0351: addTestToCampaignUsingID(stmtRes.getResults().getInt(
0352: "id_cas"), campId);
0353: }
0354: } catch (SQLException e) {
0355: e.printStackTrace();
0356: org.objectweb.salome_tmf.api.Api.addException(
0357: "selectSuiteTests", null, e);
0358: } catch (Exception ex) {
0359: ex.printStackTrace();
0360: org.objectweb.salome_tmf.api.Api.addException(null, null,
0361: ex);
0362: }
0363: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0364: }
0365:
0366: /**
0367: * Ajout d'une famille a une campagne de test
0368: * @param familyName
0369: * @param campaignName
0370: */
0371: public void addFamilyToCampaign(String familyName,
0372: String campaignName) {
0373: if (!special_allow) {
0374: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0375: .canCreateCamp())) {
0376: org.objectweb.salome_tmf.api.Api
0377: .log("addFamilyToCampaign NOT ALLOW");
0378: try {
0379: throw new Exception("addFamilyToCampaign NOT ALLOW");
0380: } catch (Exception e) {
0381: e.printStackTrace();
0382: org.objectweb.salome_tmf.api.Api.addException(e);
0383: }
0384: return;
0385: }
0386: }
0387: DataSet stmtRes = null;
0388: int familyId = -1;
0389: int num = -1;
0390: try {
0391: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0392:
0393: // On initialise l'ID de la famille de test
0394: familyId = STCommun.getIdFamily(database, prop, idProject,
0395: familyName);
0396: // On cherche tous les suites appartenent a la famille de test
0397: PreparedStatement prep = database.prepareStatement(prop
0398: .getProperty("selectFamilySuites"));
0399: prep.setInt(1, familyId);
0400: stmtRes = new DataSet(prep.executeQuery());
0401: // On ajoute chaque suite a la campagne de test
0402: while (stmtRes.hasMoreElements()) {
0403: addSuiteToCampaign(stmtRes.getResults().getString(
0404: "nom_suite"), familyName, campaignName);
0405: }
0406: } catch (SQLException e) {
0407: e.printStackTrace();
0408: org.objectweb.salome_tmf.api.Api.addException(
0409: "selectFamilySuites", null, e);
0410: } catch (Exception ex) {
0411: ex.printStackTrace();
0412: org.objectweb.salome_tmf.api.Api.addException(null, null,
0413: ex);
0414: }
0415: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0416:
0417: }
0418:
0419: /**
0420: * Ajout d'une famille a une campagne de test
0421: * @param familyId
0422: * @param campaignId
0423: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
0424: */
0425: public void addFamilyToCampaignUsingID(int familyId, int campId) {
0426: if (!special_allow) {
0427: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0428: .canCreateCamp())) {
0429: org.objectweb.salome_tmf.api.Api
0430: .log("addFamilyToCampaign NOT ALLOW");
0431: try {
0432: throw new Exception("addFamilyToCampaign NOT ALLOW");
0433: } catch (Exception e) {
0434: e.printStackTrace();
0435: org.objectweb.salome_tmf.api.Api.addException(e);
0436: }
0437: return;
0438: }
0439: }
0440: DataSet stmtRes = null;
0441: int num = -1;
0442: try {
0443: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0444:
0445: // On cherche tous les suites appartenent a la famille de test
0446: PreparedStatement prep = database.prepareStatement(prop
0447: .getProperty("selectFamilySuites"));
0448: prep.setInt(1, familyId);
0449: stmtRes = new DataSet(prep.executeQuery());
0450: // On ajoute chaque suite a la campagne de test
0451: while (stmtRes.hasMoreElements()) {
0452: addSuiteToCampaignUsingID(stmtRes.getResults().getInt(
0453: "id_suite"), campId);
0454: }
0455: } catch (SQLException e) {
0456: e.printStackTrace();
0457: org.objectweb.salome_tmf.api.Api.addException(
0458: "selectFamilySuites", null, e);
0459: } catch (Exception ex) {
0460: ex.printStackTrace();
0461: org.objectweb.salome_tmf.api.Api.addException(null, null,
0462: ex);
0463: }
0464: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0465:
0466: }
0467:
0468: /**
0469: * Ajout d'une exécution de campagne de test
0470: * @param campName
0471: * @param execName
0472: * @param jeuDonneesName
0473: * @param envName
0474: * @param execDesc
0475: * @param userLogin
0476: */
0477: public void addExecCampaign(String campName, String execName,
0478: String jeuDonneesName, String envName, String execDesc,
0479: String userLogin) {
0480: if (!special_allow) {
0481: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0482: .canExecutCamp())
0483: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0484: .canCreateCamp())) {
0485: org.objectweb.salome_tmf.api.Api
0486: .log("addExecCampaign NOT ALLOW");
0487: try {
0488: throw new Exception("addExecCampaign NOT ALLOW");
0489: } catch (Exception e) {
0490: e.printStackTrace();
0491: org.objectweb.salome_tmf.api.Api.addException(e);
0492: }
0493: return;
0494: }
0495: }
0496: int campId = -1;
0497: int personId = -1;
0498: int jeuDonneesId = -1;
0499: int envId = -1;
0500: int num = -1;
0501: // Recherche de la date et l'heure actuelles
0502: Date dateActuelle = Utile.getCurrentDate();
0503: Time heureActuelle = Utile.getCurrentTime();
0504:
0505: try {
0506: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0507: org.objectweb.salome_tmf.api.Api.log("Add exec for "
0508: + campName + ", dataset " + jeuDonneesName
0509: + ", env " + envName);
0510: // Initialisation de l'ID de la campagne de test
0511: campId = CTCommun.getIdCamp(database, prop, idProject,
0512: campName);
0513: // Initialisation de l'ID de l'utilisateur
0514: personId = Utile.getIdPerson(database, prop, userLogin);
0515: // idem pour le jeu de donnees
0516: if (jeuDonneesName != null)
0517: jeuDonneesId = CTCommun.getIdJeuDonnees(database, prop,
0518: idProject, campName, jeuDonneesName);
0519:
0520: // Idem pour l'environnement
0521: envId = APCommun.getIdEnv(database, prop, idProject,
0522: envName);
0523: // Appel de la requete
0524: PreparedStatement prep = database.prepareStatement(prop
0525: .getProperty("addExecCampaign"));
0526: prep.setInt(1, envId);
0527: prep.setInt(2, jeuDonneesId);
0528: prep.setInt(3, personId);
0529: prep.setInt(4, campId);
0530: prep.setString(5, execName);
0531: prep.setDate(6, dateActuelle);
0532: prep.setTime(7, heureActuelle);
0533: prep.setString(8, execDesc);
0534: prep.executeUpdate();
0535: } catch (SQLException E) {
0536: E.printStackTrace();
0537: org.objectweb.salome_tmf.api.Api.addException(
0538: "addExecCampaign", null, E);
0539: } catch (Exception ex) {
0540: ex.printStackTrace();
0541: org.objectweb.salome_tmf.api.Api.addException(null, null,
0542: ex);
0543: }
0544: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0545:
0546: }
0547:
0548: /**
0549: * Ajout d'une exécution de campagne de test
0550: * @param campId
0551: * @param execName
0552: * @param jeuDonneesId
0553: * @param envId
0554: * @param execDesc
0555: * @param userId
0556: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
0557: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
0558: */
0559: public void addExecCampaignUsingID(int campId, String execName,
0560: int jeuDonneesId, int envId, String execDesc, int userId) {
0561: if (!special_allow) {
0562: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0563: .canExecutCamp())
0564: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0565: .canCreateCamp())) {
0566: org.objectweb.salome_tmf.api.Api
0567: .log("addExecCampaign NOT ALLOW");
0568: try {
0569: throw new Exception("addExecCampaign NOT ALLOW");
0570: } catch (Exception e) {
0571: e.printStackTrace();
0572: org.objectweb.salome_tmf.api.Api.addException(e);
0573: }
0574: return;
0575: }
0576: }
0577:
0578: int num = -1;
0579: // Recherche de la date et l'heure actuelles
0580: Date dateActuelle = Utile.getCurrentDate();
0581: Time heureActuelle = Utile.getCurrentTime();
0582:
0583: try {
0584: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0585: org.objectweb.salome_tmf.api.Api
0586: .log("Add exec for camp (id=" + campId
0587: + "), dataset (id=" + jeuDonneesId
0588: + "), env (id=" + envId + ")");
0589:
0590: // Appel de la requete
0591: PreparedStatement prep = database.prepareStatement(prop
0592: .getProperty("addExecCampaign"));
0593: prep.setInt(1, envId);
0594: prep.setInt(2, jeuDonneesId);
0595: prep.setInt(3, userId);
0596: prep.setInt(4, campId);
0597: prep.setString(5, execName);
0598: prep.setDate(6, dateActuelle);
0599: prep.setTime(7, heureActuelle);
0600: prep.setString(8, execDesc);
0601: prep.executeUpdate();
0602: } catch (SQLException E) {
0603: E.printStackTrace();
0604: org.objectweb.salome_tmf.api.Api.addException(
0605: "addExecCampaign", null, E);
0606: } catch (Exception ex) {
0607: ex.printStackTrace();
0608: org.objectweb.salome_tmf.api.Api.addException(null, null,
0609: ex);
0610: }
0611: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0612:
0613: }
0614:
0615: /**
0616: * Enregistrement du lancement d'une execution de campagne de test
0617: * @param resExecCampName
0618: * @param campName
0619: * @param execCampName
0620: * @param userLogin
0621: * @param descResExecCamp
0622: * @param statutResExecCamp Champ énuméré: 'FAIT' ou 'A_FAIRE'
0623: * @param resultatResExecCamp Champ énuméré: 'INCOMPLETE', 'STOPPEE' ou 'TERMINEE'
0624: */
0625: public void addResExecCamp(String resExecCampName, String campName,
0626: String execCampName, String userLogin,
0627: String descResExecCamp, String statutResExecCamp,
0628: String resultatResExecCamp) {
0629: if (!special_allow) {
0630: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0631: .canExecutCamp())) {
0632: org.objectweb.salome_tmf.api.Api
0633: .log("addResExecCamp NOT ALLOW");
0634: try {
0635: throw new Exception("addResExecCamp NOT ALLOW");
0636: } catch (Exception e) {
0637: e.printStackTrace();
0638: org.objectweb.salome_tmf.api.Api.addException(e);
0639: }
0640: return;
0641: }
0642: }
0643: int execCampId = -1;
0644: int personId = -1;
0645: int num = -1;
0646: // Recherche de la date et l'heure actuelles
0647: Date dateActuelle = Utile.getCurrentDate();
0648: Time heureActuelle = Utile.getCurrentTime();
0649:
0650: try {
0651: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0652:
0653: // Initialisation de l'ID de l'execution de campagne de test
0654: execCampId = CTCommun.getIdExecCamp(database, prop,
0655: idProject, campName, execCampName);
0656: // Initialisation de l'ID de l'utilisateur
0657: personId = Utile.getIdPerson(database, prop, userLogin);
0658: // Appel de la requete
0659: PreparedStatement prep = database.prepareStatement(prop
0660: .getProperty("addResExecCamp"));
0661: prep.setInt(1, personId);
0662: prep.setInt(2, execCampId);
0663: prep.setString(3, resExecCampName);
0664: prep.setString(4, descResExecCamp);
0665: prep.setDate(5, dateActuelle);
0666: prep.setTime(6, heureActuelle);
0667: prep.setString(7, statutResExecCamp);
0668: prep.setString(8, resultatResExecCamp);
0669: prep.executeUpdate();
0670: } catch (SQLException E) {
0671: E.printStackTrace();
0672: org.objectweb.salome_tmf.api.Api.addException(
0673: "addResExecCamp", null, E);
0674: } catch (Exception ex) {
0675: ex.printStackTrace();
0676: org.objectweb.salome_tmf.api.Api.addException(null, null,
0677: ex);
0678: }
0679: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0680:
0681: }
0682:
0683: /**
0684: * Enregistrement du lancement d'une execution de campagne de test
0685: * @param resExecCampName
0686: * @param execCampId
0687: * @param userId
0688: * @param descResExecCamp
0689: * @param statutResExecCamp Champ énuméré: 'FAIT' ou 'A_FAIRE'
0690: * @param resultatResExecCamp Champ énuméré: 'INCOMPLETE', 'STOPPEE' ou 'TERMINEE'
0691: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
0692: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
0693: */
0694: public void addResExecCampUsingID(String resExecCampName,
0695: int execCampId, String userLogin, String descResExecCamp,
0696: String statutResExecCamp, String resultatResExecCamp) {
0697: if (!special_allow) {
0698: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0699: .canExecutCamp())) {
0700: org.objectweb.salome_tmf.api.Api
0701: .log("addResExecCamp NOT ALLOW");
0702: try {
0703: throw new Exception("addResExecCamp NOT ALLOW");
0704: } catch (Exception e) {
0705: e.printStackTrace();
0706: org.objectweb.salome_tmf.api.Api.addException(e);
0707: }
0708: return;
0709: }
0710: }
0711:
0712: int num = -1;
0713: // Recherche de la date et l'heure actuelles
0714: Date dateActuelle = Utile.getCurrentDate();
0715: Time heureActuelle = Utile.getCurrentTime();
0716: int userId = -1;
0717:
0718: try {
0719: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0720:
0721: userId = Utile.getIdPerson(database, prop, userLogin);
0722:
0723: // Appel de la requete
0724: PreparedStatement prep = database.prepareStatement(prop
0725: .getProperty("addResExecCamp"));
0726: prep.setInt(1, userId);
0727: prep.setInt(2, execCampId);
0728: prep.setString(3, resExecCampName);
0729: prep.setString(4, descResExecCamp);
0730: prep.setDate(5, dateActuelle);
0731: prep.setTime(6, heureActuelle);
0732: prep.setString(7, statutResExecCamp);
0733: prep.setString(8, resultatResExecCamp);
0734: prep.executeUpdate();
0735: } catch (SQLException E) {
0736: E.printStackTrace();
0737: org.objectweb.salome_tmf.api.Api.addException(
0738: "addResExecCamp", null, E);
0739: } catch (Exception ex) {
0740: ex.printStackTrace();
0741: org.objectweb.salome_tmf.api.Api.addException(null, null,
0742: ex);
0743: }
0744: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0745: }
0746:
0747: /**
0748: * Enregistrement du resultat de l'execution d'un test
0749: * @param campName
0750: * @param execCampName
0751: * @param resExecCampName
0752: * @param testName
0753: * @param suiteName
0754: * @param familyName
0755: * @param resExecCas Type énuméré: 'PASSED', 'FAILED' ou 'INCONCLUSIF'
0756: */
0757: public void addResExecCas(String campName, String execCampName,
0758: String resExecCampName, String testName, String suiteName,
0759: String familyName, String resExecCas) {
0760: if (!special_allow) {
0761: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0762: .canExecutCamp())) {
0763: org.objectweb.salome_tmf.api.Api
0764: .log("addResExecCas NOT ALLOW");
0765: try {
0766: throw new Exception("addResExecCas NOT ALLOW");
0767: } catch (Exception e) {
0768: e.printStackTrace();
0769: org.objectweb.salome_tmf.api.Api.addException(e);
0770: }
0771: return;
0772: }
0773: }
0774: int resExecCampId = -1;
0775: int familyId = -1;
0776: int suiteId = -1;
0777: int testId = -1;
0778: int num = -1;
0779: try {
0780: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0781:
0782: // Initialisation de l'ID du resultat de l'execution de campagne de test
0783: resExecCampId = CTCommun.getIdResExecCamp(database, prop,
0784: idProject, campName, execCampName, resExecCampName);
0785: // Initialisation de l'ID du test
0786: familyId = STCommun.getIdFamily(database, prop, idProject,
0787: familyName);
0788: suiteId = STCommun.getIdSuite(database, prop, idProject,
0789: suiteName, familyId);
0790: testId = STCommun.getIdTest(database, prop, testName,
0791: suiteId);
0792: // Appel de la requete
0793: PreparedStatement prep = database.prepareStatement(prop
0794: .getProperty("addResExecCas"));
0795: prep.setInt(1, resExecCampId);
0796: prep.setInt(2, testId);
0797: prep.setString(3, resExecCas);
0798:
0799: prep.executeUpdate();
0800: } catch (SQLException E) {
0801: E.printStackTrace();
0802: org.objectweb.salome_tmf.api.Api.addException(
0803: "addResExecCas", null, E);
0804: } catch (Exception ex) {
0805: ex.printStackTrace();
0806: org.objectweb.salome_tmf.api.Api.addException(null, null,
0807: ex);
0808: }
0809: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0810:
0811: }
0812:
0813: /**
0814: * Enregistrement du resultat de l'execution d'un test
0815: * @param resExecCampId
0816: * @param testId
0817: * @param resExecCas Type énuméré: 'PASSED', 'FAILED' ou 'INCONCLUSIF'
0818: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
0819: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
0820: */
0821: public void addResExecCasUsingID(int resExecCampId, int testId,
0822: String resExecCas) {
0823: if (!special_allow) {
0824: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0825: .canExecutCamp())) {
0826: org.objectweb.salome_tmf.api.Api
0827: .log("addResExecCas NOT ALLOW");
0828: try {
0829: throw new Exception("addResExecCas NOT ALLOW");
0830: } catch (Exception e) {
0831: e.printStackTrace();
0832: org.objectweb.salome_tmf.api.Api.addException(e);
0833: }
0834: return;
0835: }
0836: }
0837:
0838: int num = -1;
0839: try {
0840: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0841:
0842: // Appel de la requete
0843: PreparedStatement prep = database.prepareStatement(prop
0844: .getProperty("addResExecCas"));
0845: prep.setInt(1, resExecCampId);
0846: prep.setInt(2, testId);
0847: prep.setString(3, resExecCas);
0848:
0849: prep.executeUpdate();
0850: } catch (SQLException E) {
0851: E.printStackTrace();
0852: org.objectweb.salome_tmf.api.Api.addException(
0853: "addResExecCas", null, E);
0854: } catch (Exception ex) {
0855: ex.printStackTrace();
0856: org.objectweb.salome_tmf.api.Api.addException(null, null,
0857: ex);
0858: }
0859: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0860: }
0861:
0862: /**
0863: * Enregistrement du resultat de l'execution d'une action de test
0864: * @param campName
0865: * @param execCampName
0866: * @param resExecCampName
0867: * @param actionName
0868: * @param testName
0869: * @param suiteName
0870: * @param familyName
0871: * @param resExecAction Type énuméré: 'PASSED', 'FAILED' ou 'INCONCLUSIF'
0872: */
0873: public void addResExecAction(String campName, String execCampName,
0874: String resExecCampName, String actionName, String testName,
0875: String suiteName, String familyName, String resExecAction,
0876: String description_action, String res_attendu_action) {
0877:
0878: if (!special_allow) {
0879: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0880: .canExecutCamp())) {
0881: org.objectweb.salome_tmf.api.Api
0882: .log("addResExecAction NOT ALLOW");
0883: try {
0884: throw new Exception("addResExecAction NOT ALLOW");
0885: } catch (Exception e) {
0886: e.printStackTrace();
0887: org.objectweb.salome_tmf.api.Api.addException(e);
0888: }
0889: return;
0890: }
0891: }
0892: int resExecCasId = -1;
0893: int familyId = -1;
0894: int suiteId = -1;
0895: int testId = -1;
0896: int actionId = -1;
0897: int num = -1;
0898: try {
0899: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0900:
0901: // Initialisation de l'ID de l'action de test
0902: familyId = STCommun.getIdFamily(database, prop, idProject,
0903: familyName);
0904: suiteId = STCommun.getIdSuite(database, prop, idProject,
0905: suiteName, familyId);
0906: testId = STCommun.getIdTest(database, prop, testName,
0907: suiteId);
0908: actionId = STCommun.getIdAction(database, prop, actionName,
0909: testId);
0910:
0911: // Initialisation de l'ID du resultat de l'execution d'un test
0912: resExecCasId = CTCommun.getIdResExecCas(database, prop,
0913: idProject, campName, execCampName, resExecCampName,
0914: testId);
0915:
0916: // Appel de la requete
0917: PreparedStatement prep = database.prepareStatement(prop
0918: .getProperty("addResExecAction2"));
0919: prep.setInt(1, resExecCasId);
0920: prep.setInt(2, actionId);
0921: prep.setString(3, resExecAction);
0922: prep.setString(4, description_action);
0923: prep.setString(5, res_attendu_action);
0924: prep.executeUpdate();
0925: } catch (SQLException E) {
0926: E.printStackTrace();
0927: org.objectweb.salome_tmf.api.Api.addException(
0928: "addResExecAction2", null, E);
0929: } catch (Exception ex) {
0930: ex.printStackTrace();
0931: org.objectweb.salome_tmf.api.Api.addException(null, null,
0932: ex);
0933: }
0934: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0935:
0936: }
0937:
0938: /**
0939: * Enregistrement du resultat de l'execution d'une action de test
0940: * @param resExecCampId
0941: * @param testId
0942: * @param actionId
0943: * @param resExecAction Type énuméré: 'PASSED', 'FAILED' ou 'INCONCLUSIF'
0944: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
0945: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
0946: */
0947: public void addResExecActionUsingID(int resExecCampId, int testId,
0948: int actionId, String resExecAction,
0949: String description_action, String res_attendu_action) {
0950: if (!special_allow) {
0951: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0952: .canExecutCamp())) {
0953: org.objectweb.salome_tmf.api.Api
0954: .log("addResExecAction NOT ALLOW");
0955: try {
0956: throw new Exception("addResExecAction NOT ALLOW");
0957: } catch (Exception e) {
0958: e.printStackTrace();
0959: org.objectweb.salome_tmf.api.Api.addException(e);
0960: }
0961: return;
0962: }
0963: }
0964: int resExecCasId = -1;
0965: int num = -1;
0966: try {
0967: num = org.objectweb.salome_tmf.api.Api.beginTrans();
0968:
0969: // Initialisation de l'ID du resultat de l'execution d'un test
0970: resExecCasId = CTCommun.getIdResExecCasUsingID(database,
0971: prop, resExecCampId, testId);
0972:
0973: // Appel de la requete
0974: PreparedStatement prep = database.prepareStatement(prop
0975: .getProperty("addResExecAction2"));
0976: prep.setInt(1, resExecCasId);
0977: prep.setInt(2, actionId);
0978: prep.setString(3, resExecAction);
0979: prep.setString(4, description_action);
0980: prep.setString(5, res_attendu_action);
0981: prep.executeUpdate();
0982: } catch (SQLException E) {
0983: E.printStackTrace();
0984: org.objectweb.salome_tmf.api.Api.addException(
0985: "addResExecAction2", null, E);
0986: } catch (Exception ex) {
0987: ex.printStackTrace();
0988: org.objectweb.salome_tmf.api.Api.addException(null, null,
0989: ex);
0990: }
0991: org.objectweb.salome_tmf.api.Api.commitTrans(num);
0992: }
0993:
0994: /**
0995: * Ajout d'un nouveau jeu de données à une campagne de test
0996: * @param campName
0997: * @param JdDName
0998: * @param JdDDesc
0999: */
1000: public void addJeuDonneesToCamp(String campName, String JdDName,
1001: String JdDDesc) {
1002:
1003: if (!special_allow) {
1004: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1005: .canCreateCamp())
1006: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1007: .canExecutCamp())) {
1008: org.objectweb.salome_tmf.api.Api
1009: .log("addJeuDonneesToCamp NOT ALLOW");
1010: try {
1011: throw new Exception("addJeuDonneesToCamp NOT ALLOW");
1012: } catch (Exception e) {
1013: e.printStackTrace();
1014: org.objectweb.salome_tmf.api.Api.addException(e);
1015: }
1016: return;
1017: }
1018: }
1019:
1020: int campId = -1;
1021: int num = -1;
1022: try {
1023: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1024:
1025: // Initialisation de l'ID de la campagne de test
1026: campId = CTCommun.getIdCamp(database, prop, idProject,
1027: campName);
1028: // Appel de la requete
1029: PreparedStatement prep = database.prepareStatement(prop
1030: .getProperty("addJeuDonneesToCamp"));
1031: prep.setInt(1, campId);
1032: prep.setString(2, JdDName);
1033: prep.setString(3, JdDDesc);
1034: prep.executeUpdate();
1035: } catch (SQLException E) {
1036: E.printStackTrace();
1037: org.objectweb.salome_tmf.api.Api.addException(
1038: "addJeuDonneesToCamp", null, E);
1039: } catch (Exception ex) {
1040: ex.printStackTrace();
1041: org.objectweb.salome_tmf.api.Api.addException(null, null,
1042: ex);
1043: }
1044: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1045:
1046: }
1047:
1048: /**
1049: * Ajout d'un nouveau jeu de données à une campagne de test
1050: * @param campId
1051: * @param JdDName
1052: * @param JdDDesc
1053: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
1054: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1055: */
1056: public void addJeuDonneesToCampUsingID(int campId, String JdDName,
1057: String JdDDesc) {
1058: if (!special_allow) {
1059: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1060: .canCreateCamp())
1061: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1062: .canExecutCamp())) {
1063: org.objectweb.salome_tmf.api.Api
1064: .log("addJeuDonneesToCamp NOT ALLOW");
1065: try {
1066: throw new Exception("addJeuDonneesToCamp NOT ALLOW");
1067: } catch (Exception e) {
1068: e.printStackTrace();
1069: org.objectweb.salome_tmf.api.Api.addException(e);
1070: }
1071: return;
1072: }
1073: }
1074:
1075: int num = -1;
1076: try {
1077: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1078:
1079: // Appel de la requete
1080: PreparedStatement prep = database.prepareStatement(prop
1081: .getProperty("addJeuDonneesToCamp"));
1082: prep.setInt(1, campId);
1083: prep.setString(2, JdDName);
1084: prep.setString(3, JdDDesc);
1085: prep.executeUpdate();
1086: } catch (SQLException E) {
1087: E.printStackTrace();
1088: org.objectweb.salome_tmf.api.Api.addException(
1089: "addJeuDonneesToCamp", null, E);
1090: } catch (Exception ex) {
1091: ex.printStackTrace();
1092: org.objectweb.salome_tmf.api.Api.addException(null, null,
1093: ex);
1094: }
1095: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1096: }
1097:
1098: /**
1099: * Valorisation d'un parametre de test dans un jeu de donnees
1100: * @param campName
1101: * @param jeuDonneesName
1102: * @param paramName
1103: * @param paramValue
1104: * @param description
1105: */
1106: public void addParamValueToJeuDonnees(String campName,
1107: String jeuDonneesName, String paramName, String paramValue,
1108: String description) {
1109:
1110: if (!special_allow) {
1111: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1112: .canCreateCamp())
1113: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1114: .canExecutCamp())) {
1115: org.objectweb.salome_tmf.api.Api
1116: .log("addParamValueToJeuDonnees NOT ALLOW");
1117: try {
1118: throw new Exception(
1119: "addParamValueToJeuDonnees NOT ALLOW");
1120: } catch (Exception e) {
1121: e.printStackTrace();
1122: org.objectweb.salome_tmf.api.Api.addException(e);
1123: }
1124: return;
1125: }
1126: }
1127: int idJeuDonnees = -1;
1128: int idParam = -1;
1129: DataSet stmtRes = null;
1130: String sql = null;
1131: int num = -1;
1132: try {
1133: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1134:
1135: // Initialisation de l'ID de l'environnement
1136: //idJeuDonnees = CTCommun.getIdJeuDonnees(database,prop,campName,jeuDonneesName);
1137: // Initialisation de l'ID du parametre de test
1138: //idParam = STCommun.getIdParam(database,prop,paramName,idProject);
1139: sql = "selectParamFromDataSet";
1140: PreparedStatement prep = database.prepareStatement(prop
1141: .getProperty("selectParamFromDataSet"));
1142: prep.setString(1, jeuDonneesName);
1143: prep.setString(2, campName);
1144: prep.setString(3, paramName);
1145: prep.setInt(4, idProject);
1146: stmtRes = new DataSet(prep.executeQuery());
1147: if (stmtRes.hasMoreElements()) {
1148: idJeuDonnees = stmtRes.getResults().getInt(
1149: "id_jeu_donnees");
1150: idParam = stmtRes.getResults().getInt("id_param_test");
1151: org.objectweb.salome_tmf.api.Api.log("Insert value "
1152: + paramValue + ", to dataset " + jeuDonneesName
1153: + ",id : " + idJeuDonnees + ", on param "
1154: + paramName + ", id : " + idParam
1155: + " on project id : " + idProject + ", name : "
1156: + nameProject + "in campagne " + campName);
1157: // Appel de la requete
1158: sql = "addParamValueToJeuDonnees";
1159: prep = database.prepareStatement(prop
1160: .getProperty("addParamValueToJeuDonnees"));
1161: prep.setInt(1, idJeuDonnees);
1162: prep.setInt(2, idParam);
1163: prep.setString(3, paramValue);
1164: prep.setString(4, "");
1165: prep.executeUpdate();
1166: } else {
1167: org.objectweb.salome_tmf.api.Api
1168: .log("No param found for dataset "
1169: + jeuDonneesName + ",id : "
1170: + idJeuDonnees + ", on param "
1171: + paramName + ", id : " + idParam
1172: + " on project id : " + idProject
1173: + ", name : " + nameProject
1174: + "in campagne " + campName);
1175: }
1176:
1177: } catch (SQLException E) {
1178: E.printStackTrace();
1179: org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1180: } catch (Exception ex) {
1181: ex.printStackTrace();
1182: org.objectweb.salome_tmf.api.Api.addException(null, null,
1183: ex);
1184: }
1185: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1186:
1187: }
1188:
1189: /**
1190: * Valorisation d'un parametre de test dans un jeu de donnees
1191: * @param jeuDonneesId
1192: * @param paramId
1193: * @param paramValue
1194: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
1195: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1196: */
1197: public void addParamValueToJeuDonneesUsingID(int jeuDonneesId,
1198: int paramId, String paramValue) {
1199: if (!special_allow) {
1200: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1201: .canCreateCamp())
1202: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1203: .canExecutCamp())) {
1204: org.objectweb.salome_tmf.api.Api
1205: .log("addParamValueToJeuDonnees NOT ALLOW");
1206: try {
1207: throw new Exception(
1208: "addParamValueToJeuDonnees NOT ALLOW");
1209: } catch (Exception e) {
1210: e.printStackTrace();
1211: org.objectweb.salome_tmf.api.Api.addException(e);
1212: }
1213: return;
1214: }
1215: }
1216: //DataSet stmtRes = null;
1217: String sql = null;
1218: int num = -1;
1219: try {
1220: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1221: org.objectweb.salome_tmf.api.Api.log("Insert value "
1222: + paramValue + ", to dataset (id=" + jeuDonneesId
1223: + "), on param (id=" + paramId + ")");
1224: // Appel de la requete
1225: sql = "addParamValueToJeuDonneesUsingID";
1226: PreparedStatement prep = database.prepareStatement(prop
1227: .getProperty(sql));
1228: prep.setInt(1, jeuDonneesId);
1229: prep.setInt(2, paramId);
1230: prep.setString(3, paramValue);
1231: prep.executeUpdate();
1232:
1233: } catch (SQLException E) {
1234: E.printStackTrace();
1235: org.objectweb.salome_tmf.api.Api.addException(sql, null, E);
1236: } catch (Exception ex) {
1237: ex.printStackTrace();
1238: org.objectweb.salome_tmf.api.Api.addException(null, null,
1239: ex);
1240: }
1241: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1242: }
1243:
1244: /**
1245: * Ajout d'un fichier attachement à une campagne
1246: * @param campaignName
1247: * @param filePath
1248: * @param length
1249: * @param date
1250: * @param description
1251: */
1252: public void addAttachFileToCampaign(String campaignName,
1253: String filePath, long length, Date date, String description) {
1254: if (!special_allow) {
1255: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1256: .canCreateCamp())) {
1257: org.objectweb.salome_tmf.api.Api
1258: .log("addAttachDileToCampaign NOT ALLOW");
1259: try {
1260: throw new Exception(
1261: "addAttachFileToCampaign NOT ALLOW");
1262: } catch (Exception e) {
1263: e.printStackTrace();
1264: org.objectweb.salome_tmf.api.Api.addException(e);
1265: }
1266: return;
1267: }
1268: }
1269: // On ajoute le fichier attachement dans la BdD SalomeTMF
1270: STCommun.addFileAttachToDB(database, prop, filePath, length,
1271: date, description);
1272: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1273: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1274: // On initialse l'ID de la campagne
1275: int campaignId = CTCommun.getIdCamp(database, prop, idProject,
1276: campaignName);
1277: int num = -1;
1278: try {
1279: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1280:
1281: // Appel de la requete a executer
1282: PreparedStatement prep = database.prepareStatement(prop
1283: .getProperty("addFileAttachToCampaign"));
1284: prep.setInt(1, campaignId);
1285: prep.setInt(2, fileAttachId);
1286: prep.executeUpdate();
1287: } catch (SQLException E) {
1288: E.printStackTrace();
1289: org.objectweb.salome_tmf.api.Api.addException(
1290: "addFileAttachToCampaign", null, E);
1291: } catch (Exception ex) {
1292: ex.printStackTrace();
1293: org.objectweb.salome_tmf.api.Api.addException(null, null,
1294: ex);
1295: }
1296: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1297:
1298: }
1299:
1300: /**
1301: * Ajout d'un fichier attachement à une campagne
1302: * @param campaignId
1303: * @param filePath
1304: * @param length
1305: * @param date
1306: * @param description
1307: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
1308: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
1309: */
1310: public void addAttachFileToCampaignUsingID(int campaignId,
1311: String filePath, long length, Date date, String description) {
1312: if (!special_allow) {
1313: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1314: .canCreateCamp())) {
1315: org.objectweb.salome_tmf.api.Api
1316: .log("addAttachFileToCampaign NOT ALLOW");
1317: try {
1318: throw new Exception(
1319: "addAttachFileToCampaign NOT ALLOW");
1320: } catch (Exception e) {
1321: e.printStackTrace();
1322: org.objectweb.salome_tmf.api.Api.addException(e);
1323: }
1324: return;
1325: }
1326: }
1327: // On ajoute le fichier attachement dans la BdD SalomeTMF
1328: STCommun.addFileAttachToDB(database, prop, filePath, length,
1329: date, description);
1330: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1331: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1332: int num = -1;
1333: try {
1334: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1335:
1336: // Appel de la requete a executer
1337: PreparedStatement prep = database.prepareStatement(prop
1338: .getProperty("addFileAttachToCampaign"));
1339: prep.setInt(1, campaignId);
1340: prep.setInt(2, fileAttachId);
1341: prep.executeUpdate();
1342: } catch (SQLException E) {
1343: E.printStackTrace();
1344: org.objectweb.salome_tmf.api.Api.addException(
1345: "addFileAttachToCampaign", null, E);
1346: } catch (Exception ex) {
1347: ex.printStackTrace();
1348: org.objectweb.salome_tmf.api.Api.addException(null, null,
1349: ex);
1350: }
1351: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1352: }
1353:
1354: /**
1355: * Ajout d'une URL en attachement à une campagne
1356: * @param campaignName
1357: * @param url
1358: * @param description
1359: */
1360: public void addAttachUrlToCampaign(String campaignName, String url,
1361: String description) {
1362: if (!special_allow) {
1363: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1364: .canCreateCamp())) {
1365: org.objectweb.salome_tmf.api.Api
1366: .log("addAttachUrlToCampaign NOT ALLOW");
1367: try {
1368: throw new Exception(
1369: "addAttachUrlToCampaign NOT ALLOW");
1370: } catch (Exception e) {
1371: e.printStackTrace();
1372: org.objectweb.salome_tmf.api.Api.addException(e);
1373: }
1374: return;
1375: }
1376: }
1377: // On ajoute l'URL dans la BdD SalomeTMF
1378: STCommun.addUrlAttachToDB(database, prop, url, description);
1379: // On initialise l'ID de l'URL (max des ID des attachements de la base)
1380: int urlId = STCommun.getMaxIdAttach(database, prop);
1381: // On initialise l'ID de la campagne de tests
1382: int campaignId = CTCommun.getIdCamp(database, prop, idProject,
1383: campaignName);
1384: int num = -1;
1385: try {
1386: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1387:
1388: // Appel de la requete a executer
1389: PreparedStatement prep = database.prepareStatement(prop
1390: .getProperty("addUrlAttachToCampaign"));
1391: prep.setInt(1, campaignId);
1392: prep.setInt(2, urlId);
1393: prep.executeUpdate();
1394: } catch (SQLException E) {
1395: E.printStackTrace();
1396: org.objectweb.salome_tmf.api.Api.addException(
1397: "addUrlAttachToCampaign", null, E);
1398: } catch (Exception ex) {
1399: ex.printStackTrace();
1400: org.objectweb.salome_tmf.api.Api.addException(null, null,
1401: ex);
1402: }
1403: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1404:
1405: }
1406:
1407: /**
1408: * Ajout d'une URL en attachement à une campagne
1409: * @param campaignId
1410: * @param url
1411: * @param description
1412: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
1413: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateCamp()
1414: */
1415: public void addAttachUrlToCampaignUsingID(int campaignId,
1416: String url, String description) {
1417: if (!special_allow) {
1418: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1419: .canCreateCamp())) {
1420: org.objectweb.salome_tmf.api.Api
1421: .log("addAttachUrlToCampaign NOT ALLOW");
1422: try {
1423: throw new Exception(
1424: "addAttachUrlToCampaign NOT ALLOW");
1425: } catch (Exception e) {
1426: e.printStackTrace();
1427: org.objectweb.salome_tmf.api.Api.addException(e);
1428: }
1429: return;
1430: }
1431: }
1432: // On ajoute l'URL dans la BdD SalomeTMF
1433: STCommun.addUrlAttachToDB(database, prop, url, description);
1434: // On initialise l'ID de l'URL (max des ID des attachements de la base)
1435: int urlId = STCommun.getMaxIdAttach(database, prop);
1436: int num = -1;
1437: try {
1438: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1439:
1440: // Appel de la requete a executer
1441: PreparedStatement prep = database.prepareStatement(prop
1442: .getProperty("addUrlAttachToCampaign"));
1443: prep.setInt(1, campaignId);
1444: prep.setInt(2, urlId);
1445: prep.executeUpdate();
1446: } catch (SQLException E) {
1447: E.printStackTrace();
1448: org.objectweb.salome_tmf.api.Api.addException(
1449: "addUrlAttachToCampaign", null, E);
1450: } catch (Exception ex) {
1451: ex.printStackTrace();
1452: org.objectweb.salome_tmf.api.Api.addException(null, null,
1453: ex);
1454: }
1455: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1456: }
1457:
1458: /**
1459: * Ajout d'un fichier attachement à une exécution
1460: * @param campaignName
1461: * @param executionName
1462: * @param filePath
1463: * @param length
1464: * @param date
1465: * @param description
1466: */
1467: public void addAttachFileToExecution(String campaignName,
1468: String executionName, String filePath, long length,
1469: Date date, String description) {
1470: if (!special_allow) {
1471: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1472: .canCreateCamp())
1473: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1474: .canExecutCamp())) {
1475: org.objectweb.salome_tmf.api.Api
1476: .log("addAttachFileToExecution NOT ALLOW");
1477: try {
1478: throw new Exception(
1479: "addAttachFileToExecution NOT ALLOW");
1480: } catch (Exception e) {
1481: e.printStackTrace();
1482: org.objectweb.salome_tmf.api.Api.addException(e);
1483: }
1484: return;
1485: }
1486: }
1487: // On ajoute le fichier attachement dans la BdD SalomeTMF
1488: STCommun.addFileAttachToDB(database, prop, filePath, length,
1489: date, description);
1490: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1491: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1492: // On initialse l'ID de la campagne
1493: //int campId = CTCommun.getIdCamp(database,prop,idProject,campaignName);
1494: // On initialise l'ID de l'exécution
1495: int execId = CTCommun.getIdExecCamp(database, prop, idProject,
1496: campaignName, executionName);
1497: int num = -1;
1498: try {
1499: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1500:
1501: // Appel de la requete a executer
1502: PreparedStatement prep = database.prepareStatement(prop
1503: .getProperty("addFileAttachToExec"));
1504: prep.setInt(1, fileAttachId);
1505: prep.setInt(2, execId);
1506: prep.executeUpdate();
1507: } catch (SQLException E) {
1508: E.printStackTrace();
1509: org.objectweb.salome_tmf.api.Api.addException(
1510: "addFileAttachToExec", null, E);
1511: } catch (Exception ex) {
1512: ex.printStackTrace();
1513: org.objectweb.salome_tmf.api.Api.addException(null, null,
1514: ex);
1515: }
1516: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1517:
1518: }
1519:
1520: /**
1521: * Ajout d'un fichier attachement à une campagne
1522: * @param execId
1523: * @param filePath
1524: * @param length
1525: * @param date
1526: * @param description
1527: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
1528: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1529: */
1530: public void addAttachFileToExecutionUsingID(int execId,
1531: String filePath, long length, Date date, String description) {
1532: if (!special_allow) {
1533: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1534: .canCreateCamp())
1535: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1536: .canExecutCamp())) {
1537: org.objectweb.salome_tmf.api.Api
1538: .log("addAttachFileToExecution NOT ALLOW");
1539: try {
1540: throw new Exception(
1541: "addAttachFileToExecution NOT ALLOW");
1542: } catch (Exception e) {
1543: e.printStackTrace();
1544: org.objectweb.salome_tmf.api.Api.addException(e);
1545: }
1546: return;
1547: }
1548: }
1549: // On ajoute le fichier attachement dans la BdD SalomeTMF
1550: STCommun.addFileAttachToDB(database, prop, filePath, length,
1551: date, description);
1552: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1553: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1554: // On initialse l'ID de la campagne
1555: int num = -1;
1556: try {
1557: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1558:
1559: // Appel de la requete a executer
1560: PreparedStatement prep = database.prepareStatement(prop
1561: .getProperty("addFileAttachToExec"));
1562: prep.setInt(1, fileAttachId);
1563: prep.setInt(2, execId);
1564: prep.executeUpdate();
1565: } catch (SQLException E) {
1566: E.printStackTrace();
1567: org.objectweb.salome_tmf.api.Api.addException(
1568: "addFileAttachToExec", null, E);
1569: } catch (Exception ex) {
1570: ex.printStackTrace();
1571: org.objectweb.salome_tmf.api.Api.addException(null, null,
1572: ex);
1573: }
1574: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1575: }
1576:
1577: /**
1578: * Ajout d'une URL en attachement à une exécution
1579: * @param campaignName
1580: * @param executionName
1581: * @param url
1582: * @param description
1583: */
1584: public void addAttachUrlToExecution(String campaignName,
1585: String executionName, String url, String description) {
1586: if (!special_allow) {
1587: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1588: .canCreateCamp())
1589: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1590: .canExecutCamp())) {
1591: org.objectweb.salome_tmf.api.Api
1592: .log("addAttachUrlToExecution NOT ALLOW");
1593: try {
1594: throw new Exception(
1595: "addAttachUrlToExecution NOT ALLOW");
1596: } catch (Exception e) {
1597: e.printStackTrace();
1598: org.objectweb.salome_tmf.api.Api.addException(e);
1599: }
1600: return;
1601: }
1602: }
1603: // On ajoute l'URL dans la BdD SalomeTMF
1604: STCommun.addUrlAttachToDB(database, prop, url, description);
1605: // On initialise l'ID de l'URL (max des ID des attachements de la base)
1606: int urlId = STCommun.getMaxIdAttach(database, prop);
1607: // On initialise l'ID de la campagne de tests
1608: //int campaignId = CTCommun.getIdCamp(database,prop,idProject,campaignName);
1609: // On initialise l'ID de l'exécution
1610: int execId = CTCommun.getIdExecCamp(database, prop, idProject,
1611: campaignName, executionName);
1612: int num = -1;
1613: try {
1614: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1615:
1616: // Appel de la requete a executer
1617: PreparedStatement prep = database.prepareStatement(prop
1618: .getProperty("addUrlAttachToExec"));
1619: prep.setInt(1, urlId);
1620: prep.setInt(2, execId);
1621: prep.executeUpdate();
1622: } catch (SQLException E) {
1623: E.printStackTrace();
1624: org.objectweb.salome_tmf.api.Api.addException(
1625: "addUrlAttachToExec", null, E);
1626: } catch (Exception ex) {
1627: ex.printStackTrace();
1628: org.objectweb.salome_tmf.api.Api.addException(null, null,
1629: ex);
1630: }
1631: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1632:
1633: }
1634:
1635: /**
1636: * Ajout d'une URL en attachement à une campagne
1637: * @param execId
1638: * @param url
1639: * @param description
1640: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
1641: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1642: */
1643: public void addAttachUrlToExecutionUsingID(int execId, String url,
1644: String description) {
1645: if (!special_allow) {
1646: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1647: .canCreateCamp())
1648: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1649: .canExecutCamp())) {
1650: org.objectweb.salome_tmf.api.Api
1651: .log("addAttachUrlToExecution NOT ALLOW");
1652: try {
1653: throw new Exception(
1654: "addAttachUrlToExecution NOT ALLOW");
1655: } catch (Exception e) {
1656: e.printStackTrace();
1657: org.objectweb.salome_tmf.api.Api.addException(e);
1658: }
1659: return;
1660: }
1661: }
1662: // On ajoute l'URL dans la BdD SalomeTMF
1663: STCommun.addUrlAttachToDB(database, prop, url, description);
1664: // On initialise l'ID de l'URL (max des ID des attachements de la base)
1665: int urlId = STCommun.getMaxIdAttach(database, prop);
1666: // On initialise l'ID de la campagne de tests
1667:
1668: int num = -1;
1669: try {
1670: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1671:
1672: // Appel de la requete a executer
1673: PreparedStatement prep = database.prepareStatement(prop
1674: .getProperty("addUrlAttachToExec"));
1675: prep.setInt(1, urlId);
1676: prep.setInt(2, execId);
1677: prep.executeUpdate();
1678: } catch (SQLException E) {
1679: E.printStackTrace();
1680: org.objectweb.salome_tmf.api.Api.addException(
1681: "addUrlAttachToExec", null, E);
1682: } catch (Exception ex) {
1683: ex.printStackTrace();
1684: org.objectweb.salome_tmf.api.Api.addException(null, null,
1685: ex);
1686: }
1687: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1688: }
1689:
1690: /**
1691: * Ajout d'un fichier en attachement à un résultat d'exécution
1692: * @param campaignName
1693: * @param executionName
1694: * @param executionResultName
1695: * @param filePath
1696: * @param length
1697: * @param date
1698: * @param description
1699: */
1700: public void addAttachFileToExecutionResult(String campaignName,
1701: String executionName, String executionResultName,
1702: String filePath, long length, Date date, String description) {
1703: if (!special_allow) {
1704: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1705: .canExecutCamp())) {
1706: org.objectweb.salome_tmf.api.Api
1707: .log("addAttachFileToExecutionResult NOT ALLOW");
1708: try {
1709: throw new Exception(
1710: "addAttachFileToExecutionResult NOT ALLOW");
1711: } catch (Exception e) {
1712: e.printStackTrace();
1713: org.objectweb.salome_tmf.api.Api.addException(e);
1714: }
1715: return;
1716: }
1717: }
1718: // On ajoute le fichier attachement dans la BdD SalomeTMF
1719: STCommun.addFileAttachToDB(database, prop, filePath, length,
1720: date, description);
1721: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1722: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1723: // On initialise l'ID du résultat d'exécution
1724: int execResultId = CTCommun.getIdResExecCamp(database, prop,
1725: idProject, campaignName, executionName,
1726: executionResultName);
1727: int num = -1;
1728: try {
1729: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1730:
1731: // Appel de la requete a executer
1732: PreparedStatement prep = database.prepareStatement(prop
1733: .getProperty("addFileAttachToExecResult"));
1734: prep.setInt(1, fileAttachId);
1735: prep.setInt(2, execResultId);
1736: prep.executeUpdate();
1737: } catch (SQLException E) {
1738: E.printStackTrace();
1739: org.objectweb.salome_tmf.api.Api.addException(
1740: "addFileAttachToExecResult", null, E);
1741: } catch (Exception ex) {
1742: ex.printStackTrace();
1743: org.objectweb.salome_tmf.api.Api.addException(null, null,
1744: ex);
1745: }
1746: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1747:
1748: }
1749:
1750: /**
1751: * Ajout d'un fichier en attachement à un résultat d'exécution
1752: * @param executionResultId
1753: * @param filePath
1754: * @param length
1755: * @param date
1756: * @param description
1757: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1758: */
1759: public void addAttachFileToExecutionResultUsingID(int execResultId,
1760: String filePath, long length, Date date, String description) {
1761: if (!special_allow) {
1762: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1763: .canExecutCamp())) {
1764: org.objectweb.salome_tmf.api.Api
1765: .log("addAttachFileToExecutionResult NOT ALLOW");
1766: try {
1767: throw new Exception(
1768: "addAttachFileToExecutionResult NOT ALLOW");
1769: } catch (Exception e) {
1770: e.printStackTrace();
1771: org.objectweb.salome_tmf.api.Api.addException(e);
1772: }
1773: return;
1774: }
1775: }
1776: // On ajoute le fichier attachement dans la BdD SalomeTMF
1777: STCommun.addFileAttachToDB(database, prop, filePath, length,
1778: date, description);
1779: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1780: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1781: int num = -1;
1782: try {
1783: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1784:
1785: // Appel de la requete a executer
1786: PreparedStatement prep = database.prepareStatement(prop
1787: .getProperty("addFileAttachToExecResult"));
1788: prep.setInt(1, fileAttachId);
1789: prep.setInt(2, execResultId);
1790: prep.executeUpdate();
1791: } catch (SQLException E) {
1792: E.printStackTrace();
1793: org.objectweb.salome_tmf.api.Api.addException(
1794: "addFileAttachToExecResult", null, E);
1795: } catch (Exception ex) {
1796: ex.printStackTrace();
1797: org.objectweb.salome_tmf.api.Api.addException(null, null,
1798: ex);
1799: }
1800: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1801: }
1802:
1803: /**
1804: * Ajout d'une URL en attachement à un résultat d'exécution
1805: * @param campaignName
1806: * @param executionName
1807: * @param executionResultName
1808: * @param url
1809: * @param length
1810: * @param date
1811: * @param description
1812: */
1813: public void addAttachUrlToExecutionResult(String campaignName,
1814: String executionName, String executionResultName,
1815: String url, String description) {
1816: if (!special_allow) {
1817: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1818: .canExecutCamp())) {
1819: org.objectweb.salome_tmf.api.Api
1820: .log("addAttachUrlToExecutionResult NOT ALLOW");
1821: try {
1822: throw new Exception(
1823: "addAttachUrlToExecutionResult NOT ALLOW");
1824: } catch (Exception e) {
1825: e.printStackTrace();
1826: org.objectweb.salome_tmf.api.Api.addException(e);
1827: }
1828: return;
1829: }
1830: }
1831: // On ajoute l'URL dans la BdD SalomeTMF
1832: STCommun.addUrlAttachToDB(database, prop, url, description);
1833: // On initialise l'ID de l'URL (max des ID des attachements de la base)
1834: int urlId = STCommun.getMaxIdAttach(database, prop);
1835: // On initialise l'ID du résultat d'exécution
1836: int execResultId = CTCommun.getIdResExecCamp(database, prop,
1837: idProject, campaignName, executionName,
1838: executionResultName);
1839: int num = -1;
1840: try {
1841: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1842:
1843: // Appel de la requete a executer
1844: PreparedStatement prep = database.prepareStatement(prop
1845: .getProperty("addUrlAttachToExecResult"));
1846: prep.setInt(1, urlId);
1847: prep.setInt(2, execResultId);
1848: prep.executeUpdate();
1849: } catch (SQLException E) {
1850: E.printStackTrace();
1851: org.objectweb.salome_tmf.api.Api.addException(
1852: "addUrlAttachToExecResult", null, E);
1853: } catch (Exception ex) {
1854: ex.printStackTrace();
1855: org.objectweb.salome_tmf.api.Api.addException(null, null,
1856: ex);
1857: }
1858: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1859:
1860: }
1861:
1862: /**
1863: * Ajout d'une URL en attachement à un résultat d'exécution
1864: * @param executionResultId
1865: * @param url
1866: * @param length
1867: * @param date
1868: * @param description
1869: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1870: */
1871: public void addAttachUrlToExecutionResultUsingID(int execResultId,
1872: String url, String description) {
1873: if (!special_allow) {
1874: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1875: .canExecutCamp())) {
1876: org.objectweb.salome_tmf.api.Api
1877: .log("addAttachUrlToExecutionResult NOT ALLOW");
1878: try {
1879: throw new Exception(
1880: "addAttachUrlToExecutionResult NOT ALLOW");
1881: } catch (Exception e) {
1882: e.printStackTrace();
1883: org.objectweb.salome_tmf.api.Api.addException(e);
1884: }
1885: return;
1886: }
1887: }
1888: // On ajoute l'URL dans la BdD SalomeTMF
1889: STCommun.addUrlAttachToDB(database, prop, url, description);
1890: // On initialise l'ID de l'URL (max des ID des attachements de la base)
1891: int urlId = STCommun.getMaxIdAttach(database, prop);
1892: int num = -1;
1893: try {
1894: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1895:
1896: // Appel de la requete a executer
1897: PreparedStatement prep = database.prepareStatement(prop
1898: .getProperty("addUrlAttachToExecResult"));
1899: prep.setInt(1, urlId);
1900: prep.setInt(2, execResultId);
1901: prep.executeUpdate();
1902: } catch (SQLException E) {
1903: E.printStackTrace();
1904: org.objectweb.salome_tmf.api.Api.addException(
1905: "addUrlAttachToExecResult", null, E);
1906: } catch (Exception ex) {
1907: ex.printStackTrace();
1908: org.objectweb.salome_tmf.api.Api.addException(null, null,
1909: ex);
1910: }
1911: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1912: }
1913:
1914: /**
1915: * Ajout d'un fichier en attachement à un résultat d'exécution de test
1916: * @param familyName
1917: * @param suiteName
1918: * @param testName
1919: * @param campaignName
1920: * @param executionName
1921: * @param executionResultName
1922: * @param filePath
1923: * @param length
1924: * @param date
1925: * @param description
1926: */
1927: public void addAttachFileToExecutionTestResult(String familyName,
1928: String suiteName, String testName, String campaignName,
1929: String executionName, String executionResultName,
1930: String filePath, long length, Date date, String description) {
1931: if (!special_allow) {
1932: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1933: .canExecutCamp())) {
1934: org.objectweb.salome_tmf.api.Api
1935: .log("addAttachFileToExecutionTestResult NOT ALLOW");
1936: try {
1937: throw new Exception(
1938: "addAttachFileToExecutionTestResult NOT ALLOW");
1939: } catch (Exception e) {
1940: e.printStackTrace();
1941: org.objectweb.salome_tmf.api.Api.addException(e);
1942: }
1943: return;
1944: }
1945: }
1946: // On ajoute le fichier attachement dans la BdD SalomeTMF
1947: STCommun.addFileAttachToDB(database, prop, filePath, length,
1948: date, description);
1949: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
1950: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
1951: // On initialise l'ID du résultat d'exécution
1952: //int execResultId = CTCommun.getIdResExecCamp(database, prop, idProject, campaignName, executionName, executionResultName);
1953:
1954: // Initialisation de l'ID du test
1955: int familyId = STCommun.getIdFamily(database, prop, idProject,
1956: familyName);
1957: int suiteId = STCommun.getIdSuite(database, prop, idProject,
1958: suiteName, familyId);
1959: int testId = STCommun.getIdTest(database, prop, testName,
1960: suiteId);
1961: // Initialisation de l'ID du résultat de test
1962: int execTestResultId = CTCommun.getIdResExecCas(database, prop,
1963: idProject, campaignName, executionName,
1964: executionResultName, testId);
1965: int num = -1;
1966: try {
1967: num = org.objectweb.salome_tmf.api.Api.beginTrans();
1968:
1969: // Appel de la requete a executer
1970: PreparedStatement prep = database.prepareStatement(prop
1971: .getProperty("addFileAttachToExecTestResult"));
1972: prep.setInt(1, execTestResultId);
1973: prep.setInt(2, fileAttachId);
1974: prep.executeUpdate();
1975: } catch (SQLException E) {
1976: E.printStackTrace();
1977: org.objectweb.salome_tmf.api.Api.addException(
1978: "addFileAttachToExecTestResult", null, E);
1979: } catch (Exception ex) {
1980: ex.printStackTrace();
1981: org.objectweb.salome_tmf.api.Api.addException(null, null,
1982: ex);
1983: }
1984: org.objectweb.salome_tmf.api.Api.commitTrans(num);
1985:
1986: }
1987:
1988: /**
1989: * Ajout d'un fichier en attachement à un résultat d'exécution de test
1990: * @param testId
1991: * @param executionResultId
1992: * @param filePath
1993: * @param length
1994: * @param date
1995: * @param description
1996: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
1997: */
1998: public void addAttachFileToExecutionTestResultUsingID(int testId,
1999: int execResultId, String filePath, long length, Date date,
2000: String description) {
2001: if (!special_allow) {
2002: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2003: .canExecutCamp())) {
2004: org.objectweb.salome_tmf.api.Api
2005: .log("addAttachFileToExecutionTestResult NOT ALLOW");
2006: try {
2007: throw new Exception(
2008: "addAttachFileToExecutionTestResult NOT ALLOW");
2009: } catch (Exception e) {
2010: e.printStackTrace();
2011: org.objectweb.salome_tmf.api.Api.addException(e);
2012: }
2013: return;
2014: }
2015: }
2016: // On ajoute le fichier attachement dans la BdD SalomeTMF
2017: STCommun.addFileAttachToDB(database, prop, filePath, length,
2018: date, description);
2019: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
2020: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
2021:
2022: // Initialisation de l'ID du résultat de test
2023: int execTestResultId = CTCommun.getIdResExecCasUsingID(
2024: database, prop, execResultId, testId);
2025: int num = -1;
2026: try {
2027: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2028:
2029: // Appel de la requete a executer
2030: PreparedStatement prep = database.prepareStatement(prop
2031: .getProperty("addFileAttachToExecTestResult"));
2032: prep.setInt(1, execTestResultId);
2033: prep.setInt(2, fileAttachId);
2034: prep.executeUpdate();
2035: } catch (SQLException E) {
2036: E.printStackTrace();
2037: org.objectweb.salome_tmf.api.Api.addException(
2038: "addFileAttachToExecTestResult", null, E);
2039: } catch (Exception ex) {
2040: ex.printStackTrace();
2041: org.objectweb.salome_tmf.api.Api.addException(null, null,
2042: ex);
2043: }
2044: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2045: }
2046:
2047: /**
2048: * Ajout d'une URL en attachement à un résultat d'exécution de test
2049: * @param familyName
2050: * @param suiteName
2051: * @param testName
2052: * @param campaignName
2053: * @param executionName
2054: * @param executionResultName
2055: * @param url
2056: * @param description
2057: */
2058: public void addAttachUrlToExecutionTestResult(String familyName,
2059: String suiteName, String testName, String campaignName,
2060: String executionName, String executionResultName,
2061: String url, String description) {
2062: if (!special_allow) {
2063: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2064: .canExecutCamp())) {
2065: org.objectweb.salome_tmf.api.Api
2066: .log("addAttachFileToExecutionTestResult NOT ALLOW");
2067: try {
2068: throw new Exception(
2069: "addAttachUrlToExecutionTestResult NOT ALLOW");
2070: } catch (Exception e) {
2071: e.printStackTrace();
2072: org.objectweb.salome_tmf.api.Api.addException(e);
2073: }
2074: return;
2075: }
2076: }
2077: // On ajoute l'URL dans la BdD SalomeTMF
2078: STCommun.addUrlAttachToDB(database, prop, url, description);
2079: // On initialise l'ID de l'URL (max des ID des attachements de la base)
2080: int urlId = STCommun.getMaxIdAttach(database, prop);
2081: // On initialise l'ID du résultat d'exécution
2082: //int execResultId = CTCommun.getIdResExecCamp(database, prop, idProject, campaignName, executionName, executionResultName);
2083:
2084: // Initialisation de l'ID du test
2085: int familyId = STCommun.getIdFamily(database, prop, idProject,
2086: familyName);
2087: int suiteId = STCommun.getIdSuite(database, prop, idProject,
2088: suiteName, familyId);
2089: int testId = STCommun.getIdTest(database, prop, testName,
2090: suiteId);
2091: // Initialisation de l'ID du résultat de test
2092: int execTestResultId = CTCommun.getIdResExecCas(database, prop,
2093: idProject, campaignName, executionName,
2094: executionResultName, testId);
2095: int num = -1;
2096: try {
2097: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2098:
2099: // Appel de la requete a executer
2100: PreparedStatement prep = database.prepareStatement(prop
2101: .getProperty("addUrlAttachToExecTestResult"));
2102: prep.setInt(1, execTestResultId);
2103: prep.setInt(2, urlId);
2104: prep.executeUpdate();
2105: } catch (SQLException E) {
2106: E.printStackTrace();
2107: org.objectweb.salome_tmf.api.Api.addException(
2108: "addUrlAttachToExecTestResult", null, E);
2109: } catch (Exception ex) {
2110: ex.printStackTrace();
2111: org.objectweb.salome_tmf.api.Api.addException(null, null,
2112: ex);
2113: }
2114: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2115:
2116: }
2117:
2118: /**
2119: * Ajout d'une URL en attachement à un résultat d'exécution de test
2120: * @param testId
2121: * @param executionResultId
2122: * @param url
2123: * @param description
2124: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
2125: */
2126: public void addAttachUrlToExecutionTestResultUsingID(int testId,
2127: int execResultId, String url, String description) {
2128: if (!special_allow) {
2129: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2130: .canExecutCamp())) {
2131: org.objectweb.salome_tmf.api.Api
2132: .log("addAttachFileToExecutionTestResult NOT ALLOW");
2133: try {
2134: throw new Exception(
2135: "addAttachUrlToExecutionTestResult NOT ALLOW");
2136: } catch (Exception e) {
2137: e.printStackTrace();
2138: org.objectweb.salome_tmf.api.Api.addException(e);
2139: }
2140: return;
2141: }
2142: }
2143: // On ajoute l'URL dans la BdD SalomeTMF
2144: STCommun.addUrlAttachToDB(database, prop, url, description);
2145: // On initialise l'ID de l'URL (max des ID des attachements de la base)
2146: int urlId = STCommun.getMaxIdAttach(database, prop);
2147:
2148: // Initialisation de l'ID du résultat de test
2149: int execTestResultId = CTCommun.getIdResExecCasUsingID(
2150: database, prop, execResultId, testId);
2151: int num = -1;
2152: try {
2153: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2154:
2155: // Appel de la requete a executer
2156: PreparedStatement prep = database.prepareStatement(prop
2157: .getProperty("addUrlAttachToExecTestResult"));
2158: prep.setInt(1, execTestResultId);
2159: prep.setInt(2, urlId);
2160: prep.executeUpdate();
2161: } catch (SQLException E) {
2162: E.printStackTrace();
2163: org.objectweb.salome_tmf.api.Api.addException(
2164: "addUrlAttachToExecTestResult", null, E);
2165: } catch (Exception ex) {
2166: ex.printStackTrace();
2167: org.objectweb.salome_tmf.api.Api.addException(null, null,
2168: ex);
2169: }
2170: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2171: }
2172:
2173: /**
2174: * Ajout d'un script à une exécution
2175: * @param campaignName
2176: * @param executionName
2177: * @param scriptName
2178: * @param classPath
2179: * @param classToBeExecuted
2180: * @param type
2181: * @param scriptLength
2182: * @param scriptDate
2183: */
2184: public void addScriptToExecution(String campaignName,
2185: String executionName, String scriptPath, String classPath,
2186: String classToBeExecuted, String type, long scriptLength,
2187: Date scriptDate) {
2188: if (!special_allow) {
2189: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2190: .canCreateCamp())
2191: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2192: .canExecutCamp())) {
2193: org.objectweb.salome_tmf.api.Api
2194: .log("addScriptToExecution NOT ALLOW");
2195: try {
2196: throw new Exception(
2197: "addScriptToExecution NOT ALLOW");
2198: } catch (Exception e) {
2199: e.printStackTrace();
2200: org.objectweb.salome_tmf.api.Api.addException(e);
2201: }
2202: return;
2203: }
2204: }
2205: int num = -1;
2206: try {
2207: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2208:
2209: int execId = CTCommun.getIdExecCamp(database, prop,
2210: idProject, campaignName, executionName);
2211: // On ajoute le fichier de script dans la BdD SalomeTMF
2212: STCommun.addFileAttachToDB(database, prop, scriptPath,
2213: scriptLength, scriptDate, "", 3);
2214: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
2215: int attachId = STCommun.getMaxIdAttach(database, prop);
2216: File file = new File(scriptPath);
2217: // On initialise le nom du fichier
2218: String scriptName = file.getName();
2219:
2220: try {
2221: // Appel de la requete a executer
2222: PreparedStatement prep = database.prepareStatement(prop
2223: .getProperty("attachScriptToExecution"));
2224: prep.setString(1, scriptName);
2225: prep.setString(2, classToBeExecuted);
2226: prep.setString(3, classPath);
2227: prep.setString(4, type);
2228: prep.setInt(5, execId);
2229:
2230: prep.executeUpdate();
2231: } catch (SQLException E1) {
2232: E1.printStackTrace();
2233: org.objectweb.salome_tmf.api.Api.addException(
2234: "attachScriptToExecution", null, E1);
2235: } catch (Exception ex) {
2236: ex.printStackTrace();
2237: org.objectweb.salome_tmf.api.Api.addException(null,
2238: null, ex);
2239: }
2240: int scriptId = CTCommun.getMaxIdScript(database, prop);
2241: // On ajoute le fichier au script
2242: addFileAttachToScript(attachId, scriptId);
2243: } catch (Exception E) {
2244: E.printStackTrace();
2245: org.objectweb.salome_tmf.api.Api
2246: .addException(null, null, E);
2247: }
2248: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2249:
2250: }
2251:
2252: /**
2253: * Ajout d'un script à une exécution
2254: * @param executionId
2255: * @param scriptName
2256: * @param classPath
2257: * @param classToBeExecuted
2258: * @param type
2259: * @param scriptLength
2260: * @param scriptDate
2261: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
2262: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
2263: */
2264: public void addScriptToExecutionUsingID(int executionId,
2265: String scriptPath, String classPath,
2266: String classToBeExecuted, String type, long scriptLength,
2267: Date scriptDate) {
2268: if (!special_allow) {
2269: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2270: .canCreateCamp())
2271: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2272: .canExecutCamp())) {
2273: org.objectweb.salome_tmf.api.Api
2274: .log("addScriptToExecution NOT ALLOW");
2275: try {
2276: throw new Exception(
2277: "addScriptToExecution NOT ALLOW");
2278: } catch (Exception e) {
2279: e.printStackTrace();
2280: org.objectweb.salome_tmf.api.Api.addException(e);
2281: }
2282: return;
2283: }
2284: }
2285: int num = -1;
2286: try {
2287: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2288:
2289: // On ajoute le fichier de script dans la BdD SalomeTMF
2290: STCommun.addFileAttachToDB(database, prop, scriptPath,
2291: scriptLength, scriptDate, "", 3);
2292: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
2293: int attachId = STCommun.getMaxIdAttach(database, prop);
2294: File file = new File(scriptPath);
2295: // On initialise le nom du fichier
2296: String scriptName = file.getName();
2297:
2298: try {
2299: // Appel de la requete a executer
2300: PreparedStatement prep = database.prepareStatement(prop
2301: .getProperty("attachScriptToExecution"));
2302: prep.setString(1, scriptName);
2303: prep.setString(2, classToBeExecuted);
2304: prep.setString(3, classPath);
2305: prep.setString(4, type);
2306: prep.setInt(5, executionId);
2307:
2308: prep.executeUpdate();
2309: } catch (SQLException E1) {
2310: E1.printStackTrace();
2311: org.objectweb.salome_tmf.api.Api.addException(
2312: "attachScriptToExecution", null, E1);
2313: } catch (Exception ex) {
2314: ex.printStackTrace();
2315: org.objectweb.salome_tmf.api.Api.addException(null,
2316: null, ex);
2317: }
2318: int scriptId = CTCommun.getMaxIdScript(database, prop);
2319: // On ajoute le fichier au script
2320: addFileAttachToScript(attachId, scriptId);
2321: } catch (Exception E) {
2322: E.printStackTrace();
2323: org.objectweb.salome_tmf.api.Api
2324: .addException(null, null, E);
2325: }
2326: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2327: }
2328:
2329: /**
2330: * Ajout d'un script à un environnement
2331: * @param environmentName
2332: * @param scriptName
2333: * @param classPath
2334: * @param classToBeExecuted
2335: * @param type
2336: * @param scriptLength
2337: * @param scriptDate
2338: */
2339: public void addScriptToEnvironment(String environmentName,
2340: String scriptPath, String classPath,
2341: String classToBeExecuted, String type, long scriptLength,
2342: Date scriptDate) {
2343: if (!special_allow) {
2344: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2345: .canCreateCamp())
2346: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2347: .canExecutCamp())) {
2348: org.objectweb.salome_tmf.api.Api
2349: .log("addScriptToEnvironment NOT ALLOW");
2350: try {
2351: throw new Exception(
2352: "addScriptToEnvironment NOT ALLOW");
2353: } catch (Exception e) {
2354: e.printStackTrace();
2355: org.objectweb.salome_tmf.api.Api.addException(e);
2356: }
2357: return;
2358: }
2359: }
2360: int num = -1;
2361: try {
2362: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2363:
2364: int envId = APCommun.getIdEnv(database, prop, idProject,
2365: environmentName);
2366: // On ajoute le fichier de script dans la BdD SalomeTMF
2367: STCommun.addFileAttachToDB(database, prop, scriptPath,
2368: scriptLength, scriptDate, "", 2);
2369: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
2370: int attachId = STCommun.getMaxIdAttach(database, prop);
2371: // On crée le fichier à partir de l'URL
2372: File file = new File(scriptPath);
2373: // On initialise le nom du fichier
2374: String scriptName = file.getName();
2375:
2376: try {
2377: // Appel de la requete a executer
2378: PreparedStatement prep = database.prepareStatement(prop
2379: .getProperty("attachScriptToEnvironment"));
2380: prep.setString(1, scriptName);
2381: prep.setString(2, classToBeExecuted);
2382: prep.setString(3, classPath);
2383: prep.setString(4, type);
2384: prep.setInt(5, envId);
2385:
2386: prep.executeUpdate();
2387: } catch (SQLException E) {
2388: E.printStackTrace();
2389: org.objectweb.salome_tmf.api.Api.addException(
2390: "attachScriptToEnvironment", null, E);
2391: } catch (Exception ex) {
2392: ex.printStackTrace();
2393: org.objectweb.salome_tmf.api.Api.addException(null,
2394: null, ex);
2395: }
2396: int scriptId = CTCommun.getMaxIdScript(database, prop);
2397: // On ajoute le fichier au script
2398: addFileAttachToScript(attachId, scriptId);
2399: } catch (Exception E) {
2400: E.printStackTrace();
2401: org.objectweb.salome_tmf.api.Api
2402: .addException(null, null, E);
2403: }
2404: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2405:
2406: }
2407:
2408: /**
2409: * Ajout d'un script à un environnement
2410: * @param environmentId
2411: * @param scriptPath
2412: * @param classPath
2413: * @param classToBeExecuted
2414: * @param type
2415: * @param scriptLength
2416: * @param scriptDate
2417: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
2418: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
2419: */
2420: public void addScriptToEnvironmentUsingID(int envId,
2421: String scriptPath, String classPath,
2422: String classToBeExecuted, String type, long scriptLength,
2423: Date scriptDate) {
2424: if (!special_allow) {
2425: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2426: .canCreateCamp())
2427: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2428: .canExecutCamp())) {
2429: org.objectweb.salome_tmf.api.Api
2430: .log("addScriptToEnvironment NOT ALLOW");
2431: try {
2432: throw new Exception(
2433: "addScriptToEnvironment NOT ALLOW");
2434: } catch (Exception e) {
2435: e.printStackTrace();
2436: org.objectweb.salome_tmf.api.Api.addException(e);
2437: }
2438: return;
2439: }
2440: }
2441: int num = -1;
2442: try {
2443: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2444:
2445: // On ajoute le fichier de script dans la BdD SalomeTMF
2446: STCommun.addFileAttachToDB(database, prop, scriptPath,
2447: scriptLength, scriptDate, "", 2);
2448: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
2449: int attachId = STCommun.getMaxIdAttach(database, prop);
2450: // On crée le fichier à partir de l'URL
2451: File file = new File(scriptPath);
2452: // On initialise le nom du fichier
2453: String scriptName = file.getName();
2454:
2455: try {
2456: // Appel de la requete a executer
2457: PreparedStatement prep = database.prepareStatement(prop
2458: .getProperty("attachScriptToEnvironment"));
2459: prep.setString(1, scriptName);
2460: prep.setString(2, classToBeExecuted);
2461: prep.setString(3, classPath);
2462: prep.setString(4, type);
2463: prep.setInt(5, envId);
2464:
2465: prep.executeUpdate();
2466: } catch (SQLException E) {
2467: E.printStackTrace();
2468: org.objectweb.salome_tmf.api.Api.addException(
2469: "attachScriptToEnvironment", null, E);
2470: } catch (Exception ex) {
2471: ex.printStackTrace();
2472: org.objectweb.salome_tmf.api.Api.addException(null,
2473: null, ex);
2474: }
2475: int scriptId = CTCommun.getMaxIdScript(database, prop);
2476: // On ajoute le fichier au script
2477: addFileAttachToScript(attachId, scriptId);
2478: } catch (Exception E) {
2479: E.printStackTrace();
2480: org.objectweb.salome_tmf.api.Api
2481: .addException(null, null, E);
2482: }
2483: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2484: }
2485:
2486: /**
2487: *
2488: * @param attachId
2489: * @param scriptId
2490: */
2491: public void addFileAttachToScript(int attachId, int scriptId) {
2492: int num = -1;
2493: try {
2494: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2495:
2496: // Appel de la requete a executer
2497: PreparedStatement prep = database.prepareStatement(prop
2498: .getProperty("addFileAttachToScript"));
2499: prep.setInt(1, scriptId);
2500: prep.setInt(2, attachId);
2501:
2502: prep.executeUpdate();
2503: } catch (SQLException E) {
2504: E.printStackTrace();
2505: org.objectweb.salome_tmf.api.Api.addException(
2506: "addFileAttachToScript", null, E);
2507: } catch (Exception ex) {
2508: ex.printStackTrace();
2509: org.objectweb.salome_tmf.api.Api.addException(null, null,
2510: ex);
2511: }
2512: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2513:
2514: }
2515:
2516: /**
2517: * Insertion d'un environnement sous test
2518: * @param envName
2519: * @param envDescription
2520: */
2521: public void addEnvironment(String envName, String envDescription) {
2522:
2523: if (!special_allow) {
2524: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2525: .canCreateCamp())
2526: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2527: .canExecutCamp())) {
2528: org.objectweb.salome_tmf.api.Api
2529: .log("addEnvironment NOT ALLOW");
2530: try {
2531: throw new Exception("addEnvironment NOT ALLOW");
2532: } catch (Exception e) {
2533: e.printStackTrace();
2534: org.objectweb.salome_tmf.api.Api.addException(e);
2535: }
2536: return;
2537: }
2538: }
2539:
2540: int num = -1;
2541: try {
2542:
2543: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2544:
2545: // Appel de la requete
2546: PreparedStatement prep = database.prepareStatement(prop
2547: .getProperty("addEnvironment"));
2548: prep.setInt(1, idProject);
2549: prep.setString(2, envName);
2550: prep.setString(3, envDescription);
2551: prep.executeUpdate();
2552: //org.objectweb.salome_tmf.api.Api.getInstanceOfBugzillaAPI().insertComponent(envName,envDescription);
2553: } catch (SQLException E) {
2554: E.printStackTrace();
2555: org.objectweb.salome_tmf.api.Api.addException(
2556: "addEnvironment", null, E);
2557: } catch (Exception ex) {
2558: ex.printStackTrace();
2559: org.objectweb.salome_tmf.api.Api.addException(null, null,
2560: ex);
2561: }
2562: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2563:
2564: }
2565:
2566: /**
2567: * Ajout d'une valeur d'un paramètre à un environnement (le paramètre doit être créé auparavant dans le projet)
2568: * @param envName
2569: * @param paramName
2570: * @param paramValue
2571: */
2572: public void addParamValueToEnv(String envName, String paramName,
2573: String paramValue, String description) {
2574: if (!special_allow) {
2575: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2576: .canCreateCamp())
2577: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2578: .canExecutCamp())) {
2579: org.objectweb.salome_tmf.api.Api
2580: .log("addParamValueToEnv NOT ALLOW");
2581: try {
2582: throw new Exception("addParamValueToEnv NOT ALLOW");
2583: } catch (Exception e) {
2584: e.printStackTrace();
2585: org.objectweb.salome_tmf.api.Api.addException(e);
2586: }
2587: return;
2588: }
2589: }
2590: int idEnv = -1;
2591: int idParam = -1;
2592: int num = -1;
2593: try {
2594: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2595:
2596: // Initialisation de l'ID de l'environnement
2597: idEnv = APCommun.getIdEnv(database, prop, idProject,
2598: envName);
2599: // Initialisation de l'ID du parametre de test
2600: idParam = STCommun.getIdParam(database, prop, paramName,
2601: idProject);
2602:
2603: // Ajout du parametre de test au test
2604: PreparedStatement prep = database.prepareStatement(prop
2605: .getProperty("addParamValueToEnv"));
2606: prep.setInt(1, idEnv);
2607: prep.setInt(2, idParam);
2608: prep.setString(3, paramValue);
2609: prep.setString(4, description);
2610: prep.executeUpdate();
2611: } catch (SQLException E) {
2612: E.printStackTrace();
2613: org.objectweb.salome_tmf.api.Api.addException(
2614: "addParamValueToEnv", null, E);
2615: } catch (Exception ex) {
2616: ex.printStackTrace();
2617: org.objectweb.salome_tmf.api.Api.addException(null, null,
2618: ex);
2619: }
2620: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2621:
2622: }
2623:
2624: /**
2625: * Ajout d'une valeur d'un paramètre à un environnement (le paramètre doit être créé auparavant dans le projet)
2626: * @param envId
2627: * @param paramId
2628: * @param paramValue
2629: * @param description
2630: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canCreateCamp()
2631: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canExecutCamp()
2632: */
2633: public void addParamValueToEnvUsingID(int envId, int paramId,
2634: String paramValue, String description) {
2635: if (!special_allow) {
2636: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2637: .canCreateCamp())
2638: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2639: .canExecutCamp())) {
2640: org.objectweb.salome_tmf.api.Api
2641: .log("addParamValueToEnv NOT ALLOW");
2642: try {
2643: throw new Exception("addParamValueToEnv NOT ALLOW");
2644: } catch (Exception e) {
2645: e.printStackTrace();
2646: org.objectweb.salome_tmf.api.Api.addException(e);
2647: }
2648: return;
2649: }
2650: }
2651: //int idEnv = -1;
2652: //int idParam = -1;
2653: int num = -1;
2654: try {
2655: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2656:
2657: // Ajout du parametre de test au test
2658: PreparedStatement prep = database.prepareStatement(prop
2659: .getProperty("addParamValueToEnv"));
2660: prep.setInt(1, envId);
2661: prep.setInt(2, paramId);
2662: prep.setString(3, paramValue);
2663: prep.setString(4, description);
2664: prep.executeUpdate();
2665: } catch (SQLException E) {
2666: E.printStackTrace();
2667: org.objectweb.salome_tmf.api.Api.addException(
2668: "addParamValueToEnv", null, E);
2669: } catch (Exception ex) {
2670: ex.printStackTrace();
2671: org.objectweb.salome_tmf.api.Api.addException(null, null,
2672: ex);
2673: }
2674: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2675: }
2676:
2677: /**
2678: * Ajout d'un paramètre au projet dans la BdD SalomeTMF
2679: * @param paramName
2680: * @param paramDescription
2681: */
2682: public void addParamToProject(String paramName,
2683: String paramDescription) {
2684: if (!special_allow) {
2685: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2686: .canCreateCamp())
2687: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2688: .canCreateTest())
2689: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2690: .canExecutCamp())) {
2691: org.objectweb.salome_tmf.api.Api
2692: .log("addParamToProject NOT ALLOW");
2693: try {
2694: throw new Exception("addParamToProject NOT ALLOW");
2695: } catch (Exception e) {
2696: e.printStackTrace();
2697: org.objectweb.salome_tmf.api.Api.addException(e);
2698: }
2699: return;
2700: }
2701: }
2702: int num = -1;
2703: try {
2704: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2705:
2706: // on appelle la requete a executer
2707: PreparedStatement prep = database.prepareStatement(prop
2708: .getProperty("addParamToProject"));
2709: prep.setInt(1, idProject);
2710: prep.setString(2, paramName);
2711: prep.setString(3, paramDescription);
2712:
2713: prep.executeUpdate();
2714: } catch (SQLException E) {
2715: E.printStackTrace();
2716: org.objectweb.salome_tmf.api.Api.addException(
2717: "addParamToProject", null, E);
2718: } catch (Exception ex) {
2719: ex.printStackTrace();
2720: org.objectweb.salome_tmf.api.Api.addException(null, null,
2721: ex);
2722: }
2723: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2724:
2725: }
2726:
2727: public void addAttachFileToEnvironment(String envName,
2728: String filePath, long length, Date date, String description) {
2729:
2730: if (!special_allow) {
2731: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2732: .canCreateCamp())
2733: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2734: .canExecutCamp())) {
2735: org.objectweb.salome_tmf.api.Api
2736: .log("addAttachFileToEnvironment NOT ALLOW");
2737: try {
2738: throw new Exception(
2739: "addAttachFileToEnvironment NOT ALLOW");
2740: } catch (Exception e) {
2741: e.printStackTrace();
2742: org.objectweb.salome_tmf.api.Api.addException(e);
2743: }
2744: return;
2745: }
2746: }
2747:
2748: // On ajoute le fichier attachement dans la BdD SalomeTMF
2749: STCommun.addFileAttachToDB(database, prop, filePath, length,
2750: date, description);
2751: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
2752: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
2753: // On initialse l'ID de la campagne
2754: int envId = CTCommun.getIdEnv(database, prop, idProject,
2755: envName);
2756: int num = -1;
2757: try {
2758: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2759:
2760: // Appel de la requete a executer
2761: PreparedStatement prep = database.prepareStatement(prop
2762: .getProperty("addFileAttachToEnvironment"));
2763: prep.setInt(1, envId);
2764: prep.setInt(2, fileAttachId);
2765: prep.executeUpdate();
2766: } catch (SQLException E) {
2767: E.printStackTrace();
2768: org.objectweb.salome_tmf.api.Api.addException(
2769: "addFileAttachToEnvironment", null, E);
2770: } catch (Exception ex) {
2771: ex.printStackTrace();
2772: org.objectweb.salome_tmf.api.Api.addException(null, null,
2773: ex);
2774: }
2775: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2776: }
2777:
2778: /**
2779: * Adds an attach file to an environment
2780: * @param envId
2781: * @param filePath
2782: * @param length
2783: * @param date
2784: * @param description
2785: */
2786: public void addAttachFileToEnvironmentUsingID(int envId,
2787: String filePath, long length, Date date, String description) {
2788: if (!special_allow) {
2789: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2790: .canCreateCamp())
2791: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2792: .canExecutCamp())) {
2793: org.objectweb.salome_tmf.api.Api
2794: .log("addAttachFileToEnvironment NOT ALLOW");
2795: try {
2796: throw new Exception(
2797: "addAttachFileToEnvironment NOT ALLOW");
2798: } catch (Exception e) {
2799: e.printStackTrace();
2800: org.objectweb.salome_tmf.api.Api.addException(e);
2801: }
2802: return;
2803: }
2804: }
2805:
2806: // On ajoute le fichier attachement dans la BdD SalomeTMF
2807: STCommun.addFileAttachToDB(database, prop, filePath, length,
2808: date, description);
2809: // On initialise l'ID du fichier attaché (max des ID des attachements de la base)
2810: int fileAttachId = STCommun.getMaxIdAttach(database, prop);
2811: int num = -1;
2812: try {
2813: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2814:
2815: // Appel de la requete a executer
2816: PreparedStatement prep = database.prepareStatement(prop
2817: .getProperty("addFileAttachToEnvironment"));
2818: prep.setInt(1, envId);
2819: prep.setInt(2, fileAttachId);
2820: prep.executeUpdate();
2821: } catch (SQLException E) {
2822: E.printStackTrace();
2823: org.objectweb.salome_tmf.api.Api.addException(
2824: "addFileAttachToEnvironment", null, E);
2825: } catch (Exception ex) {
2826: ex.printStackTrace();
2827: org.objectweb.salome_tmf.api.Api.addException(null, null,
2828: ex);
2829: }
2830: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2831: }
2832:
2833: public void addAttachURLToEnvironment(String envName, String url,
2834: String description) {
2835: if (!special_allow) {
2836: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2837: .canCreateCamp())
2838: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2839: .canExecutCamp())) {
2840: org.objectweb.salome_tmf.api.Api
2841: .log("addAttachURLToEnvironment NOT ALLOW");
2842: try {
2843: throw new Exception(
2844: "addAttachURLToEnvironment NOT ALLOW");
2845: } catch (Exception e) {
2846: e.printStackTrace();
2847: org.objectweb.salome_tmf.api.Api.addException(e);
2848: }
2849: return;
2850: }
2851: }
2852:
2853: // On ajoute l'URL dans la BdD SalomeTMF
2854: STCommun.addUrlAttachToDB(database, prop, url, description);
2855: // On initialise l'ID de l'URL (max des ID des attachements de la base)
2856: int urlId = STCommun.getMaxIdAttach(database, prop);
2857: // On initialise l'ID de la campagne de tests
2858: int envId = CTCommun.getIdEnv(database, prop, idProject,
2859: envName);
2860: int num = -1;
2861: try {
2862: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2863:
2864: // Appel de la requete a executer
2865: PreparedStatement prep = database.prepareStatement(prop
2866: .getProperty("addUrlAttachToEnvironment"));
2867: prep.setInt(1, envId);
2868: prep.setInt(2, urlId);
2869: prep.executeUpdate();
2870: } catch (SQLException E) {
2871: E.printStackTrace();
2872: org.objectweb.salome_tmf.api.Api.addException(
2873: "addUrlAttachToEnvironment", null, E);
2874: } catch (Exception ex) {
2875: ex.printStackTrace();
2876: org.objectweb.salome_tmf.api.Api.addException(null, null,
2877: ex);
2878: }
2879: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2880: }
2881:
2882: /**
2883: * Adds an attach URL to an environment
2884: * @param envId
2885: * @param url
2886: * @param description
2887: */
2888: public void addAttachURLToEnvironmentUsingID(int envId, String url,
2889: String description) {
2890: if (!special_allow) {
2891: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2892: .canCreateCamp())
2893: && !(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2894: .canExecutCamp())) {
2895: org.objectweb.salome_tmf.api.Api
2896: .log("addAttachURLToEnvironment NOT ALLOW");
2897: try {
2898: throw new Exception(
2899: "addAttachURLToEnvironment NOT ALLOW");
2900: } catch (Exception e) {
2901: e.printStackTrace();
2902: org.objectweb.salome_tmf.api.Api.addException(e);
2903: }
2904: return;
2905: }
2906: }
2907:
2908: // On ajoute l'URL dans la BdD SalomeTMF
2909: STCommun.addUrlAttachToDB(database, prop, url, description);
2910: // On initialise l'ID de l'URL (max des ID des attachements de la base)
2911: int urlId = STCommun.getMaxIdAttach(database, prop);
2912:
2913: int num = -1;
2914: try {
2915: num = org.objectweb.salome_tmf.api.Api.beginTrans();
2916:
2917: // Appel de la requete a executer
2918: PreparedStatement prep = database.prepareStatement(prop
2919: .getProperty("addUrlAttachToEnvironment"));
2920: prep.setInt(1, envId);
2921: prep.setInt(2, urlId);
2922: prep.executeUpdate();
2923: } catch (SQLException E) {
2924: E.printStackTrace();
2925: org.objectweb.salome_tmf.api.Api.addException(
2926: "addUrlAttachToEnvironment", null, E);
2927: } catch (Exception ex) {
2928: ex.printStackTrace();
2929: org.objectweb.salome_tmf.api.Api.addException(null, null,
2930: ex);
2931: }
2932: org.objectweb.salome_tmf.api.Api.commitTrans(num);
2933: }
2934:
2935: }
|