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.suiteTest;
0025:
0026: import java.io.BufferedInputStream;
0027: import java.io.File;
0028: import java.io.FileInputStream;
0029: import java.io.FileNotFoundException;
0030: import java.sql.Date;
0031: import java.sql.PreparedStatement;
0032: import java.sql.SQLException;
0033: import java.util.Properties;
0034:
0035: import org.objectweb.salome_tmf.api.api2db.DataBase;
0036: import org.objectweb.salome_tmf.api.api2ihm.Utile;
0037:
0038: /**
0039: * Fonctions de mise à jour relatives à l'aire fonctionnelle "Suites de test"
0040: */
0041: public class SuiteTestUpdateImpl implements SuiteTestUpdate {
0042:
0043: /**
0044: * Base de donnees
0045: */
0046: DataBase database;
0047:
0048: /**
0049: * Fichier "properties" contenant les requetes SQL relatives aux suites de test
0050: */
0051: Properties prop;
0052:
0053: /**
0054: * ID du projet SalomeTMF dans lequel on se situe
0055: */
0056: int idProject;
0057:
0058: /**
0059: * Nom du projet SalomeTMF dans lequel on se situe
0060: */
0061: String nameProject;
0062:
0063: private boolean special_allow = false;
0064:
0065: /**
0066: * Constructeur
0067: * @param db
0068: * @param pr
0069: */
0070: public SuiteTestUpdateImpl(DataBase db, Properties pr) {
0071: database = db;
0072: prop = pr;
0073: }
0074:
0075: /**
0076: * Fonction qui fixe le projet SalomeTMF dans lequel l'utilisateur travaille
0077: * @param projectName
0078: */
0079: public void setProject(String projectName) {
0080: nameProject = projectName;
0081: idProject = Utile.getIdProject(database, prop, projectName);
0082: }
0083:
0084: /**
0085: * Mise à jour d'une famille de test
0086: * @param oldName
0087: * @param newName
0088: * @param newDesc
0089: */
0090: public void updateFamily(String oldName, String newName,
0091: String newDesc) {
0092: if (!special_allow) {
0093: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0094: .canUpdateTest())) {
0095: org.objectweb.salome_tmf.api.Api
0096: .log("updateFamily NOT ALLOW");
0097: try {
0098: throw new Exception("updateFamily NOT ALLOW");
0099: } catch (Exception e) {
0100: e.printStackTrace();
0101: org.objectweb.salome_tmf.api.Api.addException(e);
0102: }
0103: return;
0104: }
0105: }
0106: int idFamily = -1;
0107:
0108: int _num = -1;
0109: try {
0110: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0111:
0112: // Initialisation de l'ID de la famille de test
0113: idFamily = STCommun.getIdFamily(database, prop, idProject,
0114: oldName);
0115:
0116: // Mise a jour de la suite de test
0117: PreparedStatement prep = database.prepareStatement(prop
0118: .getProperty("updateFamily"));
0119: prep.setString(1, newName);
0120: prep.setString(2, newDesc);
0121: prep.setInt(3, idFamily);
0122: prep.executeUpdate();
0123:
0124: } catch (SQLException E) {
0125: E.printStackTrace();
0126: org.objectweb.salome_tmf.api.Api.addException(
0127: "updateFamily", null, E);
0128: } catch (Exception ex) {
0129: ex.printStackTrace();
0130: org.objectweb.salome_tmf.api.Api.addException(null, null,
0131: ex);
0132: }
0133: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0134: }
0135:
0136: /**
0137: * Mise à jour d'une famille de test
0138: * @param familyId
0139: * @param newName
0140: * @param newDesc
0141: */
0142: public void updateFamilyUsingID(int familyId, String newName,
0143: String newDesc) {
0144: if (!special_allow) {
0145: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0146: .canUpdateTest())) {
0147: org.objectweb.salome_tmf.api.Api
0148: .log("updateFamily NOT ALLOW");
0149: try {
0150: throw new Exception("updateFamily NOT ALLOW");
0151: } catch (Exception e) {
0152: e.printStackTrace();
0153: org.objectweb.salome_tmf.api.Api.addException(e);
0154: }
0155: return;
0156: }
0157: }
0158: int _num = -1;
0159: try {
0160: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0161:
0162: // Mise a jour de la suite de test
0163: PreparedStatement prep = database.prepareStatement(prop
0164: .getProperty("updateFamily"));
0165: prep.setString(1, newName);
0166: prep.setString(2, newDesc);
0167: prep.setInt(3, familyId);
0168: prep.executeUpdate();
0169:
0170: } catch (SQLException E) {
0171: E.printStackTrace();
0172: org.objectweb.salome_tmf.api.Api.addException(
0173: "updateFamily", null, E);
0174: } catch (Exception ex) {
0175: ex.printStackTrace();
0176: org.objectweb.salome_tmf.api.Api.addException(null, null,
0177: ex);
0178: }
0179: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0180: }
0181:
0182: /**
0183: * Change le numéro d'ordre des familles
0184: * @param familyName
0185: * @param order
0186: */
0187: public void updateFamilyOrder(String familyName, int order) {
0188: if (!special_allow) {
0189: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0190: .canUpdateTest())) {
0191: try {
0192: throw new Exception("updateFamilyOrder NOT ALLOW");
0193: } catch (Exception e) {
0194: e.printStackTrace();
0195: org.objectweb.salome_tmf.api.Api.addException(e);
0196: }
0197: return;
0198: }
0199: }
0200:
0201: int _num = -1;
0202: try {
0203: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0204:
0205: // Initialisation de l'ID de la famille de test
0206: int idFamily = STCommun.getIdFamily(database, prop,
0207: idProject, familyName);
0208:
0209: // Mise a jour de l'ordre du test dans la suite de test
0210: PreparedStatement prep = database.prepareStatement(prop
0211: .getProperty("updateFamilyOrder"));
0212: prep.setInt(1, order);
0213: prep.setInt(2, idFamily);
0214: prep.executeUpdate();
0215: } catch (SQLException E) {
0216: E.printStackTrace();
0217: org.objectweb.salome_tmf.api.Api.addException(
0218: "updateFamilyOrder", null, E);
0219: } catch (Exception ex) {
0220: ex.printStackTrace();
0221: org.objectweb.salome_tmf.api.Api.addException(null, null,
0222: ex);
0223: }
0224: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0225: }
0226:
0227: /**
0228: * Change le numéro d'ordre des familles
0229: * @param familyId
0230: * @param order
0231: */
0232: public void updateFamilyOrderUsingID(int familyId, int order) {
0233: if (!special_allow) {
0234: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0235: .canUpdateTest())) {
0236: try {
0237: throw new Exception("updateFamilyOrder NOT ALLOW");
0238: } catch (Exception e) {
0239: e.printStackTrace();
0240: org.objectweb.salome_tmf.api.Api.addException(e);
0241: }
0242: return;
0243: }
0244: }
0245:
0246: int _num = -1;
0247: try {
0248: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0249:
0250: // Mise a jour de l'ordre du test dans la suite de test
0251: PreparedStatement prep = database.prepareStatement(prop
0252: .getProperty("updateFamilyOrder"));
0253: prep.setInt(1, order);
0254: prep.setInt(2, familyId);
0255: prep.executeUpdate();
0256: } catch (SQLException E) {
0257: E.printStackTrace();
0258: org.objectweb.salome_tmf.api.Api.addException(
0259: "updateFamilyOrder", null, E);
0260: } catch (Exception ex) {
0261: ex.printStackTrace();
0262: org.objectweb.salome_tmf.api.Api.addException(null, null,
0263: ex);
0264: }
0265: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0266: }
0267:
0268: /**
0269: * mise a jour d'une suite de test
0270: * @param familyName
0271: * @param oldName
0272: * @param newName
0273: * @param newDesc
0274: */
0275: public void updateSuite(String familyName, String oldName,
0276: String newName, String newDesc) {
0277: if (!special_allow) {
0278: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0279: .canUpdateTest())) {
0280: try {
0281: throw new Exception("updateSuite NOT ALLOW");
0282: } catch (Exception e) {
0283: e.printStackTrace();
0284: org.objectweb.salome_tmf.api.Api.addException(e);
0285: }
0286: return;
0287: }
0288: }
0289: int idFamily = -1;
0290: int idSuite = -1;
0291:
0292: int _num = -1;
0293: try {
0294: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0295:
0296: // Initialisation de l'ID de la famille de test
0297: idFamily = STCommun.getIdFamily(database, prop, idProject,
0298: familyName);
0299:
0300: // Initialisation de l'ID de la suite de test
0301: idSuite = STCommun.getIdSuite(database, prop, idProject,
0302: oldName, idFamily);
0303:
0304: // Mise a jour de la suite de test
0305: PreparedStatement prep = database.prepareStatement(prop
0306: .getProperty("updateSuite"));
0307: prep.setString(1, newName);
0308: prep.setString(2, newDesc);
0309: prep.setInt(3, idSuite);
0310: prep.executeUpdate();
0311:
0312: } catch (SQLException E) {
0313: E.printStackTrace();
0314: org.objectweb.salome_tmf.api.Api.addException(
0315: "updateSuite", null, E);
0316: } catch (Exception ex) {
0317: ex.printStackTrace();
0318: org.objectweb.salome_tmf.api.Api.addException(null, null,
0319: ex);
0320: }
0321: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0322: }
0323:
0324: /**
0325: * mise a jour d'une suite de test
0326: * @param suiteId
0327: * @param newName
0328: * @param newDesc
0329: */
0330: public void updateSuiteUsingID(int suiteId, String newName,
0331: String newDesc) {
0332: if (!special_allow) {
0333: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0334: .canUpdateTest())) {
0335: try {
0336: throw new Exception("updateSuite NOT ALLOW");
0337: } catch (Exception e) {
0338: e.printStackTrace();
0339: org.objectweb.salome_tmf.api.Api.addException(e);
0340: }
0341: return;
0342: }
0343: }
0344:
0345: int _num = -1;
0346: try {
0347: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0348:
0349: // Mise a jour de la suite de test
0350: PreparedStatement prep = database.prepareStatement(prop
0351: .getProperty("updateSuite"));
0352: prep.setString(1, newName);
0353: prep.setString(2, newDesc);
0354: prep.setInt(3, suiteId);
0355: prep.executeUpdate();
0356:
0357: } catch (SQLException E) {
0358: E.printStackTrace();
0359: org.objectweb.salome_tmf.api.Api.addException(
0360: "updateSuite", null, E);
0361: } catch (Exception ex) {
0362: ex.printStackTrace();
0363: org.objectweb.salome_tmf.api.Api.addException(null, null,
0364: ex);
0365: }
0366: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0367: }
0368:
0369: /**
0370: * Changer le numéro d'ordre des suites de tests
0371: * @param familyName
0372: * @param suiteName
0373: * @param order
0374: */
0375: public void updateSuiteOrder(String familyName, String suiteName,
0376: int order) {
0377: if (!special_allow) {
0378: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0379: .canUpdateTest())) {
0380: try {
0381: throw new Exception("updateSuiteOrder NOT ALLOW");
0382: } catch (Exception e) {
0383: e.printStackTrace();
0384: org.objectweb.salome_tmf.api.Api.addException(e);
0385: }
0386: return;
0387: }
0388: }
0389: int _num = -1;
0390: try {
0391: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0392:
0393: // Initialisation de l'ID de la famille de test
0394: int idFamily = STCommun.getIdFamily(database, prop,
0395: idProject, familyName);
0396:
0397: // Initialisation de l'ID de la suite de test
0398: int idSuite = STCommun.getIdSuite(database, prop,
0399: idProject, suiteName, idFamily);
0400:
0401: // Mise a jour de l'ordre du test dans la suite de test
0402: PreparedStatement prep = database.prepareStatement(prop
0403: .getProperty("updateSuiteOrder"));
0404: prep.setInt(1, order);
0405: prep.setInt(2, idSuite);
0406: prep.executeUpdate();
0407: } catch (SQLException E) {
0408: E.printStackTrace();
0409: org.objectweb.salome_tmf.api.Api.addException(
0410: "updateSuiteOrder", null, E);
0411: } catch (Exception ex) {
0412: ex.printStackTrace();
0413: org.objectweb.salome_tmf.api.Api.addException(null, null,
0414: ex);
0415: }
0416: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0417: }
0418:
0419: /**
0420: * Changer le numéro d'ordre des suites de tests
0421: * @param suiteId
0422: * @param order
0423: */
0424: public void updateSuiteOrderUsingID(int suiteId, int order) {
0425: if (!special_allow) {
0426: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0427: .canUpdateTest())) {
0428: try {
0429: throw new Exception("updateSuiteOrder NOT ALLOW");
0430: } catch (Exception e) {
0431: e.printStackTrace();
0432: org.objectweb.salome_tmf.api.Api.addException(e);
0433: }
0434: return;
0435: }
0436: }
0437: int _num = -1;
0438: try {
0439: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0440:
0441: // Mise a jour de l'ordre du test dans la suite de test
0442: PreparedStatement prep = database.prepareStatement(prop
0443: .getProperty("updateSuiteOrder"));
0444: prep.setInt(1, order);
0445: prep.setInt(2, suiteId);
0446: prep.executeUpdate();
0447: } catch (SQLException E) {
0448: E.printStackTrace();
0449: org.objectweb.salome_tmf.api.Api.addException(
0450: "updateSuiteOrder", null, E);
0451: } catch (Exception ex) {
0452: ex.printStackTrace();
0453: org.objectweb.salome_tmf.api.Api.addException(null, null,
0454: ex);
0455: }
0456: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0457: }
0458:
0459: /**
0460: * Mise a jour d'un test
0461: * @param familyName
0462: * @param suiteName
0463: * @param oldTestName
0464: * @param newTestName
0465: * @param newLoginPersonne
0466: * @param newTestType
0467: * @param newTestDesc
0468: */
0469: public void updateTest(String familyName, String suiteName,
0470: String oldTestName, String newTestName,
0471: String newLoginPersonne, String newTestDesc) {
0472: if (!special_allow) {
0473: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0474: .canUpdateTest())) {
0475: try {
0476: throw new Exception("updateTest NOT ALLOW");
0477: } catch (Exception e) {
0478: e.printStackTrace();
0479: org.objectweb.salome_tmf.api.Api.addException(e);
0480: }
0481: return;
0482: }
0483: }
0484:
0485: int idFamily = -1;
0486: int idSuite = -1;
0487: int idTest = -1;
0488: //int idPers = -1;
0489:
0490: int _num = -1;
0491: try {
0492: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0493:
0494: // Initialisation de l'ID de la famille de test
0495: idFamily = STCommun.getIdFamily(database, prop, idProject,
0496: familyName);
0497:
0498: // Initialisation de l'ID de la suite de test
0499: idSuite = STCommun.getIdSuite(database, prop, idProject,
0500: suiteName, idFamily);
0501:
0502: // Initialisation de l'ID du test
0503: idTest = STCommun.getIdTest(database, prop, oldTestName,
0504: idSuite);
0505:
0506: // Initialisation de l'ID de l'utilisateur
0507: //idPers = Utile.getIdPerson(database,prop,newLoginPersonne);
0508:
0509: // Mise a jour du test
0510: /*
0511: PreparedStatement prep = database.prepareStatement(prop.getProperty("updateTest"));
0512: prep.setInt(1, idPers);
0513: prep.setString(2, newTestName);
0514: prep.setString(3, newTestDesc);
0515: prep.setInt(4, idTest);
0516: */
0517:
0518: // Mise a jour du test
0519: PreparedStatement prep = database.prepareStatement(prop
0520: .getProperty("updateTest2"));
0521: prep.setString(1, newTestName);
0522: prep.setString(2, newTestDesc);
0523: prep.setInt(3, idTest);
0524:
0525: prep.executeUpdate();
0526: } catch (SQLException E) {
0527: E.printStackTrace();
0528: org.objectweb.salome_tmf.api.Api.addException(
0529: "updateTest2", null, E);
0530: } catch (Exception ex) {
0531: ex.printStackTrace();
0532: org.objectweb.salome_tmf.api.Api.addException(null, null,
0533: ex);
0534: }
0535: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0536: }
0537:
0538: /**
0539: * Mise a jour d'un test
0540: * @param testId
0541: * @param newTestName
0542: * @param newLoginPersonne
0543: * @param newTestType
0544: * @param newTestDesc
0545: */
0546: public void updateTestUsingID(int testId, String newTestName,
0547: String newTestDesc) {
0548: if (!special_allow) {
0549: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0550: .canUpdateTest())) {
0551: try {
0552: throw new Exception("updateTest NOT ALLOW");
0553: } catch (Exception e) {
0554: e.printStackTrace();
0555: org.objectweb.salome_tmf.api.Api.addException(e);
0556: }
0557: return;
0558: }
0559: }
0560:
0561: int _num = -1;
0562: try {
0563: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0564:
0565: PreparedStatement prep = database.prepareStatement(prop
0566: .getProperty("updateTest2"));
0567: prep.setString(1, newTestName);
0568: prep.setString(2, newTestDesc);
0569: prep.setInt(3, testId);
0570:
0571: prep.executeUpdate();
0572: } catch (SQLException E) {
0573: E.printStackTrace();
0574: org.objectweb.salome_tmf.api.Api.addException(
0575: "updateTest2", null, E);
0576: } catch (Exception ex) {
0577: ex.printStackTrace();
0578: org.objectweb.salome_tmf.api.Api.addException(null, null,
0579: ex);
0580: }
0581: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0582: }
0583:
0584: /**
0585: * Changer l'ordre d'un test dans une suite de test
0586: * @param familyName
0587: * @param suiteName
0588: * @param testName
0589: * @param testOrder
0590: */
0591: public void updateTestOrder(String familyName, String suiteName,
0592: String testName, int testOrder) {
0593: if (!special_allow) {
0594: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0595: .canUpdateTest())) {
0596: try {
0597: throw new Exception("updateTestOrder NOT ALLOW");
0598: } catch (Exception e) {
0599: e.printStackTrace();
0600: org.objectweb.salome_tmf.api.Api.addException(e);
0601: }
0602: return;
0603: }
0604: }
0605: int idFamily = -1;
0606: int idSuite = -1;
0607: int idTest = -1;
0608:
0609: int _num = -1;
0610: try {
0611: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0612:
0613: // Initialisation de l'ID de la famille de test
0614: idFamily = STCommun.getIdFamily(database, prop, idProject,
0615: familyName);
0616:
0617: // Initialisation de l'ID de la suite de test
0618: idSuite = STCommun.getIdSuite(database, prop, idProject,
0619: suiteName, idFamily);
0620:
0621: // Initialisation de l'ID du test
0622: idTest = STCommun.getIdTest(database, prop, testName,
0623: idSuite);
0624:
0625: // Mise a jour de l'ordre du test dans la suite de test
0626: PreparedStatement prep = database.prepareStatement(prop
0627: .getProperty("updateTestOrder"));
0628: prep.setInt(1, testOrder);
0629: prep.setInt(2, idTest);
0630: prep.executeUpdate();
0631: } catch (SQLException E) {
0632: E.printStackTrace();
0633: org.objectweb.salome_tmf.api.Api.addException(
0634: "updateTestOrder", null, E);
0635: } catch (Exception ex) {
0636: ex.printStackTrace();
0637: org.objectweb.salome_tmf.api.Api.addException(null, null,
0638: ex);
0639: }
0640: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0641: }
0642:
0643: /**
0644: * Changer l'ordre d'un test dans une suite de test
0645: * @param testId
0646: * @param testOrder
0647: */
0648: public void updateTestOrderUsingID(int testId, int testOrder) {
0649: if (!special_allow) {
0650: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0651: .canUpdateTest())) {
0652: try {
0653: throw new Exception("updateTestOrder NOT ALLOW");
0654: } catch (Exception e) {
0655: e.printStackTrace();
0656: org.objectweb.salome_tmf.api.Api.addException(e);
0657: }
0658: return;
0659: }
0660: }
0661:
0662: int _num = -1;
0663: try {
0664: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0665:
0666: // Mise a jour de l'ordre du test dans la suite de test
0667: PreparedStatement prep = database.prepareStatement(prop
0668: .getProperty("updateTestOrder"));
0669: prep.setInt(1, testOrder);
0670: prep.setInt(2, testId);
0671: prep.executeUpdate();
0672: } catch (SQLException E) {
0673: E.printStackTrace();
0674: org.objectweb.salome_tmf.api.Api.addException(
0675: "updateTestOrder", null, E);
0676: } catch (Exception ex) {
0677: ex.printStackTrace();
0678: org.objectweb.salome_tmf.api.Api.addException(null, null,
0679: ex);
0680: }
0681: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0682: }
0683:
0684: /**
0685: * Mise a jour d'une action d'un test manuel
0686: * @param familyName
0687: * @param suiteName
0688: * @param testName
0689: * @param oldActionName
0690: * @param newActionName
0691: * @param newActionDesc
0692: * @param newActionResAttendu
0693: * @param newActionNum
0694: */
0695: public void updateAction(String familyName, String suiteName,
0696: String testName, String oldActionName,
0697: String newActionName, String newActionDesc,
0698: String newActionResAttendu, int newActionNum) {
0699:
0700: if (!special_allow) {
0701: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0702: .canUpdateTest())) {
0703: try {
0704: throw new Exception("updateAction NOT ALLOW");
0705: } catch (Exception e) {
0706: e.printStackTrace();
0707: org.objectweb.salome_tmf.api.Api.addException(e);
0708: }
0709: return;
0710: }
0711: }
0712: int idFamily = -1;
0713: int idSuite = -1;
0714: int idTest = -1;
0715: int idAction = -1;
0716:
0717: int _num = -1;
0718: try {
0719: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0720:
0721: PreparedStatement prep = database.prepareStatement(prop
0722: .getProperty("updateAction"));
0723:
0724: // Initialisation de l'ID de la famille de test
0725: idFamily = STCommun.getIdFamily(database, prop, idProject,
0726: familyName);
0727:
0728: // Initialisation de l'ID de la suite de test
0729: idSuite = STCommun.getIdSuite(database, prop, idProject,
0730: suiteName, idFamily);
0731:
0732: // Initialisation de l'ID du test manuel
0733: idTest = STCommun.getIdTest(database, prop, testName,
0734: idSuite);
0735:
0736: // Initialisation de l'Id de l'action de test
0737: idAction = STCommun.getIdAction(database, prop,
0738: oldActionName, idTest);
0739:
0740: prep.setString(1, newActionName);
0741: prep.setString(2, newActionDesc);
0742: prep.setString(3, newActionResAttendu);
0743: prep.setInt(4, newActionNum);
0744: prep.setInt(5, idAction);
0745: prep.executeUpdate();
0746: } catch (SQLException E) {
0747: E.printStackTrace();
0748: org.objectweb.salome_tmf.api.Api.addException(
0749: "updateAction", null, E);
0750: } catch (Exception ex) {
0751: ex.printStackTrace();
0752: org.objectweb.salome_tmf.api.Api.addException(null, null,
0753: ex);
0754: }
0755: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0756: }
0757:
0758: /**
0759: * Mise a jour d'une action d'un test manuel
0760: * @param actionId
0761: * @param newActionName
0762: * @param newActionDesc
0763: * @param newActionResAttendu
0764: * @param newActionNum
0765: */
0766: public void updateActionUsingID(int actionId, String newActionName,
0767: String newActionDesc, String newActionResAttendu,
0768: int newActionNum) {
0769:
0770: if (!special_allow) {
0771: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0772: .canUpdateTest())) {
0773: try {
0774: throw new Exception("updateAction NOT ALLOW");
0775: } catch (Exception e) {
0776: e.printStackTrace();
0777: org.objectweb.salome_tmf.api.Api.addException(e);
0778: }
0779: return;
0780: }
0781: }
0782:
0783: int _num = -1;
0784: try {
0785: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0786:
0787: PreparedStatement prep = database.prepareStatement(prop
0788: .getProperty("updateAction"));
0789:
0790: prep.setString(1, newActionName);
0791: prep.setString(2, newActionDesc);
0792: prep.setString(3, newActionResAttendu);
0793: prep.setInt(4, newActionNum);
0794: prep.setInt(5, actionId);
0795: prep.executeUpdate();
0796: } catch (SQLException E) {
0797: E.printStackTrace();
0798: org.objectweb.salome_tmf.api.Api.addException(
0799: "updateAction", null, E);
0800: } catch (Exception ex) {
0801: ex.printStackTrace();
0802: org.objectweb.salome_tmf.api.Api.addException(null, null,
0803: ex);
0804: }
0805: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0806: }
0807:
0808: /**
0809: * Changer l'ordre d'une action de test appartenant a un test manuel
0810: * @param familyName
0811: * @param suiteName
0812: * @param testName
0813: * @param actionName
0814: * @param actionOrder
0815: */
0816: public void updateActionOrder(String familyName, String suiteName,
0817: String testName, String actionName, int actionOrder) {
0818:
0819: if (!special_allow) {
0820: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0821: .canUpdateTest())) {
0822: try {
0823: throw new Exception("updateActionOrder NOT ALLOW");
0824: } catch (Exception e) {
0825: e.printStackTrace();
0826: org.objectweb.salome_tmf.api.Api.addException(e);
0827: }
0828: return;
0829: }
0830: }
0831: int idFamily = -1;
0832: int idSuite = -1;
0833: int idTest = -1;
0834: int idAction = -1;
0835:
0836: int _num = -1;
0837: try {
0838: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0839:
0840: PreparedStatement prep = database.prepareStatement(prop
0841: .getProperty("updateActionOrder"));
0842:
0843: // Initialisation de l'ID de la famille de test
0844: idFamily = STCommun.getIdFamily(database, prop, idProject,
0845: familyName);
0846:
0847: // Initialisation de l'ID de la suite de test
0848: idSuite = STCommun.getIdSuite(database, prop, idProject,
0849: suiteName, idFamily);
0850:
0851: // Initialisation de l'ID du test manuel
0852: idTest = STCommun.getIdTest(database, prop, testName,
0853: idSuite);
0854:
0855: // Initialisation de l'Id de l'action de test
0856: idAction = STCommun.getIdAction(database, prop, actionName,
0857: idTest);
0858:
0859: // Execution de la requete
0860: prep.setInt(1, actionOrder);
0861: prep.setInt(2, idAction);
0862: prep.executeUpdate();
0863: } catch (SQLException E) {
0864: E.printStackTrace();
0865: org.objectweb.salome_tmf.api.Api.addException(
0866: "updateActionOrder", null, E);
0867: } catch (Exception ex) {
0868: ex.printStackTrace();
0869: org.objectweb.salome_tmf.api.Api.addException(null, null,
0870: ex);
0871: }
0872: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0873: }
0874:
0875: /**
0876: * Changer l'ordre d'une action de test appartenant a un test manuel
0877: * @param actionId
0878: * @param actionOrder
0879: */
0880: public void updateActionOrderUsingID(int actionId, int actionOrder) {
0881:
0882: if (!special_allow) {
0883: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0884: .canUpdateTest())) {
0885: try {
0886: throw new Exception("updateActionOrder NOT ALLOW");
0887: } catch (Exception e) {
0888: e.printStackTrace();
0889: org.objectweb.salome_tmf.api.Api.addException(e);
0890: }
0891: return;
0892: }
0893: }
0894:
0895: int _num = -1;
0896: try {
0897: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0898:
0899: PreparedStatement prep = database.prepareStatement(prop
0900: .getProperty("updateActionOrder"));
0901:
0902: // Execution de la requete
0903: prep.setInt(1, actionOrder);
0904: prep.setInt(2, actionId);
0905: prep.executeUpdate();
0906: } catch (SQLException E) {
0907: E.printStackTrace();
0908: org.objectweb.salome_tmf.api.Api.addException(
0909: "updateActionOrder", null, E);
0910: } catch (Exception ex) {
0911: ex.printStackTrace();
0912: org.objectweb.salome_tmf.api.Api.addException(null, null,
0913: ex);
0914: }
0915: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0916: }
0917:
0918: /**
0919: * Changer le contenu d'un fichier attaché à une suite de tests
0920: * @param familyName
0921: * @param suiteName
0922: * @param filePath
0923: */
0924: public void updateFileForSuite(String familyName, String suiteName,
0925: String filePath) throws FileNotFoundException {
0926:
0927: if (!special_allow) {
0928: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0929: .canUpdateTest())) {
0930: try {
0931: throw new Exception("updateFileForSuite NOT ALLOW");
0932: } catch (Exception e) {
0933: e.printStackTrace();
0934: org.objectweb.salome_tmf.api.Api.addException(e);
0935: }
0936: return;
0937: }
0938: }
0939: int _num = -1;
0940: try {
0941: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
0942:
0943: // On crée le fichier à partir de l'URL
0944: File file = new File(filePath);
0945: // On récupère le nom du fichier
0946: String fileName = file.getName();
0947: // On enregistre le flux du fichier
0948: FileInputStream fis = new FileInputStream(file);
0949: BufferedInputStream bis = new BufferedInputStream(fis);
0950:
0951: // On initialse l'ID de la famille de test
0952: int familyId = STCommun.getIdFamily(database, prop,
0953: idProject, familyName);
0954: // On initialise l'ID de la suite de test
0955: int suiteId = STCommun.getIdSuite(database, prop,
0956: idProject, suiteName, familyId);
0957: // On initialise l'ID de l'attachement
0958: int fileAttachId = STCommun.getSuiteAttachFileId(database,
0959: prop, suiteId, fileName);
0960:
0961: // Appel de la requete a executer
0962: PreparedStatement prep = database.prepareStatement(prop
0963: .getProperty("updateFileAttach"));
0964: prep.setBinaryStream(1, bis, bis.available());
0965: prep.setInt(2, fileAttachId);
0966:
0967: prep.executeUpdate();
0968: bis.close();
0969: } catch (SQLException sqle) {
0970: sqle.printStackTrace();
0971: org.objectweb.salome_tmf.api.Api.addException(
0972: "updateFileAttach", null, sqle);
0973: } catch (Exception e) {
0974: org.objectweb.salome_tmf.api.Api
0975: .addException(null, null, e);
0976: e.printStackTrace();
0977: if (e instanceof FileNotFoundException) {
0978: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0979: throw new FileNotFoundException();
0980: }
0981: }
0982: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
0983: }
0984:
0985: /**
0986: * Changer le contenu d'un fichier attaché à un test
0987: * @param familyName
0988: * @param suiteName
0989: * @param testName
0990: * @param filePath
0991: */
0992: public void updateFileForTest(String familyName, String suiteName,
0993: String testName, String filePath)
0994: throws FileNotFoundException {
0995: if (!special_allow) {
0996: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
0997: .canUpdateTest())) {
0998: try {
0999: throw new Exception("updateFileForTest NOT ALLOW");
1000: } catch (Exception e) {
1001: e.printStackTrace();
1002: org.objectweb.salome_tmf.api.Api.addException(e);
1003: }
1004: return;
1005: }
1006: }
1007: int _num = -1;
1008: try {
1009: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1010:
1011: // On crée le fichier à partir de l'URL
1012: File file = new File(filePath);
1013: // On récupère le nom du fichier
1014: String fileName = file.getName();
1015: // On enregistre le flux du fichier
1016: FileInputStream fis = new FileInputStream(file);
1017: BufferedInputStream bis = new BufferedInputStream(fis);
1018:
1019: // On initialse l'ID de la famille de test
1020: int familyId = STCommun.getIdFamily(database, prop,
1021: idProject, familyName);
1022: // On initialise l'ID de la suite de test
1023: int suiteId = STCommun.getIdSuite(database, prop,
1024: idProject, suiteName, familyId);
1025: // On initialise l'ID du test
1026: int testId = STCommun.getIdTest(database, prop, testName,
1027: suiteId);
1028: // On initialise l'ID de l'attachement
1029: int fileAttachId = STCommun.getTestAttachFileId(database,
1030: prop, testId, fileName);
1031:
1032: // Appel de la requete a executer
1033: PreparedStatement prep = database.prepareStatement(prop
1034: .getProperty("updateFileAttach"));
1035: prep.setBinaryStream(1, bis, bis.available());
1036: prep.setInt(2, fileAttachId);
1037:
1038: prep.executeUpdate();
1039: bis.close();
1040: } catch (SQLException sqle) {
1041: sqle.printStackTrace();
1042: org.objectweb.salome_tmf.api.Api.addException(
1043: "updateFileAttach", null, sqle);
1044: } catch (Exception e) {
1045: org.objectweb.salome_tmf.api.Api
1046: .addException(null, null, e);
1047: e.printStackTrace();
1048: if (e instanceof FileNotFoundException) {
1049: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1050: throw new FileNotFoundException();
1051: }
1052: }
1053: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1054: }
1055:
1056: /**
1057: * Changer le contenu d'un fichier attaché à un test
1058: * @param familyName
1059: * @param suiteName
1060: * @param testName
1061: * @param filePath
1062: */
1063: public void updateScriptForTest(String familyName,
1064: String suiteName, String testName, String filePath)
1065: throws FileNotFoundException {
1066: if (!special_allow) {
1067: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1068: .canUpdateTest())) {
1069: try {
1070: throw new Exception("updateScriptForTest NOT ALLOW");
1071: } catch (Exception e) {
1072: e.printStackTrace();
1073: org.objectweb.salome_tmf.api.Api.addException(e);
1074: }
1075: return;
1076: }
1077: }
1078: int _num = -1;
1079: try {
1080: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1081:
1082: // On crée le fichier à partir de l'URL
1083: File file = new File(filePath);
1084: // On récupère le nom du fichier
1085: String fileName = file.getName();
1086: // On enregistre le flux du fichier
1087: FileInputStream fis = new FileInputStream(file);
1088: BufferedInputStream bis = new BufferedInputStream(fis);
1089:
1090: // On initialse l'ID de la famille de test
1091: int familyId = STCommun.getIdFamily(database, prop,
1092: idProject, familyName);
1093: // On initialise l'ID de la suite de test
1094: int suiteId = STCommun.getIdSuite(database, prop,
1095: idProject, suiteName, familyId);
1096: // On initialise l'ID du test
1097: int testId = STCommun.getIdTest(database, prop, testName,
1098: suiteId);
1099:
1100: int scriptId = STCommun.getIdScript(database, prop, testId,
1101: fileName);
1102: // On initialise l'ID de l'attachement
1103: int scriptAttachId = STCommun.getTestAttachScriptId(
1104: database, prop, scriptId);
1105:
1106: // Appel de la requete a executer
1107: PreparedStatement prep = database.prepareStatement(prop
1108: .getProperty("updateFileAttach"));
1109: prep.setBinaryStream(1, bis, bis.available());
1110: prep.setInt(2, scriptAttachId);
1111:
1112: prep.executeUpdate();
1113: bis.close();
1114: } catch (SQLException sqle) {
1115: sqle.printStackTrace();
1116: org.objectweb.salome_tmf.api.Api.addException(
1117: "updateFileAttach", null, sqle);
1118: } catch (Exception e) {
1119: org.objectweb.salome_tmf.api.Api
1120: .addException(null, null, e);
1121: e.printStackTrace();
1122: if (e instanceof FileNotFoundException) {
1123: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1124: throw new FileNotFoundException();
1125: }
1126: }
1127: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1128: }
1129:
1130: /**
1131: /**
1132: * @param scriptId
1133: * @param filePath
1134: * @throws FileNotFoundException
1135: */
1136: public void updateScriptContentUsingID(int scriptId, String filePath)
1137: throws FileNotFoundException {
1138: if (!special_allow) {
1139: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1140: .canUpdateTest())) {
1141: try {
1142: throw new Exception("updateScriptForTest NOT ALLOW");
1143: } catch (Exception e) {
1144: e.printStackTrace();
1145: org.objectweb.salome_tmf.api.Api.addException(e);
1146: }
1147: return;
1148: }
1149: }
1150: int _num = -1;
1151: try {
1152: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1153:
1154: // On crée le fichier à partir de l'URL
1155: File file = new File(filePath);
1156: // On récupère le nom du fichier
1157: //String fileName = file.getName();
1158: // On enregistre le flux du fichier
1159: FileInputStream fis = new FileInputStream(file);
1160: BufferedInputStream bis = new BufferedInputStream(fis);
1161:
1162: // On initialise l'ID de l'attachement
1163: int scriptAttachId = STCommun.getTestAttachScriptId(
1164: database, prop, scriptId);
1165:
1166: // Appel de la requete a executer
1167: PreparedStatement prep = database.prepareStatement(prop
1168: .getProperty("updateFileAttach"));
1169: prep.setBinaryStream(1, bis, bis.available());
1170: prep.setInt(2, scriptAttachId);
1171:
1172: prep.executeUpdate();
1173: bis.close();
1174: } catch (SQLException sqle) {
1175: sqle.printStackTrace();
1176: org.objectweb.salome_tmf.api.Api.addException(
1177: "updateFileAttach", null, sqle);
1178: } catch (Exception e) {
1179: org.objectweb.salome_tmf.api.Api
1180: .addException(null, null, e);
1181: if (e instanceof FileNotFoundException) {
1182: e.printStackTrace();
1183: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1184: throw new FileNotFoundException();
1185: }
1186: }
1187: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1188: }
1189:
1190: /**
1191: * @param scriptId
1192: * @param name
1193: */
1194: public void updateScriptNameUsingID(int scriptId, String name) {
1195: if (!special_allow) {
1196: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1197: .canUpdateTest())) {
1198: try {
1199: throw new Exception("updateScriptForTest NOT ALLOW");
1200: } catch (Exception e) {
1201: e.printStackTrace();
1202: org.objectweb.salome_tmf.api.Api.addException(e);
1203: }
1204: return;
1205: }
1206: }
1207: int _num = -1;
1208: try {
1209: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1210:
1211: // On initialise l'ID de l'attachement
1212: int scriptAttachId = STCommun.getTestAttachScriptId(
1213: database, prop, scriptId);
1214:
1215: // Mise à jour du nom du fichier attaché
1216: PreparedStatement prep = database.prepareStatement(prop
1217: .getProperty("updateFileAttachName"));
1218: prep.setString(1, name);
1219: prep.setInt(2, scriptAttachId);
1220: prep.executeUpdate();
1221:
1222: // Mise a jour du nom du script
1223: prep = database.prepareStatement(prop
1224: .getProperty("updateScriptName"));
1225: prep.setString(1, name);
1226: prep.setInt(2, scriptId);
1227: prep.executeUpdate();
1228:
1229: } catch (SQLException E) {
1230: E.printStackTrace();
1231: org.objectweb.salome_tmf.api.Api.addException(
1232: "updateScriptForTest", null, E);
1233: } catch (Exception ex) {
1234: ex.printStackTrace();
1235: org.objectweb.salome_tmf.api.Api.addException(null, null,
1236: ex);
1237: }
1238: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1239: }
1240:
1241: /**
1242: * Changer le contenu d'un fichier attaché à une action
1243: *
1244: * @param familyName
1245: * @param suiteName
1246: * @param testName
1247: * @param actionName
1248: * @param filePath
1249: */
1250: public void updateFileForAction(String familyName,
1251: String suiteName, String testName, String actionName,
1252: String filePath) throws FileNotFoundException {
1253: if (!special_allow) {
1254: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1255: .canUpdateTest())) {
1256: try {
1257: throw new Exception("updateFileForAction NOT ALLOW");
1258: } catch (Exception e) {
1259: e.printStackTrace();
1260: org.objectweb.salome_tmf.api.Api.addException(e);
1261: }
1262: return;
1263: }
1264: }
1265: int _num = -1;
1266: try {
1267: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1268:
1269: // On crée le fichier à partir de l'URL
1270: File file = new File(filePath);
1271:
1272: // On récupère le nom du fichier
1273: String fileName = file.getName();
1274: // On enregistre le flux du fichier
1275: FileInputStream fis = new FileInputStream(file);
1276: BufferedInputStream bis = new BufferedInputStream(fis);
1277:
1278: // On initialse l'ID de la famille de test
1279: int familyId = STCommun.getIdFamily(database, prop,
1280: idProject, familyName);
1281: // On initialise l'ID de la suite de test
1282: int suiteId = STCommun.getIdSuite(database, prop,
1283: idProject, suiteName, familyId);
1284: // On initialise l'ID du test
1285: int testId = STCommun.getIdTest(database, prop, testName,
1286: suiteId);
1287: // On initialise l'ID de l'action
1288: int actionId = STCommun.getIdAction(database, prop,
1289: actionName, testId);
1290: // On initialise l'ID de l'attachement
1291: int fileAttachId = STCommun.getActionAttachFileId(database,
1292: prop, actionId, fileName);
1293:
1294: // Appel de la requete a executer
1295: PreparedStatement prep = database.prepareStatement(prop
1296: .getProperty("updateFileAttach"));
1297: prep.setBinaryStream(1, bis, bis.available());
1298: prep.setInt(2, fileAttachId);
1299: prep.executeUpdate();
1300: bis.close();
1301: } catch (SQLException sqle) {
1302: sqle.printStackTrace();
1303: org.objectweb.salome_tmf.api.Api.addException(
1304: "updateFileAttach", null, sqle);
1305: } catch (Exception e) {
1306: org.objectweb.salome_tmf.api.Api
1307: .addException(null, null, e);
1308: e.printStackTrace();
1309: if (e instanceof FileNotFoundException) {
1310: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1311: throw new FileNotFoundException();
1312: }
1313: }
1314: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1315: }
1316:
1317: /**
1318: * Changer la description d'un fichier attaché
1319: * @param fileName
1320: * @param newDescription
1321: */
1322: public void updateFileAttachDescriptionForTest(String familyName,
1323: String suiteName, String testName, String fileName,
1324: String newDescription) {
1325: int idFileAttach = -1;
1326: if (!special_allow) {
1327: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1328: .canUpdateTest())) {
1329: try {
1330: throw new Exception(
1331: "updateFileAttachDescriptionForTest NOT ALLOW");
1332: } catch (Exception e) {
1333: e.printStackTrace();
1334: org.objectweb.salome_tmf.api.Api.addException(e);
1335: }
1336: return;
1337: }
1338: }
1339: int _num = -1;
1340: try {
1341: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1342:
1343: // On initialse l'ID de la famille de test
1344: //int familyId = STCommun.getIdFamily(database,prop,idProject,familyName);
1345: // On initialise l'ID de la suite de test
1346: //int suiteId = STCommun.getIdSuite(database,prop,idProject,suiteName,familyId);
1347: // On initialise l'ID du test
1348: //int testId = STCommun.getIdTest(database, prop, testName, suiteId);
1349: // On initialise l'ID de l'attachement
1350: //int fileAttachId = STCommun.getTestAttachFileId(database,prop,testId,fileName);
1351:
1352: // Mise a jour de la suite de test
1353: PreparedStatement prep = database.prepareStatement(prop
1354: .getProperty("updateAttachDescription"));
1355: prep.setString(1, newDescription);
1356: prep.setInt(2, idFileAttach);
1357: prep.executeUpdate();
1358:
1359: } catch (SQLException E) {
1360: E.printStackTrace();
1361: org.objectweb.salome_tmf.api.Api.addException(
1362: "updateAttachDescription", null, E);
1363: } catch (Exception ex) {
1364: ex.printStackTrace();
1365: org.objectweb.salome_tmf.api.Api.addException(null, null,
1366: ex);
1367: }
1368: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1369: }
1370:
1371: /**
1372: * Changer la description d'une url attachée
1373: * @param urlName
1374: * @param newDescription
1375: */
1376: public void updateUrlAttachDescriptionForTest(String familyName,
1377: String suiteName, String testName, String urlName,
1378: String newDescription) {
1379: if (!special_allow) {
1380: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1381: .canUpdateTest())) {
1382: try {
1383: throw new Exception(
1384: "updateUrlAttachDescriptionForTest NOT ALLOW");
1385: } catch (Exception e) {
1386: e.printStackTrace();
1387: org.objectweb.salome_tmf.api.Api.addException(e);
1388: }
1389: return;
1390: }
1391: }
1392: int idUrlAttach = -1;
1393:
1394: int _num = -1;
1395: try {
1396: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1397:
1398: // On initialse l'ID de la famille de test
1399: int familyId = STCommun.getIdFamily(database, prop,
1400: idProject, familyName);
1401: // On initialise l'ID de la suite de test
1402: int suiteId = STCommun.getIdSuite(database, prop,
1403: idProject, suiteName, familyId);
1404: // On initialise l'ID du test
1405: int testId = STCommun.getIdTest(database, prop, testName,
1406: suiteId);
1407: // Initialisation de l'ID de l'url
1408: idUrlAttach = STCommun.getTestAttachUrlId(database, prop,
1409: testId, urlName);
1410:
1411: // Mise a jour de la suite de test
1412: PreparedStatement prep = database.prepareStatement(prop
1413: .getProperty("updateAttachDescription"));
1414: prep.setString(1, newDescription);
1415: prep.setInt(2, idUrlAttach);
1416: prep.executeUpdate();
1417: } catch (SQLException E) {
1418: E.printStackTrace();
1419: org.objectweb.salome_tmf.api.Api.addException(
1420: "updateAttachDescription", null, E);
1421: } catch (Exception ex) {
1422: ex.printStackTrace();
1423: org.objectweb.salome_tmf.api.Api.addException(null, null,
1424: ex);
1425: }
1426: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1427: }
1428:
1429: /**
1430: * Changer la longueur d'un fichier attaché
1431: * @param fileName un nom de fichier
1432: * @param length la longueur du fichier
1433: */
1434: public void updateFileAttachLengthForTest(String familyName,
1435: String suiteName, String testName, String fileName,
1436: long length) {
1437: if (!special_allow) {
1438: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1439: .canUpdateTest())) {
1440: org.objectweb.salome_tmf.api.Api
1441: .log("updateUrlAttachDescription NOT ALLOW");
1442: try {
1443: throw new Exception("updateFileAttachLengthForTest");
1444: } catch (Exception e) {
1445: e.printStackTrace();
1446: org.objectweb.salome_tmf.api.Api.addException(e);
1447: }
1448: return;
1449: }
1450: }
1451: int _num = -1;
1452: try {
1453: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1454:
1455: // On initialse l'ID de la famille de test
1456: int familyId = STCommun.getIdFamily(database, prop,
1457: idProject, familyName);
1458: // On initialise l'ID de la suite de test
1459: int suiteId = STCommun.getIdSuite(database, prop,
1460: idProject, suiteName, familyId);
1461: // On initialise l'ID du test
1462: int testId = STCommun.getIdTest(database, prop, testName,
1463: suiteId);
1464: // On initialise l'ID de l'attachement
1465: int fileAttachId = STCommun.getTestAttachFileId(database,
1466: prop, testId, fileName);
1467:
1468: // Mise a jour de la suite de test
1469: PreparedStatement prep = database.prepareStatement(prop
1470: .getProperty("updateFileAttachLength"));
1471: prep.setLong(1, length);
1472: prep.setInt(2, fileAttachId);
1473: prep.executeUpdate();
1474:
1475: } catch (SQLException E) {
1476: E.printStackTrace();
1477: org.objectweb.salome_tmf.api.Api.addException(
1478: "updateFileAttachLength", null, E);
1479: } catch (Exception ex) {
1480: ex.printStackTrace();
1481: org.objectweb.salome_tmf.api.Api.addException(null, null,
1482: ex);
1483: }
1484: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1485: }
1486:
1487: /**
1488: * Changer la date d'un fichier
1489: * @param fileName le nom du fichier
1490: * @param date la date du fichier
1491: */
1492: public void updateFileAttachDateForTest(String familyName,
1493: String suiteName, String testName, String fileName,
1494: Date date) {
1495: if (!special_allow) {
1496: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1497: .canUpdateTest())) {
1498: org.objectweb.salome_tmf.api.Api
1499: .log("updateUrlAttachDescription NOT ALLOW");
1500: try {
1501: throw new Exception(
1502: "updateFileAttachDateForTest NOT ALLOW");
1503: } catch (Exception e) {
1504: e.printStackTrace();
1505: org.objectweb.salome_tmf.api.Api.addException(e);
1506: }
1507: return;
1508: }
1509: }
1510:
1511: int _num = -1;
1512: try {
1513: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1514:
1515: // On initialse l'ID de la famille de test
1516: int familyId = STCommun.getIdFamily(database, prop,
1517: idProject, familyName);
1518: // On initialise l'ID de la suite de test
1519: int suiteId = STCommun.getIdSuite(database, prop,
1520: idProject, suiteName, familyId);
1521: // On initialise l'ID du test
1522: int testId = STCommun.getIdTest(database, prop, testName,
1523: suiteId);
1524: // On initialise l'ID de l'attachement
1525: int fileAttachId = STCommun.getTestAttachFileId(database,
1526: prop, testId, fileName);
1527:
1528: // Mise a jour de la suite de test
1529: PreparedStatement prep = database.prepareStatement(prop
1530: .getProperty("updateFileAttachDate"));
1531: prep.setDate(1, date);
1532: prep.setInt(2, fileAttachId);
1533: prep.executeUpdate();
1534:
1535: } catch (SQLException E) {
1536: E.printStackTrace();
1537: org.objectweb.salome_tmf.api.Api.addException(
1538: "updateFileAttachDate", null, E);
1539: } catch (Exception ex) {
1540: ex.printStackTrace();
1541: org.objectweb.salome_tmf.api.Api.addException(null, null,
1542: ex);
1543: }
1544: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1545: }
1546:
1547: /**
1548: *
1549: * @param familyName
1550: * @param suiteName
1551: * @param testName
1552: * @param scriptName
1553: * @param newClassPath
1554: */
1555: public void updateScriptClassPath(String familyName,
1556: String suiteName, String testName, String scriptName,
1557: String newClassPath) {
1558: if (!special_allow) {
1559: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1560: .canUpdateTest())) {
1561: org.objectweb.salome_tmf.api.Api
1562: .log("updateUrlAttachDescription NOT ALLOW");
1563: try {
1564: throw new Exception(
1565: "updateUrlAttachDescription NOT ALLOW");
1566: } catch (Exception e) {
1567: e.printStackTrace();
1568: org.objectweb.salome_tmf.api.Api.addException(e);
1569: }
1570: return;
1571: }
1572: }
1573:
1574: int _num = -1;
1575: try {
1576: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1577:
1578: // On initialse l'ID de la famille de test
1579: int familyId = STCommun.getIdFamily(database, prop,
1580: idProject, familyName);
1581: // On initialise l'ID de la suite de test
1582: int suiteId = STCommun.getIdSuite(database, prop,
1583: idProject, suiteName, familyId);
1584: // On initialise l'ID du test
1585: int testId = STCommun.getIdTest(database, prop, testName,
1586: suiteId);
1587:
1588: // Initialisation de l'ID du script
1589: int idScript = STCommun.getIdScript(database, prop, testId,
1590: scriptName);
1591:
1592: // Mise a jour de la suite de test
1593: PreparedStatement prep = database.prepareStatement(prop
1594: .getProperty("updateScriptClassPath"));
1595: org.objectweb.salome_tmf.api.Api.log(prop
1596: .getProperty("updateScriptClassPath"));
1597: prep.setString(1, newClassPath);
1598: prep.setInt(2, idScript);
1599:
1600: prep.executeUpdate();
1601:
1602: } catch (SQLException E) {
1603: E.printStackTrace();
1604: org.objectweb.salome_tmf.api.Api.addException(
1605: "updateScriptClassPath", null, E);
1606: } catch (Exception ex) {
1607: ex.printStackTrace();
1608: org.objectweb.salome_tmf.api.Api.addException(null, null,
1609: ex);
1610: }
1611: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1612:
1613: }
1614:
1615: /**
1616: *
1617: * @param familyName
1618: * @param suiteName
1619: * @param testName
1620: * @param scriptName
1621: * @param newClassPath
1622: */
1623: public void updateScriptPlugArg(String familyName,
1624: String suiteName, String testName, String scriptName,
1625: String newPlugArg) {
1626: if (!special_allow) {
1627: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1628: .canUpdateTest())) {
1629: org.objectweb.salome_tmf.api.Api
1630: .log("updateScriptClassToBeExecuted NOT ALLOW");
1631: try {
1632: throw new Exception(
1633: "updateScriptClassToBeExecuted NOT ALLOW");
1634: } catch (Exception e) {
1635: e.printStackTrace();
1636: org.objectweb.salome_tmf.api.Api.addException(e);
1637: }
1638: return;
1639: }
1640: }
1641:
1642: int _num = -1;
1643: try {
1644: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1645:
1646: // On initialse l'ID de la famille de test
1647: int familyId = STCommun.getIdFamily(database, prop,
1648: idProject, familyName);
1649: // On initialise l'ID de la suite de test
1650: int suiteId = STCommun.getIdSuite(database, prop,
1651: idProject, suiteName, familyId);
1652: // On initialise l'ID du test
1653: int testId = STCommun.getIdTest(database, prop, testName,
1654: suiteId);
1655:
1656: // Initialisation de l'ID du script
1657: int idScript = STCommun.getIdScript(database, prop, testId,
1658: scriptName);
1659:
1660: // Mise a jour de la suite de test
1661: PreparedStatement prep = database.prepareStatement(prop
1662: .getProperty("updateScriptClassToBeExecuted"));
1663: prep.setString(1, newPlugArg);
1664: prep.setInt(2, idScript);
1665: prep.executeUpdate();
1666:
1667: } catch (SQLException E) {
1668: E.printStackTrace();
1669: org.objectweb.salome_tmf.api.Api.addException(
1670: "updateScriptClassToBeExecuted", null, E);
1671: } catch (Exception ex) {
1672: ex.printStackTrace();
1673: org.objectweb.salome_tmf.api.Api.addException(null, null,
1674: ex);
1675: }
1676: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1677:
1678: }
1679:
1680: /**
1681: * @param scriptId
1682: * @param newPlugArg
1683: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canUpdateTest()
1684: * @see org.objectweb.salome_tmf.api.api2ihm.AdminProject.canDeleteTest()
1685: */
1686: public void updateScriptPlugArgUsingID(int scriptId,
1687: String newPlugArg) {
1688: if (!special_allow) {
1689: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1690: .canUpdateTest())) {
1691: org.objectweb.salome_tmf.api.Api
1692: .log("updateScriptClassToBeExecuted NOT ALLOW");
1693: try {
1694: throw new Exception(
1695: "updateScriptClassToBeExecuted NOT ALLOW");
1696: } catch (Exception e) {
1697: e.printStackTrace();
1698: org.objectweb.salome_tmf.api.Api.addException(e);
1699: }
1700: return;
1701: }
1702: }
1703:
1704: int _num = -1;
1705: try {
1706: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1707:
1708: // Mise a jour de la suite de test
1709: PreparedStatement prep = database.prepareStatement(prop
1710: .getProperty("updateScriptClassToBeExecuted"));
1711: prep.setString(1, newPlugArg);
1712: prep.setInt(2, scriptId);
1713: prep.executeUpdate();
1714:
1715: } catch (SQLException E) {
1716: E.printStackTrace();
1717: org.objectweb.salome_tmf.api.Api.addException(
1718: "updateScriptClassToBeExecuted", null, E);
1719: } catch (Exception ex) {
1720: ex.printStackTrace();
1721: org.objectweb.salome_tmf.api.Api.addException(null, null,
1722: ex);
1723: }
1724: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1725:
1726: }
1727:
1728: /**
1729: * Changer la description d'un fichier attaché
1730: * @param fileName
1731: * @param newDescription
1732: */
1733: public void updateFileAttachDescriptionForAction(String familyName,
1734: String suiteName, String testName, String actionName,
1735: String fileName, String newDescription) {
1736: int idFileAttach = -1;
1737: if (!special_allow) {
1738: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1739: .canUpdateTest())) {
1740: org.objectweb.salome_tmf.api.Api
1741: .log("updateFileAttachDescription NOT ALLOW");
1742: try {
1743: throw new Exception(
1744: "updateFileAttachDescriptionForAction");
1745: } catch (Exception e) {
1746: e.printStackTrace();
1747: org.objectweb.salome_tmf.api.Api.addException(e);
1748: }
1749: return;
1750: }
1751: }
1752: int _num = -1;
1753: try {
1754: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1755:
1756: // On initialse l'ID de la famille de test
1757: //int familyId = STCommun.getIdFamily(database,prop,idProject,familyName);
1758: // On initialise l'ID de la suite de test
1759: //int suiteId = STCommun.getIdSuite(database,prop,idProject,suiteName,familyId);
1760: // On initialise l'ID du test
1761: //int testId = STCommun.getIdTest(database, prop, testName, suiteId);
1762:
1763: //int actionId = STCommun.getIdAction(database, prop, actionName, testId);
1764: // On initialise l'ID de l'attachement
1765: //int fileAttachId = STCommun.getActionAttachFileId(database,prop,actionId,fileName);
1766:
1767: // Mise a jour de la suite de test
1768: PreparedStatement prep = database.prepareStatement(prop
1769: .getProperty("updateAttachDescription"));
1770: prep.setString(1, newDescription);
1771: prep.setInt(2, idFileAttach);
1772: prep.executeUpdate();
1773:
1774: } catch (SQLException E) {
1775: E.printStackTrace();
1776: org.objectweb.salome_tmf.api.Api.addException(
1777: "updateAttachDescription", null, E);
1778: } catch (Exception ex) {
1779: ex.printStackTrace();
1780: org.objectweb.salome_tmf.api.Api.addException(null, null,
1781: ex);
1782: }
1783: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1784: }
1785:
1786: /**
1787: * Changer la description d'une url attachée
1788: * @param urlName
1789: * @param newDescription
1790: */
1791: public void updateUrlAttachDescriptionForAction(String familyName,
1792: String suiteName, String testName, String actionName,
1793: String urlName, String newDescription) {
1794: if (!special_allow) {
1795: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1796: .canUpdateTest())) {
1797: try {
1798: throw new Exception(
1799: "updateUrlAttachDescriptionForAction NOT ALLOW");
1800: } catch (Exception e) {
1801: e.printStackTrace();
1802: org.objectweb.salome_tmf.api.Api.addException(e);
1803: }
1804: return;
1805: }
1806: }
1807: int idUrlAttach = -1;
1808:
1809: int _num = -1;
1810: try {
1811: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1812:
1813: // On initialse l'ID de la famille de test
1814: int familyId = STCommun.getIdFamily(database, prop,
1815: idProject, familyName);
1816: // On initialise l'ID de la suite de test
1817: int suiteId = STCommun.getIdSuite(database, prop,
1818: idProject, suiteName, familyId);
1819: // On initialise l'ID du test
1820: int testId = STCommun.getIdTest(database, prop, testName,
1821: suiteId);
1822: int actionId = STCommun.getIdAction(database, prop,
1823: actionName, testId);
1824: // Initialisation de l'ID de l'url
1825: idUrlAttach = STCommun.getActionAttachUrlId(database, prop,
1826: actionId, urlName);
1827:
1828: // Mise a jour de la suite de test
1829: PreparedStatement prep = database.prepareStatement(prop
1830: .getProperty("updateAttachDescription"));
1831: prep.setString(1, newDescription);
1832: prep.setInt(2, idUrlAttach);
1833: prep.executeUpdate();
1834: } catch (SQLException E) {
1835: E.printStackTrace();
1836: org.objectweb.salome_tmf.api.Api.addException(
1837: "updateAttachDescription", null, E);
1838: } catch (Exception ex) {
1839: ex.printStackTrace();
1840: org.objectweb.salome_tmf.api.Api.addException(null, null,
1841: ex);
1842: }
1843: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1844: }
1845:
1846: /**
1847: * Changer la longueur d'un fichier attaché
1848: * @param fileName un nom de fichier
1849: * @param length la longueur du fichier
1850: */
1851: public void updateFileAttachLengthForAction(String familyName,
1852: String suiteName, String testName, String actionName,
1853: String fileName, long length) {
1854: if (!special_allow) {
1855: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1856: .canUpdateTest())) {
1857: org.objectweb.salome_tmf.api.Api
1858: .log("updateUrlAttachDescription NOT ALLOW");
1859: try {
1860: throw new Exception(
1861: "updateFileAttachLengthForAction NOT ALLOW");
1862: } catch (Exception e) {
1863: e.printStackTrace();
1864: org.objectweb.salome_tmf.api.Api.addException(e);
1865: }
1866: return;
1867: }
1868: }
1869: int _num = -1;
1870: try {
1871: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1872:
1873: // On initialse l'ID de la famille de test
1874: int familyId = STCommun.getIdFamily(database, prop,
1875: idProject, familyName);
1876: // On initialise l'ID de la suite de test
1877: int suiteId = STCommun.getIdSuite(database, prop,
1878: idProject, suiteName, familyId);
1879: // On initialise l'ID du test
1880: int testId = STCommun.getIdTest(database, prop, testName,
1881: suiteId);
1882: int actionId = STCommun.getIdAction(database, prop,
1883: actionName, testId);
1884: // On initialise l'ID de l'attachement
1885: int fileAttachId = STCommun.getActionAttachFileId(database,
1886: prop, actionId, fileName);
1887:
1888: // Mise a jour de la suite de test
1889: PreparedStatement prep = database.prepareStatement(prop
1890: .getProperty("updateFileAttachLength"));
1891: prep.setLong(1, length);
1892: prep.setInt(2, fileAttachId);
1893: prep.executeUpdate();
1894:
1895: } catch (SQLException E) {
1896: E.printStackTrace();
1897: org.objectweb.salome_tmf.api.Api.addException(
1898: "updateFileAttachLength", null, E);
1899: } catch (Exception ex) {
1900: ex.printStackTrace();
1901: org.objectweb.salome_tmf.api.Api.addException(null, null,
1902: ex);
1903: }
1904: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1905: }
1906:
1907: /**
1908: * Changer la date d'un fichier
1909: * @param fileName le nom du fichier
1910: * @param date la date du fichier
1911: */
1912: public void updateFileAttachDateForAction(String familyName,
1913: String suiteName, String testName, String actionName,
1914: String fileName, Date date) {
1915: if (!special_allow) {
1916: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1917: .canUpdateTest())) {
1918: org.objectweb.salome_tmf.api.Api
1919: .log("updateUrlAttachDescription NOT ALLOW");
1920: try {
1921: throw new Exception(
1922: "updateFileAttachDateForAction NOT ALLOW");
1923: } catch (Exception e) {
1924: e.printStackTrace();
1925: org.objectweb.salome_tmf.api.Api.addException(e);
1926: }
1927: return;
1928: }
1929: }
1930:
1931: int _num = -1;
1932: try {
1933: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1934:
1935: // On initialse l'ID de la famille de test
1936: int familyId = STCommun.getIdFamily(database, prop,
1937: idProject, familyName);
1938: // On initialise l'ID de la suite de test
1939: int suiteId = STCommun.getIdSuite(database, prop,
1940: idProject, suiteName, familyId);
1941: // On initialise l'ID du test
1942: int testId = STCommun.getIdTest(database, prop, testName,
1943: suiteId);
1944: int actionId = STCommun.getIdAction(database, prop,
1945: actionName, testId);
1946: // On initialise l'ID de l'attachement
1947: int fileAttachId = STCommun.getActionAttachFileId(database,
1948: prop, actionId, fileName);
1949:
1950: // Mise a jour de la suite de test
1951: PreparedStatement prep = database.prepareStatement(prop
1952: .getProperty("updateFileAttachDate"));
1953: prep.setDate(1, date);
1954: prep.setInt(2, fileAttachId);
1955: prep.executeUpdate();
1956:
1957: } catch (SQLException E) {
1958: E.printStackTrace();
1959: org.objectweb.salome_tmf.api.Api.addException(
1960: "updateFileAttachDate", null, E);
1961: } catch (Exception ex) {
1962: ex.printStackTrace();
1963: org.objectweb.salome_tmf.api.Api.addException(null, null,
1964: ex);
1965: }
1966: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
1967: }
1968:
1969: /**
1970: * Changer la description d'un fichier attaché
1971: * @param fileName
1972: * @param newDescription
1973: */
1974: public void updateFileAttachDescriptionForSuite(String familyName,
1975: String suiteName, String fileName, String newDescription) {
1976: int idFileAttach = -1;
1977: if (!special_allow) {
1978: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
1979: .canUpdateTest())) {
1980: org.objectweb.salome_tmf.api.Api
1981: .log("updateFileAttachDescription NOT ALLOW");
1982: try {
1983: throw new Exception(
1984: "updateFileAttachDescriptionForSuite NOT ALLOW");
1985: } catch (Exception e) {
1986: e.printStackTrace();
1987: org.objectweb.salome_tmf.api.Api.addException(e);
1988: }
1989: return;
1990: }
1991: }
1992: int _num = -1;
1993: try {
1994: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
1995:
1996: // On initialse l'ID de la famille de test
1997: //int familyId = STCommun.getIdFamily(database,prop,idProject,familyName);
1998: // On initialise l'ID de la suite de test
1999: //int suiteId = STCommun.getIdSuite(database,prop,idProject,suiteName,familyId);
2000: // On initialise l'ID de l'attachement
2001: //int fileAttachId = STCommun.getSuiteAttachFileId(database,prop,suiteId,fileName);
2002:
2003: // Mise a jour de la suite de test
2004: PreparedStatement prep = database.prepareStatement(prop
2005: .getProperty("updateAttachDescription"));
2006: prep.setString(1, newDescription);
2007: prep.setInt(2, idFileAttach);
2008: prep.executeUpdate();
2009:
2010: } catch (SQLException E) {
2011: E.printStackTrace();
2012: org.objectweb.salome_tmf.api.Api.addException(
2013: "updateAttachDescription", null, E);
2014: } catch (Exception ex) {
2015: ex.printStackTrace();
2016: org.objectweb.salome_tmf.api.Api.addException(null, null,
2017: ex);
2018: }
2019: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2020: }
2021:
2022: /**
2023: * Changer la description d'une url attachée
2024: * @param urlName
2025: * @param newDescription
2026: */
2027: public void updateUrlAttachDescriptionForSuite(String familyName,
2028: String suiteName, String urlName, String newDescription) {
2029: if (!special_allow) {
2030: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2031: .canUpdateTest())) {
2032: org.objectweb.salome_tmf.api.Api
2033: .log("updateUrlAttachDescription NOT ALLOW");
2034: try {
2035: throw new Exception(
2036: " updateUrlAttachDescriptionForSuite NOT ALLOW");
2037: } catch (Exception e) {
2038: e.printStackTrace();
2039: org.objectweb.salome_tmf.api.Api.addException(e);
2040: }
2041: return;
2042: }
2043: }
2044: int idUrlAttach = -1;
2045:
2046: int _num = -1;
2047: try {
2048: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2049:
2050: // On initialse l'ID de la famille de test
2051: int familyId = STCommun.getIdFamily(database, prop,
2052: idProject, familyName);
2053: // On initialise l'ID de la suite de test
2054: int suiteId = STCommun.getIdSuite(database, prop,
2055: idProject, suiteName, familyId);
2056: // Initialisation de l'ID de l'url
2057: idUrlAttach = STCommun.getSuiteAttachUrlId(database, prop,
2058: suiteId, urlName);
2059:
2060: // Mise a jour de la suite de test
2061: PreparedStatement prep = database.prepareStatement(prop
2062: .getProperty("updateAttachDescription"));
2063: prep.setString(1, newDescription);
2064: prep.setInt(2, idUrlAttach);
2065: prep.executeUpdate();
2066: } catch (SQLException E) {
2067: E.printStackTrace();
2068: org.objectweb.salome_tmf.api.Api.addException(
2069: "updateAttachDescription", null, E);
2070: } catch (Exception ex) {
2071: ex.printStackTrace();
2072: org.objectweb.salome_tmf.api.Api.addException(null, null,
2073: ex);
2074: }
2075: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2076: }
2077:
2078: /**
2079: * Changer la longueur d'un fichier attaché
2080: * @param fileName un nom de fichier
2081: * @param length la longueur du fichier
2082: */
2083: public void updateFileAttachLengthForSuite(String familyName,
2084: String suiteName, String fileName, long length) {
2085: if (!special_allow) {
2086: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2087: .canUpdateTest())) {
2088: org.objectweb.salome_tmf.api.Api
2089: .log("updateUrlAttachDescription NOT ALLOW");
2090: try {
2091: throw new Exception(
2092: "updateFileAttachLengthForSuite NOT ALLOW");
2093: } catch (Exception e) {
2094: e.printStackTrace();
2095: org.objectweb.salome_tmf.api.Api.addException(e);
2096: }
2097: return;
2098: }
2099: }
2100: int _num = -1;
2101: try {
2102: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2103:
2104: // On initialse l'ID de la famille de test
2105: int familyId = STCommun.getIdFamily(database, prop,
2106: idProject, familyName);
2107: // On initialise l'ID de la suite de test
2108: int suiteId = STCommun.getIdSuite(database, prop,
2109: idProject, suiteName, familyId);
2110: // On initialise l'ID de l'attachement
2111: int fileAttachId = STCommun.getSuiteAttachFileId(database,
2112: prop, suiteId, fileName);
2113:
2114: // Mise a jour de la suite de test
2115: PreparedStatement prep = database.prepareStatement(prop
2116: .getProperty("updateFileAttachLength"));
2117: prep.setLong(1, length);
2118: prep.setInt(2, fileAttachId);
2119: prep.executeUpdate();
2120:
2121: } catch (SQLException E) {
2122: E.printStackTrace();
2123: org.objectweb.salome_tmf.api.Api.addException(
2124: "updateFileAttachLength", null, E);
2125: } catch (Exception ex) {
2126: ex.printStackTrace();
2127: org.objectweb.salome_tmf.api.Api.addException(null, null,
2128: ex);
2129: }
2130: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2131: }
2132:
2133: /**
2134: * Changer la date d'un fichier
2135: * @param fileName le nom du fichier
2136: * @param date la date du fichier
2137: */
2138: public void updateFileAttachDateForSuite(String familyName,
2139: String suiteName, String fileName, Date date) {
2140: if (!special_allow) {
2141: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2142: .canUpdateTest())) {
2143: org.objectweb.salome_tmf.api.Api
2144: .log("updateUrlAttachDescription NOT ALLOW");
2145: try {
2146: throw new Exception(
2147: "updateFileAttachDateForSuite NOT ALLOW");
2148: } catch (Exception e) {
2149: e.printStackTrace();
2150: org.objectweb.salome_tmf.api.Api.addException(e);
2151: }
2152: return;
2153: }
2154: }
2155:
2156: int _num = -1;
2157: try {
2158: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2159:
2160: // On initialse l'ID de la famille de test
2161: int familyId = STCommun.getIdFamily(database, prop,
2162: idProject, familyName);
2163: // On initialise l'ID de la suite de test
2164: int suiteId = STCommun.getIdSuite(database, prop,
2165: idProject, suiteName, familyId);
2166: // On initialise l'ID du test
2167:
2168: // On initialise l'ID de l'attachement
2169: int fileAttachId = STCommun.getSuiteAttachFileId(database,
2170: prop, suiteId, fileName);
2171:
2172: // Mise a jour de la suite de test
2173: PreparedStatement prep = database.prepareStatement(prop
2174: .getProperty("updateFileAttachDate"));
2175: prep.setDate(1, date);
2176: prep.setInt(2, fileAttachId);
2177: prep.executeUpdate();
2178:
2179: } catch (SQLException E) {
2180: E.printStackTrace();
2181: org.objectweb.salome_tmf.api.Api.addException(
2182: "updateFileAttachDate", null, E);
2183: } catch (Exception ex) {
2184: ex.printStackTrace();
2185: org.objectweb.salome_tmf.api.Api.addException(null, null,
2186: ex);
2187: }
2188: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2189: }
2190:
2191: /**
2192: *
2193: * @param familyName
2194: * @param suiteName
2195: * @param testName
2196: * @param scriptName
2197: * @param date
2198: */
2199: public void updateScriptDate(String familyName, String suiteName,
2200: String testName, String scriptName, Date date) {
2201: if (!special_allow) {
2202: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2203: .canUpdateTest())) {
2204: org.objectweb.salome_tmf.api.Api
2205: .log("updateUrlAttachDescription NOT ALLOW");
2206: try {
2207: throw new Exception("updateScriptDate NOT ALLOW");
2208: } catch (Exception e) {
2209: e.printStackTrace();
2210: org.objectweb.salome_tmf.api.Api.addException(e);
2211: }
2212: return;
2213: }
2214: }
2215:
2216: int _num = -1;
2217: try {
2218: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2219:
2220: // On initialse l'ID de la famille de test
2221: int familyId = STCommun.getIdFamily(database, prop,
2222: idProject, familyName);
2223: // On initialise l'ID de la suite de test
2224: int suiteId = STCommun.getIdSuite(database, prop,
2225: idProject, suiteName, familyId);
2226: // On initialise l'ID du test
2227: int testId = STCommun.getIdTest(database, prop, testName,
2228: suiteId);
2229:
2230: // Initialisation de l'ID du script
2231: int idScript = STCommun.getIdScript(database, prop, testId,
2232: scriptName);
2233:
2234: //int idScriptAttach = STCommun.getTestAttachScriptId(database, prop, idScript);
2235:
2236: // Mise a jour de la suite de test
2237: PreparedStatement prep = database.prepareStatement(prop
2238: .getProperty("updateScriptDate"));
2239: org.objectweb.salome_tmf.api.Api.log(prop
2240: .getProperty("updateScriptClassPath"));
2241: prep.setDate(1, date);
2242: prep.setInt(2, idScript);
2243:
2244: prep.executeUpdate();
2245:
2246: } catch (SQLException E) {
2247: E.printStackTrace();
2248: org.objectweb.salome_tmf.api.Api.addException(
2249: "updateScriptDate", null, E);
2250: } catch (Exception ex) {
2251: ex.printStackTrace();
2252: org.objectweb.salome_tmf.api.Api.addException(null, null,
2253: ex);
2254: }
2255: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2256: }
2257:
2258: /**
2259: * @param scriptId
2260: * @param date
2261: */
2262: public void updateScriptDateUsingID(int scriptId, Date date) {
2263: if (!special_allow) {
2264: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2265: .canUpdateTest())) {
2266: org.objectweb.salome_tmf.api.Api
2267: .log("updateUrlAttachDescription NOT ALLOW");
2268: try {
2269: throw new Exception("updateScriptDate NOT ALLOW");
2270: } catch (Exception e) {
2271: e.printStackTrace();
2272: org.objectweb.salome_tmf.api.Api.addException(e);
2273: }
2274: return;
2275: }
2276: }
2277:
2278: int _num = -1;
2279: try {
2280: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2281:
2282: //int idScriptAttach = STCommun.getTestAttachScriptId(database, prop, scriptId);
2283:
2284: // Mise a jour de la suite de test
2285: PreparedStatement prep = database.prepareStatement(prop
2286: .getProperty("updateScriptDate"));
2287: org.objectweb.salome_tmf.api.Api.log(prop
2288: .getProperty("updateScriptClassPath"));
2289: prep.setDate(1, date);
2290: prep.setInt(2, scriptId);
2291:
2292: prep.executeUpdate();
2293:
2294: } catch (SQLException E) {
2295: E.printStackTrace();
2296: org.objectweb.salome_tmf.api.Api.addException(
2297: "updateScriptDate", null, E);
2298: } catch (Exception ex) {
2299: ex.printStackTrace();
2300: org.objectweb.salome_tmf.api.Api.addException(null, null,
2301: ex);
2302: }
2303: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2304: }
2305:
2306: /**
2307: *
2308: * @param familyName
2309: * @param suiteName
2310: * @param testName
2311: * @param scriptName
2312: * @param length
2313: */
2314: public void updateScriptLength(String familyName, String suiteName,
2315: String testName, String scriptName, long length) {
2316: if (!special_allow) {
2317: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2318: .canUpdateTest())) {
2319: org.objectweb.salome_tmf.api.Api
2320: .log("updateScriptLength NOT ALLOW");
2321: try {
2322: throw new Exception("updateScriptLength NOT ALLOW");
2323: } catch (Exception e) {
2324: e.printStackTrace();
2325: org.objectweb.salome_tmf.api.Api.addException(e);
2326: }
2327: return;
2328: }
2329: }
2330:
2331: int _num = -1;
2332: try {
2333: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2334:
2335: // On initialse l'ID de la famille de test
2336: int familyId = STCommun.getIdFamily(database, prop,
2337: idProject, familyName);
2338: // On initialise l'ID de la suite de test
2339: int suiteId = STCommun.getIdSuite(database, prop,
2340: idProject, suiteName, familyId);
2341: // On initialise l'ID du test
2342: int testId = STCommun.getIdTest(database, prop, testName,
2343: suiteId);
2344:
2345: // Initialisation de l'ID du script
2346: int idScript = STCommun.getIdScript(database, prop, testId,
2347: scriptName);
2348:
2349: //int idScriptAttach = STCommun.getTestAttachScriptId(database, prop, idScript);
2350:
2351: // Mise a jour de la suite de test
2352: PreparedStatement prep = database.prepareStatement(prop
2353: .getProperty("updateScriptLength"));
2354: org.objectweb.salome_tmf.api.Api.log(prop
2355: .getProperty("updateScriptClassPath"));
2356: prep.setLong(1, length);
2357: prep.setInt(2, idScript);
2358:
2359: prep.executeUpdate();
2360:
2361: } catch (SQLException E) {
2362: E.printStackTrace();
2363: org.objectweb.salome_tmf.api.Api.addException(
2364: "updateScriptLength", null, E);
2365: } catch (Exception ex) {
2366: ex.printStackTrace();
2367: org.objectweb.salome_tmf.api.Api.addException(null, null,
2368: ex);
2369: }
2370: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2371: }
2372:
2373: /**
2374: * @param scriptId
2375: * @param length
2376: */
2377: public void updateScriptLengthUsingID(int scriptId, long length) {
2378: if (!special_allow) {
2379: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2380: .canUpdateTest())) {
2381: org.objectweb.salome_tmf.api.Api
2382: .log("updateScriptLength NOT ALLOW");
2383: try {
2384: throw new Exception("updateScriptLength NOT ALLOW");
2385: } catch (Exception e) {
2386: e.printStackTrace();
2387: org.objectweb.salome_tmf.api.Api.addException(e);
2388: }
2389: return;
2390: }
2391: }
2392:
2393: int _num = -1;
2394: try {
2395: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2396:
2397: //int idScriptAttach = STCommun.getTestAttachScriptId(database, prop, scriptId);
2398:
2399: // Mise a jour de la suite de test
2400: PreparedStatement prep = database.prepareStatement(prop
2401: .getProperty("updateScriptLength"));
2402: org.objectweb.salome_tmf.api.Api.log(prop
2403: .getProperty("updateScriptClassPath"));
2404: prep.setLong(1, length);
2405: prep.setInt(2, scriptId);
2406:
2407: prep.executeUpdate();
2408:
2409: } catch (SQLException E) {
2410: E.printStackTrace();
2411: org.objectweb.salome_tmf.api.Api.addException(
2412: "updateScriptLength", null, E);
2413: } catch (Exception ex) {
2414: ex.printStackTrace();
2415: org.objectweb.salome_tmf.api.Api.addException(null, null,
2416: ex);
2417: }
2418: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2419: }
2420:
2421: /**
2422: * Changer le contenu d'un fichier attaché à une suite de tests
2423: * @param fileID
2424: * @param fileContent
2425: * @param
2426: */
2427: public void updateFileContentUsingID(int fileId,
2428: BufferedInputStream fileContent)
2429: throws FileNotFoundException {
2430:
2431: if (!special_allow) {
2432: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2433: .canUpdateTest())) {
2434: try {
2435: throw new Exception("updateFileContent NOT ALLOW");
2436: } catch (Exception e) {
2437: e.printStackTrace();
2438: org.objectweb.salome_tmf.api.Api.addException(e);
2439: }
2440: return;
2441: }
2442: }
2443: int _num = -1;
2444: try {
2445: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2446:
2447: // Appel de la requete a executer
2448: PreparedStatement prep = database.prepareStatement(prop
2449: .getProperty("updateFileAttach"));
2450: prep.setBinaryStream(1, fileContent, fileContent
2451: .available());
2452: prep.setInt(2, fileId);
2453:
2454: prep.executeUpdate();
2455:
2456: } catch (SQLException sqle) {
2457: sqle.printStackTrace();
2458: org.objectweb.salome_tmf.api.Api.addException(
2459: "updateFileAttachContent", null, sqle);
2460: } catch (Exception e) {
2461: org.objectweb.salome_tmf.api.Api
2462: .addException(null, null, e);
2463: e.printStackTrace();
2464: if (e instanceof FileNotFoundException) {
2465: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2466: throw new FileNotFoundException();
2467: }
2468: }
2469: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2470: }
2471:
2472: /**
2473: * Changer la date d'un fichier
2474: * @param fileId
2475: * @param fileContent
2476: * @param date la date du fichier
2477: */
2478: public void updateFileDateUsingID(int fileId, Date date) {
2479: if (!special_allow) {
2480: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2481: .canUpdateTest())) {
2482: org.objectweb.salome_tmf.api.Api
2483: .log("updateFileAttachDate NOT ALLOW");
2484: try {
2485: throw new Exception(
2486: "updateFileAttachDate NOT ALLOW");
2487: } catch (Exception e) {
2488: e.printStackTrace();
2489: org.objectweb.salome_tmf.api.Api.addException(e);
2490: }
2491: return;
2492: }
2493: }
2494:
2495: int _num = -1;
2496: try {
2497: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2498:
2499: // Mise a jour de la suite de test
2500: PreparedStatement prep = database.prepareStatement(prop
2501: .getProperty("updateFileAttachDate"));
2502: prep.setDate(1, date);
2503: prep.setInt(2, fileId);
2504: prep.executeUpdate();
2505:
2506: } catch (SQLException E) {
2507: E.printStackTrace();
2508: org.objectweb.salome_tmf.api.Api.addException(
2509: "updateFileAttachDate", null, E);
2510: } catch (Exception ex) {
2511: ex.printStackTrace();
2512: org.objectweb.salome_tmf.api.Api.addException(null, null,
2513: ex);
2514: }
2515: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2516: }
2517:
2518: /**
2519: * Changer la longueur d'un fichier attaché
2520: * @param fileId
2521: * @param length
2522: * @param length la longueur du fichier
2523: */
2524: public void updateFileLengthUsingID(int fileId, long length) {
2525: if (!special_allow) {
2526: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2527: .canUpdateTest())) {
2528: org.objectweb.salome_tmf.api.Api
2529: .log("updateFileLength NOT ALLOW");
2530: try {
2531: throw new Exception("updateFileLength NOT ALLOW");
2532: } catch (Exception e) {
2533: e.printStackTrace();
2534: org.objectweb.salome_tmf.api.Api.addException(e);
2535: }
2536: return;
2537: }
2538: }
2539: int _num = -1;
2540: try {
2541: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2542:
2543: // Mise a jour de la suite de test
2544: PreparedStatement prep = database.prepareStatement(prop
2545: .getProperty("updateFileAttachLength"));
2546: prep.setLong(1, length);
2547: prep.setInt(2, fileId);
2548: prep.executeUpdate();
2549:
2550: } catch (SQLException E) {
2551: E.printStackTrace();
2552: org.objectweb.salome_tmf.api.Api.addException(
2553: "updateFileLength", null, E);
2554: } catch (Exception ex) {
2555: ex.printStackTrace();
2556: org.objectweb.salome_tmf.api.Api.addException(null, null,
2557: ex);
2558: }
2559: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2560: }
2561:
2562: /**
2563: * Changer la description d'un fichier ou URL attachée
2564: * @param attachId
2565: * @param newDescription
2566: */
2567: public void updateAttachDescriptionUsingID(int fileId,
2568: String newDescription) {
2569: //int idFileAttach = -1;
2570: if (!special_allow) {
2571: if (!(org.objectweb.salome_tmf.api.api2ihm.AdminProject
2572: .canUpdateTest())) {
2573: org.objectweb.salome_tmf.api.Api
2574: .log("updateAttachDescription NOT ALLOW");
2575: try {
2576: throw new Exception(
2577: "updateAttachDescription NOT ALLOW");
2578: } catch (Exception e) {
2579: e.printStackTrace();
2580: org.objectweb.salome_tmf.api.Api.addException(e);
2581: }
2582: return;
2583: }
2584: }
2585: int _num = -1;
2586: try {
2587: _num = org.objectweb.salome_tmf.api.Api.beginTrans();
2588:
2589: // Mise a jour de la suite de test
2590: PreparedStatement prep = database.prepareStatement(prop
2591: .getProperty("updateAttachDescription"));
2592: prep.setString(1, newDescription);
2593: prep.setInt(2, fileId);
2594: prep.executeUpdate();
2595:
2596: } catch (SQLException E) {
2597: E.printStackTrace();
2598: org.objectweb.salome_tmf.api.Api.addException(
2599: "updateAttachDescription", null, E);
2600: } catch (Exception ex) {
2601: ex.printStackTrace();
2602: org.objectweb.salome_tmf.api.Api.addException(null, null,
2603: ex);
2604: }
2605: org.objectweb.salome_tmf.api.Api.commitTrans(_num);
2606: }
2607:
2608: } // Fin de la classe
|