Source Code Cross Referenced for QueryMetaData.java in  » Database-ORM » JPOX » org » jpox » metadata » 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 » JPOX » org.jpox.metadata 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************
002:        Copyright (c) 2004 Andy Jefferson and others. All rights reserved.
003:        Licensed under the Apache License, Version 2.0 (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
006:
007:            http://www.apache.org/licenses/LICENSE-2.0
008:
009:        Unless required by applicable law or agreed to in writing, software
010:        distributed under the License is distributed on an "AS IS" BASIS,
011:        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012:        See the License for the specific language governing permissions and
013:        limitations under the License.
014:
015:        Contributors:
016:            ...
017:         **********************************************************************/package org.jpox.metadata;
018:
019:        import org.jpox.util.StringUtils;
020:
021:        /**
022:         * Representation of the MetaData of a named Query.
023:         *
024:         * @since 1.1
025:         * @version $Revision: 1.12 $
026:         */
027:        public class QueryMetaData extends MetaData {
028:            /** Scope of this query (if any). */
029:            protected String scope;
030:
031:            /** Name of the query. */
032:            protected final String name;
033:
034:            /** Query language. */
035:            protected QueryLanguage language;
036:
037:            /** Whether the query is unmodifiable. */
038:            protected boolean unmodifiable = false;
039:
040:            /** The single string query */
041:            protected String query;
042:
043:            /** The result class to use. Only applies to SQL. */
044:            protected String resultClass = null;
045:
046:            /** Name for the MetaData defining the mapping of the result set (for JPA SQL). */
047:            protected String resultMetaDataName = null;
048:
049:            /** Whether the query returns unique. Only applies to SQL. */
050:            protected boolean unique = false;
051:
052:            /** Name of any fetch-plan to use. */
053:            protected String fetchPlanName = null;
054:
055:            /**
056:             * Constructor.
057:             * @param parent the parent of the Query
058:             * @param scope Scope of the query (if any)
059:             * @param name The Query name
060:             * @param language The language name
061:             * @param unmodifiable The unmodifiable tag
062:             * @param resultClass The result class (optional)
063:             * @param resultMetaDataName name of the result MetaData to use (optional)
064:             * @param unique The unique tag
065:             * @param fetchPlanName Name of any named fetchPlan to use with this query
066:             */
067:            public QueryMetaData(final MetaData parent, final String scope,
068:                    final String name, final String language,
069:                    final String unmodifiable, final String resultClass,
070:                    final String resultMetaDataName, final String unique,
071:                    final String fetchPlanName) {
072:                super (parent);
073:
074:                if (StringUtils.isWhitespace(name)) {
075:                    throw new InvalidMetaDataException(LOCALISER, "044154");
076:                }
077:
078:                this .scope = (StringUtils.isWhitespace(scope) ? null : scope);
079:                this .name = name;
080:
081:                // include-subclasses
082:                if (unmodifiable != null
083:                        && unmodifiable.equalsIgnoreCase("true")) {
084:                    this .unmodifiable = true;
085:                } else {
086:                    this .unmodifiable = false;
087:                }
088:
089:                // language
090:                this .language = QueryLanguage.getQueryLanguage(language);
091:
092:                this .resultClass = (StringUtils.isWhitespace(resultClass) ? null
093:                        : resultClass);
094:                this .resultMetaDataName = resultMetaDataName;
095:
096:                if (unique != null && unique.equalsIgnoreCase("true")) {
097:                    this .unique = true;
098:                }
099:                if (!StringUtils.isWhitespace(fetchPlanName)) {
100:                    this .fetchPlanName = fetchPlanName;
101:                }
102:            }
103:
104:            /**
105:             * Accessor for the scope of the query
106:             * @return scope of the query (if any).
107:             */
108:            public String getScope() {
109:                return scope;
110:            }
111:
112:            /**
113:             * Accessor for the query name.
114:             * @return query name
115:             */
116:            public String getName() {
117:                return name;
118:            }
119:
120:            /**
121:             * Accessor for the language
122:             * @return language tag value
123:             */
124:            public QueryLanguage getLanguage() {
125:                return language;
126:            }
127:
128:            /**
129:             * Accessor for the unmodifiable tag value.
130:             * @return unmodifiable tag value
131:             */
132:            public boolean isUnmodifiable() {
133:                return unmodifiable;
134:            }
135:
136:            /**
137:             * Accessor for the query
138:             * @return The query
139:             */
140:            public String getQuery() {
141:                return query;
142:            }
143:
144:            /**
145:             * Accessor for the result class
146:             * @return result class
147:             */
148:            public String getResultClass() {
149:                return resultClass;
150:            }
151:
152:            /**
153:             * Accessor for the name of the QueryResult MetaData to use.
154:             * @return name of the QueryResult MetaData
155:             */
156:            public String getResultMetaDataName() {
157:                return resultMetaDataName;
158:            }
159:
160:            /**
161:             * Accessor for the unique tag value.
162:             * @return unique tag value
163:             */
164:            public boolean isUnique() {
165:                return unique;
166:            }
167:
168:            /**
169:             * Mutator for the query
170:             * @param query The query
171:             */
172:            public void setQuery(String query) {
173:                this .query = query;
174:            }
175:
176:            /**
177:             * Accessor for the name of any FetchPlan to use.
178:             * @return name of the FetchPlan.
179:             */
180:            public String getFetchPlanName() {
181:                return fetchPlanName;
182:            }
183:
184:            /**
185:             * Returns a string representation of the object.
186:             * @param prefix prefix string
187:             * @param indent indent string
188:             * @return a string representation of the object.
189:             */
190:            public String toString(String prefix, String indent) {
191:                StringBuffer sb = new StringBuffer();
192:                sb.append(prefix).append("<query name=\"" + name + "\"\n");
193:                sb.append(prefix).append(
194:                        "       language=\"" + language + "\"\n");
195:                if (unique) {
196:                    sb.append(prefix).append("       unique=\"true\"\n");
197:                }
198:                if (resultClass != null) {
199:                    sb.append(prefix).append(
200:                            "       result-class=\"" + resultClass + "\"\n");
201:                }
202:                if (fetchPlanName != null) {
203:                    sb.append(prefix).append(
204:                            "       fetch-plan=\"" + fetchPlanName + "\"\n");
205:                }
206:                sb.append(prefix).append(
207:                        "       unmodifiable=\"" + unmodifiable + "\">\n");
208:                sb.append(prefix).append(query).append("\n");
209:
210:                // Add extensions
211:                sb.append(super .toString(prefix + indent, indent));
212:
213:                sb.append(prefix + "</query>\n");
214:                return sb.toString();
215:            }
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.