Source Code Cross Referenced for SelectQueryBuilder.java in  » Database-ORM » ODAL » com » completex » objective » components » persistency » 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 » ODAL » com.completex.objective.components.persistency 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *  Objective Database Abstraction Layer (ODAL)
003:         *  Copyright (c) 2004, The ODAL Development Group
004:         *  All rights reserved.
005:         *  For definition of the ODAL Development Group please refer to LICENCE.txt file
006:         *
007:         *  Distributable under LGPL license.
008:         *  See terms of license at gnu.org.
009:         */package com.completex.objective.components.persistency;
010:
011:        import com.completex.objective.components.persistency.core.DatabasePolicy;
012:
013:        /**
014:         * Helper to build complete SQL SELECT statements as well as its fragments
015:         *
016:         * @author Gennady Krizhevsky
017:         */
018:        public interface SelectQueryBuilder {
019:            public static final NullSelectQueryBuilder NULL_SELECT_QUERY_BUILDER = new NullSelectQueryBuilder();
020:
021:            /**
022:             * Builds complete SQL SELECT statement. If sql is set on Query through Query.setSql(sql) method -
023:             * it will be returned.
024:             *
025:             * @param query  Query
026:             * @param policy DatabasePolicy
027:             * @return complete SQL SELECT statement
028:             */
029:            String getSqlSelect(Query query, DatabasePolicy policy);
030:
031:            /**
032:             * Builds complete SQL SELECT statement. If sql is set on Query through Query.setSql(sql) method -
033:             * it will be returned.
034:             *
035:             * @param query  QueryDefinition
036:             * @param policy DatabasePolicy
037:             * @return complete SQL SELECT statement
038:             */
039:            String getSqlSelect(QueryDefinition query, DatabasePolicy policy);
040:
041:            /**
042:             * Builds SQL SELECT clause out of PersistentObjectFactory.
043:             *
044:             * @param persistentFactory PersistentObjectFactory which meta data is used to build SQL SELECT clause
045:             * @param distinct          if true SELECT DISTINCT clause is built
046:             * @return SQL SELECT clause
047:             */
048:            String getSelectSqlHeader(
049:                    PersistentObjectFactory persistentFactory, boolean distinct);
050:
051:            /**
052:             * Builds SQL SELECT clause out of PersistentObjectFactory.
053:             *
054:             * @param persistentFactory PersistentObjectFactory which meta data is used to build SQL SELECT clause
055:             * @return SQL SELECT clause
056:             */
057:            String getSelectSqlHeader(PersistentObjectFactory persistentFactory);
058:
059:            /**
060:             * Builds SQL SELECT clause without actual "SELECT" keyword out of PersistentObjectFactory.
061:             *
062:             * @param persistentFactory PersistentObjectFactory which meta data is used to build SQL SELECT clause
063:             * @return SQL SELECT clause without actual "SELECT" keyword
064:             */
065:            String getSelectSqlFragment(
066:                    PersistentObjectFactory persistentFactory);
067:
068:            /**
069:             * Builds SQL SELECT count(1) ... statement.
070:             *
071:             * @param query  Query
072:             * @param policy DatabasePolicy
073:             * @return complete SQL SELECT statement
074:             */
075:            String getSqlCount(Query query, DatabasePolicy policy);
076:
077:            /**
078:             * Builds SQL that can be used by Persistency#selectExists(Query) method.
079:             *
080:             * @param query  Query
081:             * @param policy DatabasePolicy
082:             * @return complete SQL that can be used by Persistency#selectExists(Query) method
083:             * @see Persistency#selectExists(Query)
084:             */
085:            String getSqlExists(Query query, DatabasePolicy policy);
086:
087:            /**
088:             * Builds SQL IN clause prepended by prefix. Takes Object[] of not null values as an input parameter.
089:             * If value is a String it gets single quoted.
090:             *
091:             * @param prefix prefix
092:             * @param values Object[] of IN clause values
093:             * @return SQL IN caluse prepended by prefix
094:             */
095:            String getSqlIn(String prefix, Object[] values);
096:
097:            /**
098:             * Builds SQL IN clause. Takes Object[] of not null values as an input parameter.
099:             * If value is a String it gets single quoted.
100:             *
101:             * @param values Object[] of IN clause values
102:             * @return SQL IN caluse
103:             */
104:            String getSqlIn(Object[] values);
105:
106:            /**
107:             * Builds SQL IN clause with placeholders
108:             *
109:             * @param length numberof placeholders ('?' characters)
110:             * @return SQL IN clause with placeholders
111:             */
112:            String getSqlIn(int length);
113:
114:            /**
115:             * Builds complete SQL WHERE clause out of PersistentObjectFactory.
116:             *
117:             * @param persistentObject PersistentObject which meta data and data is used to build SQL SELECT clause
118:             * @return SQL WHERE clause
119:             */
120:            String getWhereByPoValues(PersistentObject persistentObject,
121:                    boolean primaryKeyOnly);
122:
123:            /**
124:             * Builds SQL WHERE clause without actual "WHERE" keyword out of PersistentObjectFactory.
125:             *
126:             * @param persistentObject PersistentObject which meta data and data is used to build SQL SELECT clause
127:             * @return SQL WHERE clause without actual "WHERE" keyword out of PersistentObjectFactory.
128:             */
129:            String getWhereByPoValuesFragment(
130:                    PersistentObject persistentObject, boolean primaryKeyOnly);
131:
132:            /**
133:             * Builds call statement with syntax:
134:             * { ? = call <procedure-name>[<arg1>,<arg2>, ...] }
135:             * { call <procedure-name>[<arg1>,<arg2>, ...] }. If sql is set on Query through Query.setSql(sql) method -
136:             * it will be returned.
137:             *
138:             * @param query  QueryDefinition
139:             * @param policy DatabasePolicy
140:             * @return call statement
141:             */
142:            String getSqlCall(QueryDefinition query, DatabasePolicy policy);
143:
144:            /**
145:             * Builds SQL SELECT clause out of PersistentObjectFactory.
146:             *
147:             * @param persistentFactory PersistentObjectFactory which meta data is used to build SQL SELECT clause
148:             * @param distinct          if true SELECT DISTINCT clause is built
149:             * @return SQL SELECT clause
150:             */
151:            StringBuffer selectSQLHeader(
152:                    PersistentObjectFactory persistentFactory, boolean distinct);
153:
154:            /**
155:             * Builds SQL SELECT clause out of PersistentObjectFactory.
156:             *
157:             * @param persistentFactory PersistentObjectFactory which meta data is used to build SQL SELECT clause
158:             * @return SQL SELECT clause
159:             */
160:            StringBuffer selectSQLHeader(
161:                    PersistentObjectFactory persistentFactory);
162:
163:            /**
164:             * Builds SQL IN clause prepended by prefix. Takes Object[] of not null values as an input parameter.
165:             * If value is a String it gets single quoted.
166:             *
167:             * @param prefix prefix
168:             * @param values Object[] of IN clause values
169:             * @return SQL IN caluse prepended by prefix
170:             */
171:            StringBuffer in(String prefix, Object[] values);
172:
173:            /**
174:             * Builds SQL IN clause. Takes Object[] of not null values as an input parameter.
175:             * If value is a String it gets single quoted.
176:             *
177:             * @param values Object[] of IN clause values
178:             * @return SQL IN caluse
179:             */
180:            StringBuffer in(Object[] values);
181:
182:            /**
183:             * Builds SQL IN clause with placeholders
184:             *
185:             * @param length numberof placeholders ('?' characters)
186:             * @return SQL IN clause with placeholders
187:             */
188:            StringBuffer in(int length);
189:
190:            /**
191:             * Concatenates strings with comma as a separator
192:             *
193:             * @param buffer  to place concatenated result to
194:             * @param strings strings to concatenate
195:             * @return buffer concatenated strings with comma as a separator passed as a parameter
196:             */
197:            StringBuffer concatenate(StringBuffer buffer, Object[] strings);
198:
199:            /**
200:             * Concatenates strings with comma as a separator
201:             *
202:             * @param strings strings to concatenate
203:             * @return buffer concatenated strings with comma as a separator
204:             */
205:            StringBuffer concatenate(Object[] strings);
206:
207:            //
208:            // Deprecated stuff:
209:            //
210:
211:            /**
212:             * @param persistentFactory
213:             * @return SelectSqlFragment w/o SELECT keyword
214:             * @deprecated Use getSelectSqlFragment(PersistentObjectFactory persistentFactory) instead
215:             */
216:            String selectSql(PersistentObjectFactory persistentFactory);
217:
218:            /**
219:             * Builds  SQL WHERE clause out of PersistentObjectFactory.
220:             *
221:             * @param persistentObject PersistentObject which meta data and data is used to build SQL SELECT clause
222:             * @return SQL WHERE clause
223:             * @deprecated - use getWhereByPoValuesFragment(PersistentObject persistentObject, boolean primaryKeyOnly)
224:             *             instead
225:             */
226:            String whereByPersistentObjectValues(
227:                    PersistentObject persistentObject, boolean primaryKeyOnly);
228:
229:            /**
230:             * Null implementation
231:             */
232:            static class NullSelectQueryBuilder implements  SelectQueryBuilder {
233:
234:                public String getSqlSelect(Query query, DatabasePolicy policy) {
235:                    return null;
236:                }
237:
238:                public String getSqlSelect(QueryDefinition query,
239:                        DatabasePolicy policy) {
240:                    return null;
241:                }
242:
243:                public String getSqlCount(Query query, DatabasePolicy policy) {
244:                    return null;
245:                }
246:
247:                public String getSqlExists(Query query,
248:                        DatabasePolicy databasePolicy) {
249:                    return null;
250:                }
251:
252:                public StringBuffer concatenate(StringBuffer buffer,
253:                        Object[] strings) {
254:                    return null;
255:                }
256:
257:                public StringBuffer concatenate(Object[] strings) {
258:                    return null;
259:                }
260:
261:                public String getSqlIn(String prefix, Object[] strings) {
262:                    return null;
263:                }
264:
265:                public StringBuffer in(String prefix, Object[] strings) {
266:                    return null;
267:                }
268:
269:                public StringBuffer in(Object[] strings) {
270:                    return null;
271:                }
272:
273:                public String whereByPersistentObjectValues(
274:                        PersistentObject persistentObject,
275:                        boolean primaryKeyOnly) {
276:                    return null;
277:                }
278:
279:                public StringBuffer selectSQLHeader(
280:                        PersistentObjectFactory persistentFactory,
281:                        boolean distinct) {
282:                    return null;
283:                }
284:
285:                public StringBuffer selectSQLHeader(
286:                        PersistentObjectFactory persistentFactory) {
287:                    return null;
288:                }
289:
290:                public StringBuffer in(int length) {
291:                    return null;
292:                }
293:
294:                public String getSelectSqlFragment(
295:                        PersistentObjectFactory persistentFactory) {
296:                    return null;
297:                }
298:
299:                public String getSqlCall(QueryDefinition query,
300:                        DatabasePolicy policy) {
301:                    return null;
302:                }
303:
304:                public String selectSql(
305:                        PersistentObjectFactory persistentFactory) {
306:                    return null;
307:                }
308:
309:                public String getSelectSqlHeader(
310:                        PersistentObjectFactory persistentFactory,
311:                        boolean distinct) {
312:                    return null;
313:                }
314:
315:                public String getSelectSqlHeader(
316:                        PersistentObjectFactory persistentFactory) {
317:                    return null;
318:                }
319:
320:                public String getSqlIn(Object[] values) {
321:                    return null;
322:                }
323:
324:                public String getSqlIn(int length) {
325:                    return null;
326:                }
327:
328:                public String getWhereByPoValues(
329:                        PersistentObject persistentObject,
330:                        boolean primaryKeyOnly) {
331:                    return null;
332:                }
333:
334:                public String getWhereByPoValuesFragment(
335:                        PersistentObject persistentObject,
336:                        boolean primaryKeyOnly) {
337:                    return null;
338:                }
339:
340:            }
341:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.