Source Code Cross Referenced for AdminProjectInsertImpl.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.api2ihm.Utile;
031:
032:        /**
033:         * Fonctions d'insertion relatives e l'aire fonctionnelle "Administrer un projet"
034:         */
035:
036:        public class AdminProjectInsertImpl implements  AdminProjectInsert {
037:            /**
038:             * Base de donnees
039:             */
040:            DataBase database;
041:
042:            /**
043:             * Fichier "properties" contenant les requetes SQL relatives aux suites de test
044:             */
045:            Properties prop;
046:
047:            /**
048:             * ID du projet SalomeTMF dans lequel on se situe
049:             */
050:            int idProject;
051:
052:            /**
053:             * Nom du projet SalomeTMF dans lequel on se situe
054:             */
055:            String nameProject;
056:
057:            /**
058:             * Constructeur
059:             * @param db
060:             * @param pr
061:             */
062:            public AdminProjectInsertImpl(DataBase db, Properties pr) {
063:                database = db;
064:                prop = pr;
065:            }
066:
067:            /**
068:             * Fonction qui fixe le projet SalomeTMF dans lequel l'utilisateur travaille
069:             * @param projectName
070:             */
071:            public void setProject(String projectName) {
072:                nameProject = projectName;
073:                idProject = Utile.getIdProject(database, prop, projectName);
074:            }
075:
076:            /**
077:             * Ajout d'un groupe d'utilisateurs a un projet
078:             * @param groupName
079:             * @param groupDesc
080:             */
081:            public void addGroupToProject(String groupName, String groupDesc) {
082:
083:                int _num = -1;
084:                try {
085:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
086:
087:                    PreparedStatement prep = database.prepareStatement(prop
088:                            .getProperty("addGroupToProject"));
089:                    prep.setInt(1, idProject);
090:                    prep.setString(2, groupName);
091:                    prep.setString(3, groupDesc);
092:
093:                    prep.executeUpdate();
094:                } catch (SQLException E) {
095:                    E.printStackTrace();
096:                    org.objectweb.salome_tmf.api.Api.addException(
097:                            "addGroupToProject", null, E);
098:                } catch (Exception ex) {
099:                    ex.printStackTrace();
100:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
101:                            ex);
102:                }
103:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
104:            }
105:
106:            /**
107:             * Fonction qui ajoute un utilisateur a un groupe existent
108:             * @param userLogin
109:             * @param groupName
110:             * @param description
111:             */
112:            public void addUserToGroup(String userLogin, String groupName,
113:                    String description) {
114:                int userId = 0;
115:                int groupId = 0;
116:
117:                // On initialise l'ID de l'utilisateur et celui du groupe
118:                userId = Utile.getIdPerson(database, prop, userLogin);
119:                groupId = Utile
120:                        .getIdGroup(database, prop, idProject, groupName);
121:
122:                // on ajoute ensuite l'utilisateur au groupe
123:
124:                int _num = -1;
125:                try {
126:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
127:
128:                    PreparedStatement prep = database.prepareStatement(prop
129:                            .getProperty("addUserToGroup"));
130:                    prep.setInt(1, userId);
131:                    prep.setInt(2, groupId);
132:                    prep.setString(3, description);
133:                    prep.executeUpdate();
134:                } catch (SQLException E) {
135:                    E.printStackTrace();
136:                    org.objectweb.salome_tmf.api.Api.addException(
137:                            "addUserToGroup", null, E);
138:                } catch (Exception ex) {
139:                    ex.printStackTrace();
140:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
141:                            ex);
142:                }
143:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
144:            }
145:
146:            /**
147:             * Ajout d'un parametre au projet dans la BdD SalomeTMF
148:             * @param paramName
149:             * @param paramDescription
150:             */
151:            public void addParamToProject(String paramName,
152:                    String paramDescription) {
153:                int _num = -1;
154:                try {
155:                    _num = org.objectweb.salome_tmf.api.Api.beginTrans();
156:
157:                    // on appelle la requete a executer
158:                    PreparedStatement prep = database.prepareStatement(prop
159:                            .getProperty("addParamToProject"));
160:                    prep.setInt(1, idProject);
161:                    prep.setString(2, paramName);
162:                    prep.setString(3, paramDescription);
163:
164:                    prep.executeUpdate();
165:                } catch (SQLException E) {
166:                    E.printStackTrace();
167:                    org.objectweb.salome_tmf.api.Api.addException(
168:                            "addParamToProject", null, E);
169:                } catch (Exception ex) {
170:                    ex.printStackTrace();
171:                    org.objectweb.salome_tmf.api.Api.addException(null, null,
172:                            ex);
173:                }
174:                org.objectweb.salome_tmf.api.Api.commitTrans(_num);
175:            }
176:
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.