Source Code Cross Referenced for Procedure.java in  » IDE-Netbeans » sql.project » org » netbeans » modules » jdbcwizard » builder » 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 » IDE Netbeans » sql.project » org.netbeans.modules.jdbcwizard.builder 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         * 
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:         * 
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         * 
015:         * The Original Software is NetBeans. The Initial Developer of the Original
016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017:         * Microsystems, Inc. All Rights Reserved.
018:         */
019:
020:        /*
021:         * 
022:         * Copyright 2005 Sun Microsystems, Inc.
023:         * 
024:         * Licensed under the Apache License, Version 2.0 (the "License");
025:         * you may not use this file except in compliance with the License.
026:         * You may obtain a copy of the License at
027:         * 
028:         * 	http://www.apache.org/licenses/LICENSE-2.0
029:         * 
030:         * Unless required by applicable law or agreed to in writing, software
031:         * distributed under the License is distributed on an "AS IS" BASIS,
032:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
033:         * See the License for the specific language governing permissions and
034:         * limitations under the License.
035:         * 
036:         */
037:        package org.netbeans.modules.jdbcwizard.builder;
038:
039:        import java.util.ArrayList;
040:        import java.util.Iterator;
041:
042:        /**
043:         * Class to hold procedure metadata.
044:         * 
045:         * @author
046:         */
047:        public class Procedure {
048:            /** Procedure type */
049:            public static final String PROCEDURE = "PROCEDURE";
050:
051:            /** Function type */
052:            public static final String FUNCTION = "FUNCTION";
053:
054:            /** Unknown type */
055:            public static final String UNKNOWN = "UNKNOWN";
056:
057:            /** Parameter type IN */
058:            public static final String IN = "IN";
059:
060:            /** Parameter type IN/OUT */
061:            public static final String INOUT = "INOUT";
062:
063:            /** Parameter type OUT */
064:            public static final String OUT = "OUT";
065:
066:            /** Parameter type RETURN */
067:            public static final String RETURN = "RETURN";
068:
069:            /** Parameter type RESULT */
070:            public static final String RESULT = "RESULT";
071:
072:            /** Procedure types */
073:            public static final String[] PROCTYPES = { Procedure.PROCEDURE,
074:                    Procedure.FUNCTION, Procedure.UNKNOWN };
075:
076:            /** Procedure parameter types */
077:            public static final String[] PARAMTYPES = { Procedure.IN,
078:                    Procedure.INOUT, Procedure.OUT, Procedure.RETURN,
079:                    Procedure.RESULT };
080:
081:            private String name = ""; // original name of procedure
082:
083:            private String javaName = ""; // java name of procedure
084:
085:            private String catalog = ""; // catalog
086:
087:            private String schema = ""; // schema
088:
089:            private String type = ""; // type: PROCEDURE, FUNCTION, UNKNOWN
090:
091:            private int numParameters = 0; // number of parameters
092:
093:            private Parameter[] parameters; // array of parameters
094:
095:            private boolean hasReturn = false; // indicates whether has any out parameters
096:
097:            /**
098:             * Creates an instance of Procedure with the given attributes.
099:             * 
100:             * @param pname Procedure name
101:             * @param pcatalog Catalog name
102:             * @param pschema Schema name
103:             * @param ptype Procedure type
104:             */
105:            public Procedure(final String pname, final String pcatalog,
106:                    final String pschema, final String ptype) {
107:                this .name = pname;
108:                this .catalog = pcatalog;
109:                this .schema = pschema;
110:                this .type = ptype;
111:            }
112:
113:            /**
114:             * Creates an instance of Procedure with the given attributes.
115:             * 
116:             * @param pname Procedure name
117:             * @param jname Procedure java name
118:             * @param pcatalog Catalog name
119:             * @param pschema Schema name
120:             * @param ptype Procedure type
121:             */
122:            public Procedure(final String pname, final String jname,
123:                    final String pcatalog, final String pschema,
124:                    final String ptype) {
125:                this .name = pname;
126:                this .javaName = jname;
127:                this .catalog = pcatalog;
128:                this .schema = pschema;
129:                this .type = ptype;
130:            }
131:
132:            public Procedure(final Procedure p) {
133:                this .name = p.getName();
134:                this .javaName = p.getJavaName();
135:                this .catalog = p.getCatalog();
136:                this .schema = p.getSchema();
137:                this .type = p.getType();
138:                this .hasReturn = p.getHasReturn();
139:                this .cloneParameters(p.getParameters());
140:            }
141:
142:            /**
143:             * Get the procedure name.
144:             * 
145:             * @return Procedure name
146:             */
147:            public String getName() {
148:                return this .name;
149:            }
150:
151:            /**
152:             * Get the procedure java name.
153:             * 
154:             * @return Procedure java name
155:             */
156:            public String getJavaName() {
157:                return this .javaName;
158:            }
159:
160:            /**
161:             * Get the catalog name.
162:             * 
163:             * @return Catalog name
164:             */
165:            public String getCatalog() {
166:                return this .catalog;
167:            }
168:
169:            /**
170:             * Get the schema name.
171:             * 
172:             * @return Schema name
173:             */
174:            public String getSchema() {
175:                return this .schema;
176:            }
177:
178:            /**
179:             * Get the Procedure type.
180:             * 
181:             * @return Procedure type
182:             */
183:            public String getType() {
184:                return this .type;
185:            }
186:
187:            /**
188:             * Get the number of procedure parameters.
189:             * 
190:             * @return Number of procedure parameters
191:             */
192:            public int getNumParameters() {
193:                return this .numParameters;
194:            }
195:
196:            /**
197:             * Get the procedure parameter list.
198:             * 
199:             * @return Procedure parameter list
200:             */
201:            public Parameter[] getParameters() {
202:                return this .parameters;
203:            }
204:
205:            /**
206:             * Indicates whether the procedure has a return.
207:             * 
208:             * @return Indicates whether the procedure has a return.
209:             */
210:            public boolean getHasReturn() {
211:                return this .hasReturn;
212:            }
213:
214:            /**
215:             * Set the procedure name.
216:             * 
217:             * @param newName Procedure name
218:             */
219:            public void setName(final String newName) {
220:                this .name = newName;
221:            }
222:
223:            /**
224:             * Set the procedure java name.
225:             * 
226:             * @param newJavaName Procedure java name
227:             */
228:            public void setJavaName(final String newJavaName) {
229:                this .javaName = newJavaName;
230:            }
231:
232:            /**
233:             * Set the catalog name.
234:             * 
235:             * @param newCatalog Catalog name
236:             */
237:            public void setCatalog(final String newCatalog) {
238:                this .catalog = newCatalog;
239:            }
240:
241:            /**
242:             * Set the schema name.
243:             * 
244:             * @param newSchema Schema name
245:             */
246:            public void setSchema(final String newSchema) {
247:                this .schema = newSchema;
248:            }
249:
250:            /**
251:             * Set the procedure type.
252:             * 
253:             * @param newType Procedure type
254:             */
255:            public void setType(final String newType) {
256:                this .type = newType;
257:            }
258:
259:            /**
260:             * Set the procedure parameter list.
261:             * 
262:             * @param newParameters Procedure parameter list
263:             */
264:            public void setParameters(final Parameter[] newParameters) {
265:                this .parameters = newParameters;
266:
267:                // update the number of parameters
268:                if (this .parameters != null) {
269:                    this .numParameters = this .parameters.length;
270:                } else {
271:                    this .numParameters = 0;
272:                }
273:            }
274:
275:            /**
276:             * Clone the procedure parameter list.
277:             * 
278:             * @param newParameters Procedure parameter list
279:             */
280:            public void cloneParameters(final Parameter[] newParameters) {
281:                if (newParameters != null) {
282:                    this .numParameters = newParameters.length;
283:                    if (this .numParameters > 0) {
284:                        this .parameters = new Parameter[this .numParameters];
285:                        for (int i = 0; i < this .numParameters; i++) {
286:                            this .parameters[i] = new Parameter(newParameters[i]);
287:                        }
288:                    }
289:                }
290:            }
291:
292:            /**
293:             * Set the Procedure has return flag.
294:             * 
295:             * @param newHasReturn Has Return Flag
296:             */
297:            public void setHasReturn(final boolean newHasReturn) {
298:                this .hasReturn = newHasReturn;
299:            }
300:
301:            // added abey for allowing ResultSets to be added to a Procedure.
302:            private ArrayList resultSetColumns = new ArrayList();
303:
304:            /**
305:             * Set the ResultSet Columns of the Procedure.
306:             * 
307:             * @param rsCols array of the ResultSetColumns of this Procedure.
308:             */
309:            public void setResultSetColumns(final ResultSetColumns[] rsCols) {
310:                this .resultSetColumns = new ArrayList();
311:                for (int i = 0; i < rsCols.length; i++) {
312:                    this .resultSetColumns.add(rsCols[i]);
313:                }
314:            }
315:
316:            /**
317:             * Set the ResultSet Columns of the Procedure.
318:             * 
319:             * @param rsCols the Arraylist containing the ResultSetColumns of this Procedure.
320:             */
321:            public void setResultSetColumns(final ArrayList rsCols) {
322:                this .resultSetColumns = rsCols;
323:            }
324:
325:            /**
326:             * Add a ResultSetColumns to this Procedure.
327:             * 
328:             * @param rs ResultSetColumns to be added to this Procedure.
329:             */
330:            public void addResultSet(final ResultSetColumns rs) {
331:                this .resultSetColumns.add(rs);
332:            }
333:
334:            public boolean removeResultSet(final ResultSetColumns rs) {
335:                final ResultSetColumns rsCols = this .searchResultSetColumns(rs
336:                        .getName());
337:                if (rsCols != null) {
338:                    this .resultSetColumns.remove(rsCols);
339:                    return true;
340:                }
341:                return false;
342:            }
343:
344:            /**
345:             * get the ResultSet Columns of the Procedure.
346:             * 
347:             * @return an array containing the ResultSetColumns of this Procedure.
348:             */
349:            public ResultSetColumns[] getResultSetColumnsArray() {
350:                final Object[] objArray = this .resultSetColumns.toArray();
351:                final ResultSetColumns[] result = new ResultSetColumns[objArray.length];
352:
353:                for (int i = 0; i < objArray.length; i++) {
354:                    final ResultSetColumns rsCols = (ResultSetColumns) objArray[i];
355:                    result[i] = rsCols;
356:                }
357:                return result;
358:            }
359:
360:            /**
361:             * get the ResultSet Columns of the Procedure.
362:             * 
363:             * @return an Arraylist containing the ResultSetColumns of this Procedure.
364:             */
365:            public ArrayList getResultSetColumns() {
366:                return this .resultSetColumns;
367:            }
368:
369:            /**
370:             * Searches this Procedure for any ResultSet Columns of the given name.
371:             * 
372:             * @return ResultSetColumns added to this Procedure if its name matches, else null.
373:             */
374:            public ResultSetColumns searchResultSetColumns(final String rsName) {
375:                if (this .resultSetColumns != null) {
376:                    final Iterator rsColsIter = this .resultSetColumns
377:                            .iterator();
378:
379:                    while (rsColsIter.hasNext()) {
380:                        final ResultSetColumns rsCols = (ResultSetColumns) rsColsIter
381:                                .next();
382:                        if (rsCols.getName().equals(rsName)) {
383:                            return rsCols;
384:                        }
385:                    }
386:                }
387:                return null;
388:            }
389:
390:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.