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:
038: /**
039: * This class is required since the OTD seed is generated as Procedure1, Procedure2
040: * and inside WSDLGenerator there is no way of distinguishing between PreparedStatement and stored procedure DBObjects.
041: */package org.netbeans.modules.jdbcwizard.builder.dbmodel.impl;
042:
043: import org.netbeans.modules.jdbcwizard.builder.dbmodel.DBObject;
044: import java.util.HashMap;
045: import java.util.Map;
046: import java.util.ArrayList;
047:
048: import java.util.ResourceBundle;
049: import org.openide.util.NbBundle;
050:
051: public class DBPSObject extends DBObjectImpl {
052:
053: public static final String OTDSEED_PREPSTMTID_PATTERN = "PreparedStatement{0}";
054:
055: public static final String OTDSEED_PSPARAMID_PATTERN = "PreparedStatement{0}Param{1}";
056:
057: public static final String OTDSEED_PSCOLID_PATTERN = "PreparedStatement{0}$ResultsColumn{1}";
058:
059: private int numParameters = 0;
060:
061: private ArrayList parameters = null;
062:
063: private String sqlText = null;
064:
065: public PreparedStmtResultSetDescriptor getPsResultSetDesc() {
066: return this .psResultSetDesc;
067: }
068:
069: private PreparedStmtResultSetDescriptor psResultSetDesc = null;
070:
071: /** Map of column metadata. */
072: protected Map columns;
073:
074: /* No-arg constructor; initializes Collections-related member variables. */
075: public DBPSObject() {
076: this .parameters = new ArrayList();
077: this .columns = new HashMap();
078: }
079:
080: public DBPSObject(final String Objectname, final String schema,
081: final String catalog) {
082:
083: super (Objectname, schema, catalog);
084: this .parameters = new ArrayList();
085: }
086:
087: /**
088: * Creates a new instance of DBTableImpl, cloning the contents of the given DBTable
089: * implementation instance.
090: *
091: * @param src DBTable instance to be cloned
092: */
093: public DBPSObject(final DBObject src) {
094: this ();
095: if (src == null) {
096: final ResourceBundle cMessages = NbBundle
097: .getBundle(DBPSObject.class);
098: throw new IllegalArgumentException(cMessages
099: .getString("ERROR_NULL_DBTABLE")
100: + "ERROR_NULL_DBTABLE");// NO
101: // i18n
102: }
103:
104: super .copyFrom(src);
105: }
106:
107: public String getJavaName() {
108: return super .getJavaName();
109: }
110:
111: /**
112: * getter for numParameters; *
113: *
114: * @return numParameters;
115: */
116: public int getNumParameters() {
117: return this .numParameters;
118: }
119:
120: /**
121: * setter for numParameters; *
122: *
123: * @param numParameters number of parameters;
124: */
125: public void setNumParameters(final int numParameters) {
126: this .numParameters = numParameters;
127: }
128:
129: /**
130: * getter for parameters; *
131: *
132: * @return parameters;
133: */
134: public ArrayList getParameters() {
135: return this .parameters;
136: }
137:
138: /**
139: * setter for parameters; *
140: *
141: * @param parameters list of <code>ParameterDescriptor</code> * objects; *
142: */
143: public void setParameters(final ArrayList parameters) {
144: this .parameters = parameters;
145: }
146:
147: /**
148: * getter for sqlText; *
149: *
150: * @return sqlText;
151: */
152: public String getSqlText() {
153: return this .sqlText;
154: }
155:
156: /**
157: * setter for sqlText; *
158: *
159: * @param sqlText string to hold the prepared statement;
160: */
161: public void setSqlText(final String sqlText) {
162: this .sqlText = sqlText;
163: }
164:
165: public void setName(final String name) {
166: super .setName(name);
167: }
168:
169: public void setJavaName(final String javaName) {
170: super .setJavaName(javaName);
171: }
172:
173: public void setCatalog(final String catalog) {
174: super .setCatalog(catalog);
175: }
176:
177: public void setSchema(final String schema) {
178: super .setSchema(schema);
179: }
180:
181: public void setPSResultSetDesc(
182: final PreparedStmtResultSetDescriptor psrsd) {
183: this .psResultSetDesc = psrsd;
184: }
185:
186: public String getName() {
187: return super.getName();
188: }
189: }
|