Source Code Cross Referenced for AdminProjectDeleteImpl.java in  » Test-Coverage » salome-tmf » org » objectweb » salome_tmf » api » api2ihm » adminProject » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Test Coverage » salome tmf » org.objectweb.salome_tmf.api.api2ihm.adminProject 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:        package org.objectweb.salome_tmf.api.api2ihm.adminProject;
024:
025:        import java.sql.PreparedStatement;
026:        import java.sql.SQLException;
027:        import java.util.Properties;
028:
029:        import org.objectweb.salome_tmf.api.api2db.DataBase;
030:        import org.objectweb.salome_tmf.api.api2db.DataSet;
031:        import org.objectweb.salome_tmf.api.api2ihm.Utile;
032:
033:        /**
034:         * Fonctions de suppression relatives e l'aire fonctionnelle "Administrer un projet"
035:         */
036:
037:        public class AdminProjectDeleteImpl implements  AdminProjectDelete {
038:            /**
039:             * Base de donnees
040:             */
041:            DataBase database;
042:
043:            /**
044:             * Fichier "properties" contenant les requetes SQL relatives aux suites de test
045:             */
046:            Properties prop;
047:
048:            /**
049:             * ID du projet SalomeTMF dans lequel on se situe
050:             */
051:            int idProject;
052:
053:            /**
054:             * Nom du projet SalomeTMF dans lequel on se situe
055:             */
056:            String nameProject;
057:
058:            /**
059:             * Constructeur
060:             * @param db
061:             * @param pr
062:             */
063:            public AdminProjectDeleteImpl(DataBase db, Properties pr) {
064:                database = db;
065:                prop = pr;
066:            }
067:
068:            /**
069:             * Fonction qui fixe le projet SalomeTMF dans lequel l'utilisateur travaille
070:             * @param projectName
071:             */
072:            public void setProject(String projectName) {
073:                nameProject = projectName;
074:                idProject = Utile.getIdProject(database, prop, projectName);
075:            }
076:
077:            /**
078:             * Suppression d'un utilisateur d'un groupe du projet
079:             * @param userLogin
080:             * @param groupName
081:             */
082:            public void deleteUserFromGroup(String userLogin, String groupName) {
083:                int userId = -1;
084:                int groupId = -1;
085:
086:                int _num = -1;
087:                try {
088:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
089:
090:                    // Initialisation de l'ID de l'utilisateur
091:                    userId = Utile.getIdPerson(database, prop, userLogin);
092:
093:                    // Initialisation de l'ID du groupe
094:                    groupId = Utile.getIdGroup(database, prop, idProject,
095:                            groupName);
096:
097:                    //	Suppression de l'utilisateur du groupe
098:                    PreparedStatement prep = database.prepareStatement(prop
099:                            .getProperty("deleteUserFromGroup"));
100:                    prep.setInt(1, userId);
101:                    prep.setInt(2, groupId);
102:                    prep.executeUpdate();
103:
104:                } catch (SQLException e) {
105:                    e.printStackTrace();
106:                    org.objectweb.salome_tmf.api.Api.addException(
107:                            "deleteUserFromGroup", null, e);
108:                } catch (Exception ex) {
109:                    ex.printStackTrace();
110:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
111:                            ex);
112:                }
113:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
114:            }
115:
116:            /**
117:             * Suppression d'un utilisateur d'un projet
118:             * @param userLogin
119:             */
120:            public void deleteUserFromProject(String userLogin) {
121:                //int userId = -1;
122:                DataSet stmtRes = null;
123:
124:                int _num = -1;
125:                try {
126:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
127:
128:                    // On initialise l'Id de l'utilisateur
129:                    //userId = Utile.getIdPerson(database,prop,userLogin);
130:                    //	On recupere les groupes du projet
131:                    PreparedStatement prep = database.prepareStatement(prop
132:                            .getProperty("selectAllProjectGroupsName"));
133:                    prep.setInt(1, idProject);
134:                    stmtRes = new DataSet(prep.executeQuery());
135:                    while (stmtRes.hasMoreElements()) {
136:                        // On enleve l'utilisateur de chaque groupe du projet
137:                        deleteUserFromGroup(userLogin, stmtRes.getResults()
138:                                .getString("nom_groupe"));
139:                    }
140:                } catch (SQLException e) {
141:                    e.printStackTrace();
142:                    org.objectweb.salome_tmf.api.Api.addException(
143:                            "selectAllProjectGroupsName", null, e);
144:                } catch (Exception ex) {
145:                    ex.printStackTrace();
146:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
147:                            ex);
148:                }
149:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
150:            }
151:
152:            /**
153:             * Suppression d'un groupe d'utilisateurs d'un projet
154:             * @param groupName
155:             */
156:            public void deleteGroup(String groupName) {
157:                int groupId = -1;
158:                String sql = null;
159:                int _num = -1;
160:                try {
161:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
162:
163:                    // Initialisation de l'ID du groupe
164:                    groupId = Utile.getIdGroup(database, prop, idProject,
165:                            groupName);
166:                    sql = "deleteGroupUsers";
167:                    // Suppression des utilisateurs du groupe
168:                    PreparedStatement prep = database.prepareStatement(prop
169:                            .getProperty("deleteGroupUsers"));
170:                    prep.setInt(1, groupId);
171:                    prep.executeUpdate();
172:
173:                    sql = "deleteGroup";
174:                    // Suppression du groupe
175:                    prep = database.prepareStatement(prop
176:                            .getProperty("deleteGroup"));
177:                    prep.setInt(1, idProject);
178:                    prep.setInt(2, groupId);
179:                    prep.executeUpdate();
180:                } catch (SQLException e) {
181:                    e.printStackTrace();
182:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, e);
183:                } catch (Exception ex) {
184:                    ex.printStackTrace();
185:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
186:                            ex);
187:                }
188:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
189:            }
190:
191:            /**
192:             * Suppression d'un projet
193:             * @param projectName
194:             */
195:            public void deleteProject() {
196:                String sql = null;
197:                int _num = -1;
198:                try {
199:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
200:
201:                    DataSet stmtRes = null;
202:                    org.objectweb.salome_tmf.api.api2ihm.suiteTest.SuiteTestDelete st_d = org.objectweb.salome_tmf.api.Api
203:                            .getInstanceOfSuiteTest().getSuiteTestDelete();
204:                    st_d.setProject(nameProject);
205:                    sql = "selectFamilleOfProject";
206:                    PreparedStatement prep = database.prepareStatement(prop
207:                            .getProperty("selectFamilleOfProject"));
208:                    prep.setInt(1, idProject);
209:                    stmtRes = new DataSet(prep.executeQuery());
210:                    if (stmtRes.hasMoreElements()) {
211:                        int idFamily = stmtRes.getResults()
212:                                .getInt("id_famille");
213:                        String name = stmtRes.getResults().getString(
214:                                "nom_famille");
215:                        ((org.objectweb.salome_tmf.api.api2ihm.suiteTest.SuiteTestDeleteImpl) st_d)
216:                                .deleteFamily(idFamily, name);
217:                    }
218:
219:                    sql = "deleteCampFromProject";
220:                    prep = database.prepareStatement(prop
221:                            .getProperty("deleteCampFromProject"));
222:                    prep.setInt(1, idProject);
223:                    prep.executeUpdate();
224:
225:                } catch (SQLException e) {
226:                    e.printStackTrace();
227:                    org.objectweb.salome_tmf.api.Api.addException(sql, null, e);
228:                } catch (Exception ex) {
229:                    ex.printStackTrace();
230:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
231:                            ex);
232:                }
233:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
234:            }
235:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.