Source Code Cross Referenced for SQLCommon.java in  » Test-Coverage » salome-tmf » salomeTMF_plug » requirements » sqlWrapper » 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 » salomeTMF_plug.requirements.sqlWrapper 
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 Marche Mikael
020:         *
021:         * Contact: mikael.marche@rd.francetelecom.com
022:         */
023:
024:        package salomeTMF_plug.requirements.sqlWrapper;
025:
026:        import java.sql.PreparedStatement;
027:        import java.sql.ResultSet;
028:
029:        import org.objectweb.salome_tmf.api.Api;
030:        import org.objectweb.salome_tmf.api.sql.ISQLConfig;
031:
032:        public class SQLCommon {
033:
034:            public void installPlugin() throws Exception {
035:                PreparedStatement prep = SQLWrapper
036:                        .getSQLCommonQuery("showTable"); //ok
037:                ResultSet stmtRes = SQLWrapper.runSelectQuery(prep);
038:                boolean trouve = false;
039:                while (stmtRes.next() && !trouve) {
040:                    String tableName = stmtRes.getString(1);
041:                    String nomTable = "REQUIREMENTS";
042:                    if (tableName.equals(nomTable)
043:                            || tableName.equals(nomTable.toLowerCase())) {
044:                        trouve = true;
045:                    }
046:                }
047:                if (trouve == false) {
048:                    //INSTALL TABLE OF PLUGINS
049:                    int transNumber = -1;
050:                    try {
051:                        transNumber = SQLWrapper.beginTransaction();
052:
053:                        prep = SQLWrapper.getSQLCommonQuery("createTableReq"); //ok
054:                        SQLWrapper.runAddQuery(prep);
055:
056:                        prep = SQLWrapper
057:                                .getSQLCommonQuery("createTableReqAttach"); //ok
058:                        SQLWrapper.runAddQuery(prep);
059:
060:                        prep = SQLWrapper
061:                                .getSQLCommonQuery("createTableReqLink"); //ok
062:                        SQLWrapper.runAddQuery(prep);
063:
064:                        prep = SQLWrapper
065:                                .getSQLCommonQuery("createTableHistory"); //ok
066:                        SQLWrapper.runAddQuery(prep);
067:
068:                        prep = SQLWrapper
069:                                .getSQLCommonQuery("createTableReqReference"); //ok
070:                        SQLWrapper.runAddQuery(prep);
071:
072:                        prep = SQLWrapper
073:                                .getSQLCommonQuery("createTableReqLinkAction"); //ok
074:                        SQLWrapper.runAddQuery(prep);
075:
076:                        SQLWrapper.commitTrans(transNumber);
077:                    } catch (Exception e) {
078:                        SQLWrapper.rollBackTrans(transNumber);
079:                        throw e;
080:                    }
081:                    try {
082:                        ISQLConfig pISQLConfig = Api.getISQLObjectFactory()
083:                                .getISQLConfig();
084:                        pISQLConfig.insertSalomeConf("req_plug_version", "1.4");
085:                    } catch (Exception e) {
086:
087:                    }
088:                } else {
089:                    // UPDATE PLUGINS
090:                    ISQLConfig pISQLConfig = Api.getISQLObjectFactory()
091:                            .getISQLConfig();
092:                    String version = pISQLConfig
093:                            .getSalomeConf("req_plug_version");
094:                    int transNumber = -1;
095:                    if (version == null) {
096:                        try {
097:                            transNumber = SQLWrapper.beginTransaction();
098:                            //UPDATE TABLE 1.2
099:                            prep = SQLWrapper
100:                                    .getSQLCommonQuery("addPriorityFiled"); //ok
101:                            SQLWrapper.runAddQuery(prep);
102:
103:                            prep = SQLWrapper
104:                                    .getSQLCommonQuery("addVersionField"); //ok
105:                            SQLWrapper.runAddQuery(prep);
106:
107:                            //1.3
108:                            prep = SQLWrapper.getSQLCommonQuery("addCatField"); //ok
109:                            SQLWrapper.runAddQuery(prep);
110:
111:                            prep = SQLWrapper
112:                                    .getSQLCommonQuery("addComplexField"); //ok
113:                            SQLWrapper.runAddQuery(prep);
114:
115:                            prep = SQLWrapper
116:                                    .getSQLCommonQuery("addOrigineField"); //ok
117:                            SQLWrapper.runAddQuery(prep);
118:
119:                            prep = SQLWrapper
120:                                    .getSQLCommonQuery("addStateField"); //ok
121:                            SQLWrapper.runAddQuery(prep);
122:
123:                            prep = SQLWrapper
124:                                    .getSQLCommonQuery("addVerifeField"); //ok
125:                            SQLWrapper.runAddQuery(prep);
126:
127:                            prep = SQLWrapper
128:                                    .getSQLCommonQuery("addReferenceField"); //ok
129:                            SQLWrapper.runAddQuery(prep);
130:
131:                            //1.4
132:                            prep = SQLWrapper
133:                                    .getSQLCommonQuery("createTableHistory"); //ok
134:                            SQLWrapper.runAddQuery(prep);
135:
136:                            prep = SQLWrapper
137:                                    .getSQLCommonQuery("createTableReqReference"); //ok
138:                            SQLWrapper.runAddQuery(prep);
139:
140:                            prep = SQLWrapper
141:                                    .getSQLCommonQuery("createTableReqLinkAction"); //ok
142:                            SQLWrapper.runAddQuery(prep);
143:
144:                            //UPDATE VALUE
145:                            SQLWrapper.commitTrans(transNumber);
146:                        } catch (Exception e) {
147:                            SQLWrapper.rollBackTrans(transNumber);
148:                            throw e;
149:                        }
150:                        try {
151:                            pISQLConfig.insertSalomeConf("req_plug_version",
152:                                    "1.4");
153:                        } catch (Exception e) {
154:
155:                        }
156:                    } else if (version.equals("1.2")) {
157:                        try {
158:                            transNumber = SQLWrapper.beginTransaction();
159:
160:                            //UPDATE TABLE FROM 1.3
161:                            prep = SQLWrapper.getSQLCommonQuery("addCatField"); //ok
162:                            SQLWrapper.runAddQuery(prep);
163:
164:                            prep = SQLWrapper
165:                                    .getSQLCommonQuery("addComplexField"); //ok
166:                            SQLWrapper.runAddQuery(prep);
167:
168:                            prep = SQLWrapper
169:                                    .getSQLCommonQuery("addOrigineField"); //ok
170:                            SQLWrapper.runAddQuery(prep);
171:
172:                            prep = SQLWrapper
173:                                    .getSQLCommonQuery("addStateField"); //ok
174:                            SQLWrapper.runAddQuery(prep);
175:
176:                            prep = SQLWrapper
177:                                    .getSQLCommonQuery("addVerifeField"); //ok
178:                            SQLWrapper.runAddQuery(prep);
179:
180:                            prep = SQLWrapper
181:                                    .getSQLCommonQuery("addReferenceField"); //ok
182:                            SQLWrapper.runAddQuery(prep);
183:
184:                            //FROM 1.4
185:                            prep = SQLWrapper
186:                                    .getSQLCommonQuery("createTableHistory"); //ok
187:                            SQLWrapper.runAddQuery(prep);
188:
189:                            prep = SQLWrapper
190:                                    .getSQLCommonQuery("createTableReqReference"); //ok
191:                            SQLWrapper.runAddQuery(prep);
192:
193:                            prep = SQLWrapper
194:                                    .getSQLCommonQuery("createTableReqLinkAction"); //ok
195:                            SQLWrapper.runAddQuery(prep);
196:
197:                            //UPDATE VALUE
198:                            SQLWrapper.commitTrans(transNumber);
199:                        } catch (Exception e) {
200:                            SQLWrapper.rollBackTrans(transNumber);
201:                            throw e;
202:                        }
203:                        try {
204:                            pISQLConfig.updateSalomeConf("req_plug_version",
205:                                    "1.4");
206:                        } catch (Exception e) {
207:
208:                        }
209:                    } else if (version.equals("1.3")) {
210:                        try {
211:                            transNumber = SQLWrapper.beginTransaction();
212:
213:                            //FROM 1.4
214:                            prep = SQLWrapper
215:                                    .getSQLCommonQuery("createTableHistory"); //ok
216:                            SQLWrapper.runAddQuery(prep);
217:
218:                            prep = SQLWrapper
219:                                    .getSQLCommonQuery("createTableReqReference"); //ok
220:                            SQLWrapper.runAddQuery(prep);
221:
222:                            prep = SQLWrapper
223:                                    .getSQLCommonQuery("createTableReqLinkAction"); //ok
224:                            SQLWrapper.runAddQuery(prep);
225:
226:                            //UPDATE VALUE
227:                            SQLWrapper.commitTrans(transNumber);
228:                        } catch (Exception e) {
229:                            SQLWrapper.rollBackTrans(transNumber);
230:                            throw e;
231:                        }
232:                        try {
233:                            pISQLConfig.updateSalomeConf("req_plug_version",
234:                                    "1.4");
235:                        } catch (Exception e) {
236:
237:                        }
238:                    }
239:
240:                }
241:            }
242:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.