Source Code Cross Referenced for AbstractParametrizedQuery.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » database » queries » 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 » Web Framework » rife 1.6.1 » com.uwyn.rife.database.queries 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003:         * Distributed under the terms of either:
004:         * - the common development and distribution license (CDDL), v1.0; or
005:         * - the GNU Lesser General Public License, v2.1 or later
006:         * $Id: AbstractParametrizedQuery.java 3634 2007-01-08 21:42:24Z gbevin $
007:         */
008:        package com.uwyn.rife.database.queries;
009:
010:        import com.uwyn.rife.database.Datasource;
011:        import com.uwyn.rife.database.queries.QueryParameterType;
012:        import java.util.List;
013:
014:        abstract class AbstractParametrizedQuery extends AbstractQuery
015:                implements  Query, Cloneable {
016:            private QueryParameters mParameters = null;
017:
018:            protected AbstractParametrizedQuery(Datasource datasource) {
019:                super (datasource);
020:            }
021:
022:            public void clear() {
023:                super .clear();
024:
025:                if (mParameters != null) {
026:                    mParameters.clear();
027:                }
028:            }
029:
030:            private void addTypedParameters(QueryParameterType type,
031:                    QueryParameters parameters) {
032:                if (null == parameters) {
033:                    return;
034:                }
035:
036:                addTypedParameters(type, parameters.getOrderedNames());
037:            }
038:
039:            private void addTypedParameters(QueryParameterType type,
040:                    List<String> parameters) {
041:                if (null == mParameters) {
042:                    mParameters = new QueryParameters(this );
043:                }
044:
045:                mParameters.addTypedParameters(type, parameters);
046:            }
047:
048:            private void addTypedParameter(QueryParameterType type,
049:                    String parameter) {
050:                if (null == mParameters) {
051:                    mParameters = new QueryParameters(this );
052:                }
053:
054:                mParameters.addTypedParameter(type, parameter);
055:            }
056:
057:            private <T> T getTypedParameters(QueryParameterType type) {
058:                if (null == mParameters) {
059:                    return null;
060:                }
061:
062:                return (T) mParameters.getTypedParameters(type);
063:            }
064:
065:            private void clearTypedParameters(QueryParameterType type) {
066:                if (null == mParameters) {
067:                    return;
068:                }
069:
070:                mParameters.clearTypedParameters(type);
071:                if (0 == mParameters.getNumberOfTypes()) {
072:                    mParameters = null;
073:                }
074:            }
075:
076:            protected void _fieldSubselect(Select query) {
077:                if (null == query)
078:                    throw new IllegalArgumentException("query can't be null.");
079:
080:                addTypedParameters(QueryParameterType.FIELD, query
081:                        .getParameters());
082:            }
083:
084:            protected void _tableSubselect(Select query) {
085:                if (null == query)
086:                    throw new IllegalArgumentException("query can't be null.");
087:
088:                addTypedParameters(QueryParameterType.TABLE, query
089:                        .getParameters());
090:            }
091:
092:            protected void _whereSubselect(Select query) {
093:                if (null == query)
094:                    throw new IllegalArgumentException("query can't be null.");
095:
096:                addTypedParameters(QueryParameterType.WHERE, query
097:                        .getParameters());
098:            }
099:
100:            protected void _unionSubselect(Select query) {
101:                if (null == query)
102:                    throw new IllegalArgumentException("query can't be null.");
103:
104:                addTypedParameters(QueryParameterType.UNION, query
105:                        .getParameters());
106:            }
107:
108:            public QueryParameters getParameters() {
109:                return mParameters;
110:            }
111:
112:            protected void addFieldParameter(String field) {
113:                addTypedParameter(QueryParameterType.FIELD, field);
114:            }
115:
116:            protected void clearWhereParameters() {
117:                clearTypedParameters(QueryParameterType.WHERE);
118:            }
119:
120:            protected void addWhereParameter(String field) {
121:                addTypedParameter(QueryParameterType.WHERE, field);
122:            }
123:
124:            protected List<String> getWhereParameters() {
125:                return getTypedParameters(QueryParameterType.WHERE);
126:            }
127:
128:            public void addWhereParameters(List<String> parameters) {
129:                addTypedParameters(QueryParameterType.WHERE, parameters);
130:            }
131:
132:            protected void setLimitParameter(String limitParameter) {
133:                addTypedParameter(QueryParameterType.LIMIT, limitParameter);
134:            }
135:
136:            public String getLimitParameter() {
137:                return getTypedParameters(QueryParameterType.LIMIT);
138:            }
139:
140:            protected void setOffsetParameter(String offsetParameter) {
141:                addTypedParameter(QueryParameterType.OFFSET, offsetParameter);
142:            }
143:
144:            public String getOffsetParameter() {
145:                return getTypedParameters(QueryParameterType.OFFSET);
146:            }
147:
148:            protected boolean isLimitBeforeOffset() {
149:                return true;
150:            }
151:
152:            public AbstractParametrizedQuery clone() {
153:                AbstractParametrizedQuery new_instance = (AbstractParametrizedQuery) super
154:                        .clone();
155:
156:                if (new_instance != null && mParameters != null) {
157:                    new_instance.mParameters = mParameters.clone();
158:                }
159:
160:                return new_instance;
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.