Source Code Cross Referenced for WhereStatement.java in  » Workflow-Engines » JFolder » org » jfolder » platforms » stores » base » 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 » Workflow Engines » JFolder » org.jfolder.platforms.stores.base 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.platforms.stores.base;
009:
010:        //base classes
011:        import java.math.BigDecimal;
012:        import java.sql.PreparedStatement;
013:        import java.sql.ResultSet;
014:        import java.sql.SQLException;
015:        import java.util.ArrayList;
016:        import java.util.HashSet;
017:        import java.util.Iterator;
018:
019:        //project specific classes
020:        import org.jfolder.common.utils.misc.MiscHelper;
021:        import org.jfolder.platforms.stores.base.SystemStatement;
022:
023:        //other classes
024:
025:        public class WhereStatement extends SystemStatement {
026:
027:            //
028:            public final static Integer EQUALS = new Integer(0);
029:            public final static Integer GREATER_THAN = new Integer(1);
030:            public final static Integer GREATER_THAN_OR_EQUAL = new Integer(2);
031:            public final static Integer NOT_EQUAL = new Integer(3);
032:            public final static Integer LESS_THAN = new Integer(4);
033:            public final static Integer LESS_THAN_OR_EQUAL = new Integer(5);
034:            //
035:            public final static Integer LIKE = new Integer(6);
036:            public final static Integer NOT_LIKE = new Integer(7);
037:            public final static Integer IS_NULL = new Integer(8);
038:            public final static Integer IS_NOT_NULL = new Integer(9);
039:            //
040:            public final static Integer IN = new Integer(10);
041:            public final static Integer NOT_IN = new Integer(11);
042:
043:            //
044:            public final static String AND_CONJUNCTION = "AND";
045:            public final static String OR_CONJUNCTION = "OR";
046:
047:            //
048:            //
049:            private ArrayList whereColumnNames = null;
050:            private ArrayList whereColumnMetaTypes = null;
051:            private ArrayList whereColumnTables = null;
052:            //
053:            private ArrayList whereColumnAlternateNames = null;
054:            private ArrayList whereColumnAlternateMetaTypes = null;
055:            private ArrayList whereColumnAlternateTables = null;
056:            private ArrayList whereColumnAlternateValues = null;
057:            //
058:            private ArrayList whereColumnComparisons = null;
059:            //
060:            private HashSet whereColumnTablesSet = null;
061:
062:            //
063:            private String currentWhereConjunction = null;
064:            //
065:            private ArrayList whereConjunctionSeries = null;
066:            //
067:            private ArrayList whereParenthesisSeries = null;
068:
069:            //
070:            private HashSet allColumnTablesSet = null;
071:            //
072:            private HashSet blockedForeignKeys = null;
073:
074:            protected WhereStatement() {
075:                //
076:                this .whereColumnNames = new ArrayList();
077:                this .whereColumnMetaTypes = new ArrayList();
078:                this .whereColumnTables = new ArrayList();
079:                //
080:                this .whereColumnAlternateNames = new ArrayList();
081:                this .whereColumnAlternateMetaTypes = new ArrayList();
082:                this .whereColumnAlternateTables = new ArrayList();
083:                this .whereColumnAlternateValues = new ArrayList();
084:                //
085:                this .whereColumnComparisons = new ArrayList();
086:                //
087:                this .whereColumnTablesSet = new HashSet();
088:
089:                //
090:                this .currentWhereConjunction = AND_CONJUNCTION;
091:                //
092:                this .whereConjunctionSeries = new ArrayList();
093:                //
094:                this .whereParenthesisSeries = new ArrayList();
095:                //
096:                this .allColumnTablesSet = new HashSet();
097:                //
098:                this .blockedForeignKeys = new HashSet();
099:            }
100:
101:            public void blockForeignKey(CreateStatement inCs, String inColumn) {
102:                this .blockedForeignKeys.add(inCs.getName() + "-" + inColumn);
103:            }
104:
105:            public boolean isForeignKeyBlocked(CreateStatement inCs,
106:                    String inColumn) {
107:                return this .blockedForeignKeys.contains(inCs.getName() + "-"
108:                        + inColumn);
109:            }
110:
111:            //
112:            public void addToAllTables(CreateStatement inWcs) {
113:                this .allColumnTablesSet.add(inWcs);
114:            }
115:
116:            public Iterator getAllTablesIterator() {
117:                return this .allColumnTablesSet.iterator();
118:            }
119:
120:            public boolean isPresentWithinAllTables(String inTableName) {
121:
122:                boolean outValue = false;
123:
124:                Iterator iter = getAllTablesIterator();
125:
126:                while (iter.hasNext()) {
127:                    CreateStatement nextTable = (CreateStatement) iter.next();
128:
129:                    outValue |= (inTableName.equals(nextTable.getName()));
130:                }
131:
132:                return outValue;
133:            }
134:
135:            //
136:            public void useAndConjunction() {
137:                this .currentWhereConjunction = AND_CONJUNCTION;
138:            }
139:
140:            public void useOrConjunction() {
141:                this .currentWhereConjunction = OR_CONJUNCTION;
142:            }
143:
144:            //
145:            public void addWhereColumn(String inName1, Integer inMetaType1,
146:                    CreateStatement inTable1, String inName2,
147:                    Integer inMetaType2, CreateStatement inTable2,
148:                    Integer inComparison, Integer inParenthesis) {
149:                //
150:                this .whereColumnNames.add(inName1);
151:                this .whereColumnMetaTypes.add(inMetaType1);
152:                this .whereColumnTables.add(inTable1);
153:                //
154:                this .whereColumnAlternateNames.add(inName2);
155:                this .whereColumnAlternateMetaTypes.add(inMetaType2);
156:                this .whereColumnAlternateTables.add(inTable2);
157:                this .whereColumnAlternateValues.add(null);
158:                //
159:                this .whereColumnComparisons.add(inComparison);
160:                //
161:                this .whereColumnTablesSet.add(inTable1);
162:                this .whereColumnTablesSet.add(inTable2);
163:
164:                //
165:                this .whereConjunctionSeries.add(this .currentWhereConjunction);
166:                //
167:                this .whereParenthesisSeries.add(inParenthesis);
168:
169:                //
170:                this .allColumnTablesSet.add(inTable1);
171:                this .allColumnTablesSet.add(inTable2);
172:            }
173:
174:            public void addWhereColumn(String inName, Integer inMetaType,
175:                    CreateStatement inTable, Object inValue,
176:                    Integer inComparison, Integer inParenthesis) {
177:                //
178:                this .whereColumnNames.add(inName);
179:                this .whereColumnMetaTypes.add(inMetaType);
180:                this .whereColumnTables.add(inTable);
181:                //
182:                this .whereColumnAlternateNames.add(null);
183:                this .whereColumnAlternateMetaTypes.add(null);
184:                this .whereColumnAlternateTables.add(null);
185:                this .whereColumnAlternateValues.add(inValue);
186:                //
187:                this .whereColumnComparisons.add(inComparison);
188:                //
189:                this .whereColumnTablesSet.add(inTable);
190:
191:                //
192:                this .whereConjunctionSeries.add(this .currentWhereConjunction);
193:                //
194:                this .whereParenthesisSeries.add(inParenthesis);
195:
196:                //
197:                this .allColumnTablesSet.add(inTable);
198:            }
199:
200:            //
201:            public int getWhereColumnCount() {
202:                return this .whereColumnNames.size();
203:            }
204:
205:            //
206:            public String getWhereColumnName(int inIndex) {
207:                return (String) this .whereColumnNames.get(inIndex);
208:            }
209:
210:            public CreateStatement getWhereColumnTable(int inIndex) {
211:                return (CreateStatement) this .whereColumnTables.get(inIndex);
212:            }
213:
214:            public Integer getWhereColumnMetaType(int inIndex) {
215:                return (Integer) this .whereColumnMetaTypes.get(inIndex);
216:            }
217:
218:            //
219:            public CreateStatement getWhereColumnAlternateTable(int inIndex) {
220:                return (CreateStatement) this .whereColumnAlternateTables
221:                        .get(inIndex);
222:            }
223:
224:            public Object getWhereColumnAlternateValue(int inIndex) {
225:                //MiscHelper.println("WhereStatement alternateValues = "
226:                //    + this.whereColumnAlternateValues);
227:                return this .whereColumnAlternateValues.get(inIndex);
228:            }
229:
230:            public Integer getWhereColumnAlternateMetaType(int inIndex) {
231:                return (Integer) this .whereColumnAlternateMetaTypes
232:                        .get(inIndex);
233:            }
234:
235:            public String getWhereColumnAlternateName(int inIndex) {
236:                return (String) this .whereColumnAlternateNames.get(inIndex);
237:            }
238:
239:            //
240:            public Integer getWhereColumnComparison(int inIndex) {
241:                return (Integer) this .whereColumnComparisons.get(inIndex);
242:            }
243:
244:            public String getWhereColumnConjunction(int inIndex) {
245:                return (String) this .whereConjunctionSeries.get(inIndex);
246:            }
247:
248:            //
249:            public int getWhereColumnParenthesis(int inIndex) {
250:
251:                int outValue = 0;
252:
253:                Integer parenthesis = (Integer) this .whereParenthesisSeries
254:                        .get(inIndex);
255:                if (parenthesis != null) {
256:                    outValue = parenthesis.intValue();
257:                }
258:
259:                return outValue;
260:            }
261:
262:            public int getLastWhereColumnParenthesis() {
263:
264:                int outValue = 0;
265:
266:                for (int i = 0; i < getWhereColumnCount(); i++) {
267:                    outValue = outValue - getWhereColumnParenthesis(i);
268:                }
269:
270:                return outValue;
271:            }
272:
273:            //
274:            public ArrayList getAllTables() {
275:
276:                ArrayList outValue = new ArrayList();
277:
278:                Iterator iter = getAllTablesIterator();
279:                while (iter.hasNext()) {
280:                    outValue.add(iter.next());
281:                }
282:
283:                return outValue;
284:            }
285:
286:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.