001: /*
002: * SalomeTMF is a Test Management Framework
003: * Copyright (C) 2005 France Telecom R&D
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: *
019: * @author Fayçal SOUGRATI
020: *
021: * Contact: mikael.marche@rd.francetelecom.com
022: */
023:
024: package org.objectweb.salome_tmf.api.api2ihm.adminVT;
025:
026: import java.sql.PreparedStatement;
027: import java.sql.SQLException;
028: import java.util.Hashtable;
029: import java.util.Properties;
030: import java.util.Vector;
031:
032: import org.objectweb.salome_tmf.api.api2db.DataBase;
033: import org.objectweb.salome_tmf.api.api2db.DataSet;
034: import org.objectweb.salome_tmf.api.api2ihm.Utile;
035: import org.objectweb.salome_tmf.api.wrapper.ConnectionWrapper;
036:
037: /**
038: * Fonctions de selection relatives à l'aire fonctionnelle "Administrer SalomeTMF"
039: * @author Fayçal SOUGRATI
040: */
041: public class AdminVTSelectImpl implements AdminVTSelect {
042: /**
043: * Base de données SalomeTMF
044: */
045: DataBase database;
046:
047: /**
048: * Fichier "properties" contenant les requetes SQL relatives a l'administration
049: */
050: Properties prop;
051:
052: /**
053: * Constructeur
054: * @param db
055: * @param pr
056: */
057: public AdminVTSelectImpl(DataBase db, Properties pr) {
058: database = db;
059: prop = pr;
060: }
061:
062: /**
063: * Selection des logins de tous les utilisateurs enregistres dans la BdD SalomeTMF
064: * Retourne un "Vector" (tableau dynamique) de String
065: * @return
066: */
067: public Vector getAllVTUsersLogin() {
068: Vector result = new Vector();
069: DataSet stmtRes = null;
070:
071: try {
072: // On execute la requete
073: PreparedStatement prep = database.prepareStatement(prop
074: .getProperty("selectAllVTUsersLogin"));
075: stmtRes = new DataSet(prep.executeQuery());
076: // Ajoute les element un par un au resultat
077: while (stmtRes.hasMoreElements()) {
078: result.addElement(stmtRes.getResults().getString(
079: "login_personne"));
080: }
081: } catch (SQLException e) {
082: e.printStackTrace();
083: org.objectweb.salome_tmf.api.Api.addException(
084: "selectAllVTUsersLogin", null, e);
085: } catch (Exception ex) {
086: ex.printStackTrace();
087: org.objectweb.salome_tmf.api.Api.addException(null, null,
088: ex);
089: }
090:
091: // On retourne le resultat
092: return result;
093: }
094:
095: /**
096: * Selection des noms de tous les utilisateurs enregistres dans la BdD SalomeTMF
097: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
098: * @return
099: */
100: public Vector getAllVTUsersName() {
101: Vector result = new Vector();
102: DataSet stmtRes = null;
103:
104: try {
105: // On execute la requete
106: PreparedStatement prep = database.prepareStatement(prop
107: .getProperty("selectAllVTUsersName"));
108: stmtRes = new DataSet(prep.executeQuery());
109: // Ajoute les element un par un au resultat
110: while (stmtRes.hasMoreElements()) {
111: result.addElement(stmtRes.getResults().getString(
112: "nom_personne"));
113: }
114: } catch (SQLException e) {
115: e.printStackTrace();
116: org.objectweb.salome_tmf.api.Api.addException(
117: "selectAllVTUsersName", null, e);
118: } catch (Exception ex) {
119: ex.printStackTrace();
120: org.objectweb.salome_tmf.api.Api.addException(null, null,
121: ex);
122: }
123:
124: // On retourne le resultat
125: return result;
126: }
127:
128: /**
129: * Selection des prenoms de tous les utilisateurs enregistres dans la BdD SalomeTMF
130: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
131: * @return
132: */
133: public Vector getAllVTUsersFirstName() {
134: Vector result = new Vector();
135: DataSet stmtRes = null;
136:
137: try {
138: // On execute la requete
139: PreparedStatement prep = database.prepareStatement(prop
140: .getProperty("selectAllVTUsersFirstName"));
141: stmtRes = new DataSet(prep.executeQuery());
142: // Ajoute les element un par un au resultat
143: while (stmtRes.hasMoreElements()) {
144: result.addElement(stmtRes.getResults().getString(
145: "prenom_personne"));
146: }
147: } catch (SQLException e) {
148: e.printStackTrace();
149: org.objectweb.salome_tmf.api.Api.addException(
150: "selectAllVTUsersFirstName", null, e);
151: } catch (Exception ex) {
152: ex.printStackTrace();
153: org.objectweb.salome_tmf.api.Api.addException(null, null,
154: ex);
155: }
156:
157: // On retourne le resultat
158: return result;
159: }
160:
161: /**
162: * Selection des descriptions de tous les utilisateurs enregistres dans la BdD SalomeTMF
163: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
164: * @return
165: */
166: public Vector getAllVTUsersDesc() {
167: Vector result = new Vector();
168: DataSet stmtRes = null;
169:
170: try {
171: // On execute la requete
172: PreparedStatement prep = database.prepareStatement(prop
173: .getProperty("selectAllVTUsersDesc"));
174: stmtRes = new DataSet(prep.executeQuery());
175: // Ajoute les element un par un au resultat
176: while (stmtRes.hasMoreElements()) {
177: result.addElement(stmtRes.getResults().getString(
178: "desc_personne"));
179: }
180: } catch (SQLException e) {
181: e.printStackTrace();
182: org.objectweb.salome_tmf.api.Api.addException(
183: "selectAllVTUsersDesc", null, e);
184: } catch (Exception ex) {
185: ex.printStackTrace();
186: org.objectweb.salome_tmf.api.Api.addException(null, null,
187: ex);
188: }
189:
190: // On retourne le resultat
191: return result;
192: }
193:
194: /**
195: * Selection des emails de tous les utilisateurs enregistres dans la BdD SalomeTMF
196: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
197: * @return
198: */
199: public Vector getAllVTUsersEmail() {
200: Vector result = new Vector();
201: DataSet stmtRes = null;
202:
203: try {
204: // On execute la requete
205: PreparedStatement prep = database.prepareStatement(prop
206: .getProperty("selectAllVTUsersEmail"));
207: stmtRes = new DataSet(prep.executeQuery());
208: // Ajoute les element un par un au resultat
209: while (stmtRes.hasMoreElements()) {
210: result.addElement(stmtRes.getResults().getString(
211: "email_personne"));
212: }
213: } catch (SQLException e) {
214: e.printStackTrace();
215: org.objectweb.salome_tmf.api.Api.addException(
216: "selectAllVTUsersEmail", null, e);
217: } catch (Exception ex) {
218: ex.printStackTrace();
219: org.objectweb.salome_tmf.api.Api.addException(null, null,
220: ex);
221: }
222:
223: // On retourne le resultat
224: return result;
225: }
226:
227: /**
228: * Selection des numeros de telephone de tous les utilisateurs enregistres dans la BdD SalomeTMF
229: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
230: * @return
231: */
232: public Vector getAllVTUsersTel() {
233: Vector result = new Vector();
234: DataSet stmtRes = null;
235:
236: try {
237: // On execute la requete
238: PreparedStatement prep = database.prepareStatement(prop
239: .getProperty("selectAllVTUsersTel"));
240: stmtRes = new DataSet(prep.executeQuery());
241: // Ajoute les element un par un au resultat
242: while (stmtRes.hasMoreElements()) {
243: result.addElement(stmtRes.getResults().getString(
244: "tel_personne"));
245: }
246: } catch (SQLException e) {
247: e.printStackTrace();
248: org.objectweb.salome_tmf.api.Api.addException(
249: "selectAllVTUsersTel", null, e);
250: } catch (Exception ex) {
251: ex.printStackTrace();
252: org.objectweb.salome_tmf.api.Api.addException(null, null,
253: ex);
254: }
255:
256: // On retourne le resultat
257: return result;
258: }
259:
260: /**
261: * Selection des dates de creation de tous les utilisateurs enregistres dans la BdD SalomeTMF
262: * Retourne un "Vector" (tableau dynamique) d'elements de type "Date"
263: * @return
264: */
265: public Vector getAllVTUsersDate() {
266: Vector result = new Vector();
267: DataSet stmtRes = null;
268:
269: try {
270: // On execute la requete
271: PreparedStatement prep = database.prepareStatement(prop
272: .getProperty("selectAllVTUsersDate"));
273: stmtRes = new DataSet(prep.executeQuery());
274: // Ajoute les element un par un au resultat
275: while (stmtRes.hasMoreElements()) {
276: result.addElement(stmtRes.getResults().getDate(
277: "date_creation_personne"));
278: }
279: } catch (SQLException e) {
280: e.printStackTrace();
281: org.objectweb.salome_tmf.api.Api.addException(
282: "selectAllVTUsersDate", null, e);
283: } catch (Exception ex) {
284: ex.printStackTrace();
285: org.objectweb.salome_tmf.api.Api.addException(null, null,
286: ex);
287: }
288:
289: // On retourne le resultat
290: return result;
291: }
292:
293: /**
294: * Selection des heures de creation de tous les utilisateurs enregistres dans la BdD SalomeTMF
295: * Retourne un "Vector" (tableau dynamique) d'elements de type "Time"
296: * @return
297: */
298: public Vector getAllVTUsersTime() {
299: Vector result = new Vector();
300: DataSet stmtRes = null;
301:
302: try {
303: // On execute la requete
304: PreparedStatement prep = database.prepareStatement(prop
305: .getProperty("selectAllVTUsersTime"));
306: stmtRes = new DataSet(prep.executeQuery());
307: // Ajoute les element un par un au resultat
308: while (stmtRes.hasMoreElements()) {
309: result.addElement(stmtRes.getResults().getTime(
310: "heure_creation_personne"));
311: }
312: } catch (SQLException e) {
313: e.printStackTrace();
314: org.objectweb.salome_tmf.api.Api.addException(
315: "selectAllVTUsersName", null, e);
316: } catch (Exception ex) {
317: ex.printStackTrace();
318: org.objectweb.salome_tmf.api.Api.addException(null, null,
319: ex);
320: }
321:
322: // On retourne le resultat
323: return result;
324: }
325:
326: /**
327: * Selection des noms de tous les projets enregistres dans la BdD SalomeTMF
328: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
329: * @return
330: */
331: public Vector getAllVTProjectsName() {
332: Vector result = new Vector();
333: DataSet stmtRes = null;
334:
335: try {
336: // On execute la requete
337: PreparedStatement prep = database.prepareStatement(prop
338: .getProperty("selectAllVTProjectsName"));
339: stmtRes = new DataSet(prep.executeQuery());
340: // Ajoute les element un par un au resultat
341: while (stmtRes.hasMoreElements()) {
342: result.addElement(stmtRes.getResults().getString(
343: "nom_projet"));
344: }
345:
346: //prep = database.prepareStatement(prop.getProperty("selectBadTest"));
347: //stmtRes = new DataSet(prep.executeQuery());
348:
349: } catch (SQLException e) {
350: e.printStackTrace();
351: org.objectweb.salome_tmf.api.Api.addException(
352: "selectAllVTProjectsName", null, e);
353: } catch (Exception ex) {
354: ex.printStackTrace();
355: org.objectweb.salome_tmf.api.Api.addException(null, null,
356: ex);
357: }
358:
359: // On retourne le resultat
360: return result;
361: }
362:
363: /**
364: * Selection des descriptions de tous les projets enregistres dans la BdD SalomeTMF
365: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
366: * @return
367: */
368: public Vector getAllVTProjectsDesc() {
369: Vector result = new Vector();
370: DataSet stmtRes = null;
371:
372: try {
373: // On execute la requete
374: PreparedStatement prep = database.prepareStatement(prop
375: .getProperty("selectAllVTProjectsDesc"));
376: stmtRes = new DataSet(prep.executeQuery());
377: // Ajoute les element un par un au resultat
378: while (stmtRes.hasMoreElements()) {
379: result.addElement(stmtRes.getResults().getString(
380: "description_projet"));
381: }
382: } catch (SQLException e) {
383: e.printStackTrace();
384: org.objectweb.salome_tmf.api.Api.addException(
385: "selectAllVTProjectsDesc", null, e);
386: } catch (Exception ex) {
387: ex.printStackTrace();
388: org.objectweb.salome_tmf.api.Api.addException(null, null,
389: ex);
390: }
391:
392: // On retourne le resultat
393: return result;
394: }
395:
396: /**
397: * Selection des dates de creation de tous les projets enregistres dans la BdD SalomeTMF
398: * Retourne un "Vector" (tableau dynamique) d'elements de type "Date"
399: * @return
400: */
401: public Vector getAllVTProjectsDate() {
402: Vector result = new Vector();
403: DataSet stmtRes = null;
404:
405: try {
406: // On execute la requete
407: PreparedStatement prep = database.prepareStatement(prop
408: .getProperty("selectAllVTProjectsDate"));
409: stmtRes = new DataSet(prep.executeQuery());
410: // Ajoute les element un par un au resultat
411: while (stmtRes.hasMoreElements()) {
412: result.addElement(stmtRes.getResults().getDate(
413: "date_creation_projet"));
414: }
415: } catch (SQLException e) {
416: e.printStackTrace();
417: org.objectweb.salome_tmf.api.Api.addException(
418: "selectAllVTProjectsDate", null, e);
419: } catch (Exception ex) {
420: ex.printStackTrace();
421: org.objectweb.salome_tmf.api.Api.addException(null, null,
422: ex);
423: }
424:
425: // On retourne le resultat
426: return result;
427: }
428:
429: /**
430: * Selection des logins des administrateurs de tous les projets
431: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
432: * @return
433: */
434: public Vector getAllProjectsAdminLogin() {
435: Vector result = new Vector();
436: DataSet stmtRes = null;
437:
438: try {
439: // On execute la requete
440: PreparedStatement prep = database.prepareStatement(prop
441: .getProperty("selectAllVTProjectsAdmins"));
442: stmtRes = new DataSet(prep.executeQuery());
443: // Ajoute les element un par un au resultat
444: while (stmtRes.hasMoreElements()) {
445: result.addElement(stmtRes.getResults().getString(
446: "login_personne"));
447: }
448: } catch (SQLException e) {
449: e.printStackTrace();
450: org.objectweb.salome_tmf.api.Api.addException(
451: "selectAllVTProjectsAdmins", null, e);
452: } catch (Exception ex) {
453: ex.printStackTrace();
454: org.objectweb.salome_tmf.api.Api.addException(null, null,
455: ex);
456: }
457:
458: // On retourne le resultat
459: return result;
460: }
461:
462: /**
463: * Selection des noms des administrateurs de tous les projets
464: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
465: * @return
466: */
467: public Vector getAllProjectsAdminName() {
468: Vector result = new Vector();
469: DataSet stmtRes = null;
470:
471: try {
472: // On execute la requete
473: PreparedStatement prep = database.prepareStatement(prop
474: .getProperty("selectAllVTProjectsAdmins"));
475: stmtRes = new DataSet(prep.executeQuery());
476: // Ajoute les element un par un au resultat
477: while (stmtRes.hasMoreElements()) {
478: result.addElement(stmtRes.getResults().getString(
479: "nom_personne"));
480: }
481: } catch (SQLException e) {
482: e.printStackTrace();
483: org.objectweb.salome_tmf.api.Api.addException(
484: "selectAllVTProjectsAdmins", null, e);
485: } catch (Exception ex) {
486: ex.printStackTrace();
487: org.objectweb.salome_tmf.api.Api.addException(null, null,
488: ex);
489: }
490:
491: // On retourne le resultat
492: return result;
493: }
494:
495: /**
496: * Selection des prenoms des administrateurs de tous les projets
497: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
498: * @return
499: */
500: public Vector getAllProjectsAdminFirstName() {
501: Vector result = new Vector();
502: DataSet stmtRes = null;
503:
504: try {
505: // On execute la requete
506: PreparedStatement prep = database.prepareStatement(prop
507: .getProperty("selectAllVTProjectsAdmins"));
508: stmtRes = new DataSet(prep.executeQuery());
509: // Ajoute les element un par un au resultat
510: while (stmtRes.hasMoreElements()) {
511: result.addElement(stmtRes.getResults().getString(
512: "prenom_personne"));
513: }
514: } catch (SQLException e) {
515: e.printStackTrace();
516: org.objectweb.salome_tmf.api.Api.addException(
517: "selectAllVTProjectsAdmins", null, e);
518: } catch (Exception ex) {
519: ex.printStackTrace();
520: org.objectweb.salome_tmf.api.Api.addException(null, null,
521: ex);
522: }
523:
524: // On retourne le resultat
525: return result;
526: }
527:
528: /**
529: * Selection des descriptions des administrateurs de tous les projets
530: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
531: * @return
532: */
533: public Vector getAllProjectsAdminDesc() {
534: Vector result = new Vector();
535: DataSet stmtRes = null;
536:
537: try {
538: // On execute la requete
539: PreparedStatement prep = database.prepareStatement(prop
540: .getProperty("selectAllVTProjectsAdmins"));
541: stmtRes = new DataSet(prep.executeQuery());
542: // Ajoute les element un par un au resultat
543: while (stmtRes.hasMoreElements()) {
544: result.addElement(stmtRes.getResults().getString(
545: "desc_personne"));
546: }
547: } catch (SQLException e) {
548: e.printStackTrace();
549: org.objectweb.salome_tmf.api.Api.addException(
550: "selectAllVTProjectsAdmins", null, e);
551: } catch (Exception ex) {
552: ex.printStackTrace();
553: org.objectweb.salome_tmf.api.Api.addException(null, null,
554: ex);
555: }
556:
557: // On retourne le resultat
558: return result;
559: }
560:
561: /**
562: * Selection des emails des administrateurs de tous les projets
563: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
564: * @return
565: */
566: public Vector getAllProjectsAdminEmail() {
567: Vector result = new Vector();
568: DataSet stmtRes = null;
569:
570: try {
571: // On execute la requete
572: PreparedStatement prep = database.prepareStatement(prop
573: .getProperty("selectAllVTProjectsAdmins"));
574: stmtRes = new DataSet(prep.executeQuery());
575: // Ajoute les element un par un au resultat
576: while (stmtRes.hasMoreElements()) {
577: result.addElement(stmtRes.getResults().getString(
578: "email_personne"));
579: }
580: } catch (SQLException e) {
581: e.printStackTrace();
582: org.objectweb.salome_tmf.api.Api.addException(
583: "selectAllVTProjectsAdmins", null, e);
584: } catch (Exception ex) {
585: ex.printStackTrace();
586: org.objectweb.salome_tmf.api.Api.addException(null, null,
587: ex);
588: }
589:
590: // On retourne le resultat
591: return result;
592: }
593:
594: /**
595: * Selection des numeros de telephone des administrateurs de tous les projets
596: * Retourne un "Vector" (tableau dynamique) d'elements de type "String"
597: * @return
598: */
599: public Vector getAllProjectsAdminTel() {
600: Vector result = new Vector();
601: DataSet stmtRes = null;
602:
603: try {
604: // On execute la requete
605: PreparedStatement prep = database.prepareStatement(prop
606: .getProperty("selectAllVTProjectsAdmins"));
607: stmtRes = new DataSet(prep.executeQuery());
608: // Ajoute les element un par un au resultat
609: while (stmtRes.hasMoreElements()) {
610: result.addElement(stmtRes.getResults().getString(
611: "tel_personne"));
612: }
613: } catch (SQLException e) {
614: e.printStackTrace();
615: org.objectweb.salome_tmf.api.Api.addException(
616: "selectAllVTProjectsAdmins", null, e);
617: } catch (Exception ex) {
618: ex.printStackTrace();
619: org.objectweb.salome_tmf.api.Api.addException(null, null,
620: ex);
621: }
622:
623: // On retourne le resultat
624: return result;
625: }
626:
627: /**
628: * Donne le nom d'un utilisateur d'un projet a partir de son login
629: * @param userLogin
630: * @return
631: */
632: public String getUserName(String userLogin) {
633: String result = null;
634: DataSet stmtRes = null;
635: try {
636: // On execute la requete
637: PreparedStatement prep = database.prepareStatement(prop
638: .getProperty("selectUserFromLogin"));
639: prep.setString(1, userLogin);
640: stmtRes = new DataSet(prep.executeQuery());
641: if (stmtRes.getResults().next()) {
642: result = stmtRes.getResults().getString("nom_personne");
643: }
644: } catch (SQLException e) {
645: e.printStackTrace();
646: org.objectweb.salome_tmf.api.Api.addException(
647: "selectUserFromLogin", null, e);
648: } catch (Exception ex) {
649: ex.printStackTrace();
650: org.objectweb.salome_tmf.api.Api.addException(null, null,
651: ex);
652: }
653:
654: // On retourne le resultat
655: return result;
656: }
657:
658: /**
659: * Donne le prenom d'un utilisateur d'un projet a partir de son login
660: * @param userLogin
661: * @return
662: */
663: public String getUserFirstName(String userLogin) {
664: String result = null;
665: DataSet stmtRes = null;
666: try {
667: // On execute la requete
668: PreparedStatement prep = database.prepareStatement(prop
669: .getProperty("selectUserFromLogin"));
670: prep.setString(1, userLogin);
671: stmtRes = new DataSet(prep.executeQuery());
672: if (stmtRes.getResults().next()) {
673: result = stmtRes.getResults().getString(
674: "prenom_personne");
675: }
676: } catch (SQLException e) {
677: e.printStackTrace();
678: org.objectweb.salome_tmf.api.Api.addException(
679: "selectUserFromLogin", null, e);
680: } catch (Exception ex) {
681: ex.printStackTrace();
682: org.objectweb.salome_tmf.api.Api.addException(null, null,
683: ex);
684: }
685:
686: // On retourne le resultat
687: return result;
688: }
689:
690: /**
691: * Donne l'E-mail d'un utilisateur d'un projet a partir de son login
692: * @param userLogin
693: * @return
694: */
695: public String getUserEmail(String userLogin) {
696: String result = null;
697: DataSet stmtRes = null;
698: try {
699: // On execute la requete
700: PreparedStatement prep = database.prepareStatement(prop
701: .getProperty("selectUserFromLogin"));
702: prep.setString(1, userLogin);
703: stmtRes = new DataSet(prep.executeQuery());
704: if (stmtRes.getResults().next()) {
705: result = stmtRes.getResults().getString(
706: "email_personne");
707: }
708: } catch (SQLException e) {
709: e.printStackTrace();
710: org.objectweb.salome_tmf.api.Api.addException(
711: "selectUserFromLogin", null, e);
712: } catch (Exception ex) {
713: ex.printStackTrace();
714: org.objectweb.salome_tmf.api.Api.addException(null, null,
715: ex);
716: }
717:
718: // On retourne le resultat
719: return result;
720: }
721:
722: /**
723: * Donne le telephone d'un utilisateur d'un projet a partir de son login
724: * @param userLogin
725: * @return
726: */
727: public String getUserTel(String userLogin) {
728: String result = null;
729: DataSet stmtRes = null;
730: try {
731: // On execute la requete
732: PreparedStatement prep = database.prepareStatement(prop
733: .getProperty("selectUserFromLogin"));
734: prep.setString(1, userLogin);
735: stmtRes = new DataSet(prep.executeQuery());
736: if (stmtRes.getResults().next()) {
737: result = stmtRes.getResults().getString("tel_personne");
738: }
739: } catch (SQLException e) {
740: e.printStackTrace();
741: org.objectweb.salome_tmf.api.Api.addException(
742: "selectUserFromLogin", null, e);
743: } catch (Exception ex) {
744: ex.printStackTrace();
745: org.objectweb.salome_tmf.api.Api.addException(null, null,
746: ex);
747: }
748:
749: // On retourne le resultat
750: return result;
751: }
752:
753: /**
754: * Donne la description d'un utilisateur d'un projet a partir de son login
755: * @param userLogin
756: * @return
757: */
758: public String getUserDescription(String userLogin) {
759: String result = null;
760: DataSet stmtRes = null;
761: try {
762: // On execute la requete
763: PreparedStatement prep = database.prepareStatement(prop
764: .getProperty("selectUserFromLogin"));
765: prep.setString(1, userLogin);
766: stmtRes = new DataSet(prep.executeQuery());
767: if (stmtRes.getResults().next()) {
768: result = stmtRes.getResults()
769: .getString("desc_personne");
770: }
771: } catch (SQLException e) {
772: e.printStackTrace();
773: org.objectweb.salome_tmf.api.Api.addException(
774: "selectUserFromLogin", null, e);
775: } catch (Exception ex) {
776: ex.printStackTrace();
777: org.objectweb.salome_tmf.api.Api.addException(null, null,
778: ex);
779: }
780:
781: // On retourne le resultat
782: return result;
783: }
784:
785: /**
786: * Donne le mot de passe d'un utilisateur
787: * @param userLogin un utilisateur
788: * @return le mot de passe
789: */
790: public String getUserPassword(String userLogin) {
791: String result = null;
792: DataSet stmtRes = null;
793: try {
794: // On execute la requete
795: PreparedStatement prep = database.prepareStatement(prop
796: .getProperty("selectUserFromLogin"));
797: prep.setString(1, userLogin);
798: stmtRes = new DataSet(prep.executeQuery());
799: if (stmtRes.getResults().next()) {
800: result = stmtRes.getResults().getString("mot_de_passe");
801: }
802: } catch (SQLException e) {
803: e.printStackTrace();
804: org.objectweb.salome_tmf.api.Api.addException(
805: "selectUserFromLogin", null, e);
806: } catch (Exception ex) {
807: ex.printStackTrace();
808: org.objectweb.salome_tmf.api.Api.addException(null, null,
809: ex);
810: }
811:
812: // On retourne le resultat
813: return result;
814:
815: }
816:
817: /**
818: * Donne les utilisateurs d'un projet
819: * @param projectName
820: * @return le mot de passe
821: */
822: public Hashtable getAllUserOfProject(String projectName) {
823: Hashtable result = new Hashtable();
824: DataSet stmtRes = null;
825: try {
826: // On execute la requete
827: org.objectweb.salome_tmf.api.Api.log("Find user for "
828: + projectName);
829: PreparedStatement prep = database.prepareStatement(prop
830: .getProperty("selectAllProjectUsers"));
831: prep.setString(1, projectName);
832: stmtRes = new DataSet(prep.executeQuery());
833: while (stmtRes.hasMoreElements()) {
834: result.put(stmtRes.getResults().getString(
835: "login_personne"), stmtRes.getResults()
836: .getString("mot_de_passe"));
837: }
838:
839: } catch (SQLException e) {
840: e.printStackTrace();
841: org.objectweb.salome_tmf.api.Api.addException(
842: "selectAllProjectUsers", null, e);
843: } catch (Exception ex) {
844: ex.printStackTrace();
845: org.objectweb.salome_tmf.api.Api.addException(null, null,
846: ex);
847: }
848:
849: // On retourne le resultat
850: return result;
851: }
852:
853: /**
854: * Donne les utilisateurs d'un projet
855: * @param projectName
856: * @return le mot de passe
857: */
858: public Hashtable getAllAdminOfProject(String projectName) {
859: Hashtable result = new Hashtable();
860:
861: DataSet stmtRes = null;
862: try {
863: // On execute la requete
864: org.objectweb.salome_tmf.api.Api.log("Find user for "
865: + projectName);
866: PreparedStatement prep = database.prepareStatement(prop
867: .getProperty("selectAllProjectAdmin"));
868: prep.setString(1, projectName);
869: stmtRes = new DataSet(prep.executeQuery());
870: while (stmtRes.hasMoreElements()) {
871: result.put(stmtRes.getResults().getString(
872: "login_personne"), stmtRes.getResults()
873: .getString("mot_de_passe"));
874: }
875:
876: } catch (SQLException e) {
877: e.printStackTrace();
878: org.objectweb.salome_tmf.api.Api.addException(
879: "selectAllProjectUsers", null, e);
880: } catch (Exception ex) {
881: ex.printStackTrace();
882: org.objectweb.salome_tmf.api.Api.addException(null, null,
883: ex);
884: }
885:
886: // On retourne le resultat
887: return result;
888: }
889:
890: public int getProjetID(String projectName) {
891: int projectID = Utile.getIdProject(database, prop, projectName);
892: return projectID;
893: }
894:
895: public int getPersonID(String personLogin) {
896: int personID = Utile.getIdPerson(database, prop, personLogin);
897: return personID;
898: }
899:
900: public Vector getAllConnection() {
901: Vector res = new Vector();
902: DataSet stmtRes = null;
903: try {
904: PreparedStatement prep = database.prepareStatement(prop
905: .getProperty("selectAllConnections"));
906: stmtRes = new DataSet(prep.executeQuery());
907: while (stmtRes.hasMoreElements()) {
908: ConnectionWrapper pConnectionWrapper = new ConnectionWrapper();
909: pConnectionWrapper.setId(stmtRes.getResults().getInt(
910: "id_connection"));
911: pConnectionWrapper.setProjectConnected(stmtRes
912: .getResults().getString("project_connec"));
913: pConnectionWrapper.setLoginConnected(stmtRes
914: .getResults().getString("login_connec"));
915: pConnectionWrapper.setHostConnected(stmtRes
916: .getResults().getString("host_connec"));
917: pConnectionWrapper.setDateConnected(stmtRes
918: .getResults().getDate("date_connec"));
919: pConnectionWrapper.setTimeConnected(stmtRes
920: .getResults().getTime("hour_connec"));
921: res.add(pConnectionWrapper);
922: }
923: } catch (SQLException e) {
924: e.printStackTrace();
925: org.objectweb.salome_tmf.api.Api.addException(
926: "selectAllConnections", null, e);
927: } catch (Exception ex) {
928: ex.printStackTrace();
929: org.objectweb.salome_tmf.api.Api.addException(null, null,
930: ex);
931: }
932: return res;
933: }
934:
935: public Vector getAllProcess() {
936: Vector res = new Vector();
937: DataSet stmtRes = null;
938: try {
939: PreparedStatement prep = database.prepareStatement(prop
940: .getProperty("selectProcess"));
941: stmtRes = new DataSet(prep.executeQuery());
942: while (stmtRes.hasMoreElements()) {
943: ConnectionWrapper pConnectionWrapper = new ConnectionWrapper();
944: pConnectionWrapper.setId(stmtRes.getResults().getInt(
945: "id_connection"));
946: pConnectionWrapper.setProjectConnected(stmtRes
947: .getResults().getString("project_connec"));
948: pConnectionWrapper.setLoginConnected(stmtRes
949: .getResults().getString("login_connec"));
950: pConnectionWrapper.setHostConnected(stmtRes
951: .getResults().getString("host_connec"));
952: pConnectionWrapper.setDateConnected(stmtRes
953: .getResults().getDate("date_connec"));
954: pConnectionWrapper.setTimeConnected(stmtRes
955: .getResults().getTime("hour_connec"));
956: res.add(pConnectionWrapper);
957: }
958: } catch (SQLException e) {
959: e.printStackTrace();
960: org.objectweb.salome_tmf.api.Api.addException(
961: "selectAllConnections", null, e);
962: } catch (Exception ex) {
963: ex.printStackTrace();
964: org.objectweb.salome_tmf.api.Api.addException(null, null,
965: ex);
966: }
967: return res;
968:
969: }
970: }
|