Source Code Cross Referenced for ColumnDefinition.java in  » Content-Management-System » harmonise » org » openharmonise » commons » dsi » ddl » 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 » Content Management System » harmonise » org.openharmonise.commons.dsi.ddl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.commons.dsi.ddl;
020:
021:        /**
022:         * An abstraction of a databse table column.
023:         * 
024:         * @author Michael Bell
025:         * @version $Revision: 1.1 $
026:         *
027:         */
028:        public class ColumnDefinition {
029:
030:            /**
031:             * Constant indicating a date data type.
032:             */
033:            static public int DATE = 0;
034:
035:            /**
036:             * Constant indicating a text data type.
037:             */
038:            static public int TEXT = 1;
039:
040:            /**
041:             * Constant indicating a number data type.
042:             */
043:            static public int NUMBER = 2;
044:
045:            /**
046:             * Constant indicating a long text data type.
047:             */
048:            static public int LONG_TEXT = 3;
049:
050:            /**
051:             * Constant indicating a boolean data type.
052:             */
053:            static public int BOOLEAN = 4;
054:
055:            /**
056:             * The name of the column.
057:             */
058:            private String m_sColumnName = null;
059:
060:            /**
061:             * The data type of the column.
062:             */
063:            private int m_nDataType = 1;
064:
065:            /**
066:             * Default value for column.
067:             */
068:            Object m_default = null;
069:
070:            /**
071:             * <code>boolean</code> flag to indicate whether column can be NULL.
072:             */
073:            boolean m_bAllowNull = false;
074:
075:            /**
076:             * <code>boolean</code> flag to indicate whether column value has to be unique.
077:             */
078:
079:            boolean m_bIsUnique = false;
080:
081:            /**
082:             * <code>boolean</code> flag to indicate whether column is a primary key.
083:             */
084:            boolean m_bIsPrimaryKey = false;
085:
086:            /**
087:             * The table name that this column references as a foreign key.
088:             */
089:            String m_sForeignKeyRef = null;
090:
091:            /**
092:             * Creates a column definition for a column with the given name
093:             * and datatype.
094:             * 
095:             * @param sColName the column name
096:             * @param nDataType the data type
097:             */
098:            public ColumnDefinition(String sColName, int nDataType) {
099:                m_sColumnName = sColName;
100:                m_nDataType = nDataType;
101:            }
102:
103:            /**
104:             * Creates a column definition for a column with the given name
105:             * ,datatype and whether the column can be NULL.
106:             * 
107:             * @param sColName the column name
108:             * @param nDataType the data type
109:             * @param bAllowNull <code>true</code> if the column can be NULL
110:             */
111:            public ColumnDefinition(String sColName, int nDataType,
112:                    boolean bAllowNull) {
113:                this (sColName, nDataType);
114:                m_bAllowNull = bAllowNull;
115:            }
116:
117:            /**
118:             * Creates a column definition for a column.
119:             * 
120:             * @param sColName the column name
121:             * @param bIsPrimaryKey <code>true</code> if the column is a primary key
122:             * @param nDataType the data type
123:             */
124:            public ColumnDefinition(String sColName, boolean bIsPrimaryKey,
125:                    int nDataType) {
126:                this (sColName, nDataType);
127:                m_bIsPrimaryKey = bIsPrimaryKey;
128:            }
129:
130:            /**
131:             * Creates a column definition for a column.
132:             * 
133:             * @param sColName the column name
134:             * @param bIsPrimaryKey <code>true</code> if the column is a primary key
135:             * @param nDataType the data type
136:             * @param bAllowNull <code>true</code> if the column can be NULL
137:             */
138:            public ColumnDefinition(String sColName, boolean bIsPrimaryKey,
139:                    int nDataType, boolean bAllowNull) {
140:                this (sColName, bIsPrimaryKey, nDataType);
141:                m_bAllowNull = bAllowNull;
142:            }
143:
144:            /**
145:             * Creates a column definition for a column.
146:             * 
147:             * @param sColName the column name
148:             * @param nDataType the data type
149:             * @param defaultVal the default value
150:             */
151:            public ColumnDefinition(String sColName, int nDataType,
152:                    Object defaultVal) {
153:                this (sColName, nDataType);
154:                m_default = defaultVal;
155:            }
156:
157:            /**
158:             * Creates a column definition for a column.
159:             * 
160:             * @param sColName the column name
161:             * @param bIsPrimaryKey <code>true</code> if the column is a primary key
162:             * @param nDataType the data type
163:             * @param defaultVal the default value
164:             */
165:            public ColumnDefinition(String sColName, boolean bIsPrimaryKey,
166:                    int nDataType, Object defaultVal) {
167:                this (sColName, nDataType, defaultVal);
168:                m_bIsPrimaryKey = bIsPrimaryKey;
169:                m_bIsUnique = true;
170:            }
171:
172:            /**
173:             * Returns the column name.
174:             * 
175:             * @return  the column name
176:             */
177:            public String getName() {
178:                return m_sColumnName;
179:            }
180:
181:            /**
182:             * Returns the data type.
183:             * 
184:             * @return the data type
185:             */
186:            public int getDataType() {
187:                return m_nDataType;
188:            }
189:
190:            /**
191:             * Returns <code>true</code> if the column is a primary key.
192:             * 
193:             * @return <code>true</code> if the column is a primary key
194:             */
195:            public boolean isPrimaryKey() {
196:                return m_bIsPrimaryKey;
197:            }
198:
199:            /**
200:             * Returns <code>true</code> if the column values must be unique.
201:             * 
202:             * @return <code>true</code> if the column values must be unique
203:             */
204:            public boolean isUnique() {
205:                return m_bIsUnique;
206:            }
207:
208:            /**
209:             * Sets whether the column values must be unique.
210:             * 
211:             * @param bIsUnique <code>true</code> if the column values must be unique
212:             */
213:            public void setIsUnique(boolean bIsUnique) {
214:                m_bIsUnique = bIsUnique;
215:            }
216:
217:            /**
218:             * Returns <code>true</code> if the column can have NULL values.
219:             * 
220:             * @return <code>true</code> if the column can have NULL values
221:             */
222:            public boolean allowNulls() {
223:                return m_bAllowNull;
224:            }
225:
226:            /**
227:             * Returns the default value for the column.
228:             * 
229:             * @return the default value for the column
230:             */
231:            public Object getDefault() {
232:                return m_default;
233:            }
234:
235:            /**
236:             * Returns <code>true</code> if the column is/has a foreign key.
237:             * 
238:             * @return <code>true</code> if the column is/has a foreign key
239:             */
240:            public boolean isForeignKey() {
241:                return m_sForeignKeyRef != null;
242:            }
243:
244:            /**
245:             * Returns the table name of the foreign key reference.
246:             * 
247:             * @return the foreign key reference
248:             */
249:            public String getForeignKeyReference() {
250:                return m_sForeignKeyRef;
251:            }
252:
253:            /**
254:             * Adds a foreign key reference .
255:             * 
256:             * @param string the table name of the foreign key reference 
257:             */
258:            public void addForeignKey(String sForeignKeyRef) {
259:                m_sForeignKeyRef = sForeignKeyRef;
260:            }
261:
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.