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, Vincent Pautret, Marche Mikael
020: *
021: * Contact: mikael.marche@rd.francetelecom.com
022: * faycal.sougrati@francetelecom.com
023: */
024:
025: package salomeTMF_plug.bugzilla;
026:
027: import java.net.URL;
028: import java.net.URLEncoder;
029: import java.sql.Date;
030: import java.sql.PreparedStatement;
031: import java.sql.ResultSet;
032: import java.text.DateFormat;
033: import java.util.Locale;
034: import java.util.Vector;
035:
036: import javax.swing.JOptionPane;
037:
038: import org.objectweb.salome_tmf.api.Util;
039: import org.objectweb.salome_tmf.api.sql.IDataBase;
040: import org.objectweb.salome_tmf.data.Attachment;
041: import org.objectweb.salome_tmf.data.Environment;
042: import org.objectweb.salome_tmf.data.Execution;
043: import org.objectweb.salome_tmf.data.ExecutionResult;
044: import org.objectweb.salome_tmf.data.Project;
045: import org.objectweb.salome_tmf.data.Test;
046: import org.objectweb.salome_tmf.data.UrlAttachment;
047: import org.objectweb.salome_tmf.data.User;
048: import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
049: import org.objectweb.salome_tmf.ihm.main.plugins.PluginsTools;
050: import org.objectweb.salome_tmf.plugins.core.BugTracker;
051:
052: import salomeTMF_plug.bugzilla.languages.Language;
053:
054: public class BugZillaTracker_2_16 extends BugZillaTracker {
055: final static String ATTACH_DESC = "[BUGZILLA_2_16_ATTACH]";
056:
057: BugZillaTracker_2_16(IDataBase _iDB, String _bugzilla_host) {
058: super (_iDB, _bugzilla_host);
059: BUGZILLA_STMT_FILE = "/salomeTMF_plug/bugzilla/resources/sql/Bugzilla_Stmts_2_16.properties";
060: BUGZILLA_SUB_MENU = "Bugzilla-2.16";
061: }
062:
063: void init(User pUser, Project pProject) throws Exception {
064: currentUser = pUser;
065: currentProject = pProject;
066:
067: sql_prop = Util.getPropertiesFile(getClass().getResource(
068: BUGZILLA_STMT_FILE));
069: //Set bug user
070: String userEmail = pUser.getEmailFromModel();
071: ResultSet stmtRes = null;
072: PreparedStatement prep = iDB.prepareStatement(sql_prop
073: .getProperty("SelectUsrID"));
074: prep.setString(1, userEmail);
075: stmtRes = prep.executeQuery();
076: if (stmtRes.next()) {
077: Util.log("[BugzillaPlugin] Bugzilla connexion with user : "
078: + userEmail);
079: isCurrentUserExists = true;
080: bugUsrID = stmtRes.getInt("userid");
081: } else {
082: Util
083: .log("[BugzillaPlugin] Current user in Salomé doesn't exist in bugzilla DB : "
084: + userEmail);
085: isCurrentUserExists = false;
086: }
087: }
088:
089: String getBugTrackerAttachDesc() {
090: return ATTACH_DESC;
091: }
092:
093: void addUser(User user) throws Exception {
094: if (isCurrentUserExists) {
095: JOptionPane.showMessageDialog(SalomeTMFContext
096: .getInstance().getSalomeFrame(), Language
097: .getInstance().getText("L'utilisateur_\"")
098: + currentUser.getLoginFromModel()
099: + Language.getInstance().getText(
100: "\"_existe_déjà _dans_Bugzilla"), Language
101: .getInstance().getText("Information..."),
102: JOptionPane.INFORMATION_MESSAGE);
103: } else {
104: int nbTrans = -1;
105:
106: try {
107: nbTrans = SQLUtils.beginTrans();
108: PreparedStatement prep = iDB.prepareStatement(sql_prop
109: .getProperty("AddNewBugUser"));
110: prep.setString(1, user.getEmailFromModel());
111: prep.setString(2, user.getFirstNameFromModel() + " "
112: + user.getLastNameFromModel());
113: prep.setString(3, "");
114: prep.setInt(4, 104);
115: prep.executeUpdate();
116: SQLUtils.commitTrans(nbTrans);
117: bugUsrID = getUserID(user.getEmailFromModel());
118: isCurrentUserExists = true;
119: JOptionPane
120: .showMessageDialog(
121: SalomeTMFContext.getInstance()
122: .getSalomeFrame(),
123: Language.getInstance().getText(
124: "utilisateur_added")
125: + "\n"
126: + Language
127: .getInstance()
128: .getText(
129: "vous_devez_quitter_Salomé_et_vous_reconnecter_pour\n")
130: + Language
131: .getInstance()
132: .getText(
133: "accéder_aux_fonctionnalités_concernées"),
134: Language.getInstance().getText(
135: "Information..."),
136: JOptionPane.INFORMATION_MESSAGE);
137:
138: } catch (Exception e) {
139: e.printStackTrace();
140: SQLUtils.rollBackTrans(nbTrans);
141: throw e;
142: }
143: }
144: }
145:
146: void addProject(Project project) throws Exception {
147: if (!isCurrentUserExists) {
148: JOptionPane
149: .showMessageDialog(
150: SalomeTMFContext.getInstance()
151: .getSalomeFrame(),
152: Language
153: .getInstance()
154: .getText(
155: "creation_projet_avant_creation_utilisateur"),
156: Language.getInstance().getText(
157: "Information..."),
158: JOptionPane.INFORMATION_MESSAGE);
159: } else {
160: if (!isExistsProject(project)) {
161: JOptionPane.showMessageDialog(SalomeTMFContext
162: .getInstance().getSalomeFrame(), Language
163: .getInstance().getText("Le_projet_\"")
164: + currentProject.getNameFromModel()
165: + Language.getInstance().getText(
166: "\"_existe_déjà _dans_Bugzilla"),
167: Language.getInstance()
168: .getText("Information..."),
169: JOptionPane.INFORMATION_MESSAGE);
170: } else {
171: PreparedStatement prep = null;
172: // Adding Salomé TMF project to Bugzilla DB
173: int nbTrans = -1;
174: try {
175: nbTrans = SQLUtils.beginTrans();
176: prep = iDB.prepareStatement(sql_prop
177: .getProperty("AddNewProduct"));
178: prep
179: .setString(1, currentProject
180: .getNameFromModel());
181: prep.setString(2, currentProject
182: .getDescriptionFromModel());
183: prep.setString(3, "---");
184: prep.executeUpdate();
185: SQLUtils.commitTrans(nbTrans);
186: } catch (Exception e) {
187: e.printStackTrace();
188: SQLUtils.rollBackTrans(nbTrans);
189: throw e;
190: }
191:
192: try {
193: nbTrans = SQLUtils.beginTrans();
194: prep = iDB.prepareStatement(sql_prop
195: .getProperty("AddVersion"));
196: prep.setString(1, "Salome_Project");
197: prep
198: .setString(2, currentProject
199: .getNameFromModel());
200: prep.executeUpdate();
201: SQLUtils.commitTrans(nbTrans);
202: } catch (Exception e) {
203: e.printStackTrace();
204: SQLUtils.rollBackTrans(nbTrans);
205: throw e;
206: }
207:
208: try {
209: nbTrans = SQLUtils.beginTrans();
210: prep = iDB.prepareStatement(sql_prop
211: .getProperty("AddMilestones"));
212: prep
213: .setString(1, currentProject
214: .getNameFromModel());
215: prep.setString(2, "---");
216: prep.executeUpdate();
217: SQLUtils.commitTrans(nbTrans);
218: } catch (Exception e) {
219: e.printStackTrace();
220: SQLUtils.rollBackTrans(nbTrans);
221: throw e;
222: }
223:
224: // Adding default environment
225: nbTrans = -1;
226: try {
227: nbTrans = SQLUtils.beginTrans();
228: prep = iDB.prepareStatement(sql_prop
229: .getProperty("AddNewComponent"));
230: prep
231: .setString(1, currentProject
232: .getNameFromModel());
233: prep.setString(2, "___NO_ENV___");
234: prep.setString(3, "[SALOME_DEFAULT_ENVIRONMENT]");
235: prep.setInt(4, bugUsrID);
236: prep.setInt(5, 0);
237: prep.setInt(5, bugUsrID);
238: prep.executeUpdate();
239: SQLUtils.commitTrans(nbTrans);
240: } catch (Exception e) {
241: e.printStackTrace();
242: SQLUtils.rollBackTrans(nbTrans);
243: throw e;
244: }
245:
246: afterAddProject(currentProject);
247:
248: }
249: }
250: }
251:
252: void addEnvironment(Environment environment) throws Exception {
253: int nbTrans = -1;
254: try {
255: nbTrans = SQLUtils.beginTrans();
256: PreparedStatement prep = iDB.prepareStatement(sql_prop
257: .getProperty("AddNewComponent"));
258: prep.setString(1, currentProject.getNameFromModel());
259: prep.setString(2, environment.getNameFromModel().trim());
260: prep.setString(3, environment.getDescriptionFromModel());
261: prep.setInt(4, bugUsrID);
262: prep.setInt(5, 0);
263: prep.setInt(5, bugUsrID);
264: prep.executeUpdate();
265: SQLUtils.commitTrans(nbTrans);
266: validateChange();
267: } catch (Exception e) {
268: e.printStackTrace();
269: SQLUtils.rollBackTrans(nbTrans);
270: throw e;
271: }
272: }
273:
274: void updateEnvironment(String old_component, String new_component,
275: String description) throws Exception {
276: int nbTrans = -1;
277: try {
278: PreparedStatement prep = iDB.prepareStatement(sql_prop
279: .getProperty("SelectBugOfComponent"));
280: prep.setString(1, currentProject.getNameFromModel());
281: prep.setString(2, old_component);
282: ResultSet stmtRes = prep.executeQuery();
283: while (stmtRes.next()) {
284: nbTrans = SQLUtils.beginTrans();
285: prep = iDB.prepareStatement(sql_prop
286: .getProperty("UpdateComponentForBug"));
287: prep.setString(1, new_component.trim());
288: prep.setString(2, old_component.trim());
289:
290: prep.executeUpdate();
291: SQLUtils.commitTrans(nbTrans);
292: }
293:
294: nbTrans = SQLUtils.beginTrans();
295: prep = iDB.prepareStatement(sql_prop
296: .getProperty("UpdateComponent"));
297: prep.setString(1, description);
298: prep.setString(2, new_component);
299: prep.setString(3, currentProject.getNameFromModel());
300: prep.setString(4, old_component);
301: prep.executeUpdate();
302: SQLUtils.commitTrans(nbTrans);
303: validateChange();
304: } catch (Exception e) {
305: e.printStackTrace();
306: SQLUtils.rollBackTrans(nbTrans);
307: throw e;
308: }
309: }
310:
311: void deleteEnvironment(String environment) throws Exception {
312: int nbTrans = -1;
313: try {
314:
315: PreparedStatement prep = iDB.prepareStatement(sql_prop
316: .getProperty("SelectBugOfComponent"));
317: prep.setString(1, currentProject.getNameFromModel());
318: prep.setString(2, environment.trim());
319: ResultSet stmtRes = prep.executeQuery();
320: while (stmtRes.next()) {
321: nbTrans = SQLUtils.beginTrans();
322: prep = iDB.prepareStatement(sql_prop
323: .getProperty("UpdateComponentForBug"));
324: prep.setString(1, "___NO_ENV___");
325: prep.setString(2, environment);
326:
327: prep.executeUpdate();
328: SQLUtils.commitTrans(nbTrans);
329: }
330:
331: nbTrans = SQLUtils.beginTrans();
332: prep = iDB.prepareStatement(sql_prop
333: .getProperty("DeleteComponent"));
334: prep.setString(1, currentProject.getNameFromModel());
335: prep.setString(2, environment);
336: prep.executeUpdate();
337: SQLUtils.commitTrans(nbTrans);
338:
339: validateChange();
340: } catch (Exception e) {
341: e.printStackTrace();
342: SQLUtils.rollBackTrans(nbTrans);
343: throw e;
344: }
345: }
346:
347: Attachment addBug(String long_desc, String assigned_to,
348: String url_attach, String bug_severity, String short_desc,
349: String bug_OS, String bug_priority, String bug_platform,
350: Execution pExec, ExecutionResult pExecRes, Test ptest)
351: throws Exception {
352:
353: if (!isExistsProject(PluginsTools.getCurrentProject())) {
354: JOptionPane.showMessageDialog(SalomeTMFContext
355: .getInstance().getSalomeFrame(), Language
356: .getInstance().getText("Must_create_project"),
357: "Error!", JOptionPane.ERROR_MESSAGE);
358: throw new Exception("[Bugzilla] Project not found");
359: }
360: UrlAttachment bugURL = null;
361: Environment env = pExec.getEnvironmentFromModel();
362: if (env == null) {
363: throw new Exception(
364: "[BugZillaTracker] Can't add Bug to NULL Environment");
365: }
366: try {
367: if (!isExistEnv(currentProject.getNameFromModel(), env
368: .getNameFromModel())) {
369: addEnvironment(env);
370: }
371:
372: int assigned_to_ID = -1;
373: assigned_to_ID = bugUsrID;
374: try {
375: if (!(assigned_to == null) && !(assigned_to.equals(""))) {
376: ResultSet stmtRes;
377: PreparedStatement prep = iDB
378: .prepareStatement(sql_prop
379: .getProperty("SelectUsrID"));
380: prep.setString(1, assigned_to);
381: stmtRes = prep.executeQuery();
382: if (stmtRes.next()) {
383: assigned_to_ID = stmtRes.getInt("userid");
384: }
385: }
386: } catch (Exception e) {
387: }
388:
389: Date creation_ts = Util.getCurrentDate();
390: Locale locale = Locale.getDefault();
391: DateFormat dateFormat = DateFormat.getDateTimeInstance(
392: DateFormat.LONG, DateFormat.LONG, locale);
393: java.util.Date date = new java.util.Date();
394: String myDate = dateFormat.format(date);
395:
396: // Adding the bug
397: int nbTrans = -1;
398: try {
399: nbTrans = SQLUtils.beginTrans();
400: PreparedStatement prep = iDB.prepareStatement(sql_prop
401: .getProperty("AddBug"));
402: prep.setInt(1, assigned_to_ID);
403: prep.setString(2, url_attach);
404: prep.setString(3, bug_severity);
405: prep.setString(4, "NEW");
406: prep.setDate(5, creation_ts);
407: prep.setString(6, short_desc);
408: prep.setString(7, bug_OS);
409: prep.setString(8, bug_priority);
410: prep.setString(9, PluginsTools.getCurrentProject()
411: .getNameFromModel());
412: prep.setString(10, bug_platform);
413: prep.setInt(11, bugUsrID);
414: prep.setString(12, "Salome_Project");
415: prep.setString(13, PluginsTools
416: .getCurrentCampExecutionEnvironment()
417: .getNameFromModel());
418: prep.setString(14, myDate);
419: prep.executeUpdate();
420: SQLUtils.commitTrans(nbTrans);
421: } catch (Exception e) {
422: e.printStackTrace();
423: SQLUtils.rollBackTrans(nbTrans);
424: throw e;
425: }
426:
427: // Shows the bug in Bugzilla
428: int bug_id = -1;
429: try {
430: PreparedStatement prep = iDB.prepareStatement(sql_prop
431: .getProperty("SelectBugID"));
432: prep.setString(1, short_desc);
433: prep.setString(2, PluginsTools.getCurrentProject()
434: .getNameFromModel());
435: prep.setString(3, PluginsTools
436: .getCurrentCampExecutionEnvironment()
437: .getNameFromModel());
438: prep.setDate(4, creation_ts);
439: prep.setString(5, myDate);
440: ResultSet stmtRes = prep.executeQuery();
441: if (stmtRes.next()) {
442: bug_id = stmtRes.getInt("bug_id");
443: Util.log("[BugzillaPlugin]Add bug id = " + bug_id);
444: String url_res = bugzilla_host
445: + "/show_bug.cgi?id=" + bug_id;
446: bugURL = new UrlAttachment(url_res, ATTACH_DESC);
447: }
448: } catch (Exception E) {
449: E.printStackTrace();
450: }
451:
452: if (bug_id != -1) {
453: Util.log("[BugzillaPlugin] Bug_id : " + bug_id);
454: Util.log("[BugzillaPlugin] userID :"
455: + PluginsTools.getCurrentUser().getIdBdd());
456: Util.log("[BugzillaPlugin] creation time : "
457: + creation_ts);
458: Util.log("[BugzillaPlugin] description : " + long_desc);
459:
460: try {
461: nbTrans = SQLUtils.beginTrans();
462: PreparedStatement prep = iDB
463: .prepareStatement(sql_prop
464: .getProperty("AddDescToBUG"));
465: prep.setInt(1, bug_id);
466: prep.setInt(2, bugUsrID);
467: prep.setDate(3, creation_ts);
468: prep.setString(4, long_desc);
469: prep.executeUpdate();
470: SQLUtils.commitTrans(nbTrans);
471: } catch (Exception e) {
472: e.printStackTrace();
473: SQLUtils.rollBackTrans(nbTrans);
474: throw e;
475: }
476: }
477: validateChange();
478:
479: } catch (Exception e) {
480: e.printStackTrace();
481: throw e;
482: }
483:
484: return bugURL;
485: }
486:
487: String getBugID(Attachment pAttachment) {
488: return null;
489: }
490:
491: boolean isExistEnv(String projectName, String envName)
492: throws Exception {
493: boolean ret = true;
494: try {
495: PreparedStatement prep = iDB.prepareStatement(sql_prop
496: .getProperty("SelectComponent"));
497: prep.setString(1, projectName);
498: prep.setString(2, envName.trim());
499: ResultSet stmtRes = prep.executeQuery();
500: if (!stmtRes.next()) {
501: ret = false;
502: }
503: } catch (Exception e) {
504: e.printStackTrace();
505: throw e;
506: }
507: return ret;
508: }
509:
510: void showEnvironmentBugs(Environment env) {
511: String url_res = bugzilla_host
512: + "/buglist.cgi?"
513: + "short_desc_type=allwordssubstr&short_desc="
514: + "&product="
515: + URLEncoder.encode(currentProject.getNameFromModel())
516: + "&component="
517: + URLEncoder.encode(env.getNameFromModel())
518: + "&version="
519: + "&long_desc_type=allwordssubstr&long_desc="
520: + "&bug_file_loc_type=allwordssubstr&bug_file_loc="
521: + "&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"
522: + "&bug_status=UNCONFIRMED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED"
523: + "&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailcc2=1"
524: + "&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&changedin=&chfieldfrom=&chfieldto=Now"
525: + "&chfieldvalue=&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0=";
526:
527: //String url_res = bugzilla_host + "/buglist.cgi?" +
528: //"short_desc_type=allwordssubstr&short_desc=" +
529: //&product=D%E9mo_04022006&component=eShopFree&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0=
530: try {
531: //applet.getAppletContext().showDocument(new URL(url_res), getBugTrackerName());
532: SalomeTMFContext.getInstance().getBaseIHM().showDocument(
533: new URL(url_res), getBugTrackerName());
534: } catch (Exception e) {
535: e.printStackTrace();
536: }
537: }
538:
539: int getEnvironmentNbBugs(Environment env, int severity,
540: boolean onlyCorretedBugs) {
541: int res = 0;
542: String severity_str = "";
543: if (severity == BugTracker.CRITICAL) {
544: severity_str = BLOCKER_STR;
545: } else if (severity == BugTracker.MAJOR) {
546: severity_str = CRITICAL_STR;
547: }
548:
549: try {
550: ResultSet stmtRes;
551: PreparedStatement prep;
552: if (onlyCorretedBugs) {
553: prep = iDB.prepareStatement(sql_prop
554: .getProperty("SelectCorretedBugsBySeverity"));
555: prep.setString(1, CORRECTED_STR);
556: prep.setString(2, severity_str);
557: prep.setString(3, env.getNameFromModel());
558: stmtRes = prep.executeQuery();
559: while (stmtRes.next()) {
560: res++;
561: }
562: } else {
563: prep = iDB.prepareStatement(sql_prop
564: .getProperty("SelectBugsBySeverity"));
565: prep.setString(1, severity_str);
566: prep.setString(2, env.getNameFromModel());
567: stmtRes = prep.executeQuery();
568: while (stmtRes.next()) {
569: res++;
570: }
571: }
572: } catch (Exception E) {
573: E.printStackTrace();
574: }
575:
576: return res;
577: }
578:
579: /**************************************************************************************************************/
580: int getUserID(String login) throws Exception {
581: int pID = -1;
582: PreparedStatement prep = iDB.prepareStatement(sql_prop
583: .getProperty("SelectUsrID"));
584: prep.setString(1, login);
585: ResultSet stmtRes = prep.executeQuery();
586: if (stmtRes.next()) {
587: pID = stmtRes.getInt("userid");
588: }
589: return pID;
590: }
591:
592: Vector getBugOSList() {
593: Vector list = new Vector();
594:
595: try {
596: ResultSet stmtRes;
597: PreparedStatement prep = iDB.prepareStatement(sql_prop
598: .getProperty("SelectBugsFields"));
599: stmtRes = prep.executeQuery();
600: String field = "";
601: while ((!field.equals("op_sys")) && (stmtRes.next())) {
602: field = stmtRes.getString("Field");
603: }
604: list = getEnumField(stmtRes.getString("Type"));
605: } catch (Exception E) {
606: E.printStackTrace();
607: }
608:
609: return list;
610: }
611:
612: Vector getBugPriorityList() {
613: Vector list = new Vector();
614:
615: try {
616: ResultSet stmtRes;
617: PreparedStatement prep = iDB.prepareStatement(sql_prop
618: .getProperty("SelectBugsFields"));
619: stmtRes = prep.executeQuery();
620: String field = "";
621: while ((!field.equals("priority")) && (stmtRes.next())) {
622: field = stmtRes.getString("Field");
623: }
624: list = getEnumField(stmtRes.getString("Type"));
625: } catch (Exception E) {
626: E.printStackTrace();
627: }
628:
629: return list;
630: }
631:
632: Vector getBugPlateformList() {
633: Vector list = new Vector();
634:
635: try {
636: ResultSet stmtRes;
637: PreparedStatement prep = iDB.prepareStatement(sql_prop
638: .getProperty("SelectBugsFields"));
639: stmtRes = prep.executeQuery();
640: String field = "";
641: while ((!field.equals("rep_platform")) && (stmtRes.next())) {
642: field = stmtRes.getString("Field");
643: }
644: list = getEnumField(stmtRes.getString("Type"));
645: } catch (Exception E) {
646: E.printStackTrace();
647: }
648:
649: return list;
650: }
651:
652: Vector getBugSeverityList() {
653: Vector list = new Vector();
654:
655: try {
656: ResultSet stmtRes;
657: PreparedStatement prep = iDB.prepareStatement(sql_prop
658: .getProperty("SelectBugsFields"));
659: stmtRes = prep.executeQuery();
660: String field = "";
661: while ((!field.equals("bug_severity")) && (stmtRes.next())) {
662: field = stmtRes.getString("Field");
663: }
664: list = getEnumField(stmtRes.getString("Type"));
665: } catch (Exception E) {
666: E.printStackTrace();
667: }
668:
669: return list;
670: }
671:
672: boolean isExistsProject(Project project) {
673: boolean res = false;
674: try {
675: PreparedStatement prep = iDB.prepareStatement(sql_prop
676: .getProperty("SelectProduct"));
677: prep.setString(1, currentProject.getNameFromModel());
678: ResultSet stmtRes = prep.executeQuery();
679: if (stmtRes.next()) {
680: res = true;
681: }
682: } catch (Exception e) {
683: e.printStackTrace();
684: }
685: return res;
686: }
687: }
|