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


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        package org.netbeans.modules.sql.framework.codegen;
042:
043:        import java.util.ArrayList;
044:        import java.util.HashMap;
045:        import java.util.HashSet;
046:        import java.util.Iterator;
047:        import java.util.List;
048:        import java.util.Map;
049:        import java.util.Set;
050:        import org.netbeans.modules.sql.framework.model.SQLCondition;
051:        import org.netbeans.modules.sql.framework.model.SQLDBTable;
052:        import org.netbeans.modules.sql.framework.model.SourceTable;
053:
054:        /**
055:         * @author Ritesh Adval
056:         * @author Ahimanikya Satapathy
057:         * @version $Revision$
058:         */
059:        public class StatementContext {
060:
061:            public static final String USE_SOURCE_TEMP_TABLE_NAME = "USE_SOURCE_TEMP_TABLE_NAME";
062:            public static final String USE_SOURCE_TABLE_ALIAS_NAME = "USE_SOURCE_TABLE_ALIAS_NAME";
063:            public static final String USE_TARGET_TABLE_ALIAS_NAME = "USE_TARGET_TABLE_ALIAS_NAME";
064:            public static final String USE_SOURCE_COLUMN_ALIAS_NAME = "USE_SOURCE_COLUMN_ALIAS_NAME";
065:            public static final String USE_TARGET_COLUMN_ALIAS_NAME = "USE_TARGET_COLUMN_ALIAS_NAME";
066:            public static final String USE_WHERE_STATEMENT = "USE_WHERE_STATEMENT";
067:            public static final String USE_FULLY_QUALIFIED_TABLE = "USE_FULLY_QUALIFIED_TABLE";
068:            public static final String JOIN_OPERATOR = "joinOperator";
069:            public static final String WHERE_CONDITION_LIST = "whereList";
070:            public static final String IF_EXISTS = "ifExists";
071:            public static final String VALIDATION_CONDITIONS = "VALIDATION_CONDITIONS";
072:            public static final String SUPPRESS_TABLE_PREFIX_FOR_SOURCE_COL = "SUPPRESS_TABLE_PREFIX_FOR_SOURCE_COL";
073:            public static final String SUPPRESS_TABLE_PREFIX_FOR_TARGET_COL = "SUPPRESS_TABLE_PREFIX_FOR_TARGET_COL";
074:            public static final String USE_ORIGINAL_SOURCE_TABLE_NAME = "USE_ORIGINAL_SOURCE_TABLE_NAME";
075:            public static final String USE_ORIGINAL_TARGET_TABLE_NAME = "USE_ORIGINAL_TARGET_TABLE_NAME";
076:            public static final String USE_UNIQUE_TABLE_NAME = "USE_UNIQUE_TABLE_NAME";
077:            public static final String SET_TEMP_SOURCE_TABLES = "SET_TEMP_SOURCE_TABLES";
078:            public static final String SET_UNIQUE_TABLES = "SET_UNIQUE_TABLES";
079:            public static final String USER_FUNCTION_NAME = "USER_FUNCTION_NAME";
080:            private Map<Object, Object> propertyMap = new HashMap<Object, Object>();
081:
082:            public StatementContext() {
083:                putClientProperty(VALIDATION_CONDITIONS, new ArrayList());
084:            }
085:
086:            public void putClientProperty(Object key, Object value) {
087:                propertyMap.put(key, value);
088:            }
089:
090:            public Object getClientProperty(Object key) {
091:                return propertyMap.get(key);
092:            }
093:
094:            public void putAll(StatementContext context) {
095:                Iterator it = context.keys();
096:                while (it.hasNext()) {
097:                    Object key = it.next();
098:                    this .putClientProperty(key, context.getClientProperty(key));
099:                }
100:            }
101:
102:            public Iterator keys() {
103:                return propertyMap.keySet().iterator();
104:            }
105:
106:            @SuppressWarnings(value="unchecked")
107:            public void setUsingTempTableName(SourceTable table, boolean use) {
108:                Set tempTableSet = (Set) this 
109:                        .getClientProperty(SET_TEMP_SOURCE_TABLES);
110:                if (tempTableSet == null) {
111:                    tempTableSet = new HashSet();
112:                    this 
113:                            .putClientProperty(SET_TEMP_SOURCE_TABLES,
114:                                    tempTableSet);
115:                }
116:
117:                if (use) {
118:                    tempTableSet.add(table);
119:                } else {
120:                    tempTableSet.remove(table);
121:                }
122:            }
123:
124:            public void clearAllUsingTempTableName() {
125:                Set tempTableSet = (Set) this 
126:                        .getClientProperty(SET_TEMP_SOURCE_TABLES);
127:                if (tempTableSet == null) {
128:                    tempTableSet = new HashSet();
129:                    this 
130:                            .putClientProperty(SET_TEMP_SOURCE_TABLES,
131:                                    tempTableSet);
132:                } else {
133:                    tempTableSet.clear();
134:                }
135:            }
136:
137:            public boolean isUsingTempTableName(SourceTable table) {
138:                Set tempTableSet = (Set) this 
139:                        .getClientProperty(SET_TEMP_SOURCE_TABLES);
140:                if (tempTableSet != null) {
141:                    return tempTableSet.contains(table);
142:                }
143:                return false;
144:            }
145:
146:            public boolean isUseSourceTableAliasName() {
147:                Boolean val = (Boolean) this 
148:                        .getClientProperty(USE_SOURCE_TABLE_ALIAS_NAME);
149:                if (val != null) {
150:                    return val.booleanValue();
151:                }
152:                return false;
153:            }
154:
155:            public void setUseSourceTableAliasName(boolean use) {
156:                this .putClientProperty(USE_SOURCE_TABLE_ALIAS_NAME,
157:                        new Boolean(use));
158:            }
159:
160:            public boolean isUseTargetTableAliasName() {
161:                Boolean val = (Boolean) this 
162:                        .getClientProperty(USE_TARGET_TABLE_ALIAS_NAME);
163:                if (val != null) {
164:                    return val.booleanValue();
165:                }
166:                return false;
167:            }
168:
169:            public void setUseTargetTableAliasName(boolean use) {
170:                this .putClientProperty(USE_TARGET_TABLE_ALIAS_NAME, Boolean
171:                        .valueOf(use));
172:            }
173:
174:            public boolean isUseSourceColumnAliasName() {
175:                Boolean val = (Boolean) this 
176:                        .getClientProperty(USE_SOURCE_COLUMN_ALIAS_NAME);
177:                if (val != null) {
178:                    return val.booleanValue();
179:                }
180:                return false;
181:            }
182:
183:            public void setUseSourceColumnAliasName(boolean use) {
184:                this .putClientProperty(USE_SOURCE_COLUMN_ALIAS_NAME, Boolean
185:                        .valueOf(use));
186:            }
187:
188:            public boolean isUseTargetColumnAliasName() {
189:                Boolean val = (Boolean) this 
190:                        .getClientProperty(USE_TARGET_COLUMN_ALIAS_NAME);
191:                if (val != null) {
192:                    return val.booleanValue();
193:                }
194:                return false;
195:            }
196:
197:            public void setUseTargetColumnAliasName(boolean use) {
198:                this .putClientProperty(USE_TARGET_COLUMN_ALIAS_NAME, Boolean
199:                        .valueOf(use));
200:            }
201:
202:            /**
203:             * @return
204:             */
205:            public boolean isUsingFullyQualifiedTablePrefix() {
206:                Boolean val = (Boolean) this 
207:                        .getClientProperty(USE_FULLY_QUALIFIED_TABLE);
208:                if (val != null) {
209:                    return val.booleanValue();
210:                }
211:                return true;
212:            }
213:
214:            public boolean hasValidationConditions() {
215:                return getValidationConditions().size() != 0;
216:            }
217:
218:            @SuppressWarnings(value="unchecked")
219:            public List getValidationConditions() {
220:                return new ArrayList((List) this 
221:                        .getClientProperty(VALIDATION_CONDITIONS));
222:            }
223:
224:            @SuppressWarnings(value="unchecked")
225:            public void addValidationCondition(SQLCondition newCondition) {
226:                if (newCondition != null) {
227:                    List conditions = this .getValidationConditions();
228:                    conditions.add(newCondition);
229:                }
230:            }
231:
232:            public void removeValidationCondition(SQLCondition oldCondition) {
233:                if (oldCondition != null) {
234:                    List conditions = this .getValidationConditions();
235:                    conditions.remove(oldCondition);
236:                }
237:            }
238:
239:            @SuppressWarnings(value="unchecked")
240:            public void setValidationConditions(List newList) {
241:                List conditions = this .getValidationConditions();
242:                conditions.clear();
243:                if (newList != null) {
244:                    conditions.addAll(newList);
245:                }
246:            }
247:
248:            public void setUsingFullyQualifiedTablePrefix(boolean use) {
249:                this .putClientProperty(USE_FULLY_QUALIFIED_TABLE, Boolean
250:                        .valueOf(use));
251:            }
252:
253:            /**
254:             * @return
255:             */
256:            public boolean isSuppressingTablePrefixForTargetColumn() {
257:                Boolean suppress = (Boolean) this 
258:                        .getClientProperty(SUPPRESS_TABLE_PREFIX_FOR_TARGET_COL);
259:                if (suppress != null) {
260:                    return suppress.booleanValue();
261:                }
262:                return false;
263:            }
264:
265:            public void setSuppressingTablePrefixForTargetColumn(
266:                    boolean newValue) {
267:                this .putClientProperty(SUPPRESS_TABLE_PREFIX_FOR_TARGET_COL,
268:                        newValue ? Boolean.TRUE : Boolean.FALSE);
269:            }
270:
271:            public boolean isSuppressingTablePrefixForSourceColumn() {
272:                Boolean suppress = (Boolean) this 
273:                        .getClientProperty(SUPPRESS_TABLE_PREFIX_FOR_SOURCE_COL);
274:                if (suppress != null) {
275:                    return suppress.booleanValue();
276:                }
277:                return false;
278:            }
279:
280:            public void setSuppressingTablePrefixForSourceColumn(
281:                    boolean newValue) {
282:                this .putClientProperty(SUPPRESS_TABLE_PREFIX_FOR_SOURCE_COL,
283:                        newValue ? Boolean.TRUE : Boolean.FALSE);
284:            }
285:
286:            public boolean isUsingOriginalSourceTableName() {
287:                Boolean useOriginal = (Boolean) this 
288:                        .getClientProperty(USE_ORIGINAL_SOURCE_TABLE_NAME);
289:                return (useOriginal != null) ? useOriginal.booleanValue()
290:                        : false;
291:            }
292:
293:            public void setUsingOriginalSourceTableName(boolean newValue) {
294:                this .putClientProperty(USE_ORIGINAL_SOURCE_TABLE_NAME,
295:                        newValue ? Boolean.TRUE : Boolean.FALSE);
296:            }
297:
298:            public boolean isUsingOriginalTargetTableName() {
299:                Boolean useOriginal = (Boolean) this 
300:                        .getClientProperty(USE_ORIGINAL_TARGET_TABLE_NAME);
301:                return (useOriginal != null) ? useOriginal.booleanValue()
302:                        : false;
303:            }
304:
305:            public void setUsingOriginalTargetTableName(boolean newValue) {
306:                this .putClientProperty(USE_ORIGINAL_TARGET_TABLE_NAME,
307:                        newValue ? Boolean.TRUE : Boolean.FALSE);
308:            }
309:
310:            public boolean isUsingUniqueTableName() {
311:                Boolean useUnique = (Boolean) this 
312:                        .getClientProperty(USE_UNIQUE_TABLE_NAME);
313:                return (useUnique != null) ? useUnique.booleanValue() : false;
314:            }
315:
316:            public void setUsingUniqueTableName(boolean newValue) {
317:                this .putClientProperty(USE_UNIQUE_TABLE_NAME,
318:                        newValue ? Boolean.TRUE : Boolean.FALSE);
319:            }
320:
321:            /**
322:             * Indicates whether given table should use unique table name in generator
323:             *
324:             * @param table Table to be flagged
325:             * @return true if table should use unique table name, false otherwise
326:             */
327:            public boolean isUsingUniqueTableName(SQLDBTable table) {
328:                Set tempTableSet = (Set) this 
329:                        .getClientProperty(SET_UNIQUE_TABLES);
330:                if (tempTableSet != null) {
331:                    return tempTableSet.contains(table);
332:                }
333:                return false;
334:            }
335:
336:            /**
337:             * Sets flag to indicate whether given table should use unique table name in
338:             * generator.
339:             *
340:             * @param table Table to be flagged
341:             * @param use true if table should use unique table name, false otherwise
342:             */
343:            @SuppressWarnings(value="unchecked")
344:            public void setUsingUniqueTableName(SQLDBTable table, boolean use) {
345:                Set tempTableSet = (Set) this 
346:                        .getClientProperty(SET_UNIQUE_TABLES);
347:                if (tempTableSet == null) {
348:                    tempTableSet = new HashSet();
349:                    this .putClientProperty(SET_UNIQUE_TABLES, tempTableSet);
350:                }
351:
352:                if (use) {
353:                    tempTableSet.add(table);
354:                } else {
355:                    tempTableSet.remove(table);
356:                }
357:            }
358:
359:            /**
360:             * Clears set of tables flagged to use unique table name in generator.
361:             */
362:            public void clearAllUsingUniqueTableName() {
363:                Set tempTableSet = (Set) this 
364:                        .getClientProperty(SET_UNIQUE_TABLES);
365:                if (tempTableSet == null) {
366:                    tempTableSet = new HashSet();
367:                    this.putClientProperty(SET_UNIQUE_TABLES, tempTableSet);
368:                } else {
369:                    tempTableSet.clear();
370:                }
371:            }
372:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.