Source Code Cross Referenced for ColumnRef.java in  » Content-Management-System » harmonise » org » openharmonise » commons » dsi » 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 
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;
020:
021:        /**
022:         * A coloumn reference in a relational database with a table name, 
023:         * a column name, a data type and possibly an alias for the table name.
024:         * 
025:         * @author Michael Bell
026:         * @version $Revision: 1.1 $
027:         *
028:         */
029:        public class ColumnRef extends Object {
030:
031:            /**
032:             * Constant indicating a date data type
033:             */
034:            static public int DATE = 0;
035:
036:            /**
037:             * Constant indicating a text data type
038:             */
039:            static public int TEXT = 1;
040:
041:            /**
042:             * Constant indicating a number data type
043:             */
044:            static public int NUMBER = 2;
045:
046:            /**
047:             * Constant indicating a long text data type
048:             */
049:            static public int LONG_TEXT = 3;
050:
051:            /**
052:             * The name of the table containing the column
053:             */
054:            private String m_sTable = null;
055:
056:            /**
057:             * The alias for the table name
058:             */
059:            private String m_sTableAlias = null;
060:
061:            /**
062:             * The name of the column
063:             */
064:            private String m_sColumn = null;
065:
066:            /**
067:             * The data type of the column
068:             */
069:            private int m_nDataType = 1;
070:
071:            /**
072:             * The cached full string representation of this column reference
073:             */
074:            private String m_sFullRefCache = null;
075:
076:            /**
077:             * Hashcode for this object
078:             */
079:            private int m_nHashcode = 0;
080:
081:            /**
082:             * Constructs a column reference.
083:             * 
084:             * @param sTable the name of table containing the column
085:             * @param sColumn the name of the column
086:             * @param nDataType the data type
087:             * @throws DataStoreException if any of the parameters are invalid
088:             */
089:            public ColumnRef(String sTable, String sColumn, int nDataType)
090:                    throws DataStoreException {
091:                if ((sTable == null) || (sColumn == null)) {
092:                    throw new DataStoreException("Invalid Type: table:"
093:                            + sTable + ",column:" + sColumn);
094:                }
095:
096:                if ((nDataType < DATE) || (nDataType > LONG_TEXT)) {
097:                    throw new DataStoreException("Invalid data type");
098:                }
099:
100:                m_sTable = sTable;
101:                m_sColumn = sColumn;
102:                m_nDataType = nDataType;
103:            }
104:
105:            /**
106:             * Returns the name of the table containing the column.
107:             * 
108:             * @return the name of the table containing the column
109:             */
110:            public String getTable() {
111:                return m_sTable;
112:            }
113:
114:            /**
115:             * Sets the name of the table containing the column.
116:             * 
117:             * @param sTable the name of the table containing the column
118:             */
119:            public void setTable(String sTable) {
120:                if (this .m_sFullRefCache != null) {
121:                    this .m_sFullRefCache = null;
122:                }
123:                m_sTable = sTable;
124:            }
125:
126:            /**
127:             * Returns the alias for the table name.
128:             * 
129:             * @return the alias for the table name
130:             */
131:            public String getTableAlias() {
132:                return m_sTableAlias;
133:            }
134:
135:            /**
136:             * Sets the alias for the table name.
137:             * 
138:             * @param sTableAlias the alias for the table name
139:             */
140:            public void setTableAlias(String sTableAlias) {
141:                if (this .m_sFullRefCache != null) {
142:                    this .m_sFullRefCache = null;
143:                }
144:
145:                m_sTableAlias = sTableAlias;
146:            }
147:
148:            /**
149:             * Returns <code>true</code> if the table name has an alias set.
150:             * 
151:             * @return <code>true</code> if the table name has an alias set.
152:             */
153:            public boolean hasTableAlias() {
154:                return (m_sTableAlias != null);
155:            }
156:
157:            /**
158:             * Returns the name of the column.
159:             * 
160:             * @return the name of the column
161:             */
162:            public String getColumn() {
163:                return m_sColumn;
164:            }
165:
166:            /**
167:             * Sets the name of the column.
168:             * 
169:             * @param sColumn the name of the column
170:             */
171:            public void setColumn(String sColumn) {
172:                if (this .m_sFullRefCache != null) {
173:                    this .m_sFullRefCache = null;
174:                }
175:                m_sColumn = sColumn;
176:            }
177:
178:            /**
179:             * Returns the full string representation of this column reference.
180:             * 
181:             * @return the full string representation of this column reference
182:             */
183:            public String getFullRef() {
184:                if (this .m_sFullRefCache == null) {
185:                    String sTable = m_sTable;
186:                    if (hasTableAlias() == true) {
187:                        sTable = m_sTableAlias;
188:                    }
189:
190:                    m_sFullRefCache = sTable + "." + m_sColumn;
191:                }
192:                return this .m_sFullRefCache;
193:            }
194:
195:            /**
196:             * Returns the data type of this column.
197:             * 
198:             * @return the data type of this column
199:             */
200:            public int getDataType() {
201:                return m_nDataType;
202:            }
203:
204:            /* (non-Javadoc)
205:             * @see java.lang.Object#equals(java.lang.Object)
206:             */
207:            public boolean equals(Object obj) {
208:                boolean bEq = false;
209:
210:                if (this  == obj) {
211:                    bEq = true;
212:                } else if (obj instanceof  ColumnRef) {
213:                    ColumnRef colref = (ColumnRef) obj;
214:
215:                    if (colref.getColumn().equals(getColumn()) == true
216:                            && colref.getTable().equals(getTable())) {
217:                        bEq = true;
218:                    }
219:                }
220:
221:                return bEq;
222:            }
223:
224:            /* (non-Javadoc)
225:             * @see java.lang.Object#hashCode()
226:             */
227:            public int hashCode() {
228:
229:                if (m_nHashcode == 0) {
230:                    int nHash = 17;
231:
232:                    nHash = 37 * nHash + m_nDataType;
233:                    if (m_sColumn != null) {
234:                        nHash = 37 * nHash + m_sColumn.hashCode();
235:                    }
236:                    if (m_sTable != null) {
237:                        nHash = 37 * nHash + m_sTable.hashCode();
238:                    }
239:                    if (m_sTableAlias != null) {
240:                        nHash = 37 * nHash + m_sTableAlias.hashCode();
241:                    }
242:
243:                    m_nHashcode = nHash;
244:                }
245:
246:                return m_nHashcode;
247:            }
248:
249:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.