Source Code Cross Referenced for CreateStatement.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.HashMap;
017:
018:        //project specific classes
019:        import org.jfolder.common.UnexpectedSystemException;
020:        import org.jfolder.platforms.stores.base.SystemStatement;
021:
022:        //other classes
023:
024:        public class CreateStatement extends SystemStatement {
025:
026:            //
027:            //private int type = 0;
028:            private String name = null;
029:            private boolean idPresent = false;
030:            private boolean seriesSequencePresent = false;
031:            private SequenceStatement wss = null;
032:            //private boolean shadow = false;
033:            //
034:            private ArrayList columnNames = null;
035:            private ArrayList columnTypes = null;
036:            private ArrayList columnNulls = null;
037:            private ArrayList columnForeignKeys = null;
038:            //
039:            //private HashMap foreignTables = null;
040:            //private HashMap foreignColumns = null;
041:            //
042:            private ArrayList uniqueColumns = null;
043:            //
044:            private ArrayList groupByNames = null;
045:            private ArrayList groupByTypes = null;
046:
047:            //
048:            public int hashCode() {
049:                return this .name.hashCode();
050:            }
051:
052:            public boolean equals(Object inObject) {
053:
054:                boolean outValue = false;
055:
056:                if (inObject instanceof  CreateStatement) {
057:                    CreateStatement wcs = (CreateStatement) inObject;
058:                    outValue = this .name.equals(wcs.name);
059:                }
060:
061:                return outValue;
062:            }
063:
064:            //
065:            protected CreateStatement(String inName) {
066:                //
067:                //super();
068:                //
069:                this .name = inName;
070:                //
071:                this .wss = newSequenceStatement(inName);
072:                //
073:                this .columnNames = new ArrayList();
074:                this .columnTypes = new ArrayList();
075:                this .columnNulls = new ArrayList();
076:                this .columnForeignKeys = new ArrayList();
077:                //
078:                //this.foreignTables = new HashMap();
079:                //
080:                this .uniqueColumns = new ArrayList();
081:                //
082:                this .groupByNames = new ArrayList();
083:                this .groupByTypes = new ArrayList();
084:            }
085:
086:            //
087:            //public void setName(String inName) {
088:            //    this.name = inName;
089:            //}
090:            public String getName() {
091:                return this .name;
092:            }
093:
094:            public Integer getColumnDataType(String inName) {
095:
096:                Integer outValue = null;
097:
098:                int columnIndex = this .columnNames.indexOf(inName);
099:                outValue = getColumnDataType(columnIndex);
100:
101:                return outValue;
102:            }
103:
104:            public boolean verifyColumnAndType(String inName, Integer inType,
105:                    boolean inThrow) {
106:
107:                boolean outValue = false;
108:
109:                int columnIndex = this .columnNames.indexOf(inName);
110:
111:                if (columnIndex != -1) {
112:                    Integer columnType = getColumnDataType(columnIndex);
113:                    if (inType.equals(columnType)) {
114:                        outValue = true;
115:                    } else if (inThrow) {
116:                        throw new UnexpectedSystemException("Column '" + inName
117:                                + "' has a different type");
118:                    }
119:                } else if (inThrow) {
120:                    throw new UnexpectedSystemException("Column '" + inName
121:                            + "' does not exist");
122:                }
123:
124:                return outValue;
125:            }
126:
127:            private void verifyAvailableColumn(String inName) {
128:                if (this .columnNames.indexOf(inName) != -1) {
129:                    throw new UnexpectedSystemException("Column '" + inName
130:                            + "' is already defined");
131:                }
132:            }
133:
134:            //
135:            //public void setShadowTableAttached(boolean inShadow) {
136:            //    this.shadow = inShadow;
137:            //}
138:
139:            //
140:            public boolean isIdColumnPresent() {
141:                return this .idPresent;
142:            }
143:
144:            public void addIdColumn() {
145:                this .idPresent = true;
146:            }
147:
148:            //
149:            public boolean isSeriesSequenceColumnPresent() {
150:                return this .seriesSequencePresent;
151:            }
152:
153:            public void addSeriesSequenceColumn() {
154:                this .seriesSequencePresent = true;
155:            }
156:
157:            public SequenceStatement getSequenceSeries() {
158:                return this .wss;
159:            }
160:
161:            public void addSeriesSequenceGroupByColumn(String inName,
162:                    Integer inType) {
163:                this .groupByNames.add(inName);
164:                this .groupByTypes.add(inType);
165:            }
166:
167:            public int getGroupByColumnCount() {
168:                return this .groupByNames.size();
169:            }
170:
171:            public String getGroupByColumnName(int inIndex) {
172:                return (String) this .groupByNames.get(inIndex);
173:            }
174:
175:            public Integer getGroupByColumnType(int inIndex) {
176:                return (Integer) this .groupByTypes.get(inIndex);
177:            }
178:
179:            //
180:            public int getColumnCount() {
181:                return this .columnNames.size();
182:            }
183:
184:            public String getColumnName(int inIndex) {
185:                return (String) this .columnNames.get(inIndex);
186:            }
187:
188:            public Integer getColumnDataType(int inIndex) {
189:                return (Integer) this .columnTypes.get(inIndex);
190:            }
191:
192:            public boolean getColumnNull(int inIndex) {
193:                return ((Boolean) this .columnNulls.get(inIndex)).booleanValue();
194:            }
195:
196:            public String getColumnForeignKey(int inIndex) {
197:                return (String) this .columnForeignKeys.get(inIndex);
198:            }
199:
200:            //
201:            public void addDecimalColumn(String inName, boolean inNull,
202:                    String inForeignTable) {
203:                //
204:                verifyAvailableColumn(inName);
205:                //
206:                this .columnNames.add(inName);
207:                this .columnTypes.add(DECIMAL);
208:                this .columnNulls.add(new Boolean(inNull));
209:                this .columnForeignKeys.add(inForeignTable);
210:            }
211:
212:            public void addSStringColumn(String inName, boolean inNull,
213:                    String inForeignTable) {
214:                //
215:                verifyAvailableColumn(inName);
216:                //
217:                this .columnNames.add(inName);
218:                this .columnTypes.add(SHORT_STRING);
219:                this .columnNulls.add(new Boolean(inNull));
220:                this .columnForeignKeys.add(inForeignTable);
221:            }
222:
223:            //null must be permitted
224:            public void addLStringColumn(String inName, String inForeignTable) {
225:                //
226:                verifyAvailableColumn(inName);
227:                //
228:                this .columnNames.add(inName);
229:                this .columnTypes.add(LONG_STRING);
230:                this .columnNulls.add(new Boolean(true));
231:                this .columnForeignKeys.add(inForeignTable);
232:            }
233:
234:            public void addBooleanColumn(String inName, boolean inNull,
235:                    String inForeignTable) {
236:                //
237:                verifyAvailableColumn(inName);
238:                //
239:                this .columnNames.add(inName);
240:                this .columnTypes.add(BOOLEAN);
241:                this .columnNulls.add(new Boolean(inNull));
242:                this .columnForeignKeys.add(inForeignTable);
243:            }
244:
245:            //null must be permitted
246:            public void addBObjectColumn(String inName, String inForeignTable) {
247:                //
248:                verifyAvailableColumn(inName);
249:                //
250:                this .columnNames.add(inName);
251:                this .columnTypes.add(BINARY_OBJECT);
252:                this .columnNulls.add(new Boolean(true));
253:                this .columnForeignKeys.add(inForeignTable);
254:            }
255:
256:            //public void addBStreamColumn(String inName, boolean inNull,
257:            //    String inForeignTable) {
258:            //    this.columnNames.add(inName);
259:            //    this.columnTypes.add(BINARY_STREAM);
260:            //    this.columnNulls.add(new Boolean(inNull));
261:            //    this.columnForeignKeys.add(inForeignTable);
262:            //}
263:
264:            //
265:            //public void assignForeignKey(String inName, String inForeignTable) {
266:            //    this.foreignTables.put(inName, inForeignTable);
267:            //}
268:
269:            //
270:            public void assignUnique(ArrayList inColumns) {
271:                this .uniqueColumns.add(inColumns);
272:            }
273:
274:            //
275:            public int getUniqueConstraintCount() {
276:                return this .uniqueColumns.size();
277:            }
278:
279:            public ArrayList getUniqueConstraint(int inIndex) {
280:                return ((ArrayList) this.uniqueColumns.get(inIndex));
281:            }
282:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.