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.net.URL;
0028: import java.sql.Date;
0029: import java.sql.PreparedStatement;
0030: import java.sql.SQLException;
0031: import java.sql.Time;
0032: import java.util.Properties;
0033: import java.util.Vector;
0034:
0035: import org.objectweb.salome_tmf.api.Api;
0036: import org.objectweb.salome_tmf.api.ApiConstants;
0037: import org.objectweb.salome_tmf.api.api2db.DataBase;
0038: import org.objectweb.salome_tmf.api.api2db.DataSet;
0039: import org.objectweb.salome_tmf.api.api2ihm.Utile;
0040: import org.objectweb.salome_tmf.api.api2ihm.adminProject.APCommun;
0041: import org.objectweb.salome_tmf.api.api2ihm.suiteTest.STCommun;
0042: import org.objectweb.salome_tmf.api.wrapper.CampaignWrapper;
0043: import org.objectweb.salome_tmf.api.wrapper.DataSetWrapper;
0044: import org.objectweb.salome_tmf.api.wrapper.ExecutionResultWrapper;
0045: import org.objectweb.salome_tmf.api.wrapper.ExecutionWrapper;
0046: import org.objectweb.salome_tmf.api.wrapper.FileAttachementWrapper;
0047: import org.objectweb.salome_tmf.api.wrapper.ScriptWrapper;
0048: import org.objectweb.salome_tmf.api.wrapper.TestCampWrapper;
0049: import org.objectweb.salome_tmf.api.wrapper.UrlAttachementWrapper;
0050:
0051: //import org.objectweb.salome_tmf.data.DataSet;
0052: //import org.objectweb.salome_tmf.data.ExecutionResult;
0053: //import org.objectweb.salome_tmf.data.FileAttachment;
0054: //import org.objectweb.salome_tmf.data.Script;
0055: //import org.objectweb.salome_tmf.data.UrlAttachment;
0056:
0057: /**
0058: * Fonctions de sélection relatives à l'aire fonctionnelle "campagnes de test"
0059: * @author Fayçal SOUGRATI
0060: */
0061: public class CampTestSelectImpl implements CampTestSelect, ApiConstants {
0062: /**
0063: * Base de donnees
0064: */
0065: DataBase database;
0066:
0067: /**
0068: * Fichier "properties" contenant les requetes SQL relatives aux campagnes de test
0069: */
0070: Properties prop;
0071:
0072: /**
0073: * ID du projet SalomeTMF dans lequel on se situe
0074: */
0075: int idProject;
0076:
0077: /**
0078: * Nom du projet SalomeTMF dans lequel on se situe
0079: */
0080: String nameProject;
0081:
0082: /**
0083: * Constructeur
0084: * @param db
0085: * @param pr
0086: */
0087: public CampTestSelectImpl(DataBase db, Properties pr) {
0088: database = db;
0089: prop = pr;
0090: }
0091:
0092: /**
0093: * Fonction qui fixe le projet SalomeTMF dans lequel l'utilisateur travaille
0094: * @param projectName
0095: */
0096: public void setProject(String projectName) {
0097: nameProject = projectName;
0098: idProject = Utile.getIdProject(database, prop, projectName);
0099: }
0100:
0101: /**
0102: * Selection des noms de toutes les campagnes de test appartenant a un projet
0103: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
0104: * @return
0105: */
0106: public Vector getProjectCampaigns() {
0107: Vector result = new Vector();
0108: DataSet stmtRes = null;
0109:
0110: try {
0111: // On execute la requete
0112: PreparedStatement prep = database.prepareStatement(prop
0113: .getProperty("selectProjectCampaigns"));
0114: prep.setInt(1, idProject);
0115: stmtRes = new DataSet(prep.executeQuery());
0116: // Ajoute les element un par un au resultat
0117: while (stmtRes.hasMoreElements()) {
0118: result.addElement(stmtRes.getResults().getString(
0119: "nom_camp"));
0120: }
0121: } catch (SQLException e) {
0122: e.printStackTrace();
0123: org.objectweb.salome_tmf.api.Api.addException(
0124: "selectProjectCampaigns", null, e);
0125: } catch (Exception ex) {
0126: ex.printStackTrace();
0127: org.objectweb.salome_tmf.api.Api.addException(null, null,
0128: ex);
0129: }
0130:
0131: // On retourne le resultat
0132: return result;
0133: }
0134:
0135: /**
0136: * Selection de la date de creation d'une campagne de test
0137: * @param campaignName
0138: * @return
0139: */
0140: public Date getCampaignCreationDate(String campaignName) {
0141: Date result = null;
0142: DataSet stmtRes = null;
0143:
0144: try {
0145: // On execute la requete
0146: PreparedStatement prep = database.prepareStatement(prop
0147: .getProperty("selectCampaignFromName"));
0148: prep.setInt(1, idProject);
0149: prep.setString(2, campaignName);
0150: stmtRes = new DataSet(prep.executeQuery());
0151: if (stmtRes.getResults().next()) {
0152: result = stmtRes.getResults().getDate(
0153: "date_creation_camp");
0154: }
0155: } catch (SQLException e) {
0156: e.printStackTrace();
0157: org.objectweb.salome_tmf.api.Api.addException(
0158: "selectCampaignFromName", null, e);
0159: } catch (Exception ex) {
0160: ex.printStackTrace();
0161: org.objectweb.salome_tmf.api.Api.addException(null, null,
0162: ex);
0163: }
0164:
0165: // On retourne le resultat
0166: return result;
0167: }
0168:
0169: /**
0170: * Selection de l'heure de creation d'une campagne de test
0171: * @param campaignName
0172: * @return
0173: */
0174: public Time getCampaignCreationTime(String campaignName) {
0175: Time result = null;
0176: DataSet stmtRes = null;
0177:
0178: try {
0179: // On execute la requete
0180: PreparedStatement prep = database.prepareStatement(prop
0181: .getProperty("selectCampaignFromName"));
0182: prep.setInt(1, idProject);
0183: prep.setString(2, campaignName);
0184: stmtRes = new DataSet(prep.executeQuery());
0185: if (stmtRes.getResults().next()) {
0186: result = stmtRes.getResults().getTime(
0187: "heure_creation_camp");
0188: }
0189: } catch (SQLException e) {
0190: e.printStackTrace();
0191: org.objectweb.salome_tmf.api.Api.addException(
0192: "selectCampaignFromName", null, e);
0193: } catch (Exception ex) {
0194: ex.printStackTrace();
0195: org.objectweb.salome_tmf.api.Api.addException(null, null,
0196: ex);
0197: }
0198:
0199: // On retourne le resultat
0200: return result;
0201: }
0202:
0203: /**
0204: * Selection du nom complet (nom+prenom) du createur d'une campagne de test
0205: * @param campaignName
0206: * @return
0207: */
0208: public String getCampaignDesignerCompleteName(String campaignName) {
0209: String result = null;
0210: DataSet stmtRes = null;
0211: int userId = -1;
0212: String sql = null;
0213: try {
0214: // On execute la requete
0215: sql = "selectCampaignFromName";
0216: PreparedStatement prep = database.prepareStatement(prop
0217: .getProperty("selectCampaignFromName"));
0218: prep.setInt(1, idProject);
0219: prep.setString(2, campaignName);
0220: stmtRes = new DataSet(prep.executeQuery());
0221: if (stmtRes.getResults().next()) {
0222: userId = stmtRes.getResults().getInt(
0223: "PERSONNE_id_personne");
0224: }
0225: sql = "selectUserFromId";
0226: prep = database.prepareStatement(prop
0227: .getProperty("selectUserFromId"));
0228: prep.setInt(1, userId);
0229: stmtRes = new DataSet(prep.executeQuery());
0230: if (stmtRes.getResults().next()) {
0231: result = stmtRes.getResults().getString("nom_personne")
0232: + " "
0233: + stmtRes.getResults().getString(
0234: "prenom_personne");
0235: }
0236: } catch (SQLException e) {
0237: e.printStackTrace();
0238: org.objectweb.salome_tmf.api.Api.addException(sql, null, e);
0239: } catch (Exception ex) {
0240: ex.printStackTrace();
0241: org.objectweb.salome_tmf.api.Api.addException(null, null,
0242: ex);
0243: }
0244:
0245: // On retourne le resultat
0246: return result;
0247: }
0248:
0249: /**
0250: * Selection de la description d'une campagne de test
0251: * @param campaignName
0252: * @return
0253: */
0254: public String getCampaignDescription(String campaignName) {
0255: String result = null;
0256: DataSet stmtRes = null;
0257:
0258: try {
0259: // On execute la requete
0260: PreparedStatement prep = database.prepareStatement(prop
0261: .getProperty("selectCampaignFromName"));
0262: prep.setInt(1, idProject);
0263: prep.setString(2, campaignName);
0264: stmtRes = new DataSet(prep.executeQuery());
0265: if (stmtRes.getResults().next()) {
0266: result = stmtRes.getResults().getString(
0267: "description_camp");
0268: }
0269: } catch (SQLException e) {
0270: e.printStackTrace();
0271: org.objectweb.salome_tmf.api.Api.addException(
0272: "selectCampaignFromName", null, e);
0273: } catch (Exception ex) {
0274: ex.printStackTrace();
0275: org.objectweb.salome_tmf.api.Api.addException(null, null,
0276: ex);
0277: }
0278:
0279: // On retourne le resultat
0280: return result;
0281: }
0282:
0283: /**
0284: * Selection des tests appartenant a une campagne de test.
0285: * IMPORTANT: LA FONCTION RETOURNE UN VECTOR D'OBJETS DE TYPE "TestSuiteFamily"
0286: * @param campaignName
0287: * @return
0288: */
0289: public Vector getCampaignTests(String campaignName) {
0290: Vector result = new Vector();
0291: TestSuiteFamily test;
0292: DataSet stmtRes = null;
0293:
0294: try {
0295: // On execute la requete
0296: PreparedStatement prep = database.prepareStatement(prop
0297: .getProperty("selectCampaignTests"));
0298: prep.setString(1, campaignName);
0299: prep.setInt(2, idProject);
0300: stmtRes = new DataSet(prep.executeQuery());
0301: // Ajoute les element un par un au resultat
0302: while (stmtRes.hasMoreElements()) {
0303: test = new TestSuiteFamily();
0304: test.setTestName(stmtRes.getResults().getString(
0305: "nom_cas"));
0306: test.setSuiteName(stmtRes.getResults().getString(
0307: "nom_suite"));
0308: test.setFamilyName(stmtRes.getResults().getString(
0309: "nom_famille"));
0310: result.addElement(test);
0311: }
0312: } catch (SQLException e) {
0313: e.printStackTrace();
0314: org.objectweb.salome_tmf.api.Api.addException(
0315: "selectCampaignTests", null, e);
0316: } catch (Exception ex) {
0317: ex.printStackTrace();
0318: org.objectweb.salome_tmf.api.Api.addException(null, null,
0319: ex);
0320: }
0321:
0322: // On retourne le resultat
0323: return result;
0324: }
0325:
0326: /**
0327: * Selection des noms de toutes les executions liees a une campagne de test
0328: * @param campaignName
0329: * @return
0330: */
0331: public Vector getCampaignExecutionsName(String campaignName) {
0332: Vector result = new Vector();
0333: DataSet stmtRes = null;
0334: int campId = -1;
0335:
0336: try {
0337: // On initialise l'ID de la campagne de test
0338: campId = CTCommun.getIdCamp(database, prop, idProject,
0339: campaignName);
0340: // On execute la requete
0341: PreparedStatement prep = database.prepareStatement(prop
0342: .getProperty("selectCampaignExecutions"));
0343: prep.setInt(1, campId);
0344: stmtRes = new DataSet(prep.executeQuery());
0345: // Ajoute les element un par un au resultat
0346: while (stmtRes.hasMoreElements()) {
0347: result.addElement(stmtRes.getResults().getString(
0348: "nom_exec_camp"));
0349: }
0350: } catch (SQLException e) {
0351: e.printStackTrace();
0352: org.objectweb.salome_tmf.api.Api.addException(
0353: "selectCampaignExecutions", null, e);
0354: } catch (Exception ex) {
0355: ex.printStackTrace();
0356: org.objectweb.salome_tmf.api.Api.addException(null, null,
0357: ex);
0358: }
0359:
0360: // On retourne le resultat
0361: return result;
0362: }
0363:
0364: /**
0365: * Selection des dates de creation de toutes les executions liees a une campagne de test
0366: * @param campaignName
0367: * @return
0368: */
0369: public Vector getCampaignExecutionsDate(String campaignName) {
0370: Vector result = new Vector();
0371: DataSet stmtRes = null;
0372: int campId = -1;
0373:
0374: try {
0375: // On initialise l'ID de la campagne de test
0376: campId = CTCommun.getIdCamp(database, prop, idProject,
0377: campaignName);
0378: // On execute la requete
0379: PreparedStatement prep = database.prepareStatement(prop
0380: .getProperty("selectCampaignExecutions"));
0381: prep.setInt(1, campId);
0382: stmtRes = new DataSet(prep.executeQuery());
0383: // Ajoute les element un par un au resultat
0384: while (stmtRes.hasMoreElements()) {
0385: result.addElement(stmtRes.getResults().getDate(
0386: "date_exec_camp"));
0387: }
0388: } catch (SQLException e) {
0389: e.printStackTrace();
0390: org.objectweb.salome_tmf.api.Api.addException(
0391: "selectCampaignExecutions", null, e);
0392: } catch (Exception ex) {
0393: ex.printStackTrace();
0394: org.objectweb.salome_tmf.api.Api.addException(null, null,
0395: ex);
0396: }
0397:
0398: // On retourne le resultat
0399: return result;
0400: }
0401:
0402: /**
0403: * Selection des descriptions de toutes les executions liees a une campagne de test
0404: * @param campaignName
0405: * @return
0406: */
0407: public Vector getCampaignExecutionsDesc(String campaignName) {
0408: Vector result = new Vector();
0409: DataSet stmtRes = null;
0410: int campId = -1;
0411:
0412: try {
0413: // On initialise l'ID de la campagne de test
0414: campId = CTCommun.getIdCamp(database, prop, idProject,
0415: campaignName);
0416: // On execute la requete
0417: PreparedStatement prep = database.prepareStatement(prop
0418: .getProperty("selectCampaignExecutions"));
0419: prep.setInt(1, campId);
0420: stmtRes = new DataSet(prep.executeQuery());
0421: // Ajoute les element un par un au resultat
0422: while (stmtRes.hasMoreElements()) {
0423: result.addElement(stmtRes.getResults().getString(
0424: "desc_exec_camp"));
0425: }
0426: } catch (SQLException e) {
0427: e.printStackTrace();
0428: org.objectweb.salome_tmf.api.Api.addException(
0429: "selectCampaignExecutions", null, e);
0430: } catch (Exception ex) {
0431: ex.printStackTrace();
0432: org.objectweb.salome_tmf.api.Api.addException(null, null,
0433: ex);
0434: }
0435:
0436: // On retourne le resultat
0437: return result;
0438: }
0439:
0440: /**
0441: * Selection de l'environnement lié à une execution de campagne (renvoie "null" si pas d'env.)
0442: * @param campName
0443: * @param execName
0444: * @return
0445: */
0446: public String getExecutionEnv(String campName, String execName) {
0447: String result = null;
0448: DataSet stmtRes = null;
0449: int campId = -1;
0450:
0451: try {
0452: // Initialisation de l'ID de la campagne de test
0453: campId = CTCommun.getIdCamp(database, prop, idProject,
0454: campName);
0455: // On execute la requete
0456: PreparedStatement prep = database.prepareStatement(prop
0457: .getProperty("selectExecutionEnv"));
0458: prep.setInt(1, campId);
0459: prep.setString(2, execName);
0460: stmtRes = new DataSet(prep.executeQuery());
0461: if (stmtRes.getResults().next()) {
0462: result = stmtRes.getResults().getString("nom_env");
0463: }
0464: } catch (SQLException e) {
0465: e.printStackTrace();
0466: org.objectweb.salome_tmf.api.Api.addException(
0467: "selectExecutionEnv", null, e);
0468: } catch (Exception ex) {
0469: ex.printStackTrace();
0470: org.objectweb.salome_tmf.api.Api.addException(null, null,
0471: ex);
0472: }
0473:
0474: // On retourne le resultat
0475: return result;
0476: }
0477:
0478: /**
0479: * Selection du jeu de données lié à une execution de campagne (renvoie "null" si pas de jeu de données)
0480: * @param campName
0481: * @param execName
0482: * @return
0483: */
0484: public String getExecutionJeuDonnees(String campName,
0485: String execName) {
0486: String result = null;
0487: DataSet stmtRes = null;
0488: int campId = -1;
0489:
0490: try {
0491: // Initialisation de l'ID de la campagne de test
0492: campId = CTCommun.getIdCamp(database, prop, idProject,
0493: campName);
0494: // On execute la requete
0495: PreparedStatement prep = database.prepareStatement(prop
0496: .getProperty("selectExecutionJeuDonnees"));
0497: prep.setInt(1, campId);
0498: prep.setString(2, execName);
0499: stmtRes = new DataSet(prep.executeQuery());
0500: if (stmtRes.getResults().next()) {
0501: result = stmtRes.getResults().getString(
0502: "nom_jeu_donnees");
0503: }
0504: } catch (SQLException e) {
0505: e.printStackTrace();
0506: org.objectweb.salome_tmf.api.Api.addException(
0507: "selectExecutionJeuDonnees", null, e);
0508: } catch (Exception ex) {
0509: ex.printStackTrace();
0510: org.objectweb.salome_tmf.api.Api.addException(null, null,
0511: ex);
0512: }
0513:
0514: // On retourne le resultat
0515: return result;
0516: }
0517:
0518: /**
0519: * Selection des noms de tous les resultats d'une execution de campagne de test
0520: * @param campName
0521: * @param execCampName
0522: * @return
0523: */
0524: public Vector getExecutionResultsName(String campName,
0525: String execCampName) {
0526: Vector result = new Vector();
0527: DataSet stmtRes = null;
0528: int execCampId = -1;
0529:
0530: try {
0531: // On initialise l'ID de l'execution de campagne de test
0532: execCampId = CTCommun.getIdExecCamp(database, prop,
0533: idProject, campName, execCampName);
0534: // On execute la requete
0535: PreparedStatement prep = database.prepareStatement(prop
0536: .getProperty("selectExecutionResults"));
0537: prep.setInt(1, execCampId);
0538: stmtRes = new DataSet(prep.executeQuery());
0539: // Ajoute les element un par un au resultat
0540: while (stmtRes.hasMoreElements()) {
0541: result.addElement(stmtRes.getResults().getString(
0542: "nom_res_exec_camp"));
0543: }
0544: } catch (SQLException e) {
0545: e.printStackTrace();
0546: org.objectweb.salome_tmf.api.Api.addException(
0547: "selectExecutionResults", null, e);
0548: } catch (Exception ex) {
0549: ex.printStackTrace();
0550: org.objectweb.salome_tmf.api.Api.addException(null, null,
0551: ex);
0552: }
0553:
0554: // On retourne le resultat
0555: return result;
0556: }
0557:
0558: /**
0559: * Selection des dates d'execution de tous les resultats d'une execution de campagne de test
0560: * @param campName
0561: * @param execCampName
0562: * @return
0563: */
0564: public Vector getExecutionResultsDate(String campName,
0565: String execCampName) {
0566: Vector result = new Vector();
0567: DataSet stmtRes = null;
0568: int execCampId = -1;
0569:
0570: try {
0571: // On initialise l'ID de l'execution de campagne de test
0572: execCampId = CTCommun.getIdExecCamp(database, prop,
0573: idProject, campName, execCampName);
0574: // On execute la requete
0575: PreparedStatement prep = database.prepareStatement(prop
0576: .getProperty("selectExecutionResults"));
0577: prep.setInt(1, execCampId);
0578: stmtRes = new DataSet(prep.executeQuery());
0579: // Ajoute les element un par un au resultat
0580: while (stmtRes.hasMoreElements()) {
0581: result.addElement(stmtRes.getResults().getDate(
0582: "date_res_exec_camp"));
0583: }
0584: } catch (SQLException e) {
0585: e.printStackTrace();
0586: org.objectweb.salome_tmf.api.Api.addException(
0587: "selectExecutionResults", null, e);
0588: } catch (Exception ex) {
0589: ex.printStackTrace();
0590: org.objectweb.salome_tmf.api.Api.addException(null, null,
0591: ex);
0592: }
0593:
0594: // On retourne le resultat
0595: return result;
0596: }
0597:
0598: /**
0599: * Selection des heures d'execution de tous les resultats d'une execution de campagne de test
0600: * @param campName
0601: * @param execCampName
0602: * @return
0603: */
0604: public Vector getExecutionResultsTime(String campName,
0605: String execCampName) {
0606: Vector result = new Vector();
0607: DataSet stmtRes = null;
0608: int execCampId = -1;
0609:
0610: try {
0611: // On initialise l'ID de l'execution de campagne de test
0612: execCampId = CTCommun.getIdExecCamp(database, prop,
0613: idProject, campName, execCampName);
0614: // On execute la requete
0615: PreparedStatement prep = database.prepareStatement(prop
0616: .getProperty("selectExecutionResults"));
0617: prep.setInt(1, execCampId);
0618: stmtRes = new DataSet(prep.executeQuery());
0619: // Ajoute les element un par un au resultat
0620: while (stmtRes.hasMoreElements()) {
0621: result.addElement(stmtRes.getResults().getTime(
0622: "heure_res_exec_camp"));
0623: }
0624: } catch (SQLException e) {
0625: e.printStackTrace();
0626: org.objectweb.salome_tmf.api.Api.addException(
0627: "selectExecutionResults", null, e);
0628: } catch (Exception ex) {
0629: ex.printStackTrace();
0630: org.objectweb.salome_tmf.api.Api.addException(null, null,
0631: ex);
0632: }
0633:
0634: // On retourne le resultat
0635: return result;
0636: }
0637:
0638: /**
0639: * Selection des heures d'execution de tous les resultats d'une execution de campagne de test
0640: * @param execCampId
0641: * @return
0642: */
0643: public Vector getExecutionResultsTimeUsingID(int execCampId) {
0644: Vector result = new Vector();
0645: DataSet stmtRes = null;
0646:
0647: try {
0648: // On execute la requete
0649: PreparedStatement prep = database.prepareStatement(prop
0650: .getProperty("selectExecutionResults"));
0651: prep.setInt(1, execCampId);
0652: stmtRes = new DataSet(prep.executeQuery());
0653: // Ajoute les element un par un au resultat
0654: while (stmtRes.hasMoreElements()) {
0655: result.addElement(stmtRes.getResults().getTime(
0656: "heure_res_exec_camp"));
0657: }
0658: } catch (SQLException e) {
0659: e.printStackTrace();
0660: org.objectweb.salome_tmf.api.Api.addException(
0661: "selectExecutionResults", null, e);
0662: } catch (Exception ex) {
0663: ex.printStackTrace();
0664: org.objectweb.salome_tmf.api.Api.addException(null, null,
0665: ex);
0666: }
0667:
0668: // On retourne le resultat
0669: return result;
0670: }
0671:
0672: /**
0673: * Selection des noms des testeurs de tous les resultats d'une execution de campagne de test
0674: * @param campName
0675: * @param execCampName
0676: * @return
0677: */
0678: public Vector getExecutionResultsTester(String campName,
0679: String execCampName) {
0680: Vector result = new Vector();
0681: DataSet stmtRes = null;
0682: int execCampId = -1;
0683: int userId = -1;
0684:
0685: try {
0686: // On initialise l'ID de l'execution de campagne de test
0687: execCampId = CTCommun.getIdExecCamp(database, prop,
0688: idProject, campName, execCampName);
0689: // On execute la requete
0690: PreparedStatement prep = database.prepareStatement(prop
0691: .getProperty("selectExecutionResults"));
0692: prep.setInt(1, execCampId);
0693: stmtRes = new DataSet(prep.executeQuery());
0694: // Ajoute les element un par un au resultat
0695: while (stmtRes.hasMoreElements()) {
0696: userId = stmtRes.getResults().getInt(
0697: "PERSONNE_id_personne");
0698: result.addElement(Utile.selectUserCompleteNameFromId(
0699: database, prop, userId));
0700: }
0701: } catch (SQLException e) {
0702: e.printStackTrace();
0703: org.objectweb.salome_tmf.api.Api.addException(
0704: "selectExecutionResults", null, e);
0705: } catch (Exception ex) {
0706: ex.printStackTrace();
0707: org.objectweb.salome_tmf.api.Api.addException(null, null,
0708: ex);
0709: }
0710:
0711: // On retourne le resultat
0712: return result;
0713: }
0714:
0715: /**
0716: * Selection de tous les resultats des lansements d'une execution de campagne de test
0717: * Le resultat est 'INCOMPLETE', 'STOPPEE' ou 'TERMINEE'
0718: * @param campName
0719: * @param execCampName
0720: * @return
0721: */
0722: public Vector getExecutionResultsRes(String campName,
0723: String execCampName) {
0724: Vector result = new Vector();
0725: DataSet stmtRes = null;
0726: int execCampId = -1;
0727:
0728: try {
0729: // On initialise l'ID de l'execution de campagne de test
0730: execCampId = CTCommun.getIdExecCamp(database, prop,
0731: idProject, campName, execCampName);
0732: // On execute la requete
0733: PreparedStatement prep = database.prepareStatement(prop
0734: .getProperty("selectExecutionResults"));
0735: prep.setInt(1, execCampId);
0736: stmtRes = new DataSet(prep.executeQuery());
0737: // Ajoute les element un par un au resultat
0738: while (stmtRes.hasMoreElements()) {
0739: result.addElement(stmtRes.getResults().getString(
0740: "resultat_res_exec_camp"));
0741: }
0742: } catch (SQLException e) {
0743: e.printStackTrace();
0744: org.objectweb.salome_tmf.api.Api.addException(
0745: "selectExecutionResults", null, e);
0746: } catch (Exception ex) {
0747: ex.printStackTrace();
0748: org.objectweb.salome_tmf.api.Api.addException(null, null,
0749: ex);
0750: }
0751:
0752: // On retourne le resultat
0753: return result;
0754: }
0755:
0756: /**
0757: * Calcul du nombre de tests en succès d'un resultat d'execution de campagne de test
0758: * @param campName
0759: * @param execCampName
0760: * @param resExecCampName
0761: * @return
0762: */
0763: public int getNbResExecCampPassedTests(String campName,
0764: String execCampName, String resExecCampName) {
0765: int resExecCampId = -1;
0766: int nbPassedTests = 0;
0767:
0768: try {
0769: // Initialisation de l'ID de l'Id du resultat de l'execution de la campagne de test
0770: resExecCampId = CTCommun.getIdResExecCamp(database, prop,
0771: idProject, campName, execCampName, resExecCampName);
0772:
0773: // Execution de la requete
0774: PreparedStatement prep = database.prepareStatement(prop
0775: .getProperty("selectResExecCampTestResults"));
0776: prep.setInt(1, resExecCampId);
0777: prep.setString(2, SUCCESS);
0778:
0779: DataSet DS = new DataSet(prep.executeQuery());
0780:
0781: while (DS.hasMoreElements()) {
0782: nbPassedTests++;
0783: }
0784: } catch (SQLException e) {
0785: e.printStackTrace();
0786: org.objectweb.salome_tmf.api.Api.addException(
0787: "selectResExecCampTestResults", null, e);
0788: } catch (Exception ex) {
0789: ex.printStackTrace();
0790: org.objectweb.salome_tmf.api.Api.addException(null, null,
0791: ex);
0792: }
0793:
0794: return nbPassedTests;
0795: }
0796:
0797: /**
0798: * Calcul du nombre de tests en échec d'un resultat d'execution de campagne de test
0799: * @param campName
0800: * @param execCampName
0801: * @param resExecCampName
0802: * @return
0803: */
0804: public int getNbResExecCampFailedTests(String campName,
0805: String execCampName, String resExecCampName) {
0806: int nbFailedTests = 0;
0807: int resExecCampId = -1;
0808:
0809: try {
0810: // Initialisation de l'ID de l'Id du resultat de l'execution de la campagne de test
0811: resExecCampId = CTCommun.getIdResExecCamp(database, prop,
0812: idProject, campName, execCampName, resExecCampName);
0813:
0814: // Execution de la requete
0815: PreparedStatement prep = database.prepareStatement(prop
0816: .getProperty("selectResExecCampTestResults"));
0817: prep.setInt(1, resExecCampId);
0818: prep.setString(2, FAIL);
0819:
0820: DataSet DS = new DataSet(prep.executeQuery());
0821:
0822: while (DS.hasMoreElements()) {
0823: nbFailedTests++;
0824: }
0825: } catch (SQLException e) {
0826: e.printStackTrace();
0827: org.objectweb.salome_tmf.api.Api.addException(
0828: "selectResExecCampTestResults", null, e);
0829: } catch (Exception ex) {
0830: ex.printStackTrace();
0831: org.objectweb.salome_tmf.api.Api.addException(null, null,
0832: ex);
0833: }
0834:
0835: return nbFailedTests;
0836: }
0837:
0838: /**
0839: * Calcul du nombre de tests en inconclusif d'un resultat d'execution de campagne de test
0840: * @param campName
0841: * @param execCampName
0842: * @param resExecCampName
0843: * @return
0844: */
0845: public int getNbResExecCampInconclusiveTests(String campName,
0846: String execCampName, String resExecCampName) {
0847: int nbInconclusiveTests = 0;
0848: int resExecCampId = -1;
0849:
0850: try {
0851: // Initialisation de l'ID de l'Id du resultat de l'execution de la campagne de test
0852: resExecCampId = CTCommun.getIdResExecCamp(database, prop,
0853: idProject, campName, execCampName, resExecCampName);
0854:
0855: // Execution de la requete
0856: PreparedStatement prep = database.prepareStatement(prop
0857: .getProperty("selectResExecCampTestResults"));
0858: prep.setInt(1, resExecCampId);
0859: prep.setString(2, UNKNOWN);
0860:
0861: DataSet DS = new DataSet(prep.executeQuery());
0862:
0863: while (DS.hasMoreElements()) {
0864: nbInconclusiveTests++;
0865: }
0866: } catch (SQLException e) {
0867: e.printStackTrace();
0868: org.objectweb.salome_tmf.api.Api.addException(
0869: "selectResExecCampTestResults", null, e);
0870: } catch (Exception ex) {
0871: ex.printStackTrace();
0872: org.objectweb.salome_tmf.api.Api.addException(null, null,
0873: ex);
0874: }
0875:
0876: return nbInconclusiveTests;
0877: }
0878:
0879: /**
0880: * Calcul du nombre de tests en succès d'un resultat d'execution de campagne de test
0881: * @param campName
0882: * @param execCampName
0883: * @param resExecCampName
0884: * @return
0885: */
0886: public int getNbResExecCampPassedTests(int resExecCampId) {
0887: int nbPassedTests = 0;
0888:
0889: try {
0890: // Execution de la requete
0891: PreparedStatement prep = database.prepareStatement(prop
0892: .getProperty("selectResExecCampTestResults"));
0893: prep.setInt(1, resExecCampId);
0894: prep.setString(2, SUCCESS);
0895:
0896: DataSet DS = new DataSet(prep.executeQuery());
0897:
0898: while (DS.hasMoreElements()) {
0899: nbPassedTests++;
0900: }
0901: } catch (SQLException e) {
0902: e.printStackTrace();
0903: org.objectweb.salome_tmf.api.Api.addException(
0904: "selectResExecCampTestResults", null, e);
0905: } catch (Exception ex) {
0906: ex.printStackTrace();
0907: org.objectweb.salome_tmf.api.Api.addException(null, null,
0908: ex);
0909: }
0910:
0911: return nbPassedTests;
0912: }
0913:
0914: /**
0915: * Calcul du nombre de tests en échec d'un resultat d'execution de campagne de test
0916: * @param campName
0917: * @param execCampName
0918: * @param resExecCampName
0919: * @return
0920: */
0921: public int getNbResExecCampFailedTests(int resExecCampId) {
0922: int nbFailedTests = 0;
0923:
0924: try {
0925: // Execution de la requete
0926: PreparedStatement prep = database.prepareStatement(prop
0927: .getProperty("selectResExecCampTestResults"));
0928: prep.setInt(1, resExecCampId);
0929: prep.setString(2, FAIL);
0930:
0931: DataSet DS = new DataSet(prep.executeQuery());
0932:
0933: while (DS.hasMoreElements()) {
0934: nbFailedTests++;
0935: }
0936: } catch (SQLException e) {
0937: e.printStackTrace();
0938: org.objectweb.salome_tmf.api.Api.addException(
0939: "selectResExecCampTestResults", null, e);
0940: } catch (Exception ex) {
0941: ex.printStackTrace();
0942: org.objectweb.salome_tmf.api.Api.addException(null, null,
0943: ex);
0944: }
0945:
0946: return nbFailedTests;
0947: }
0948:
0949: /**
0950: * Calcul du nombre de tests en inconclusif d'un resultat d'execution de campagne de test
0951: * @param campName
0952: * @param execCampName
0953: * @param resExecCampName
0954: * @return
0955: */
0956: public int getNbResExecCampInconclusiveTests(int resExecCampId) {
0957: int nbInconclusiveTests = 0;
0958:
0959: try {
0960: // Execution de la requete
0961: PreparedStatement prep = database.prepareStatement(prop
0962: .getProperty("selectResExecCampTestResults"));
0963: prep.setInt(1, resExecCampId);
0964: prep.setString(2, UNKNOWN);
0965:
0966: DataSet DS = new DataSet(prep.executeQuery());
0967:
0968: while (DS.hasMoreElements()) {
0969: nbInconclusiveTests++;
0970: }
0971: } catch (SQLException e) {
0972: e.printStackTrace();
0973: org.objectweb.salome_tmf.api.Api.addException(
0974: "selectResExecCampTestResults", null, e);
0975: } catch (Exception ex) {
0976: ex.printStackTrace();
0977: org.objectweb.salome_tmf.api.Api.addException(null, null,
0978: ex);
0979: }
0980:
0981: return nbInconclusiveTests;
0982: }
0983:
0984: /**
0985: * Selection des statistiques de tous les resultats d'une execution de campagne de test
0986: * Les statistiques sont sous la forme : "[x S, y E, z I] sur n test(s)" où x, y, z et n sont des nombres
0987: * @param campName
0988: * @param execCampName
0989: * @return
0990: */
0991: public Vector getExecutionResultsStatistics(String campName,
0992: String execCampName) {
0993: Vector result = new Vector();
0994: DataSet stmtRes = null;
0995: int execCampId = -1;
0996: String resExecCampName = null;
0997: int resExecCampId = 0;
0998:
0999: try {
1000: // On initialise l'ID de l'execution de campagne de test
1001: execCampId = CTCommun.getIdExecCamp(database, prop,
1002: idProject, campName, execCampName);
1003: // On execute la requete
1004: PreparedStatement prep = database.prepareStatement(prop
1005: .getProperty("selectExecutionResults"));
1006: prep.setInt(1, execCampId);
1007: stmtRes = new DataSet(prep.executeQuery());
1008: // Ajoute les element un par un au resultat
1009: while (stmtRes.hasMoreElements()) {
1010: resExecCampName = stmtRes.getResults().getString(
1011: "nom_res_exec_camp");
1012: resExecCampId = stmtRes.getResults().getInt(
1013: "id_res_exec_camp");
1014: result.addElement("["
1015: + getNbResExecCampPassedTests(campName,
1016: execCampName, resExecCampName)
1017: + " S, "
1018: + getNbResExecCampFailedTests(campName,
1019: execCampName, resExecCampName)
1020: + " E, "
1021: + getNbResExecCampInconclusiveTests(campName,
1022: execCampName, resExecCampName)
1023: + " I]"
1024: + " sur "
1025: + CTCommun.getNbResExecCampTests(database,
1026: prop, resExecCampId) + " test(s)");
1027: }
1028: } catch (SQLException e) {
1029: e.printStackTrace();
1030: org.objectweb.salome_tmf.api.Api.addException(
1031: "selectExecutionResults", null, e);
1032: } catch (Exception ex) {
1033: ex.printStackTrace();
1034: org.objectweb.salome_tmf.api.Api.addException(null, null,
1035: ex);
1036: }
1037:
1038: // On retourne le resultat
1039: return result;
1040: }
1041:
1042: /**
1043: * Fonction qui donne le resultat de l'execution d'un test inclu dans un resultat d'execution d'une
1044: * campagne de test
1045: * @param campName
1046: * @param execCampName
1047: * @param resExecCampName
1048: * @param familyName
1049: * @param suiteName
1050: * @param testName
1051: * @return
1052: */
1053: public String getResExecTest(String campName, String execCampName,
1054: String resExecCampName, String familyName,
1055: String suiteName, String testName) {
1056: String result = null;
1057: DataSet stmtRes = null;
1058: int resExecCampId = -1;
1059: int familyId = -1;
1060: int suiteId = -1;
1061: int testId = -1;
1062:
1063: try {
1064: // On initialise l'ID du resultat de l'execution de la campagne de test
1065: resExecCampId = CTCommun.getIdResExecCamp(database, prop,
1066: idProject, campName, execCampName, resExecCampName);
1067: // On initialise l'ID du test
1068: familyId = STCommun.getIdFamily(database, prop, idProject,
1069: familyName);
1070: suiteId = STCommun.getIdSuite(database, prop, idProject,
1071: suiteName, familyId);
1072: testId = STCommun.getIdTest(database, prop, testName,
1073: suiteId);
1074:
1075: // On execute la requete
1076: PreparedStatement prep = database.prepareStatement(prop
1077: .getProperty("selectResExecTest"));
1078: prep.setInt(1, resExecCampId);
1079: prep.setInt(2, testId);
1080: stmtRes = new DataSet(prep.executeQuery());
1081: if (stmtRes.getResults().next()) {
1082: result = stmtRes.getResults().getString("res_exec_cas");
1083: }
1084: } catch (SQLException e) {
1085: e.printStackTrace();
1086: org.objectweb.salome_tmf.api.Api.addException(
1087: "selectResExecTest", null, e);
1088: } catch (Exception ex) {
1089: ex.printStackTrace();
1090: org.objectweb.salome_tmf.api.Api.addException(null, null,
1091: ex);
1092: }
1093:
1094: // On retourne le resultat
1095: return result;
1096: }
1097:
1098: /**
1099: * Fonction qui donne le resultat de l'execution d'une action de test inclue dans un resultat d'execution
1100: * d'un test
1101: * @param campName
1102: * @param execCampName
1103: * @param resExecCampName
1104: * @param familyName
1105: * @param suiteName
1106: * @param testName
1107: * @param actionName
1108: * @return
1109: */
1110: public String getResExecAction(String campName,
1111: String execCampName, String resExecCampName,
1112: String familyName, String suiteName, String testName,
1113: String actionName) {
1114: String result = null;
1115: DataSet stmtRes = null;
1116: int resExecTestId = -1;
1117: int familyId = -1;
1118: int suiteId = -1;
1119: int testId = -1;
1120: int actionId = -1;
1121:
1122: try {
1123: // On initialise l'ID de l'action de test
1124: familyId = STCommun.getIdFamily(database, prop, idProject,
1125: familyName);
1126: suiteId = STCommun.getIdSuite(database, prop, idProject,
1127: suiteName, familyId);
1128: testId = STCommun.getIdTest(database, prop, testName,
1129: suiteId);
1130: actionId = STCommun.getIdAction(database, prop, actionName,
1131: testId);
1132: // On initialise l'ID du resultat de l'execution du test
1133: resExecTestId = CTCommun.getIdResExecCas(database, prop,
1134: idProject, campName, execCampName, resExecCampName,
1135: testId);
1136:
1137: // On execute la requete
1138: PreparedStatement prep = database.prepareStatement(prop
1139: .getProperty("selectResExecAction"));
1140: prep.setInt(1, resExecTestId);
1141: prep.setInt(2, actionId);
1142: stmtRes = new DataSet(prep.executeQuery());
1143: if (stmtRes.getResults().next()) {
1144: result = stmtRes.getResults().getString(
1145: "res_exec_action");
1146: }
1147: } catch (SQLException e) {
1148: e.printStackTrace();
1149: org.objectweb.salome_tmf.api.Api.addException(
1150: "selectResExecAction", null, e);
1151: } catch (Exception ex) {
1152: ex.printStackTrace();
1153: org.objectweb.salome_tmf.api.Api.addException(null, null,
1154: ex);
1155: }
1156:
1157: // On retourne le resultat
1158: return result;
1159: }
1160:
1161: /**
1162: * Selection des noms des jeux de données liés à une campagne de test
1163: * @param campName
1164: * @return
1165: */
1166: public Vector getCampJeuxDonneesName(String campName) {
1167: Vector result = new Vector();
1168: DataSet stmtRes = null;
1169: int campId = -1;
1170:
1171: try {
1172: // On initialise l'ID de la campagne de test
1173: campId = CTCommun.getIdCamp(database, prop, idProject,
1174: campName);
1175: // On execute la requete
1176: PreparedStatement prep = database.prepareStatement(prop
1177: .getProperty("selectCampJeuxDonnees"));
1178: prep.setInt(1, campId);
1179: stmtRes = new DataSet(prep.executeQuery());
1180: // Ajoute les element un par un au resultat
1181: while (stmtRes.hasMoreElements()) {
1182: result.addElement(stmtRes.getResults().getString(
1183: "nom_jeu_donnees"));
1184: }
1185: } catch (SQLException e) {
1186: e.printStackTrace();
1187: org.objectweb.salome_tmf.api.Api.addException(
1188: "selectCampJeuxDonnees", null, e);
1189: } catch (Exception ex) {
1190: ex.printStackTrace();
1191: org.objectweb.salome_tmf.api.Api.addException(null, null,
1192: ex);
1193: }
1194:
1195: // On retourne le resultat
1196: return result;
1197: }
1198:
1199: /**
1200: * Selection des descriptions des jeux de données liés à une campagne de test
1201: * @param campName
1202: * @return
1203: */
1204: public Vector getCampJeuxDonneesDesc(String campName) {
1205: Vector result = new Vector();
1206: DataSet stmtRes = null;
1207: int campId = -1;
1208:
1209: try {
1210: // On initialise l'ID de la campagne de test
1211: campId = CTCommun.getIdCamp(database, prop, idProject,
1212: campName);
1213: // On execute la requete
1214: PreparedStatement prep = database.prepareStatement(prop
1215: .getProperty("selectCampJeuxDonnees"));
1216: prep.setInt(1, campId);
1217: stmtRes = new DataSet(prep.executeQuery());
1218: // Ajoute les element un par un au resultat
1219: while (stmtRes.hasMoreElements()) {
1220: result.addElement(stmtRes.getResults().getString(
1221: "desc_jeu_donnees"));
1222: }
1223: } catch (SQLException e) {
1224: e.printStackTrace();
1225: org.objectweb.salome_tmf.api.Api.addException(
1226: "selectCampJeuxDonnees", null, e);
1227: } catch (Exception ex) {
1228: ex.printStackTrace();
1229: org.objectweb.salome_tmf.api.Api.addException(null, null,
1230: ex);
1231: }
1232:
1233: // On retourne le resultat
1234: return result;
1235: }
1236:
1237: /**
1238: * Selection des noms des parametres valués dans un jeu de données
1239: * @param campName
1240: * @param jeuDonneesName
1241: * @return
1242: */
1243: public Vector getJeuDonneesParamsName(String campName,
1244: String jeuDonneesName) {
1245: Vector result = new Vector();
1246: DataSet stmtRes = null;
1247: int campId = -1;
1248:
1249: try {
1250: // On initialise l'ID de la campagne de test
1251: campId = CTCommun.getIdCamp(database, prop, idProject,
1252: campName);
1253: // On execute la requete
1254: PreparedStatement prep = database.prepareStatement(prop
1255: .getProperty("selectJeuxDonneesParams"));
1256: prep.setInt(1, campId);
1257: prep.setString(2, jeuDonneesName);
1258: stmtRes = new DataSet(prep.executeQuery());
1259: // Ajoute les element un par un au resultat
1260: while (stmtRes.hasMoreElements()) {
1261: result.addElement(stmtRes.getResults().getString(
1262: "nom_param_test"));
1263: }
1264: } catch (SQLException e) {
1265: e.printStackTrace();
1266: org.objectweb.salome_tmf.api.Api.addException(
1267: "selectJeuxDonneesParams", null, e);
1268: } catch (Exception ex) {
1269: ex.printStackTrace();
1270: org.objectweb.salome_tmf.api.Api.addException(null, null,
1271: ex);
1272: }
1273:
1274: // On retourne le resultat
1275: return result;
1276: }
1277:
1278: /**
1279: * Selection des valeurs des parametres valués dans un jeu de données
1280: * @param campName
1281: * @param jeuDonneesName
1282: * @return
1283: */
1284: public Vector getJeuDonneesParamsValue(String campName,
1285: String jeuDonneesName) {
1286: Vector result = new Vector();
1287: DataSet stmtRes = null;
1288: int campId = -1;
1289:
1290: try {
1291: // On initialise l'ID de la campagne de test
1292: campId = CTCommun.getIdCamp(database, prop, idProject,
1293: campName);
1294: // On execute la requete
1295: PreparedStatement prep = database.prepareStatement(prop
1296: .getProperty("selectJeuxDonneesParams"));
1297: prep.setInt(1, campId);
1298: prep.setString(2, jeuDonneesName);
1299: stmtRes = new DataSet(prep.executeQuery());
1300: // Ajoute les element un par un au resultat
1301: while (stmtRes.hasMoreElements()) {
1302: result.addElement(stmtRes.getResults().getString(
1303: "valeur"));
1304: }
1305: } catch (SQLException e) {
1306: e.printStackTrace();
1307: org.objectweb.salome_tmf.api.Api.addException(
1308: "selectJeuxDonneesParams", null, e);
1309: } catch (Exception ex) {
1310: ex.printStackTrace();
1311: org.objectweb.salome_tmf.api.Api.addException(null, null,
1312: ex);
1313: }
1314:
1315: // On retourne le resultat
1316: return result;
1317: }
1318:
1319: /**
1320: * Selection des descriptions des parametres valués dans un jeu de données
1321: * @param campName
1322: * @param jeuDonneesName
1323: * @return
1324: */
1325: public Vector getJeuDonneesParamsDesc(String campName,
1326: String jeuDonneesName) {
1327: Vector result = new Vector();
1328: DataSet stmtRes = null;
1329: int campId = -1;
1330:
1331: try {
1332: // On initialise l'ID de la campagne de test
1333: campId = CTCommun.getIdCamp(database, prop, idProject,
1334: campName);
1335: // On execute la requete
1336: PreparedStatement prep = database.prepareStatement(prop
1337: .getProperty("selectJeuxDonneesParams"));
1338: prep.setInt(1, campId);
1339: prep.setString(2, jeuDonneesName);
1340: stmtRes = new DataSet(prep.executeQuery());
1341: // Ajoute les element un par un au resultat
1342: while (stmtRes.hasMoreElements()) {
1343: result.addElement(stmtRes.getResults().getString(
1344: "desc_param_test"));
1345: }
1346: } catch (SQLException e) {
1347: e.printStackTrace();
1348: org.objectweb.salome_tmf.api.Api.addException(
1349: "selectJeuxDonneesParams", null, e);
1350: } catch (Exception ex) {
1351: ex.printStackTrace();
1352: org.objectweb.salome_tmf.api.Api.addException(null, null,
1353: ex);
1354: }
1355:
1356: // On retourne le resultat
1357: return result;
1358: }
1359:
1360: /**
1361: * Selection de la valeur associée à un parametre de test dans un jeu de données
1362: * @param campName
1363: * @param jeuDonneesName
1364: * @param paramName
1365: * @return
1366: */
1367: public String getParamValueInJeuDonnees(String campName,
1368: String jeuDonneesName, String paramName) {
1369: int campId = -1;
1370: String result = null;
1371: DataSet stmtRes = null;
1372:
1373: try {
1374: // Initialisation de l'Id de la campagne de test
1375: campId = CTCommun.getIdCamp(database, prop, idProject,
1376: campName);
1377: // On execute la requete
1378: PreparedStatement prep = database.prepareStatement(prop
1379: .getProperty("selectParamValueInJeuDonnees"));
1380: prep.setInt(1, campId);
1381: prep.setString(2, jeuDonneesName);
1382: prep.setString(3, paramName);
1383: stmtRes = new DataSet(prep.executeQuery());
1384: if (stmtRes.getResults().next()) {
1385: result = stmtRes.getResults().getString("valeur");
1386: }
1387: } catch (SQLException e) {
1388: e.printStackTrace();
1389: org.objectweb.salome_tmf.api.Api.addException(
1390: "selectParamValueInJeuDonnees", null, e);
1391: } catch (Exception ex) {
1392: ex.printStackTrace();
1393: org.objectweb.salome_tmf.api.Api.addException(null, null,
1394: ex);
1395: }
1396:
1397: // On retourne le resultat
1398: return result;
1399: }
1400:
1401: /**
1402: * Selection d'un fichier attaché à une campagne
1403: * @param campaignName
1404: * @param fileName
1405: * @return
1406: */
1407: public File getCampaignAttachFile(String campaignName,
1408: String fileName) {
1409: int fileAttachId = -1;
1410: File file = null;
1411: DataSet stmtRes = null;
1412:
1413: try {
1414: // On initialise l'ID de la campagne
1415: int campaignId = CTCommun.getIdCamp(database, prop,
1416: idProject, campaignName);
1417:
1418: // On execute la requete
1419: PreparedStatement prep = database.prepareStatement(prop
1420: .getProperty("selectCampaignAttachFile"));
1421: prep.setInt(1, campaignId);
1422: prep.setString(2, fileName);
1423: stmtRes = new DataSet(prep.executeQuery());
1424: if (stmtRes.getResults().next()) {
1425: fileAttachId = stmtRes.getResults().getInt("id_attach");
1426: }
1427:
1428: // On selectionne le fichier attachement
1429: file = STCommun.getFileAttachFromDB(database, prop,
1430: fileAttachId);
1431: } catch (SQLException e) {
1432: e.printStackTrace();
1433: org.objectweb.salome_tmf.api.Api.addException(
1434: "selectCampaignAttachFile", null, e);
1435: } catch (Exception ex) {
1436: ex.printStackTrace();
1437: org.objectweb.salome_tmf.api.Api.addException(null, null,
1438: ex);
1439: }
1440: // On retourne le resultat
1441: return file;
1442: }
1443:
1444: /**
1445: * Selection d'un fichier attaché à un environnement sous test
1446: * @param envName
1447: * @param fileName
1448: * @return
1449: */
1450: public File getEnvironmentAttachFile(String envName, String fileName) {
1451: int fileAttachId = -1;
1452: File file = null;
1453: DataSet stmtRes = null;
1454:
1455: try {
1456: // On initialise l'ID de l'environnement
1457: int envId = CTCommun.getIdEnv(database, prop, idProject,
1458: envName);
1459:
1460: // On execute la requete
1461: PreparedStatement prep = database.prepareStatement(prop
1462: .getProperty("selectEnvAttachFile"));
1463: prep.setInt(1, envId);
1464: prep.setString(2, fileName);
1465: stmtRes = new DataSet(prep.executeQuery());
1466: if (stmtRes.getResults().next()) {
1467: fileAttachId = stmtRes.getResults().getInt("id_attach");
1468: }
1469:
1470: // On selectionne le fichier attachement
1471: file = STCommun.getFileAttachFromDB(database, prop,
1472: fileAttachId);
1473: } catch (SQLException e) {
1474: e.printStackTrace();
1475: org.objectweb.salome_tmf.api.Api.addException(
1476: "selectEnvironmentAttachFile", null, e);
1477: } catch (Exception ex) {
1478: ex.printStackTrace();
1479: org.objectweb.salome_tmf.api.Api.addException(null, null,
1480: ex);
1481: }
1482: // On retourne le resultat
1483: return file;
1484: }
1485:
1486: /**
1487: * Selection des fichiers attachés à une campagne
1488: * Retourne un vecteur (tableau dynamique) d'objets de type "File"
1489: * @param campaignName
1490: * @return
1491: */
1492: public Vector getCampaignAttachFiles(String campaignName) {
1493: Vector result = new Vector();
1494: DataSet stmtRes = null;
1495: File file = null;
1496:
1497: try {
1498: // On initialise l'ID de la famille de test
1499: int campaignId = CTCommun.getIdCamp(database, prop,
1500: idProject, campaignName);
1501: // On execute la requete
1502: PreparedStatement prep = database.prepareStatement(prop
1503: .getProperty("selectCampaignAttachFiles"));
1504: prep.setInt(1, campaignId);
1505: stmtRes = new DataSet(prep.executeQuery());
1506: // Ajoute les element un par un au resultat
1507: while (stmtRes.hasMoreElements()) {
1508: file = STCommun.getFileAttachFromDB(database, prop,
1509: stmtRes.getResults().getInt("id_attach"));
1510: result.addElement(file);
1511: }
1512: } catch (SQLException e) {
1513: e.printStackTrace();
1514: org.objectweb.salome_tmf.api.Api.addException(
1515: "selectCampaignAttachFiles", null, e);
1516: } catch (Exception ex) {
1517: ex.printStackTrace();
1518: org.objectweb.salome_tmf.api.Api.addException(null, null,
1519: ex);
1520: }
1521:
1522: // On retourne le resultat
1523: return result;
1524: }
1525:
1526: /**
1527: * Selection des URL attachés à une campagne
1528: * @param campaignName
1529: * @return Retourne un vecteur (tableau dynamique) d'objets de type "String"
1530: */
1531: public Vector getCampaignAttachUrls(String campaignName) {
1532: Vector result = new Vector();
1533: DataSet stmtRes = null;
1534:
1535: try {
1536: // On initialise l'ID de la famille de test
1537: int campaignId = CTCommun.getIdCamp(database, prop,
1538: idProject, campaignName);
1539: // On execute la requete
1540: PreparedStatement prep = database.prepareStatement(prop
1541: .getProperty("selectCampaignAttachUrls"));
1542: prep.setInt(1, campaignId);
1543: stmtRes = new DataSet(prep.executeQuery());
1544: // Ajoute les element un par un au resultat
1545: while (stmtRes.hasMoreElements()) {
1546: result.addElement(stmtRes.getResults().getString(
1547: "url_attach"));
1548: }
1549: } catch (SQLException e) {
1550: e.printStackTrace();
1551: org.objectweb.salome_tmf.api.Api.addException(
1552: "selectCampaignAttachUrls", null, e);
1553: } catch (Exception ex) {
1554: ex.printStackTrace();
1555: org.objectweb.salome_tmf.api.Api.addException(null, null,
1556: ex);
1557: }
1558:
1559: // On retourne le resultat
1560: return result;
1561: }
1562:
1563: /**
1564: * Selection d'un fichier attaché à une exécution
1565: * @param campaignName
1566: * @param execName
1567: * @param fileName
1568: * @return
1569: */
1570: public File getExecAttachFile(String campaignName, String execName,
1571: String fileName) {
1572: int fileAttachId = -1;
1573: File file = null;
1574: DataSet stmtRes = null;
1575:
1576: try {
1577: // On initialise l'ID de l'exécution
1578: int execId = CTCommun.getIdExecCamp(database, prop,
1579: idProject, campaignName, execName);
1580: // On execute la requete
1581: PreparedStatement prep = database.prepareStatement(prop
1582: .getProperty("selectExecAttachFile"));
1583: prep.setInt(1, execId);
1584: prep.setString(2, fileName);
1585: stmtRes = new DataSet(prep.executeQuery());
1586: if (stmtRes.getResults().next()) {
1587: fileAttachId = stmtRes.getResults().getInt("id_attach");
1588: }
1589:
1590: // On selectionne le fichier attachement
1591: file = STCommun.getFileAttachFromDB(database, prop,
1592: fileAttachId);
1593: } catch (SQLException e) {
1594: e.printStackTrace();
1595: org.objectweb.salome_tmf.api.Api.addException(
1596: "selectExecAttachFile", null, e);
1597: } catch (Exception ex) {
1598: ex.printStackTrace();
1599: org.objectweb.salome_tmf.api.Api.addException(null, null,
1600: ex);
1601: }
1602: // On retourne le resultat
1603: return file;
1604:
1605: }
1606:
1607: /**
1608: * Selection des fichiers attachés à une exécution
1609: * Retourne un vecteur (tableau dynamique) d'objets de type "File"
1610: * @param campaignName
1611: * @param execName
1612: * @return
1613: */
1614: public Vector getExecAttachFiles(String campaignName,
1615: String execName) {
1616: Vector result = new Vector();
1617: DataSet stmtRes = null;
1618: File file = null;
1619:
1620: try {
1621: // On initialise l'ID de l'exécution
1622: int execId = CTCommun.getIdExecCamp(database, prop,
1623: idProject, campaignName, execName);
1624: // On execute la requete
1625: PreparedStatement prep = database.prepareStatement(prop
1626: .getProperty("selectExecAttachFiles"));
1627: prep.setInt(1, execId);
1628: stmtRes = new DataSet(prep.executeQuery());
1629: // Ajoute les element un par un au resultat
1630: while (stmtRes.hasMoreElements()) {
1631: file = STCommun.getFileAttachFromDB(database, prop,
1632: stmtRes.getResults().getInt("id_attach"));
1633: result.addElement(file);
1634: }
1635: } catch (SQLException e) {
1636: e.printStackTrace();
1637: org.objectweb.salome_tmf.api.Api.addException(
1638: "selectExecAttachFiles", null, e);
1639: } catch (Exception ex) {
1640: ex.printStackTrace();
1641: org.objectweb.salome_tmf.api.Api.addException(null, null,
1642: ex);
1643: }
1644:
1645: // On retourne le resultat
1646: return result;
1647:
1648: }
1649:
1650: /**
1651: * Selection des URL attachés à une exécution
1652: * @param campaignName
1653: * @param execName
1654: * @return Retourne un vecteur (tableau dynamique) d'objets de type "String"
1655: */
1656: public Vector getExecAttachUrls(String campaignName, String execName) {
1657: Vector result = new Vector();
1658: DataSet stmtRes = null;
1659:
1660: try {
1661: // On initialise l'ID de l'exécution
1662: int execId = CTCommun.getIdExecCamp(database, prop,
1663: idProject, campaignName, execName);
1664: // On execute la requete
1665: PreparedStatement prep = database.prepareStatement(prop
1666: .getProperty("selectExecAttachUrls"));
1667: prep.setInt(1, execId);
1668: stmtRes = new DataSet(prep.executeQuery());
1669: // Ajoute les element un par un au resultat
1670: while (stmtRes.hasMoreElements()) {
1671: result.addElement(stmtRes.getResults().getString(
1672: "url_attach"));
1673: }
1674: } catch (SQLException e) {
1675: e.printStackTrace();
1676: org.objectweb.salome_tmf.api.Api.addException(
1677: "selectExecAttachUrls", null, e);
1678: } catch (Exception ex) {
1679: ex.printStackTrace();
1680: org.objectweb.salome_tmf.api.Api.addException(null, null,
1681: ex);
1682: }
1683:
1684: // On retourne le resultat
1685: return result;
1686: }
1687:
1688: /**
1689: * Selection des dates de dernière exécution
1690: * @param campName un nom de campagne
1691: * @param execCampName nom de l'exécution
1692: * @return un vecteur de dates
1693: */
1694: public Date getExecutionLastDate(String campName,
1695: String execCampName) {
1696: Date result = null;
1697: DataSet stmtRes = null;
1698: int execCampId = -1;
1699:
1700: try {
1701: // On initialise l'ID de l'execution de campagne de test
1702: execCampId = CTCommun.getIdExecCamp(database, prop,
1703: idProject, campName, execCampName);
1704: // On execute la requete
1705: PreparedStatement prep = database.prepareStatement(prop
1706: .getProperty("selectExecutionLastDate"));
1707: prep.setInt(1, execCampId);
1708: stmtRes = new DataSet(prep.executeQuery());
1709: // Ajoute les element un par un au resultat
1710: while (stmtRes.hasMoreElements()) {
1711: result = stmtRes.getResults().getDate("last_exec_date");
1712: }
1713: } catch (SQLException e) {
1714: e.printStackTrace();
1715: org.objectweb.salome_tmf.api.Api.addException(
1716: "selectExecutionLastDate", null, e);
1717: } catch (Exception ex) {
1718: ex.printStackTrace();
1719: org.objectweb.salome_tmf.api.Api.addException(null, null,
1720: ex);
1721: }
1722:
1723: // On retourne le resultat
1724: return result;
1725: }
1726:
1727: /**
1728: * Selection des noms de fichiers attachés à une campagne
1729: * Retourne un vecteur (tableau dynamique) d'objets de type "String"
1730: * @param campaignName
1731: * @return
1732: */
1733: public Vector getCampaignAttachFileNames(String campaignName) {
1734: Vector result = new Vector();
1735: DataSet stmtRes = null;
1736: String name = null;
1737:
1738: try {
1739: // On initialise l'ID de la famille de test
1740: int campaignId = CTCommun.getIdCamp(database, prop,
1741: idProject, campaignName);
1742: // On execute la requete
1743: PreparedStatement prep = database.prepareStatement(prop
1744: .getProperty("selectCampaignAttachFiles"));
1745: prep.setInt(1, campaignId);
1746: stmtRes = new DataSet(prep.executeQuery());
1747: // Ajoute les element un par un au resultat
1748: while (stmtRes.hasMoreElements()) {
1749: name = STCommun.getFileAttachNameFromDB(database, prop,
1750: stmtRes.getResults().getInt("id_attach"));
1751: result.addElement(name);
1752: }
1753: } catch (SQLException e) {
1754: e.printStackTrace();
1755: org.objectweb.salome_tmf.api.Api.addException(
1756: "selectCampaignAttachFiles", null, e);
1757: } catch (Exception ex) {
1758: ex.printStackTrace();
1759: org.objectweb.salome_tmf.api.Api.addException(null, null,
1760: ex);
1761: }
1762:
1763: // On retourne le resultat
1764: return result;
1765:
1766: }
1767:
1768: /**
1769: * Selection des noms de fichiers attachés à un environnement
1770: * Retourne un vecteur (tableau dynamique) d'objets de type "String"
1771: * @param campaignName
1772: * @return
1773: */
1774: public Vector getEnvAttachFileNames(String envName) {
1775: Vector result = new Vector();
1776: DataSet stmtRes = null;
1777: String name = null;
1778:
1779: try {
1780: // On initialise l'ID de la famille de test
1781: int envId = CTCommun.getIdEnv(database, prop, idProject,
1782: envName);
1783: // On execute la requete
1784: PreparedStatement prep = database.prepareStatement(prop
1785: .getProperty("selectEnvAttachFiles"));
1786: prep.setInt(1, envId);
1787: stmtRes = new DataSet(prep.executeQuery());
1788: // Ajoute les element un par un au resultat
1789: while (stmtRes.hasMoreElements()) {
1790: name = STCommun.getFileAttachNameFromDB(database, prop,
1791: stmtRes.getResults().getInt("id_attach"));
1792: result.addElement(name);
1793: }
1794: } catch (SQLException e) {
1795: e.printStackTrace();
1796: org.objectweb.salome_tmf.api.Api.addException(
1797: "selectEnvAttachFiles", null, e);
1798: } catch (Exception ex) {
1799: ex.printStackTrace();
1800: org.objectweb.salome_tmf.api.Api.addException(null, null,
1801: ex);
1802: }
1803:
1804: // On retourne le resultat
1805: return result;
1806:
1807: }
1808:
1809: /**
1810: * Selection des noms de fichiers attachés à une exécution
1811: * Retourne un vecteur (tableau dynamique) d'objets de type "String"
1812: * @param campaignName
1813: * @param execName
1814: * @return
1815: */
1816: public Vector getExecAttachFileNames(String campaignName,
1817: String execName) {
1818: Vector result = new Vector();
1819: DataSet stmtRes = null;
1820: String name = null;
1821:
1822: try {
1823: // On initialise l'ID de l'exécution
1824: int execId = CTCommun.getIdExecCamp(database, prop,
1825: idProject, campaignName, execName);
1826: // On execute la requete
1827: PreparedStatement prep = database.prepareStatement(prop
1828: .getProperty("selectExecAttachFiles"));
1829: prep.setInt(1, execId);
1830: stmtRes = new DataSet(prep.executeQuery());
1831: // Ajoute les element un par un au resultat
1832: while (stmtRes.hasMoreElements()) {
1833: name = STCommun.getFileAttachNameFromDB(database, prop,
1834: stmtRes.getResults().getInt("id_attach"));
1835: result.addElement(name);
1836: }
1837: } catch (SQLException e) {
1838: e.printStackTrace();
1839: org.objectweb.salome_tmf.api.Api.addException(
1840: "selectExecAttachFiles", null, e);
1841: } catch (Exception ex) {
1842: ex.printStackTrace();
1843: org.objectweb.salome_tmf.api.Api.addException(null, null,
1844: ex);
1845: }
1846:
1847: // On retourne le resultat
1848: return result;
1849: }
1850:
1851: /**
1852: * Fonction qui donne le resultat de l'execution d'une action de test inclue dans un resultat d'execution
1853: * d'un test
1854: * @param campName
1855: * @param execCampName
1856: * @param resExecCampName
1857: * @param familyName
1858: * @param suiteName
1859: * @param testName
1860: * @param actionName
1861: * @return
1862: */
1863: public String[] getResExecActionEffetivResult(String campName,
1864: String execCampName, String resExecCampName,
1865: String familyName, String suiteName, String testName,
1866: String actionName) {
1867: String result[] = null;
1868: DataSet stmtRes = null;
1869: int resExecTestId = -1;
1870: int familyId = -1;
1871: int suiteId = -1;
1872: int testId = -1;
1873: int actionId = -1;
1874:
1875: try {
1876: // On initialise l'ID de l'action de test
1877: familyId = STCommun.getIdFamily(database, prop, idProject,
1878: familyName);
1879: suiteId = STCommun.getIdSuite(database, prop, idProject,
1880: suiteName, familyId);
1881: testId = STCommun.getIdTest(database, prop, testName,
1882: suiteId);
1883: actionId = STCommun.getIdAction(database, prop, actionName,
1884: testId);
1885: // On initialise l'ID du resultat de l'execution du test
1886: resExecTestId = CTCommun.getIdResExecCas(database, prop,
1887: idProject, campName, execCampName, resExecCampName,
1888: testId);
1889:
1890: // On execute la requete
1891: PreparedStatement prep = database.prepareStatement(prop
1892: .getProperty("selectResExecActionEffectivResult"));
1893: prep.setInt(1, resExecTestId);
1894: prep.setInt(2, actionId);
1895: stmtRes = new DataSet(prep.executeQuery());
1896: if (stmtRes.getResults().next()) {
1897: result = new String[3];
1898: result[0] = stmtRes.getResults().getString(
1899: "ACTION_TEST_description_action");
1900: result[1] = stmtRes.getResults().getString(
1901: "ACTION_TEST_res_attendu_action");
1902: result[2] = stmtRes.getResults().getString(
1903: "effectiv_res_action");
1904: }
1905: } catch (SQLException e) {
1906: e.printStackTrace();
1907: org.objectweb.salome_tmf.api.Api.addException(
1908: "selectResExecActionEffectivResult", null, e);
1909: } catch (Exception ex) {
1910: ex.printStackTrace();
1911: org.objectweb.salome_tmf.api.Api.addException(null, null,
1912: ex);
1913: }
1914:
1915: // On retourne le resultat
1916: return result;
1917: }
1918:
1919: /**
1920: * Selection d'un fichier attaché à un résultat d'exécution
1921: * @param campaignName
1922: * @param execName
1923: * @param executionResultName
1924: * @param fileName
1925: * @return
1926: */
1927: public File getExecResultAttachFile(String campaignName,
1928: String execName, String executionResultName, String fileName) {
1929: int fileAttachId = -1;
1930: File file = null;
1931: DataSet stmtRes = null;
1932:
1933: try {
1934: // On initialise l'ID du résultat d'exécution
1935: int execResultId = CTCommun.getIdResExecCamp(database,
1936: prop, idProject, campaignName, execName,
1937: executionResultName);
1938: // On execute la requete
1939: PreparedStatement prep = database.prepareStatement(prop
1940: .getProperty("selectExecResultAttachFile"));
1941: prep.setInt(1, execResultId);
1942: prep.setString(2, fileName);
1943: stmtRes = new DataSet(prep.executeQuery());
1944: if (stmtRes.getResults().next()) {
1945: fileAttachId = stmtRes.getResults().getInt("id_attach");
1946: }
1947:
1948: // On selectionne le fichier attachement
1949: file = STCommun.getFileAttachFromDB(database, prop,
1950: fileAttachId);
1951: } catch (SQLException e) {
1952: e.printStackTrace();
1953: org.objectweb.salome_tmf.api.Api.addException(
1954: "selectExecResultAttachFile", null, e);
1955: } catch (Exception ex) {
1956: ex.printStackTrace();
1957: org.objectweb.salome_tmf.api.Api.addException(null, null,
1958: ex);
1959: }
1960: // On retourne le resultat
1961: return file;
1962: }
1963:
1964: /**
1965: * Selection des fichiers attachés à un résultat d'exécution
1966: * Retourne un vecteur (tableau dynamique) d'objets de type "File"
1967: * @param campaignName
1968: * @param execName
1969: * @param executionResultName
1970: * @return
1971: */
1972: public Vector getExecResultAttachFiles(String campaignName,
1973: String execName, String executionResultName) {
1974: Vector result = new Vector();
1975: DataSet stmtRes = null;
1976: File file = null;
1977:
1978: try {
1979: // On initialise l'ID du résultat d'exécution
1980: int execResultId = CTCommun.getIdResExecCamp(database,
1981: prop, idProject, campaignName, execName,
1982: executionResultName);
1983: // On execute la requete
1984: PreparedStatement prep = database.prepareStatement(prop
1985: .getProperty("selectExecResultAttachFiles"));
1986: prep.setInt(1, execResultId);
1987: stmtRes = new DataSet(prep.executeQuery());
1988: // Ajoute les element un par un au resultat
1989: while (stmtRes.hasMoreElements()) {
1990: file = STCommun.getFileAttachFromDB(database, prop,
1991: stmtRes.getResults().getInt("id_attach"));
1992: result.addElement(file);
1993: }
1994: } catch (SQLException e) {
1995: e.printStackTrace();
1996: org.objectweb.salome_tmf.api.Api.addException(
1997: "selectExecResultAttachFiles", null, e);
1998: } catch (Exception ex) {
1999: ex.printStackTrace();
2000: org.objectweb.salome_tmf.api.Api.addException(null, null,
2001: ex);
2002: }
2003:
2004: // On retourne le resultat
2005: return result;
2006: }
2007:
2008: /**
2009: * Selection des noms de fichiers attachés à un résultat d'exécution
2010: * Retourne un vecteur (tableau dynamique) d'objets de type "File"
2011: * @param campaignName
2012: * @param execName
2013: * @param executionResultName
2014: * @return
2015: */
2016: public Vector getExecResultAttachFileNames(String campaignName,
2017: String execName, String executionResultName) {
2018: Vector result = new Vector();
2019: DataSet stmtRes = null;
2020: String name = null;
2021:
2022: try {
2023: // On initialise l'ID du résultat d'exécution
2024: int execResultId = CTCommun.getIdResExecCamp(database,
2025: prop, idProject, campaignName, execName,
2026: executionResultName);
2027: // On execute la requete
2028: PreparedStatement prep = database.prepareStatement(prop
2029: .getProperty("selectExecResultAttachFiles"));
2030: prep.setInt(1, execResultId);
2031: stmtRes = new DataSet(prep.executeQuery());
2032: // Ajoute les element un par un au resultat
2033: while (stmtRes.hasMoreElements()) {
2034: name = STCommun.getFileAttachNameFromDB(database, prop,
2035: stmtRes.getResults().getInt("id_attach"));
2036: result.addElement(name);
2037: }
2038: } catch (SQLException e) {
2039: e.printStackTrace();
2040: org.objectweb.salome_tmf.api.Api.addException(
2041: "selectExecResultAttachFiles", null, e);
2042: } catch (Exception ex) {
2043: ex.printStackTrace();
2044: org.objectweb.salome_tmf.api.Api.addException(null, null,
2045: ex);
2046: }
2047:
2048: // On retourne le resultat
2049: return result;
2050: }
2051:
2052: /**
2053: * Selection des URL attachés à un résultat d'exécution
2054: * @param campaignName
2055: * @param execName
2056: * @param executionResultName
2057: * @return Retourne un vecteur (tableau dynamique) d'objets de type "String"
2058: */
2059: public Vector getExecResultAttachUrls(String campaignName,
2060: String execName, String executionResultName) {
2061: Vector result = new Vector();
2062: DataSet stmtRes = null;
2063:
2064: try {
2065: // On initialise l'ID du résultat d'exécution
2066: int execResultId = CTCommun.getIdResExecCamp(database,
2067: prop, idProject, campaignName, execName,
2068: executionResultName);
2069: // On execute la requete
2070: PreparedStatement prep = database.prepareStatement(prop
2071: .getProperty("selectExecResultAttachUrls"));
2072: prep.setInt(1, execResultId);
2073: stmtRes = new DataSet(prep.executeQuery());
2074: // Ajoute les element un par un au resultat
2075: while (stmtRes.hasMoreElements()) {
2076: result.addElement(stmtRes.getResults().getString(
2077: "url_attach"));
2078: }
2079: } catch (SQLException e) {
2080: e.printStackTrace();
2081: org.objectweb.salome_tmf.api.Api.addException(
2082: "selectExecResultAttachUrls", null, e);
2083: } catch (Exception ex) {
2084: ex.printStackTrace();
2085: org.objectweb.salome_tmf.api.Api.addException(null, null,
2086: ex);
2087: }
2088:
2089: // On retourne le resultat
2090: return result;
2091: }
2092:
2093: /**
2094: * Sélection d'un fichier attaché à un résultat d'exécution de test
2095: * @param familyName
2096: * @param suiteName
2097: * @param testName
2098: * @param campaignName
2099: * @param execName
2100: * @param executionResultName
2101: * @param fileName
2102: * @return
2103: */
2104: public File getExecTestResultAttachFile(String familyName,
2105: String suiteName, String testName, String campaignName,
2106: String execName, String executionResultName, String fileName) {
2107: int fileAttachId = -1;
2108: File file = null;
2109: DataSet stmtRes = null;
2110:
2111: try {
2112: // Initialisation de l'ID du test
2113: int familyId = STCommun.getIdFamily(database, prop,
2114: idProject, familyName);
2115: int suiteId = STCommun.getIdSuite(database, prop,
2116: idProject, suiteName, familyId);
2117: int testId = STCommun.getIdTest(database, prop, testName,
2118: suiteId);
2119:
2120: // On initialise l'ID du résultat d'exécution
2121: //int execResultId = CTCommun.getIdResExecCamp(database, prop, idProject, campaignName, execName, executionResultName);
2122: // Initialisation de l'ID du résultat de test
2123: int execTestResultId = CTCommun.getIdResExecCas(database,
2124: prop, idProject, campaignName, execName,
2125: executionResultName, testId);
2126:
2127: // On execute la requete
2128: PreparedStatement prep = database.prepareStatement(prop
2129: .getProperty("selectExecTestResultAttachFile"));
2130: prep.setInt(1, execTestResultId);
2131: prep.setString(2, fileName);
2132: stmtRes = new DataSet(prep.executeQuery());
2133: if (stmtRes.getResults().next()) {
2134: fileAttachId = stmtRes.getResults().getInt("id_attach");
2135: }
2136:
2137: // On selectionne le fichier attachement
2138: file = STCommun.getFileAttachFromDB(database, prop,
2139: fileAttachId);
2140: } catch (SQLException e) {
2141: e.printStackTrace();
2142: org.objectweb.salome_tmf.api.Api.addException(
2143: "selectExecTestResultAttachFile", null, e);
2144: } catch (Exception ex) {
2145: ex.printStackTrace();
2146: org.objectweb.salome_tmf.api.Api.addException(null, null,
2147: ex);
2148: }
2149: // On retourne le resultat
2150: return file;
2151:
2152: }
2153:
2154: /**
2155: * Selection des fichiers attachés à un résultat d'exécution de test
2156: * @param familyName
2157: * @param suiteName
2158: * @param testName
2159: * @param campaignName
2160: * @param execName
2161: * @param executionResultName
2162: * @return
2163: */
2164: public Vector getExecTestResultAttachFiles(String familyName,
2165: String suiteName, String testName, String campaignName,
2166: String execName, String executionResultName) {
2167: Vector result = new Vector();
2168: DataSet stmtRes = null;
2169: File file = null;
2170:
2171: try {
2172: // Initialisation de l'ID du test
2173: int familyId = STCommun.getIdFamily(database, prop,
2174: idProject, familyName);
2175: int suiteId = STCommun.getIdSuite(database, prop,
2176: idProject, suiteName, familyId);
2177: int testId = STCommun.getIdTest(database, prop, testName,
2178: suiteId);
2179:
2180: // On initialise l'ID du résultat d'exécution
2181: //int execResultId = CTCommun.getIdResExecCamp(database, prop, idProject, campaignName, execName, executionResultName);
2182: // Initialisation de l'ID du résultat de test
2183: int execTestResultId = CTCommun.getIdResExecCas(database,
2184: prop, idProject, campaignName, execName,
2185: executionResultName, testId);
2186:
2187: // On execute la requete
2188: PreparedStatement prep = database.prepareStatement(prop
2189: .getProperty("selectExecTestResultAttachFiles"));
2190: prep.setInt(1, execTestResultId);
2191: stmtRes = new DataSet(prep.executeQuery());
2192: // Ajoute les element un par un au resultat
2193: while (stmtRes.hasMoreElements()) {
2194: file = STCommun.getFileAttachFromDB(database, prop,
2195: stmtRes.getResults().getInt("id_attach"));
2196: result.addElement(file);
2197: }
2198: } catch (SQLException e) {
2199: e.printStackTrace();
2200: org.objectweb.salome_tmf.api.Api.addException(
2201: "selectExecTestResultAttachFiles", null, e);
2202: } catch (Exception ex) {
2203: ex.printStackTrace();
2204: org.objectweb.salome_tmf.api.Api.addException(null, null,
2205: ex);
2206: }
2207:
2208: // On retourne le resultat
2209: return result;
2210:
2211: }
2212:
2213: /**
2214: * Selection des noms de fichiers attachés à un résultat d'exécution de test
2215: * Retourne un vecteur (tableau dynamique) d'objets de type "File"
2216: * @param familyName
2217: * @param suiteName
2218: * @param testName
2219: * @param campaignName
2220: * @param execName
2221: * @param executionResultName
2222: * @return
2223: */
2224: public Vector getExecTestResultAttachFileNames(String familyName,
2225: String suiteName, String testName, String campaignName,
2226: String execName, String executionResultName) {
2227: Vector result = new Vector();
2228: DataSet stmtRes = null;
2229: String name = null;
2230:
2231: try {
2232: // Initialisation de l'ID du test
2233: int familyId = STCommun.getIdFamily(database, prop,
2234: idProject, familyName);
2235: int suiteId = STCommun.getIdSuite(database, prop,
2236: idProject, suiteName, familyId);
2237: int testId = STCommun.getIdTest(database, prop, testName,
2238: suiteId);
2239:
2240: // On initialise l'ID du résultat d'exécution
2241: //int execResultId = CTCommun.getIdResExecCamp(database,prop,idProject,campaignName, execName, executionResultName);
2242: // Initialisation de l'ID du résultat de test
2243: int execTestResultId = CTCommun.getIdResExecCas(database,
2244: prop, idProject, campaignName, execName,
2245: executionResultName, testId);
2246:
2247: // On execute la requete
2248: PreparedStatement prep = database.prepareStatement(prop
2249: .getProperty("selectExecTestResultAttachFiles"));
2250: prep.setInt(1, execTestResultId);
2251: stmtRes = new DataSet(prep.executeQuery());
2252: // Ajoute les element un par un au resultat
2253: while (stmtRes.hasMoreElements()) {
2254: name = STCommun.getFileAttachNameFromDB(database, prop,
2255: stmtRes.getResults().getInt("id_attach"));
2256: result.addElement(name);
2257: }
2258: } catch (SQLException e) {
2259: e.printStackTrace();
2260: org.objectweb.salome_tmf.api.Api.addException(
2261: "selectExecTestResultAttachFiles", null, e);
2262: } catch (Exception ex) {
2263: ex.printStackTrace();
2264: org.objectweb.salome_tmf.api.Api.addException(null, null,
2265: ex);
2266: }
2267:
2268: // On retourne le resultat
2269: return result;
2270:
2271: }
2272:
2273: /**
2274: * Selection des URL attachés à un résultat d'exécution de test
2275: * @param familyName
2276: * @param suiteName
2277: * @param testName
2278: * @param campaignName
2279: * @param execName
2280: * @param executionResultName
2281: * @return
2282: */
2283: public Vector getExecTestResultAttachUrls(String familyName,
2284: String suiteName, String testName, String campaignName,
2285: String execName, String executionResultName) {
2286: Vector result = new Vector();
2287: DataSet stmtRes = null;
2288:
2289: try {
2290: // Initialisation de l'ID du test
2291: int familyId = STCommun.getIdFamily(database, prop,
2292: idProject, familyName);
2293: int suiteId = STCommun.getIdSuite(database, prop,
2294: idProject, suiteName, familyId);
2295: int testId = STCommun.getIdTest(database, prop, testName,
2296: suiteId);
2297:
2298: // On initialise l'ID du résultat d'exécution
2299: //int execResultId = CTCommun.getIdResExecCamp(database, prop, idProject, campaignName, execName, executionResultName);
2300: // Initialisation de l'ID du résultat de test
2301: int execTestResultId = CTCommun.getIdResExecCas(database,
2302: prop, idProject, campaignName, execName,
2303: executionResultName, testId);
2304:
2305: // On execute la requete
2306: PreparedStatement prep = database.prepareStatement(prop
2307: .getProperty("selectExecTestResultAttachUrls"));
2308: prep.setInt(1, execTestResultId);
2309: stmtRes = new DataSet(prep.executeQuery());
2310: // Ajoute les element un par un au resultat
2311: while (stmtRes.hasMoreElements()) {
2312: result.addElement(stmtRes.getResults().getString(
2313: "url_attach"));
2314: }
2315: } catch (SQLException e) {
2316: e.printStackTrace();
2317: org.objectweb.salome_tmf.api.Api.addException(
2318: "selectExecTestResultAttachUrls", null, e);
2319: } catch (Exception ex) {
2320: ex.printStackTrace();
2321: org.objectweb.salome_tmf.api.Api.addException(null, null,
2322: ex);
2323: }
2324:
2325: // On retourne le resultat
2326: return result;
2327:
2328: }
2329:
2330: /**
2331: *
2332: * @param campaignName
2333: * @param execName
2334: * @param scriptName
2335: * @param type
2336: * @return
2337: */
2338: public File getScriptOfExecution(String campaignName,
2339: String execName, String scriptName, String type) {
2340: int fileAttachId = 0;
2341: File file = null;
2342: DataSet stmtRes = null;
2343:
2344: try {
2345: // On initialise l'iD de l'exécution
2346: int execId = CTCommun.getIdExecCamp(database, prop,
2347: idProject, campaignName, execName);
2348: // On initialise l'ID pour l'action
2349: int scriptId = CTCommun.getIdScriptExecution(database,
2350: prop, execId, scriptName, type);
2351:
2352: // On execute la requete
2353: PreparedStatement prep = database.prepareStatement(prop
2354: .getProperty("selectExecutionScriptAttachId"));
2355: prep.setInt(1, scriptId);
2356:
2357: stmtRes = new DataSet(prep.executeQuery());
2358: if (stmtRes.getResults().next()) {
2359: fileAttachId = stmtRes.getResults().getInt(
2360: "ATTACHEMENT_id_attach");
2361: }
2362:
2363: // On selectionne le fichier attachement
2364: file = STCommun.getFileAttachFromDB(database, prop,
2365: fileAttachId);
2366: } catch (SQLException e) {
2367: e.printStackTrace();
2368: org.objectweb.salome_tmf.api.Api.addException(
2369: "selectExecutionScriptAttachId", null, e);
2370: } catch (Exception ex) {
2371: ex.printStackTrace();
2372: org.objectweb.salome_tmf.api.Api.addException(null, null,
2373: ex);
2374: }
2375: return file;
2376: }
2377:
2378: /**
2379: *
2380: * @param execId
2381: * @param scriptName
2382: * @param type
2383: * @return
2384: */
2385: public File getScriptOfExecutionUsingID(int execId,
2386: String scriptName, String type) {
2387: int fileAttachId = 0;
2388: File file = null;
2389: DataSet stmtRes = null;
2390:
2391: try {
2392: // On initialise l'ID pour l'action
2393: int scriptId = CTCommun.getIdScriptExecution(database,
2394: prop, execId, scriptName, type);
2395:
2396: // On execute la requete
2397: PreparedStatement prep = database.prepareStatement(prop
2398: .getProperty("selectExecutionScriptAttachId"));
2399: prep.setInt(1, scriptId);
2400:
2401: stmtRes = new DataSet(prep.executeQuery());
2402: if (stmtRes.getResults().next()) {
2403: fileAttachId = stmtRes.getResults().getInt(
2404: "ATTACHEMENT_id_attach");
2405: }
2406:
2407: // On selectionne le fichier attachement
2408: file = STCommun.getFileAttachFromDB(database, prop,
2409: fileAttachId);
2410: } catch (SQLException e) {
2411: e.printStackTrace();
2412: org.objectweb.salome_tmf.api.Api.addException(
2413: "selectExecutionScriptAttachId", null, e);
2414: } catch (Exception ex) {
2415: ex.printStackTrace();
2416: org.objectweb.salome_tmf.api.Api.addException(null, null,
2417: ex);
2418: }
2419: return file;
2420: }
2421:
2422: /**
2423: *
2424: * @param campaignName
2425: * @param execName
2426: * @param scriptName
2427: * @param type
2428: * @param pathName
2429: * @return
2430: */
2431: public File getScriptOfExecution(String campaignName,
2432: String execName, String scriptName, String type, String path) {
2433: int fileAttachId = 0;
2434: File file = null;
2435: DataSet stmtRes = null;
2436:
2437: try {
2438: // On initialise l'iD de l'exécution
2439: int execId = CTCommun.getIdExecCamp(database, prop,
2440: idProject, campaignName, execName);
2441: // On initialise l'ID pour l'action
2442: int scriptId = CTCommun.getIdScriptExecution(database,
2443: prop, execId, scriptName, type);
2444:
2445: // On execute la requete
2446: PreparedStatement prep = database.prepareStatement(prop
2447: .getProperty("selectExecutionScriptAttachId"));
2448: prep.setInt(1, scriptId);
2449:
2450: stmtRes = new DataSet(prep.executeQuery());
2451: if (stmtRes.getResults().next()) {
2452: fileAttachId = stmtRes.getResults().getInt(
2453: "ATTACHEMENT_id_attach");
2454: }
2455:
2456: // On selectionne le fichier attachement
2457: file = STCommun.getFileAttachFromDB(database, prop,
2458: fileAttachId, path);
2459: } catch (SQLException e) {
2460: e.printStackTrace();
2461: org.objectweb.salome_tmf.api.Api.addException(
2462: "selectExecutionScriptAttachId", null, e);
2463: } catch (Exception ex) {
2464: ex.printStackTrace();
2465: org.objectweb.salome_tmf.api.Api.addException(null, null,
2466: ex);
2467: }
2468: return file;
2469: }
2470:
2471: /**
2472: *
2473: * @param campaignName
2474: * @param execName
2475: * @param scriptName
2476: * @return
2477: */
2478: public String getExecutionScriptClassPath(String campaignName,
2479: String execName, String scriptName, String type) {
2480: String result = null;
2481: DataSet stmtRes = null;
2482: try {
2483: // On initialise l'iD de l'exécution
2484: int execId = CTCommun.getIdExecCamp(database, prop,
2485: idProject, campaignName, execName);
2486: // On initialise l'ID pour l'action
2487: int scriptId = CTCommun.getIdScriptExecution(database,
2488: prop, execId, scriptName, type);
2489:
2490: PreparedStatement prep = database.prepareStatement(prop
2491: .getProperty("selectClassPathExecutionScript"));
2492: prep.setInt(1, scriptId);
2493: stmtRes = new DataSet(prep.executeQuery());
2494: if (stmtRes.getResults().next()) {
2495: result = stmtRes.getResults().getString(
2496: "classpath_script");
2497: }
2498: } catch (SQLException e) {
2499: e.printStackTrace();
2500: org.objectweb.salome_tmf.api.Api.addException(
2501: "selectClassPathExecutionScript", null, e);
2502: } catch (Exception ex) {
2503: ex.printStackTrace();
2504: org.objectweb.salome_tmf.api.Api.addException(null, null,
2505: ex);
2506: }
2507: return result;
2508: }
2509:
2510: /**
2511: *
2512: * @param campaignName
2513: * @param execName
2514: * @param scriptName
2515: * @return
2516: */
2517: public String getExecutionScriptPlugArg(String campaignName,
2518: String execName, String scriptName, String type) {
2519: String result = null;
2520: DataSet stmtRes = null;
2521: try {
2522: // On initialise l'iD de l'exécution
2523: int execId = CTCommun.getIdExecCamp(database, prop,
2524: idProject, campaignName, execName);
2525: // On initialise l'ID pour l'action
2526: int scriptId = CTCommun.getIdScriptExecution(database,
2527: prop, execId, scriptName, type);
2528:
2529: PreparedStatement prep = database
2530: .prepareStatement(prop
2531: .getProperty("selectClassToBeExecutedExecutionScript"));
2532: prep.setInt(1, scriptId);
2533: stmtRes = new DataSet(prep.executeQuery());
2534: if (stmtRes.getResults().next()) {
2535: result = stmtRes.getResults().getString(
2536: "classe_autom_script");
2537: }
2538: } catch (SQLException e) {
2539: e.printStackTrace();
2540: org.objectweb.salome_tmf.api.Api.addException(
2541: "selectClassToBeExecutedExecutionScript", null, e);
2542: } catch (Exception ex) {
2543: ex.printStackTrace();
2544: org.objectweb.salome_tmf.api.Api.addException(null, null,
2545: ex);
2546: }
2547: return result;
2548:
2549: }
2550:
2551: /**
2552: *
2553: * @param envName
2554: * @param scriptName
2555: * @return
2556: */
2557: public File getScriptOfEnvironment(String envName, String scriptName) {
2558: int fileAttachId = -1;
2559: File file = null;
2560: DataSet stmtRes = null;
2561:
2562: try {
2563: // On initialise l'iD de l'exécution
2564: int envId = APCommun.getIdEnv(database, prop, idProject,
2565: envName);
2566: // On initialise l'ID pour l'action
2567: int scriptId = CTCommun.getIdScriptEnvironment(database,
2568: prop, envId, scriptName);
2569:
2570: // On execute la requete
2571: PreparedStatement prep = database.prepareStatement(prop
2572: .getProperty("selectEnvironmentScriptAttachId"));
2573: prep.setInt(1, scriptId);
2574:
2575: stmtRes = new DataSet(prep.executeQuery());
2576: if (stmtRes.getResults().next()) {
2577: fileAttachId = stmtRes.getResults().getInt(
2578: "ATTACHEMENT_id_attach");
2579: }
2580:
2581: // On selectionne le fichier attachement
2582: file = STCommun.getFileAttachFromDB(database, prop,
2583: fileAttachId);
2584: } catch (SQLException e) {
2585: e.printStackTrace();
2586: org.objectweb.salome_tmf.api.Api.addException(
2587: "selectEnvironmentScriptAttachId", null, e);
2588: } catch (Exception ex) {
2589: ex.printStackTrace();
2590: org.objectweb.salome_tmf.api.Api.addException(null, null,
2591: ex);
2592: }
2593: return file;
2594:
2595: }
2596:
2597: /**
2598: *
2599: * @param envId
2600: * @param scriptName
2601: * @return
2602: */
2603: public File getScriptOfEnvironmentUsingID(int envId,
2604: String scriptName) {
2605: int fileAttachId = -1;
2606: File file = null;
2607: DataSet stmtRes = null;
2608:
2609: try {
2610: // On initialise l'ID pour l'action
2611: int scriptId = CTCommun.getIdScriptEnvironment(database,
2612: prop, envId, scriptName);
2613: // On execute la requete
2614: PreparedStatement prep = database.prepareStatement(prop
2615: .getProperty("selectEnvironmentScriptAttachId"));
2616: prep.setInt(1, scriptId);
2617:
2618: stmtRes = new DataSet(prep.executeQuery());
2619: if (stmtRes.getResults().next()) {
2620: fileAttachId = stmtRes.getResults().getInt(
2621: "ATTACHEMENT_id_attach");
2622: }
2623:
2624: // On selectionne le fichier attachement
2625: file = STCommun.getFileAttachFromDB(database, prop,
2626: fileAttachId);
2627: } catch (SQLException e) {
2628: e.printStackTrace();
2629: org.objectweb.salome_tmf.api.Api.addException(
2630: "selectEnvironmentScriptAttachId", null, e);
2631: } catch (Exception ex) {
2632: ex.printStackTrace();
2633: org.objectweb.salome_tmf.api.Api.addException(null, null,
2634: ex);
2635: }
2636: return file;
2637: }
2638:
2639: /**
2640: *
2641: * @param envName
2642: * @param scriptName
2643: * @param pathName
2644: * @return
2645: */
2646: public File getScriptOfEnvironment(String envName,
2647: String scriptName, String pathName) {
2648: int fileAttachId = -1;
2649: File file = null;
2650: DataSet stmtRes = null;
2651:
2652: try {
2653: // On initialise l'iD de l'exécution
2654: int envId = APCommun.getIdEnv(database, prop, idProject,
2655: envName);
2656: // On initialise l'ID pour l'action
2657: int scriptId = CTCommun.getIdScriptEnvironment(database,
2658: prop, envId, scriptName);
2659:
2660: // On execute la requete
2661: PreparedStatement prep = database.prepareStatement(prop
2662: .getProperty("selectEnvironmentScriptAttachId"));
2663: prep.setInt(1, scriptId);
2664:
2665: stmtRes = new DataSet(prep.executeQuery());
2666: if (stmtRes.getResults().next()) {
2667: fileAttachId = stmtRes.getResults().getInt(
2668: "ATTACHEMENT_id_attach");
2669: }
2670:
2671: // On selectionne le fichier attachement
2672: file = STCommun.getFileAttachFromDB(database, prop,
2673: fileAttachId, pathName);
2674: } catch (SQLException e) {
2675: e.printStackTrace();
2676: org.objectweb.salome_tmf.api.Api.addException(
2677: "selectEnvironmentScriptAttachId", null, e);
2678: } catch (Exception ex) {
2679: ex.printStackTrace();
2680: org.objectweb.salome_tmf.api.Api.addException(null, null,
2681: ex);
2682: }
2683: return file;
2684:
2685: }
2686:
2687: /**
2688: *
2689: * @param envName
2690: * @param scriptName
2691: * @return
2692: */
2693: public String getEnvironmentScriptClassPath(String envName,
2694: String scriptName) {
2695: String result = null;
2696: DataSet stmtRes = null;
2697: try {
2698: // On initialise l'iD de l'exécution
2699: int envId = APCommun.getIdEnv(database, prop, idProject,
2700: envName);
2701: // On initialise l'ID pour l'action
2702: int scriptId = CTCommun.getIdScriptEnvironment(database,
2703: prop, envId, scriptName);
2704:
2705: PreparedStatement prep = database.prepareStatement(prop
2706: .getProperty("selectClassPathEnvironmentScript"));
2707: prep.setInt(1, scriptId);
2708: stmtRes = new DataSet(prep.executeQuery());
2709: if (stmtRes.getResults().next()) {
2710: result = stmtRes.getResults().getString(
2711: "classpath_script");
2712: }
2713: } catch (SQLException e) {
2714: e.printStackTrace();
2715: org.objectweb.salome_tmf.api.Api.addException(
2716: "selectClassPathEnvironmentScript", null, e);
2717: } catch (Exception ex) {
2718: ex.printStackTrace();
2719: org.objectweb.salome_tmf.api.Api.addException(null, null,
2720: ex);
2721: }
2722: return result;
2723:
2724: }
2725:
2726: /**
2727: *
2728: * @param envName
2729: * @param scriptName
2730: * @return
2731: */
2732: public String getEnvironmentScriptPlugArg(String envName,
2733: String scriptName) {
2734: String result = null;
2735: DataSet stmtRes = null;
2736: try {
2737: // On initialise l'iD de l'exécution
2738: int envId = APCommun.getIdEnv(database, prop, idProject,
2739: envName);
2740: // On initialise l'ID pour l'action
2741: int scriptId = CTCommun.getIdScriptEnvironment(database,
2742: prop, envId, scriptName);
2743:
2744: PreparedStatement prep = database
2745: .prepareStatement(prop
2746: .getProperty("selectClassToBeExecutedEnvironmentScript"));
2747: prep.setInt(1, scriptId);
2748: stmtRes = new DataSet(prep.executeQuery());
2749: if (stmtRes.getResults().next()) {
2750: result = stmtRes.getResults().getString(
2751: "classe_autom_script");
2752: }
2753: } catch (SQLException e) {
2754: e.printStackTrace();
2755: org.objectweb.salome_tmf.api.Api
2756: .addException(
2757: "selectClassToBeExecutedEnvironmentScript",
2758: null, e);
2759: } catch (Exception ex) {
2760: ex.printStackTrace();
2761: org.objectweb.salome_tmf.api.Api.addException(null, null,
2762: ex);
2763: }
2764: return result;
2765:
2766: }
2767:
2768: /**
2769: *
2770: * @param envName
2771: * @param scriptName
2772: * @return
2773: */
2774: public String getEnvironmentScriptType(String envName,
2775: String scriptName) {
2776: String result = null;
2777: DataSet stmtRes = null;
2778: try {
2779: // On initialise l'iD de l'exécution
2780: int envId = APCommun.getIdEnv(database, prop, idProject,
2781: envName);
2782: // On initialise l'ID pour l'action
2783: int scriptId = CTCommun.getIdScriptEnvironment(database,
2784: prop, envId, scriptName);
2785:
2786: PreparedStatement prep = database.prepareStatement(prop
2787: .getProperty("selectTypeEnvironmentScript"));
2788: prep.setInt(1, scriptId);
2789: stmtRes = new DataSet(prep.executeQuery());
2790: if (stmtRes.getResults().next()) {
2791: result = stmtRes.getResults().getString("type_script");
2792: }
2793: } catch (SQLException e) {
2794: e.printStackTrace();
2795: org.objectweb.salome_tmf.api.Api.addException(
2796: "selectTypeEnvironmentScript", null, e);
2797: } catch (Exception ex) {
2798: ex.printStackTrace();
2799: org.objectweb.salome_tmf.api.Api.addException(null, null,
2800: ex);
2801: }
2802: return result;
2803:
2804: }
2805:
2806: /**
2807: *
2808: * @param campaignName
2809: * @param execName
2810: * @param type
2811: * @return
2812: */
2813: public String getExecutionScriptName(String campaignName,
2814: String execName, String type) {
2815: String result = null;
2816: DataSet stmtRes = null;
2817:
2818: try {
2819: // On initialise l'iD de l'exécution
2820: int execId = CTCommun.getIdExecCamp(database, prop,
2821: idProject, campaignName, execName);
2822:
2823: // On execute la requete
2824: PreparedStatement prep = database.prepareStatement(prop
2825: .getProperty("selectExecutionScriptName"));
2826: prep.setInt(1, execId);
2827: prep.setString(2, type);
2828:
2829: stmtRes = new DataSet(prep.executeQuery());
2830: if (stmtRes.getResults().next()) {
2831: result = stmtRes.getResults().getString("url_script");
2832: }
2833:
2834: } catch (SQLException e) {
2835: e.printStackTrace();
2836: org.objectweb.salome_tmf.api.Api.addException(
2837: "selectExecutionScriptName", null, e);
2838: } catch (Exception ex) {
2839: ex.printStackTrace();
2840: org.objectweb.salome_tmf.api.Api.addException(null, null,
2841: ex);
2842: }
2843: return result;
2844:
2845: }
2846:
2847: /**
2848: *
2849: * @param envName
2850: * @return
2851: */
2852: public String getEnvironmentScriptName(String envName) {
2853: String result = null;
2854: DataSet stmtRes = null;
2855:
2856: try {
2857: // On initialise l'iD de l'environnement
2858: int envId = APCommun.getIdEnv(database, prop, idProject,
2859: envName);
2860:
2861: // On execute la requete
2862: PreparedStatement prep = database.prepareStatement(prop
2863: .getProperty("selectEnvironmentScriptName"));
2864: prep.setInt(1, envId);
2865:
2866: stmtRes = new DataSet(prep.executeQuery());
2867: if (stmtRes.getResults().next()) {
2868: result = stmtRes.getResults().getString("url_script");
2869: }
2870:
2871: } catch (SQLException e) {
2872: e.printStackTrace();
2873: org.objectweb.salome_tmf.api.Api.addException(
2874: "selectEnvironmentScriptName", null, e);
2875: } catch (Exception ex) {
2876: ex.printStackTrace();
2877: org.objectweb.salome_tmf.api.Api.addException(null, null,
2878: ex);
2879: }
2880: return result;
2881:
2882: }
2883:
2884: /**
2885: * Retourne l'identifiant dans la base d'une campagne dont le nom est passé
2886: * en paramètre. S'il n'existe pas, une exception est stockée dans le vecteur
2887: * d'exception.
2888: * @param campaignName un nom de campagne
2889: * @return
2890: */
2891: public int getCampaignId(String campaignName) {
2892: return CTCommun.getIdCamp(database, prop, idProject,
2893: campaignName);
2894: }
2895:
2896: /**
2897: * Retourne l'identifiant dans la base d'une exécution dont le nom est passé
2898: * en paramètre. S'il n'existe pas, une exception est stockée dans le vecteur
2899: * d'exception.
2900: * @param executionName un nom d'exécution
2901: * @param campaignName un nom de campagne
2902: * @return
2903: */
2904: public int getExecutionId(String executionName, String campaignName) {
2905: return CTCommun.getIdExecCamp(database, prop, idProject,
2906: campaignName, executionName);
2907: }
2908:
2909: /**
2910: * Retourne l'identifiant dans la base d'un environment dont le nom est passé
2911: * en paramètre. S'il n'existe pas, une exception est stockée dans le vecteur
2912: * d'exception.
2913: * @param environmentName un nom d'environment
2914: * @return
2915: */
2916: public int getEnvironmentId(String environmentName) {
2917: return APCommun.getIdEnv(database, prop, idProject,
2918: environmentName);
2919: }
2920:
2921: /**
2922: * Retourne l'identifiant dans la base d'un jeu de données dont le nom est passé
2923: * en paramètre. S'il n'existe pas, une exception est stockée dans le vecteur
2924: * d'exception.
2925: * @param dataSetName un nom de jeu de données
2926: * @return
2927: */
2928: public int getDataSetId(String dataSetName, String campaignName) {
2929: return CTCommun.getIdJeuDonnees(database, prop, idProject,
2930: campaignName, dataSetName);
2931: }
2932:
2933: //public Script getEnvironmentScript(int envId) {
2934: public ScriptWrapper getEnvironmentScript(int envId) {
2935: //Script pScript = null;
2936: ScriptWrapper pScript = null;
2937: DataSet stmtRes = null;
2938:
2939: try {
2940:
2941: // On execute la requete
2942: PreparedStatement prep = database.prepareStatement(prop
2943: .getProperty("selectEnvironmentScript"));
2944: prep.setInt(1, envId);
2945:
2946: stmtRes = new DataSet(prep.executeQuery());
2947: if (stmtRes.getResults().next()) {
2948: /*pScript = new Script();
2949: pScript.setName(stmtRes.getResults().getString("url_script"));
2950: pScript.setScriptExtension(stmtRes.getResults().getString("classpath_script"));
2951: pScript.setPlugArg(stmtRes.getResults().getString("classe_autom_script"));
2952: pScript.setType(stmtRes.getResults().getString("type_script"));
2953: pScript.setIdBdd(stmtRes.getResults().getInt("id_script"));*/
2954: pScript = new ScriptWrapper();
2955: pScript.setName(stmtRes.getResults().getString(
2956: "url_script"));
2957: pScript.setScriptExtension(stmtRes.getResults()
2958: .getString("classpath_script"));
2959: pScript.setPlugArg(stmtRes.getResults().getString(
2960: "classe_autom_script"));
2961: pScript.setType(stmtRes.getResults().getString(
2962: "type_script"));
2963: pScript.setIdBDD(stmtRes.getResults().getInt(
2964: "id_script"));
2965: }
2966:
2967: } catch (SQLException e) {
2968: e.printStackTrace();
2969: org.objectweb.salome_tmf.api.Api.addException(
2970: "selectEnvironmentScriptName", null, e);
2971: } catch (Exception ex) {
2972: ex.printStackTrace();
2973: org.objectweb.salome_tmf.api.Api.addException(null, null,
2974: ex);
2975: }
2976: return pScript;
2977: }
2978:
2979: public Vector getAllProjectCampaigns() {
2980: Vector result = new Vector();
2981: DataSet stmtRes = null;
2982:
2983: try {
2984: // On execute la requete
2985: PreparedStatement prep = database.prepareStatement(prop
2986: .getProperty("selectProjectCampaigns"));
2987: prep.setInt(1, idProject);
2988: stmtRes = new DataSet(prep.executeQuery());
2989: // Ajoute les element un par un au resultat
2990: while (stmtRes.hasMoreElements()) {
2991: /*Campaign pCampaign = new Campaign();
2992: pCampaign.setName(stmtRes.getResults().getString("nom_camp"));
2993: pCampaign.setIdBdd(stmtRes.getResults().getInt("id_camp"));
2994: pCampaign.setConceptor(getCampaignDesignerCompleteName(pCampaign.getName()));
2995: pCampaign.setDescription(stmtRes.getResults().getString("description_camp"));
2996: pCampaign.setDate(stmtRes.getResults().getDate("date_creation_camp"));
2997: */
2998: CampaignWrapper pCampaign = new CampaignWrapper();
2999: pCampaign.setName(stmtRes.getResults().getString(
3000: "nom_camp"));
3001: pCampaign.setIdBDD(stmtRes.getResults().getInt(
3002: "id_camp"));
3003: pCampaign
3004: .setConceptor(getCampaignDesignerCompleteName(pCampaign
3005: .getName()));
3006: pCampaign.setDescription(stmtRes.getResults()
3007: .getString("description_camp"));
3008: pCampaign.setDate(stmtRes.getResults().getDate(
3009: "date_creation_camp"));
3010:
3011: result.addElement(pCampaign);
3012: }
3013: } catch (SQLException e) {
3014: e.printStackTrace();
3015: org.objectweb.salome_tmf.api.Api.addException(
3016: "selectProjectCampaigns", null, e);
3017: } catch (Exception ex) {
3018: ex.printStackTrace();
3019: org.objectweb.salome_tmf.api.Api.addException(null, null,
3020: ex);
3021: }
3022:
3023: // On retourne le resultat
3024: return result;
3025: }
3026:
3027: public Vector getCampJeuxDonnees(int campId) {
3028: Vector result = new Vector();
3029: DataSet stmtRes = null;
3030:
3031: try {
3032: // On execute la requete
3033: PreparedStatement prep = database.prepareStatement(prop
3034: .getProperty("selectCampJeuxDonnees"));
3035: prep.setInt(1, campId);
3036: stmtRes = new DataSet(prep.executeQuery());
3037: // Ajoute les element un par un au resultat
3038: while (stmtRes.hasMoreElements()) {
3039: /*org.objectweb.salome_tmf.data.DataSet pDataSet = new org.objectweb.salome_tmf.data.DataSet();
3040: pDataSet.setDescription(stmtRes.getResults().getString("desc_jeu_donnees"));
3041: pDataSet.setName(stmtRes.getResults().getString("nom_jeu_donnees"));
3042: pDataSet.setIdBdd(stmtRes.getResults().getInt("id_jeu_donnees"));*/
3043: DataSetWrapper pDataSet = new DataSetWrapper();
3044: pDataSet.setDescription(stmtRes.getResults().getString(
3045: "desc_jeu_donnees"));
3046: pDataSet.setName(stmtRes.getResults().getString(
3047: "nom_jeu_donnees"));
3048: pDataSet.setIdBDD(stmtRes.getResults().getInt(
3049: "id_jeu_donnees"));
3050:
3051: result.addElement(pDataSet);
3052: }
3053: } catch (SQLException e) {
3054: e.printStackTrace();
3055: org.objectweb.salome_tmf.api.Api.addException(
3056: "selectCampJeuxDonnees", null, e);
3057: } catch (Exception ex) {
3058: ex.printStackTrace();
3059: org.objectweb.salome_tmf.api.Api.addException(null, null,
3060: ex);
3061: }
3062:
3063: // On retourne le resultat
3064: return result;
3065: }
3066:
3067: public Vector getCampaignExecutions(int campId) {
3068: Vector result = new Vector();
3069: DataSet stmtRes = null;
3070:
3071: try {
3072: // On execute la requete
3073: PreparedStatement prep = database.prepareStatement(prop
3074: .getProperty("selectCampaignExecutions"));
3075: prep.setInt(1, campId);
3076: stmtRes = new DataSet(prep.executeQuery());
3077: // Ajoute les element un par un au resultat
3078: while (stmtRes.hasMoreElements()) {
3079: /*Execution exec = new Execution();
3080: exec.setName(stmtRes.getResults().getString("nom_exec_camp"));
3081: exec.setLastDate(stmtRes.getResults().getDate("last_exec_date"));
3082: exec.setCreationDate(stmtRes.getResults().getDate("date_exec_camp"));
3083: exec.setIdBdd(stmtRes.getResults().getInt("id_exec_camp"));
3084: exec.setDescription(stmtRes.getResults().getString("desc_exec_camp"));
3085: */
3086: ExecutionWrapper exec = new ExecutionWrapper();
3087: exec.setName(stmtRes.getResults().getString(
3088: "nom_exec_camp"));
3089: exec.setLastDate(stmtRes.getResults().getDate(
3090: "last_exec_date"));
3091: exec.setCreationDate(stmtRes.getResults().getDate(
3092: "date_exec_camp"));
3093: exec.setIdBDD(stmtRes.getResults().getInt(
3094: "id_exec_camp"));
3095: exec.setDescription(stmtRes.getResults().getString(
3096: "desc_exec_camp"));
3097: exec.setCampId(campId);
3098: result.addElement(exec);
3099: }
3100: } catch (SQLException e) {
3101: e.printStackTrace();
3102: org.objectweb.salome_tmf.api.Api.addException(
3103: "selectCampaignExecutions", null, e);
3104: } catch (Exception ex) {
3105: ex.printStackTrace();
3106: org.objectweb.salome_tmf.api.Api.addException(null, null,
3107: ex);
3108: }
3109:
3110: // On retourne le resultat
3111: return result;
3112: }
3113:
3114: //public Script[] getExecutionScript(int execId) {
3115: public ScriptWrapper[] getExecutionScript(int execId) {
3116: //Script[] pScript = new Script[2];
3117: ScriptWrapper[] pScript = new ScriptWrapper[2];
3118: DataSet stmtRes = null;
3119:
3120: try {
3121:
3122: // On execute la requete
3123: PreparedStatement prep = database.prepareStatement(prop
3124: .getProperty("selectExecutionScript"));
3125: prep.setInt(1, execId);
3126: int i = 0;
3127: stmtRes = new DataSet(prep.executeQuery());
3128: while (stmtRes.hasMoreElements() && i < 2) {
3129: /*pScript[i] = new Script();
3130: pScript[i].setName(stmtRes.getResults().getString("url_script"));
3131: pScript[i].setScriptExtension(stmtRes.getResults().getString("classpath_script"));
3132: pScript[i].setPlugArg(stmtRes.getResults().getString("classe_autom_script"));
3133: pScript[i].setType(stmtRes.getResults().getString("type_script"));
3134: pScript[i].setIdBdd(stmtRes.getResults().getInt("id_script"));
3135: */
3136: pScript[i] = new ScriptWrapper();
3137: pScript[i].setName(stmtRes.getResults().getString(
3138: "url_script"));
3139: pScript[i].setScriptExtension(stmtRes.getResults()
3140: .getString("classpath_script"));
3141: pScript[i].setPlugArg(stmtRes.getResults().getString(
3142: "classe_autom_script"));
3143: pScript[i].setType(stmtRes.getResults().getString(
3144: "type_script"));
3145: pScript[i].setIdBDD(stmtRes.getResults().getInt(
3146: "id_script"));
3147: i++;
3148: }
3149:
3150: } catch (SQLException e) {
3151: e.printStackTrace();
3152: org.objectweb.salome_tmf.api.Api.addException(
3153: "selectEnvironmentScriptName", null, e);
3154: } catch (Exception ex) {
3155: ex.printStackTrace();
3156: org.objectweb.salome_tmf.api.Api.addException(null, null,
3157: ex);
3158: }
3159: return pScript;
3160: }
3161:
3162: public Vector getExecutionResults(int execId) {
3163:
3164: Vector result = new Vector();
3165: DataSet stmtRes = null;
3166: // int execCampId = -1;
3167:
3168: try {
3169: // On execute la requete
3170: PreparedStatement prep = database.prepareStatement(prop
3171: .getProperty("selectExecutionResults"));
3172: prep.setInt(1, execId);
3173: stmtRes = new DataSet(prep.executeQuery());
3174: // Ajoute les element un par un au resultat
3175: while (stmtRes.hasMoreElements()) {
3176: /*ExecutionResult pExecResult = new ExecutionResult();
3177: pExecResult.setName(stmtRes.getResults().getString("nom_res_exec_camp"));
3178: pExecResult.setExecutionDate(stmtRes.getResults().getDate("date_res_exec_camp"));
3179: pExecResult.setTime(stmtRes.getResults().getTime("heure_res_exec_camp"));
3180: int userId = stmtRes.getResults().getInt("PERSONNE_id_personne");
3181: pExecResult.setTester(Utile.selectUserCompleteNameFromId(database,prop,userId));
3182: pExecResult.setExecutionStatus(stmtRes.getResults().getString("resultat_res_exec_camp"));
3183: int res_execId = stmtRes.getResults().getInt("id_res_exec_camp");
3184: pExecResult.setIdBDD(res_execId);
3185: pExecResult.setNumberOfFail(getNbResExecCampFailedTests(res_execId));
3186: pExecResult.setNumberOfSuccess(getNbResExecCampPassedTests(res_execId));
3187: pExecResult.setNumberOfUnknow(getNbResExecCampInconclusiveTests(res_execId));
3188: */
3189: ExecutionResultWrapper pExecResult = new ExecutionResultWrapper();
3190: pExecResult.setName(stmtRes.getResults().getString(
3191: "nom_res_exec_camp"));
3192: pExecResult.setExecutionDate(stmtRes.getResults()
3193: .getDate("date_res_exec_camp"));
3194: pExecResult.setTime(stmtRes.getResults().getTime(
3195: "heure_res_exec_camp"));
3196: int userId = stmtRes.getResults().getInt(
3197: "PERSONNE_id_personne");
3198: pExecResult.setTester(Utile
3199: .selectUserCompleteNameFromId(database, prop,
3200: userId));
3201: pExecResult.setExecutionStatus(stmtRes.getResults()
3202: .getString("resultat_res_exec_camp"));
3203: int res_execId = stmtRes.getResults().getInt(
3204: "id_res_exec_camp");
3205: pExecResult.setIdBDD(res_execId);
3206: pExecResult
3207: .setNumberOfFail(getNbResExecCampFailedTests(res_execId));
3208: pExecResult
3209: .setNumberOfSuccess(getNbResExecCampPassedTests(res_execId));
3210: pExecResult
3211: .setNumberOfUnknow(getNbResExecCampInconclusiveTests(res_execId));
3212:
3213: result.addElement(pExecResult);
3214: }
3215: } catch (SQLException e) {
3216: e.printStackTrace();
3217: org.objectweb.salome_tmf.api.Api.addException(
3218: "selectExecutionResults", null, e);
3219: } catch (Exception ex) {
3220: ex.printStackTrace();
3221: org.objectweb.salome_tmf.api.Api.addException(null, null,
3222: ex);
3223: }
3224:
3225: // On retourne le resultat
3226: return result;
3227: }
3228:
3229: public String getResExecTest(int testId, int resExecCamId) {
3230: String result = null;
3231: DataSet stmtRes = null;
3232:
3233: try {
3234: //On execute la requete
3235: PreparedStatement prep = database.prepareStatement(prop
3236: .getProperty("selectResExecTest"));
3237: prep.setInt(1, resExecCamId);
3238: prep.setInt(2, testId);
3239: stmtRes = new DataSet(prep.executeQuery());
3240: if (stmtRes.getResults().next()) {
3241: result = stmtRes.getResults().getString("res_exec_cas");
3242: }
3243: } catch (SQLException e) {
3244: e.printStackTrace();
3245: org.objectweb.salome_tmf.api.Api.addException(
3246: "selectResExecTest", null, e);
3247: } catch (Exception ex) {
3248: ex.printStackTrace();
3249: org.objectweb.salome_tmf.api.Api.addException(null, null,
3250: ex);
3251: }
3252:
3253: // On retourne le resultat
3254: return result;
3255: }
3256:
3257: public String getResExecAction(int resExecCamId, int testId,
3258: int actionId) {
3259: String result = null;
3260: DataSet stmtRes = null;
3261: try {
3262: //On execute la requete
3263: PreparedStatement prep = database.prepareStatement(prop
3264: .getProperty("SelectResExecActionForTest"));
3265: prep.setInt(1, resExecCamId);
3266: prep.setInt(2, testId);
3267: prep.setInt(3, actionId);
3268: System.out.println(prep);
3269: stmtRes = new DataSet(prep.executeQuery());
3270: if (stmtRes.getResults().next()) {
3271: result = stmtRes.getResults().getString(
3272: "res_exec_action");
3273: }
3274: } catch (SQLException e) {
3275: e.printStackTrace();
3276: org.objectweb.salome_tmf.api.Api.addException(
3277: "selectResExecAction", null, e);
3278: } catch (Exception ex) {
3279: ex.printStackTrace();
3280: org.objectweb.salome_tmf.api.Api.addException(null, null,
3281: ex);
3282: }
3283:
3284: // On retourne le resultat
3285: return result;
3286:
3287: }
3288:
3289: public String[] getResExecActionResult(int resExecCamId,
3290: int testId, int actionId) {
3291: String result[] = null;
3292: DataSet stmtRes = null;
3293:
3294: try {
3295: PreparedStatement prep = database.prepareStatement(prop
3296: .getProperty("SelectResExecActionForTest"));
3297: prep.setInt(1, resExecCamId);
3298: prep.setInt(2, testId);
3299: prep.setInt(3, actionId);
3300: stmtRes = new DataSet(prep.executeQuery());
3301: if (stmtRes.getResults().next()) {
3302: result = new String[4];
3303: result[0] = stmtRes.getResults().getString(
3304: "ACTION_TEST_description_action");
3305: result[1] = stmtRes.getResults().getString(
3306: "ACTION_TEST_res_attendu_action");
3307: result[2] = stmtRes.getResults().getString(
3308: "effectiv_res_action");
3309: result[3] = stmtRes.getResults().getString(
3310: "res_exec_action");
3311: }
3312: } catch (SQLException e) {
3313: e.printStackTrace();
3314: org.objectweb.salome_tmf.api.Api.addException(
3315: "selectResExecActionEffectivResult", null, e);
3316: } catch (Exception ex) {
3317: ex.printStackTrace();
3318: org.objectweb.salome_tmf.api.Api.addException(null, null,
3319: ex);
3320: }
3321:
3322: // On retourne le resultat
3323: return result;
3324: }
3325:
3326: public String[] getResExecActionEffetivResult(int resExecCamId,
3327: int testId, int actionId) {
3328: String result[] = null;
3329: DataSet stmtRes = null;
3330: try {
3331: PreparedStatement prep = database.prepareStatement(prop
3332: .getProperty("SelectResExecActionForTest"));
3333: prep.setInt(1, resExecCamId);
3334: prep.setInt(2, testId);
3335: prep.setInt(3, actionId);
3336: stmtRes = new DataSet(prep.executeQuery());
3337: if (stmtRes.getResults().next()) {
3338: result = new String[3];
3339: result[0] = stmtRes.getResults().getString(
3340: "ACTION_TEST_description_action");
3341: result[1] = stmtRes.getResults().getString(
3342: "ACTION_TEST_res_attendu_action");
3343: result[2] = stmtRes.getResults().getString(
3344: "effectiv_res_action");
3345: }
3346: } catch (SQLException e) {
3347: e.printStackTrace();
3348: org.objectweb.salome_tmf.api.Api.addException(
3349: "selectResExecActionEffectivResult", null, e);
3350: } catch (Exception ex) {
3351: ex.printStackTrace();
3352: org.objectweb.salome_tmf.api.Api.addException(null, null,
3353: ex);
3354: }
3355:
3356: // On retourne le resultat
3357: return result;
3358: }
3359:
3360: public Vector getExecTestResultAttachFiles(int resExecCamId,
3361: int testId) {
3362: Vector result = new Vector();
3363: DataSet stmtRes = null;
3364: //String name = null;
3365:
3366: try {
3367:
3368: // On execute la requete
3369: PreparedStatement prep = database.prepareStatement(prop
3370: .getProperty("selectAllExecTestResultAttchFile"));
3371: prep.setInt(1, resExecCamId);
3372: prep.setInt(2, testId);
3373: stmtRes = new DataSet(prep.executeQuery());
3374: // Ajoute les element un par un au resultat
3375: while (stmtRes.hasMoreElements()) {
3376: /*FileAttachment fileAttach = new FileAttachment();
3377: fileAttach.setName(stmtRes.getResults().getString("nom_attach"));
3378: fileAttach.setLocalisation("");
3379: fileAttach.setDate(stmtRes.getResults().getDate("date_attachement"));
3380: fileAttach.setSize(new Long(stmtRes.getResults().getLong("taille_attachement")));
3381: fileAttach.setDescription(stmtRes.getResults().getString("description_attach"));
3382: fileAttach.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
3383: FileAttachementWrapper fileAttach = new FileAttachementWrapper();
3384: fileAttach.setName(stmtRes.getResults().getString(
3385: "nom_attach"));
3386: fileAttach.setLocalisation("");
3387: fileAttach.setDate(stmtRes.getResults().getDate(
3388: "date_attachement"));
3389: fileAttach.setSize(new Long(stmtRes.getResults()
3390: .getLong("taille_attachement")));
3391: fileAttach.setDescription(stmtRes.getResults()
3392: .getString("description_attach"));
3393: fileAttach.setIdBDD(stmtRes.getResults().getInt(
3394: "id_attach"));
3395: result.addElement(fileAttach);
3396: }
3397: } catch (SQLException e) {
3398: e.printStackTrace();
3399: org.objectweb.salome_tmf.api.Api.addException(
3400: "selectExecTestResultAttachFiles", null, e);
3401: } catch (Exception ex) {
3402: ex.printStackTrace();
3403: org.objectweb.salome_tmf.api.Api.addException(null, null,
3404: ex);
3405: }
3406:
3407: // On retourne le resultat
3408: return result;
3409: }
3410:
3411: public Vector getExecTestResultAttachUrls(int resExecCamId,
3412: int testId) {
3413: Vector result = new Vector();
3414: DataSet stmtRes = null;
3415: //String name = null;
3416:
3417: try {
3418:
3419: // On execute la requete
3420: PreparedStatement prep = database.prepareStatement(prop
3421: .getProperty("selectAllExecTestResultAttchURL"));
3422: prep.setInt(1, resExecCamId);
3423: prep.setInt(2, testId);
3424: stmtRes = new DataSet(prep.executeQuery());
3425: // Ajoute les element un par un au resultat
3426: while (stmtRes.hasMoreElements()) {
3427: /*UrlAttachment pUrlAttachment = new UrlAttachment();
3428: String url = stmtRes.getResults().getString("url_attach");
3429: pUrlAttachment.setUrl(new URL(url));
3430: pUrlAttachment.setName(url);
3431: pUrlAttachment.setDescription(stmtRes.getResults().getString("description_attach"));;
3432: pUrlAttachment.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
3433: UrlAttachementWrapper pUrlAttachment = new UrlAttachementWrapper();
3434: String url = stmtRes.getResults().getString(
3435: "url_attach");
3436: pUrlAttachment.setUrl(new URL(url));
3437: pUrlAttachment.setName(url);
3438: pUrlAttachment.setDescription(stmtRes.getResults()
3439: .getString("description_attach"));
3440: ;
3441: pUrlAttachment.setIdBDD(stmtRes.getResults().getInt(
3442: "id_attach"));
3443: result.addElement(pUrlAttachment);
3444: }
3445: } catch (SQLException e) {
3446: e.printStackTrace();
3447: org.objectweb.salome_tmf.api.Api.addException(
3448: "selectExecTestResultAttachFiles", null, e);
3449: } catch (Exception ex) {
3450: ex.printStackTrace();
3451: org.objectweb.salome_tmf.api.Api.addException(null, null,
3452: ex);
3453: }
3454:
3455: // On retourne le resultat
3456: return result;
3457: }
3458:
3459: public Vector getExecResultAttachFiles(int execResultId) {
3460: Vector result = new Vector();
3461: DataSet stmtRes = null;
3462: //File file = null;
3463:
3464: try {
3465: // On execute la requete
3466: PreparedStatement prep = database.prepareStatement(prop
3467: .getProperty("selectExecResultAttachFiles"));
3468: prep.setInt(1, execResultId);
3469: stmtRes = new DataSet(prep.executeQuery());
3470: // Ajoute les element un par un au resultat
3471: while (stmtRes.hasMoreElements()) {
3472: /*FileAttachment fileAttach = new FileAttachment();
3473: fileAttach.setName(stmtRes.getResults().getString("nom_attach"));
3474: fileAttach.setLocalisation("");
3475: fileAttach.setDate(stmtRes.getResults().getDate("date_attachement"));
3476: fileAttach.setSize(new Long(stmtRes.getResults().getLong("taille_attachement")));
3477: fileAttach.setDescription(stmtRes.getResults().getString("description_attach"));
3478: fileAttach.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
3479: FileAttachementWrapper fileAttach = new FileAttachementWrapper();
3480: fileAttach.setName(stmtRes.getResults().getString(
3481: "nom_attach"));
3482: fileAttach.setLocalisation("");
3483: fileAttach.setDate(stmtRes.getResults().getDate(
3484: "date_attachement"));
3485: fileAttach.setSize(new Long(stmtRes.getResults()
3486: .getLong("taille_attachement")));
3487: fileAttach.setDescription(stmtRes.getResults()
3488: .getString("description_attach"));
3489: fileAttach.setIdBDD(stmtRes.getResults().getInt(
3490: "id_attach"));
3491: result.addElement(fileAttach);
3492: }
3493: } catch (SQLException e) {
3494: e.printStackTrace();
3495: org.objectweb.salome_tmf.api.Api.addException(
3496: "selectExecResultAttachFiles", null, e);
3497: } catch (Exception ex) {
3498: ex.printStackTrace();
3499: org.objectweb.salome_tmf.api.Api.addException(null, null,
3500: ex);
3501: }
3502:
3503: // On retourne le resultat
3504: return result;
3505: }
3506:
3507: public Vector getExecResultAttachUrls(int execResultId) {
3508: Vector result = new Vector();
3509: DataSet stmtRes = null;
3510:
3511: try {
3512: // On execute la requete
3513: PreparedStatement prep = database.prepareStatement(prop
3514: .getProperty("selectExecResultAttachUrls"));
3515: prep.setInt(1, execResultId);
3516: stmtRes = new DataSet(prep.executeQuery());
3517: // Ajoute les element un par un au resultat
3518: while (stmtRes.hasMoreElements()) {
3519: /*UrlAttachment pUrlAttachment = new UrlAttachment();
3520: String url = stmtRes.getResults().getString("url_attach");
3521: pUrlAttachment.setUrl(new URL(url));
3522: pUrlAttachment.setName(url);
3523: pUrlAttachment.setDescription(stmtRes.getResults().getString("description_attach"));;
3524: pUrlAttachment.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
3525: UrlAttachementWrapper pUrlAttachment = new UrlAttachementWrapper();
3526: String url = stmtRes.getResults().getString(
3527: "url_attach");
3528: pUrlAttachment.setUrl(new URL(url));
3529: pUrlAttachment.setName(url);
3530: pUrlAttachment.setDescription(stmtRes.getResults()
3531: .getString("description_attach"));
3532: ;
3533: pUrlAttachment.setIdBDD(stmtRes.getResults().getInt(
3534: "id_attach"));
3535: result.addElement(pUrlAttachment);
3536: }
3537: } catch (SQLException e) {
3538: e.printStackTrace();
3539: org.objectweb.salome_tmf.api.Api.addException(
3540: "selectExecResultAttachUrls", null, e);
3541: } catch (Exception ex) {
3542: ex.printStackTrace();
3543: org.objectweb.salome_tmf.api.Api.addException(null, null,
3544: ex);
3545: }
3546:
3547: // On retourne le resultat
3548: return result;
3549: }
3550:
3551: public Vector getExecAttachFiles(int execID) {
3552: Vector result = new Vector();
3553: DataSet stmtRes = null;
3554:
3555: try {
3556: // On execute la requete
3557: PreparedStatement prep = database.prepareStatement(prop
3558: .getProperty("selectExecAttachFiles"));
3559: prep.setInt(1, execID);
3560: stmtRes = new DataSet(prep.executeQuery());
3561: // Ajoute les element un par un au resultat
3562: while (stmtRes.hasMoreElements()) {
3563: /*FileAttachment fileAttach = new FileAttachment();
3564: fileAttach.setName(stmtRes.getResults().getString("nom_attach"));
3565: fileAttach.setLocalisation("");
3566: fileAttach.setDate(stmtRes.getResults().getDate("date_attachement"));
3567: fileAttach.setSize(new Long(stmtRes.getResults().getLong("taille_attachement")));
3568: fileAttach.setDescription(stmtRes.getResults().getString("description_attach"));
3569: fileAttach.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
3570: FileAttachementWrapper fileAttach = new FileAttachementWrapper();
3571: fileAttach.setName(stmtRes.getResults().getString(
3572: "nom_attach"));
3573: fileAttach.setLocalisation("");
3574: fileAttach.setDate(stmtRes.getResults().getDate(
3575: "date_attachement"));
3576: fileAttach.setSize(new Long(stmtRes.getResults()
3577: .getLong("taille_attachement")));
3578: fileAttach.setDescription(stmtRes.getResults()
3579: .getString("description_attach"));
3580: fileAttach.setIdBDD(stmtRes.getResults().getInt(
3581: "id_attach"));
3582: result.addElement(fileAttach);
3583: }
3584: } catch (SQLException e) {
3585: e.printStackTrace();
3586: org.objectweb.salome_tmf.api.Api.addException(
3587: "selectExecAttachFiles", null, e);
3588: } catch (Exception ex) {
3589: ex.printStackTrace();
3590: org.objectweb.salome_tmf.api.Api.addException(null, null,
3591: ex);
3592: }
3593:
3594: // On retourne le resultat
3595: return result;
3596: }
3597:
3598: public Vector getExecAttachUrls(int execID) {
3599: Vector result = new Vector();
3600: DataSet stmtRes = null;
3601:
3602: try {
3603: PreparedStatement prep = database.prepareStatement(prop
3604: .getProperty("selectExecAttachUrls"));
3605: prep.setInt(1, execID);
3606: stmtRes = new DataSet(prep.executeQuery());
3607: // Ajoute les element un par un au resultat
3608: while (stmtRes.hasMoreElements()) {
3609: /*UrlAttachment pUrlAttachment = new UrlAttachment();
3610: String url = stmtRes.getResults().getString("url_attach");
3611: pUrlAttachment.setUrl(new URL(url));
3612: pUrlAttachment.setName(url);
3613: pUrlAttachment.setDescription(stmtRes.getResults().getString("description_attach"));;
3614: pUrlAttachment.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
3615: UrlAttachementWrapper pUrlAttachment = new UrlAttachementWrapper();
3616: String url = stmtRes.getResults().getString(
3617: "url_attach");
3618: pUrlAttachment.setUrl(new URL(url));
3619: pUrlAttachment.setName(url);
3620: pUrlAttachment.setDescription(stmtRes.getResults()
3621: .getString("description_attach"));
3622: ;
3623: pUrlAttachment.setIdBDD(stmtRes.getResults().getInt(
3624: "id_attach"));
3625: result.addElement(pUrlAttachment);
3626: }
3627: } catch (SQLException e) {
3628: e.printStackTrace();
3629: org.objectweb.salome_tmf.api.Api.addException(
3630: "selectExecAttachUrls", null, e);
3631: } catch (Exception ex) {
3632: ex.printStackTrace();
3633: org.objectweb.salome_tmf.api.Api.addException(null, null,
3634: ex);
3635: }
3636:
3637: // On retourne le resultat
3638: return result;
3639: }
3640:
3641: public Vector getCampaignAttachFiles(int campId) {
3642: Vector result = new Vector();
3643: DataSet stmtRes = null;
3644: //String name = null;
3645:
3646: try {
3647: // On execute la requete
3648: PreparedStatement prep = database.prepareStatement(prop
3649: .getProperty("selectCampaignAttachFiles"));
3650: prep.setInt(1, campId);
3651: stmtRes = new DataSet(prep.executeQuery());
3652: // Ajoute les element un par un au resultat
3653: while (stmtRes.hasMoreElements()) {
3654: /*FileAttachment fileAttach = new FileAttachment();
3655: fileAttach.setName(stmtRes.getResults().getString("nom_attach"));
3656: fileAttach.setLocalisation("");
3657: fileAttach.setDate(stmtRes.getResults().getDate("date_attachement"));
3658: fileAttach.setSize(new Long(stmtRes.getResults().getLong("taille_attachement")));
3659: fileAttach.setDescription(stmtRes.getResults().getString("description_attach"));
3660: fileAttach.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
3661: FileAttachementWrapper fileAttach = new FileAttachementWrapper();
3662: fileAttach.setName(stmtRes.getResults().getString(
3663: "nom_attach"));
3664: fileAttach.setLocalisation("");
3665: fileAttach.setDate(stmtRes.getResults().getDate(
3666: "date_attachement"));
3667: fileAttach.setSize(new Long(stmtRes.getResults()
3668: .getLong("taille_attachement")));
3669: fileAttach.setDescription(stmtRes.getResults()
3670: .getString("description_attach"));
3671: fileAttach.setIdBDD(stmtRes.getResults().getInt(
3672: "id_attach"));
3673: result.addElement(fileAttach);
3674: }
3675: } catch (SQLException e) {
3676: e.printStackTrace();
3677: org.objectweb.salome_tmf.api.Api.addException(
3678: "selectCampaignAttachFiles", null, e);
3679: } catch (Exception ex) {
3680: ex.printStackTrace();
3681: org.objectweb.salome_tmf.api.Api.addException(null, null,
3682: ex);
3683: }
3684:
3685: // On retourne le resultat
3686: return result;
3687: }
3688:
3689: public Vector getCampaignAttachUrls(int campId) {
3690: Vector result = new Vector();
3691: DataSet stmtRes = null;
3692:
3693: try {
3694: // On execute la requete
3695: PreparedStatement prep = database.prepareStatement(prop
3696: .getProperty("selectCampaignAttachUrls"));
3697: prep.setInt(1, campId);
3698: stmtRes = new DataSet(prep.executeQuery());
3699: // Ajoute les element un par un au resultat
3700: while (stmtRes.hasMoreElements()) {
3701: /*UrlAttachment pUrlAttachment = new UrlAttachment();
3702: String url = stmtRes.getResults().getString("url_attach");
3703: pUrlAttachment.setUrl(new URL(url));
3704: pUrlAttachment.setName(url);
3705: pUrlAttachment.setDescription(stmtRes.getResults().getString("description_attach"));;
3706: pUrlAttachment.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
3707: UrlAttachementWrapper pUrlAttachment = new UrlAttachementWrapper();
3708: String url = stmtRes.getResults().getString(
3709: "url_attach");
3710: pUrlAttachment.setUrl(new URL(url));
3711: pUrlAttachment.setName(url);
3712: pUrlAttachment.setDescription(stmtRes.getResults()
3713: .getString("description_attach"));
3714: ;
3715: pUrlAttachment.setIdBDD(stmtRes.getResults().getInt(
3716: "id_attach"));
3717: result.addElement(pUrlAttachment);
3718: }
3719: } catch (SQLException e) {
3720: e.printStackTrace();
3721: org.objectweb.salome_tmf.api.Api.addException(
3722: "selectCampaignAttachUrls", null, e);
3723: } catch (Exception ex) {
3724: ex.printStackTrace();
3725: org.objectweb.salome_tmf.api.Api.addException(null, null,
3726: ex);
3727: }
3728:
3729: // On retourne le resultat
3730: return result;
3731: }
3732:
3733: public int getResExcId(String campName, String execCampName,
3734: String resExecCampName) {
3735: return CTCommun.getIdResExecCamp(database, prop, idProject,
3736: campName, execCampName, resExecCampName);
3737: }
3738:
3739: public int getLastAttachID() {
3740: return STCommun.getMaxIdAttach(database, prop);
3741: }
3742:
3743: public int getLastScriptID() {
3744: return STCommun.getMaxIdScript(database, prop);
3745: }
3746:
3747: public int getIdParam(String nameParam) {
3748: return CTCommun
3749: .getIdParam(database, prop, nameParam, idProject);
3750: }
3751:
3752: /**
3753: * Selection des fichiers attachés à un environnement
3754: * Retourne un vecteur (tableau dynamique) d'objets de type "File"
3755: * @param envName
3756: * @return
3757: */
3758: public Vector getEnvAttachFiles(String envName) {
3759: int idEnv = CTCommun.getIdEnv(database, prop, idProject,
3760: envName);
3761: Vector result = new Vector();
3762: Vector vFileAttachs = getEnvAttachFiles(idEnv);
3763: for (int i = 0; i < vFileAttachs.size(); i++) {
3764: //result.add(i, ((FileAttachment)vFileAttachs.elementAt(i)).getName());
3765: result.add(i, ((FileAttachementWrapper) vFileAttachs
3766: .elementAt(i)).getName());
3767: }
3768: return result;
3769: }
3770:
3771: /**
3772: * Selection des fichiers attachés à un environnement
3773: * Retourne un vecteur (tableau dynamique) d'objets de type "File"
3774: * @param envId
3775: * @return
3776: */
3777: public Vector getEnvAttachFiles(int envId) {
3778: Vector result = new Vector();
3779: DataSet stmtRes = null;
3780: //String name = null;
3781:
3782: try {
3783: //On execute la requete
3784: PreparedStatement prep = database.prepareStatement(prop
3785: .getProperty("selectEnvAttachFiles"));
3786: prep.setInt(1, envId);
3787: stmtRes = new DataSet(prep.executeQuery());
3788: // Ajoute les element un par un au resultat
3789: while (stmtRes.hasMoreElements()) {
3790: /*FileAttachment fileAttach = new FileAttachment();
3791: fileAttach.setName(stmtRes.getResults().getString("nom_attach"));
3792: fileAttach.setLocalisation("");
3793: fileAttach.setDate(stmtRes.getResults().getDate("date_attachement"));
3794: fileAttach.setSize(new Long(stmtRes.getResults().getLong("taille_attachement")));
3795: fileAttach.setDescription(stmtRes.getResults().getString("description_attach"));
3796: fileAttach.setIdBdd(stmtRes.getResults().getInt("id_attach"));*/
3797: FileAttachementWrapper fileAttach = new FileAttachementWrapper();
3798: fileAttach.setName(stmtRes.getResults().getString(
3799: "nom_attach"));
3800: fileAttach.setLocalisation("");
3801: fileAttach.setDate(stmtRes.getResults().getDate(
3802: "date_attachement"));
3803: fileAttach.setSize(new Long(stmtRes.getResults()
3804: .getLong("taille_attachement")));
3805: fileAttach.setDescription(stmtRes.getResults()
3806: .getString("description_attach"));
3807: fileAttach.setIdBDD(stmtRes.getResults().getInt(
3808: "id_attach"));
3809: result.addElement(fileAttach);
3810: }
3811: } catch (SQLException e) {
3812: e.printStackTrace();
3813: org.objectweb.salome_tmf.api.Api.addException(
3814: "selectEnvAttachFiles", null, e);
3815: } catch (Exception ex) {
3816: ex.printStackTrace();
3817: org.objectweb.salome_tmf.api.Api.addException(null, null,
3818: ex);
3819: }
3820:
3821: // On retourne le resultat
3822: return result;
3823: }
3824:
3825: /**
3826: * Selection des URL attachées à un environnement
3827: * Retourne un vecteur (tableau dynamique) d'objets de type "String"
3828: * @param envName
3829: * @return
3830: */
3831: public Vector getEnvAttachUrls(String envName) {
3832: int idEnv = CTCommun.getIdEnv(database, prop, idProject,
3833: envName);
3834: Vector result = new Vector();
3835: Vector vUrlAttachs = getEnvAttachUrls(idEnv);
3836: for (int i = 0; i < vUrlAttachs.size(); i++) {
3837: //result.add(i, ((UrlAttachment)vUrlAttachs.elementAt(i)).getName());
3838: result.add(i, ((UrlAttachementWrapper) vUrlAttachs
3839: .elementAt(i)).getName());
3840: }
3841: return result;
3842: }
3843:
3844: /**
3845: * Selection des URL attachées à un environnement
3846: * Retourne un vecteur (tableau dynamique) d'objets de type "String"
3847: * @param envId
3848: * @return
3849: */
3850: public Vector getEnvAttachUrls(int envId) {
3851: Vector result = new Vector();
3852: DataSet stmtRes = null;
3853:
3854: try {
3855: // On execute la requete
3856: PreparedStatement prep = database.prepareStatement(prop
3857: .getProperty("selectEnvAttachUrls"));
3858: prep.setInt(1, envId);
3859: stmtRes = new DataSet(prep.executeQuery());
3860: // Ajoute les element un par un au resultat
3861: while (stmtRes.hasMoreElements()) {
3862: /*UrlAttachment pUrlAttachment = new UrlAttachment();
3863: String url = stmtRes.getResults().getString("url_attach");
3864: pUrlAttachment.setUrl(new URL(url));
3865: pUrlAttachment.setName(url);
3866: pUrlAttachment.setDescription(stmtRes.getResults().getString("description_attach"));;
3867: pUrlAttachment.setIdBdd(stmtRes.getResults().getInt("id_attach"));
3868: */
3869: UrlAttachementWrapper pUrlAttachment = new UrlAttachementWrapper();
3870: String url = stmtRes.getResults().getString(
3871: "url_attach");
3872: pUrlAttachment.setUrl(new URL(url));
3873: pUrlAttachment.setName(url);
3874: pUrlAttachment.setDescription(stmtRes.getResults()
3875: .getString("description_attach"));
3876: ;
3877: pUrlAttachment.setIdBDD(stmtRes.getResults().getInt(
3878: "id_attach"));
3879:
3880: result.addElement(pUrlAttachment);
3881: }
3882: } catch (SQLException e) {
3883: e.printStackTrace();
3884: org.objectweb.salome_tmf.api.Api.addException(
3885: "selectEnvAttachUrls", null, e);
3886: } catch (Exception ex) {
3887: ex.printStackTrace();
3888: org.objectweb.salome_tmf.api.Api.addException(null, null,
3889: ex);
3890: }
3891:
3892: // On retourne le resultat
3893: return result;
3894: }
3895:
3896: /**
3897: * Récupérer l'identifiant de l'URL aatché à l'environnemnt
3898: * @param idEnv identifiant de l'environnemnt
3899: * @param url
3900: * @return identifiant de l'url
3901: */
3902: public int getEnvAttachUrlId(int idEnv, String url) {
3903: return CTCommun.getEnvAttachUrlId(database, prop, idEnv, url);
3904: }
3905:
3906: /**
3907: * Récupérer l'identifiant du fichier attaché à l'environnemnt
3908: * @param idEnv identifiant de l'environnemnt
3909: * @param fileName
3910: * @return identifiant du fichier
3911: */
3912: public int getEnvAttachFileId(int idEnv, String fileName) {
3913: return CTCommun.getEnvAttachFileId(database, prop, idEnv,
3914: fileName);
3915: }
3916:
3917: /**
3918: * Récupérer l'identifiant du script d'un environnement
3919: * @param idEnv identifiant de l'environnement
3920: * @param scriptName, nom du script
3921: * @return l'identifiant du script
3922: */
3923: public int getIdScriptOfEnvironment(int idEnv, String scriptName) {
3924: return CTCommun.getIdScriptEnvironment(database, prop, idEnv,
3925: scriptName);
3926: }
3927:
3928: public int getNumberOfCampaign() {
3929: int result = -1;
3930: DataSet stmtRes = null;
3931:
3932: try {
3933: // On execute la requete
3934: PreparedStatement prep = database.prepareStatement(prop
3935: .getProperty("selectProjectCampaigns"));
3936: prep.setInt(1, idProject);
3937: stmtRes = new DataSet(prep.executeQuery());
3938: // Ajoute les element un par un au resultat
3939: while (stmtRes.hasMoreElements()) {
3940: result++;
3941: }
3942: } catch (SQLException e) {
3943: e.printStackTrace();
3944: org.objectweb.salome_tmf.api.Api.addException(
3945: "selectProjectCampaigns", null, e);
3946: } catch (Exception ex) {
3947: ex.printStackTrace();
3948: org.objectweb.salome_tmf.api.Api.addException(null, null,
3949: ex);
3950: }
3951:
3952: return result;
3953: }
3954:
3955: public CampaignWrapper getCampaignByOrder(int order_camp) {
3956: DataSet stmtRes = null;
3957: CampaignWrapper pCamp = null;
3958: try {
3959: // On execute la requete
3960: PreparedStatement prep = database.prepareStatement(prop
3961: .getProperty("selectCampaignByOrder"));
3962: prep.setInt(1, idProject);
3963: prep.setInt(2, order_camp);
3964: stmtRes = new DataSet(prep.executeQuery());
3965: // Ajoute les element un par un au resultat
3966: if (stmtRes.hasMoreElements()) {
3967: pCamp = new CampaignWrapper();
3968: pCamp.setName(stmtRes.getResults()
3969: .getString("nom_camp"));
3970: pCamp.setDescription(stmtRes.getResults().getString(
3971: "description_camp"));
3972: pCamp.setIdBDD(stmtRes.getResults().getInt("id_camp"));
3973: pCamp.setOrder(stmtRes.getResults()
3974: .getInt("ordre_camp"));
3975: }
3976: } catch (SQLException e) {
3977: e.printStackTrace();
3978: org.objectweb.salome_tmf.api.Api.addException(
3979: "selectCampaignByOrder", null, e);
3980: } catch (Exception ex) {
3981: ex.printStackTrace();
3982: org.objectweb.salome_tmf.api.Api.addException(null, null,
3983: ex);
3984: }
3985:
3986: // On retourne le resultat
3987: return pCamp;
3988: }
3989:
3990: public CampaignWrapper getCampaignUsingID(int IdCampaign) {
3991: DataSet stmtRes = null;
3992: CampaignWrapper pCamp = null;
3993: try {
3994: // On execute la requete
3995: PreparedStatement prep = database.prepareStatement(prop
3996: .getProperty("selectCampaignUsingID"));
3997: prep.setInt(1, IdCampaign);
3998: stmtRes = new DataSet(prep.executeQuery());
3999: // Ajoute les element un par un au resultat
4000: if (stmtRes.hasMoreElements()) {
4001: pCamp = new CampaignWrapper();
4002: pCamp.setName(stmtRes.getResults()
4003: .getString("nom_camp"));
4004: pCamp.setDescription(stmtRes.getResults().getString(
4005: "description_camp"));
4006: pCamp.setIdBDD(stmtRes.getResults().getInt("id_camp"));
4007: pCamp.setOrder(stmtRes.getResults()
4008: .getInt("ordre_camp"));
4009: }
4010: } catch (SQLException e) {
4011: e.printStackTrace();
4012: org.objectweb.salome_tmf.api.Api.addException(
4013: "selectCampaignUsingID", null, e);
4014: } catch (Exception ex) {
4015: ex.printStackTrace();
4016: org.objectweb.salome_tmf.api.Api.addException(null, null,
4017: ex);
4018: }
4019:
4020: // On retourne le resultat
4021: return pCamp;
4022: }
4023:
4024: public int getNumberOfTestInCampaign(int idCamp) {
4025: int result = -1;
4026: DataSet stmtRes = null;
4027:
4028: try {
4029: // On execute la requete
4030: PreparedStatement prep = database.prepareStatement(prop
4031: .getProperty("selectCampaignTestsUsingID"));
4032: prep.setInt(1, idCamp);
4033: stmtRes = new DataSet(prep.executeQuery());
4034: // Ajoute les element un par un au resultat
4035: while (stmtRes.hasMoreElements()) {
4036: result++;
4037: }
4038: } catch (SQLException e) {
4039: e.printStackTrace();
4040: org.objectweb.salome_tmf.api.Api.addException(
4041: "selectCampaignTestsUsingID", null, e);
4042: } catch (Exception ex) {
4043: ex.printStackTrace();
4044: org.objectweb.salome_tmf.api.Api.addException(null, null,
4045: ex);
4046: }
4047:
4048: return result;
4049: }
4050:
4051: public TestCampWrapper getTestCampByOrder(int idCampaign,
4052: int order_test_camp) {
4053: DataSet stmtRes = null;
4054: TestCampWrapper pTestCamp = null;
4055: try {
4056: // On execute la requete
4057: PreparedStatement prep = database.prepareStatement(prop
4058: .getProperty("selectTestCampByOrder"));
4059: prep.setInt(1, idCampaign);
4060: prep.setInt(2, order_test_camp);
4061: stmtRes = new DataSet(prep.executeQuery());
4062: // Ajoute les element un par un au resultat
4063: if (stmtRes.hasMoreElements()) {
4064: pTestCamp = new TestCampWrapper();
4065: pTestCamp.setIdBDD(stmtRes.getResults().getInt(
4066: "CAS_TEST_id_cas"));
4067: pTestCamp.setIdCamp(stmtRes.getResults().getInt(
4068: "CAMPAGNE_TEST_id_camp"));
4069: pTestCamp.setOrder(stmtRes.getResults().getInt(
4070: "ordre_cas_camp"));
4071: }
4072: } catch (SQLException e) {
4073: e.printStackTrace();
4074: org.objectweb.salome_tmf.api.Api.addException(
4075: "selectTestCampByOrder", null, e);
4076: } catch (Exception ex) {
4077: ex.printStackTrace();
4078: org.objectweb.salome_tmf.api.Api.addException(null, null,
4079: ex);
4080: }
4081:
4082: // On retourne le resultat
4083: return pTestCamp;
4084: }
4085:
4086: public TestCampWrapper getTestCampUsingID(int idCampaign, int idTest) {
4087: DataSet stmtRes = null;
4088: TestCampWrapper pTestCamp = null;
4089: try {
4090: // On execute la requete
4091: PreparedStatement prep = database.prepareStatement(prop
4092: .getProperty("selectTestCampUsingID"));
4093: prep.setInt(1, idCampaign);
4094: prep.setInt(2, idTest);
4095: stmtRes = new DataSet(prep.executeQuery());
4096: // Ajoute les element un par un au resultat
4097: if (stmtRes.hasMoreElements()) {
4098: pTestCamp = new TestCampWrapper();
4099: pTestCamp.setIdBDD(stmtRes.getResults().getInt(
4100: "CAS_TEST_id_cas"));
4101: pTestCamp.setIdCamp(stmtRes.getResults().getInt(
4102: "CAMPAGNE_TEST_id_camp"));
4103: pTestCamp.setOrder(stmtRes.getResults().getInt(
4104: "ordre_cas_camp"));
4105: }
4106: } catch (SQLException e) {
4107: e.printStackTrace();
4108: org.objectweb.salome_tmf.api.Api.addException(
4109: "selectTestCampUsingID", null, e);
4110: } catch (Exception ex) {
4111: ex.printStackTrace();
4112: org.objectweb.salome_tmf.api.Api.addException(null, null,
4113: ex);
4114: }
4115:
4116: // On retourne le resultat
4117: return pTestCamp;
4118: }
4119:
4120: public TestCampWrapper getInCampaignFirstTestCampInSuite(
4121: int idCampaign, int idSuite) {
4122: DataSet stmtRes = null;
4123: TestCampWrapper pTestCamp = null;
4124: try {
4125: // On execute la requete
4126: PreparedStatement prep = database.prepareStatement(prop
4127: .getProperty("selectSuiteTestsInCamp"));
4128: prep.setInt(1, idCampaign);
4129: prep.setInt(2, idSuite);
4130: stmtRes = new DataSet(prep.executeQuery());
4131: // Ajoute les element un par un au resultat
4132: if (stmtRes.hasMoreElements()) {
4133: pTestCamp = new TestCampWrapper();
4134: pTestCamp.setIdBDD(stmtRes.getResults().getInt(
4135: "CAS_TEST_id_cas"));
4136: pTestCamp.setIdCamp(stmtRes.getResults().getInt(
4137: "CAMPAGNE_TEST_id_camp"));
4138: pTestCamp.setOrder(stmtRes.getResults().getInt(
4139: "ordre_cas_camp"));
4140: }
4141: } catch (SQLException e) {
4142: e.printStackTrace();
4143: org.objectweb.salome_tmf.api.Api.addException(
4144: "selectSuiteTestsInCamp", null, e);
4145: } catch (Exception ex) {
4146: ex.printStackTrace();
4147: org.objectweb.salome_tmf.api.Api.addException(null, null,
4148: ex);
4149: }
4150:
4151: // On retourne le resultat
4152: return pTestCamp;
4153: }
4154:
4155: public TestCampWrapper getInCampaignLastTestCampInSuite(
4156: int idCampaign, int idSuite) {
4157: DataSet stmtRes = null;
4158: TestCampWrapper pTestCamp = null;
4159: java.sql.ResultSet res = null;
4160: try {
4161: // On execute la requete
4162: PreparedStatement prep = database.prepareStatement(prop
4163: .getProperty("selectSuiteTestsInCamp"));
4164: prep.setInt(1, idCampaign);
4165: prep.setInt(2, idSuite);
4166: stmtRes = new DataSet(prep.executeQuery());
4167: pTestCamp = new TestCampWrapper();
4168: // Ajoute les element un par un au resultat
4169: while (stmtRes.hasMoreElements()) {
4170: Api
4171: .log("[CampTestSelect:getInCampaignLastTestCampInSuite] : Ajoute les element un par un au resultat");
4172: res = stmtRes.getResults();
4173: pTestCamp.setIdBDD(res.getInt("CAS_TEST_id_cas"));
4174: pTestCamp
4175: .setIdCamp(res.getInt("CAMPAGNE_TEST_id_camp"));
4176: pTestCamp.setOrder(res.getInt("ordre_cas_camp"));
4177: }
4178:
4179: /* if (res != null) {
4180: pTestCamp = new TestCampWrapper();
4181: pTestCamp.setIdBDD(res.getInt("CAS_TEST_id_cas"));
4182: pTestCamp.setIdCamp(res.getInt("CAMPAGNE_TEST_id_camp"));
4183: pTestCamp.setOrder(res.getInt("ordre_cas_camp"));
4184: } */
4185: } catch (SQLException e) {
4186: e.printStackTrace();
4187: org.objectweb.salome_tmf.api.Api.addException(
4188: "selectSuiteTestsInCamp", null, e);
4189: } catch (Exception ex) {
4190: ex.printStackTrace();
4191: org.objectweb.salome_tmf.api.Api.addException(null, null,
4192: ex);
4193: }
4194:
4195: // On retourne le resultat
4196: return pTestCamp;
4197: }
4198:
4199: public TestCampWrapper getInCampaignFirstTestCampInFamily(
4200: int idCampaign, int idFamily) {
4201: DataSet stmtRes = null;
4202: TestCampWrapper pTestCamp = null;
4203: try {
4204: // On execute la requete
4205: PreparedStatement prep = database.prepareStatement(prop
4206: .getProperty("selectFamilyTestsInCamp"));
4207: prep.setInt(1, idCampaign);
4208: prep.setInt(2, idFamily);
4209: stmtRes = new DataSet(prep.executeQuery());
4210: // Ajoute les element un par un au resultat
4211: if (stmtRes.hasMoreElements()) {
4212: pTestCamp = new TestCampWrapper();
4213: pTestCamp.setIdBDD(stmtRes.getResults().getInt(
4214: "CAS_TEST_id_cas"));
4215: pTestCamp.setIdCamp(stmtRes.getResults().getInt(
4216: "CAMPAGNE_TEST_id_camp"));
4217: pTestCamp.setOrder(stmtRes.getResults().getInt(
4218: "ordre_cas_camp"));
4219: }
4220: } catch (SQLException e) {
4221: e.printStackTrace();
4222: org.objectweb.salome_tmf.api.Api.addException(
4223: "selectFamilyTestsInCamp", null, e);
4224: } catch (Exception ex) {
4225: ex.printStackTrace();
4226: org.objectweb.salome_tmf.api.Api.addException(null, null,
4227: ex);
4228: }
4229:
4230: // On retourne le resultat
4231: return pTestCamp;
4232: }
4233:
4234: public TestCampWrapper getInCampaignLastTestCampInFamily(
4235: int idCampaign, int idFamily) {
4236: DataSet stmtRes = null;
4237: TestCampWrapper pTestCamp = null;
4238: java.sql.ResultSet res = null;
4239: try {
4240: // On execute la requete
4241: PreparedStatement prep = database.prepareStatement(prop
4242: .getProperty("selectFamilyTestsInCamp"));
4243: prep.setInt(1, idCampaign);
4244: prep.setInt(2, idFamily);
4245: stmtRes = new DataSet(prep.executeQuery());
4246: pTestCamp = new TestCampWrapper();
4247: // Ajoute les element un par un au resultat
4248: while (stmtRes.hasMoreElements()) {
4249: res = stmtRes.getResults();
4250: pTestCamp.setIdBDD(res.getInt("CAS_TEST_id_cas"));
4251: pTestCamp
4252: .setIdCamp(res.getInt("CAMPAGNE_TEST_id_camp"));
4253: pTestCamp.setOrder(res.getInt("ordre_cas_camp"));
4254: }
4255:
4256: /*if (res != null) {
4257: pTestCamp = new TestCampWrapper();
4258: pTestCamp.setIdBDD(res.getInt("CAS_TEST_id_cas"));
4259: pTestCamp.setIdCamp(res.getInt("CAMPAGNE_TEST_id_camp"));
4260: pTestCamp.setOrder(res.getInt("ordre_cas_camp"));
4261: } */
4262: } catch (SQLException e) {
4263: e.printStackTrace();
4264: org.objectweb.salome_tmf.api.Api.addException(
4265: "selectFamilyTestsInCamp", null, e);
4266: } catch (Exception ex) {
4267: ex.printStackTrace();
4268: org.objectweb.salome_tmf.api.Api.addException(null, null,
4269: ex);
4270: }
4271:
4272: // On retourne le resultat
4273: return pTestCamp;
4274: }
4275:
4276: public int getSizeOfSuiteInCampaign(int idCampaign, int idSuite) {
4277: DataSet stmtRes = null;
4278: int size = 0;
4279: try {
4280: // On execute la requete
4281: PreparedStatement prep = database.prepareStatement(prop
4282: .getProperty("selectSuiteTestsInCamp"));
4283: prep.setInt(1, idCampaign);
4284: prep.setInt(2, idSuite);
4285: stmtRes = new DataSet(prep.executeQuery());
4286: // Ajoute les element un par un au resultat
4287: while (stmtRes.hasMoreElements()) {
4288: size++;
4289: }
4290: } catch (SQLException e) {
4291: e.printStackTrace();
4292: org.objectweb.salome_tmf.api.Api.addException(
4293: "selectSuiteTestsInCamp", null, e);
4294: } catch (Exception ex) {
4295: ex.printStackTrace();
4296: org.objectweb.salome_tmf.api.Api.addException(null, null,
4297: ex);
4298: }
4299:
4300: // On retourne le resultat
4301: return size;
4302: }
4303:
4304: public int getSizeOfFamilyInCampaign(int idCampaign, int idFamily) {
4305: DataSet stmtRes = null;
4306: int size = 0;
4307: try {
4308: // On execute la requete
4309: PreparedStatement prep = database.prepareStatement(prop
4310: .getProperty("selectFamilyTestsInCamp"));
4311: prep.setInt(1, idCampaign);
4312: prep.setInt(2, idFamily);
4313: stmtRes = new DataSet(prep.executeQuery());
4314: // Ajoute les element un par un au resultat
4315: while (stmtRes.hasMoreElements()) {
4316: size++;
4317: }
4318: } catch (SQLException e) {
4319: e.printStackTrace();
4320: org.objectweb.salome_tmf.api.Api.addException(
4321: "selectFamilyTestsInCamp", null, e);
4322: } catch (Exception ex) {
4323: ex.printStackTrace();
4324: org.objectweb.salome_tmf.api.Api.addException(null, null,
4325: ex);
4326: }
4327:
4328: // On retourne le resultat
4329: return size;
4330: }
4331: } // Fin de la classe CampTestSelectImpl
|