Source Code Cross Referenced for Union.java in  » Database-ORM » ODAL » com » completex » objective » components » persistency » core » 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.core 
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.core;
010:
011:        import com.completex.objective.components.persistency.Query;
012:        import com.completex.objective.components.persistency.QueryDefinition;
013:        import com.completex.objective.components.persistency.Mappable;
014:        import com.completex.objective.components.persistency.core.impl.query.QueryDefinitionImpl;
015:        import com.completex.objective.util.PropertyMap;
016:
017:        import java.util.List;
018:        import java.util.Map;
019:        import java.util.HashMap;
020:        import java.io.Serializable;
021:
022:        /**
023:         * Represents SQL union query. Generally it is not thread safe. 
024:         * 
025:         * @author Gennady Krizhevsky
026:         */
027:        public interface Union {
028:
029:            public static final UnionMode UNION = UnionMode.UNION;
030:            public static final UnionMode UNION_ALL = UnionMode.UNION_ALL;
031:
032:            /**
033:             * Adds another query to the union with "UNION" clause
034:             * 
035:             * @param query
036:             * @return self
037:             */
038:            Union union(QueryDefinition query);
039:
040:            /**
041:             * Adds another query to the union with "UNION ALL" clause
042:             * 
043:             * @param query
044:             * @return self
045:             */
046:            Union unionAll(QueryDefinition query);
047:
048:            /**
049:             * Adds another query to the union with UnionMode dependent clause
050:             * 
051:             * @param query
052:             * @return self
053:             */
054:            Union union(QueryDefinition query, UnionMode union);
055:
056:            /**
057:             * Sets order by clause that has union scope rather than query one
058:             * 
059:             * @param orderBy
060:             * @return self
061:             */
062:            Union setOrderBy(String[] orderBy);
063:
064:            /**
065:             * 
066:             * @return true if it contains any sub-queries (same as unionSize() > 0)
067:             */
068:            boolean hasEntries();
069:
070:            /**
071:             * 
072:             * @return number of union sub-queries
073:             */
074:            int unionSize();
075:
076:            /**
077:             * 
078:             * @return union's Order By columns
079:             */
080:            String[] getOrderBy();
081:
082:            /**
083:             * Adds column expression to the order by clause. All the expressions will be used when 
084:             * compiling separated by commas
085:             * 
086:             * @param columnExpression
087:             * @param direction - ascending or descending
088:             * @return self
089:             */
090:            Union addToOrderBy(String columnExpression,
091:                    Query.OrderDirection direction);
092:
093:            /**
094:             * Adds column expression to the order by clause with default sort direction.
095:             *  
096:             * @param columnExpression
097:             * @return self
098:             */
099:            Union addToOrderBy(String columnExpression);
100:
101:            /**
102:             * Sets array of column expressions to the order by clause. All the expressions will be used when
103:             * compiling separated by commas
104:             * 
105:             * @param orderBy
106:             * @return self
107:             */
108:            Union setOrderBy(List orderBy);
109:
110:            /**
111:             * 
112:             * @return true if Union is compiled
113:             */
114:            boolean isCompiled();
115:
116:            /**
117:             * Decompiles union allowing for the modifications 
118:             * 
119:             * @return self
120:             */
121:            Union decompile();
122:
123:            /**
124:             * Decompiles union. After that it becomes immutable until decompile() is used.
125:             * 
126:             * @param databasePolicy
127:             * @return self
128:             */
129:            Union compile(DatabasePolicy databasePolicy);
130:
131:            /**
132:             * 
133:             * @param index
134:             * @return index-th union part
135:             * @throws IndexOutOfBoundsException if the index is out of range (index
136:             * 		  < 0 || index >= size()).
137:             */
138:            UnionEntry getUnionEntry(int index);
139:
140:            /**
141:             * 
142:             * @return true if there is order by clause
143:             */
144:            boolean hasOrderBy();
145:
146:            /**
147:             * Utility class representing Union sub-query
148:             */
149:            static class UnionEntry implements  Serializable, Mappable {
150:                private QueryDefinition queryDefinition;
151:                private UnionMode unionMode;
152:                private static final String TAG_QUERY_DEFINITION = "queryDefinition";
153:                private static final String TAG_UNION_MODE = "unionMode";
154:
155:                public UnionEntry(QueryDefinition queryDefinition,
156:                        UnionMode unionMode) {
157:                    this .queryDefinition = queryDefinition;
158:                    this .unionMode = unionMode;
159:                }
160:
161:                public QueryDefinition getQueryDefinition() {
162:                    return queryDefinition;
163:                }
164:
165:                public UnionMode getUnionMode() {
166:                    return unionMode;
167:                }
168:
169:                public Map toMap() {
170:                    HashMap map = new HashMap();
171:                    map.put(TAG_QUERY_DEFINITION, ((Mappable) queryDefinition)
172:                            .toMap());
173:                    map.put(TAG_UNION_MODE, unionMode.getName());
174:                    return map;
175:                }
176:
177:                public void fromMap(Map map) {
178:                    PropertyMap propertyMap = PropertyMap.toPropertyMap(map);
179:                    Map queryDefinitionMap = propertyMap.getPropertyMap(
180:                            TAG_QUERY_DEFINITION, true);
181:                    queryDefinition = new QueryDefinitionImpl(
182:                            queryDefinitionMap);
183:                    String unionModeName = propertyMap.getProperty(
184:                            TAG_UNION_MODE, true);
185:                    unionMode = UnionMode.name2mode(unionModeName);
186:                }
187:            }
188:
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.