Source Code Cross Referenced for Constraint.java in  » Database-ORM » openjpa » org » apache » openjpa » jdbc » schema » 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 » Database ORM » openjpa » org.apache.openjpa.jdbc.schema 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements.  See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership.  The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License.  You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied.  See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.    
018:         */
019:        package org.apache.openjpa.jdbc.schema;
020:
021:        /**
022:         * A table constraint. This class is closely aligned with the constraint
023:         * information available from {@link java.sql.DatabaseMetaData}.
024:         *
025:         * @author Abe White
026:         */
027:        public abstract class Constraint extends ReferenceCounter {
028:
029:            private String _name = null;
030:            private String _fullName = null;
031:            private Table _table = null;
032:            private String _tableName = null;
033:            private String _schemaName = null;
034:            private String _columnName = null;
035:            private boolean _deferred = false;
036:
037:            /**
038:             * Default constructor.
039:             */
040:            Constraint() {
041:            }
042:
043:            /**
044:             * Constructor.
045:             *
046:             * @param name the name of the constraint, or null if none
047:             * @param table the local table of the constraint
048:             */
049:            Constraint(String name, Table table) {
050:                setName(name);
051:                if (table != null) {
052:                    setTableName(table.getName());
053:                    setSchemaName(table.getSchemaName());
054:                }
055:                _table = table;
056:            }
057:
058:            /**
059:             * Called when the constraint is removed from the owning table.
060:             * Invalidates the constraint.
061:             */
062:            void remove() {
063:                _table = null;
064:            }
065:
066:            /**
067:             * Return the table of this constraint.
068:             */
069:            public Table getTable() {
070:                return _table;
071:            }
072:
073:            /**
074:             * Return the column's table name.
075:             */
076:            public String getTableName() {
077:                return _tableName;
078:            }
079:
080:            /**
081:             * Set the column's table name. You can only call this method on
082:             * columns whose table object is not set.
083:             */
084:            public void setTableName(String name) {
085:                if (getTable() != null)
086:                    throw new IllegalStateException();
087:                _tableName = name;
088:                _fullName = null;
089:            }
090:
091:            /**
092:             * Return the column table's schema name.
093:             */
094:            public String getSchemaName() {
095:                return _schemaName;
096:            }
097:
098:            /**
099:             * Set the column table's schema name. You can only call this method on
100:             * columns whose tbale object is not set.
101:             */
102:            public void setSchemaName(String schema) {
103:                if (getTable() != null)
104:                    throw new IllegalStateException();
105:                _schemaName = schema;
106:            }
107:
108:            /**
109:             * Return the column's name.
110:             */
111:            public String getColumnName() {
112:                return _columnName;
113:            }
114:
115:            /**
116:             * Set the column's name. You can only call this method on
117:             * columns whose table object is not set.
118:             */
119:            public void setColumnName(String name) {
120:                if (getTable() != null)
121:                    throw new IllegalStateException();
122:                _columnName = name;
123:            }
124:
125:            /**
126:             * Return the name of the constraint.
127:             */
128:            public String getName() {
129:                return _name;
130:            }
131:
132:            /**
133:             * Set the name of the constraint. This method cannot be called if the
134:             * constraint already belongs to a table.
135:             */
136:            public void setName(String name) {
137:                if (getTable() != null)
138:                    throw new IllegalStateException();
139:                _name = name;
140:                _fullName = null;
141:            }
142:
143:            /**
144:             * Return the full name of the constraint.
145:             */
146:            public String getFullName() {
147:                if (_fullName == null) {
148:                    String name = getName();
149:                    if (name == null)
150:                        return null;
151:                    String tname = getTableName();
152:                    if (tname == null)
153:                        return name;
154:                    _fullName = tname + "." + name;
155:                }
156:                return _fullName;
157:            }
158:
159:            /**
160:             * Return whether this constraint is a logical constraint only; i.e.
161:             * if it does not exist in the database.
162:             */
163:            public abstract boolean isLogical();
164:
165:            /**
166:             * Return true if this is a deferred constraint.
167:             */
168:            public boolean isDeferred() {
169:                return _deferred;
170:            }
171:
172:            /**
173:             * Make this constrain deferred.
174:             */
175:            public void setDeferred(boolean deferred) {
176:                _deferred = deferred;
177:            }
178:
179:            public String toString() {
180:                if (getName() != null)
181:                    return getName();
182:
183:                String name = getClass().getName();
184:                name = name.substring(name.lastIndexOf('.') + 1);
185:                return "<" + name.toLowerCase() + ">";
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.