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


001:        /**********************************************************************
002:        Copyright (c) 2003 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.store.expression;
018:
019:        import java.util.List;
020:
021:        import org.jpox.store.mapping.JavaTypeMapping;
022:
023:        /**
024:         * Representation of an expression with an SQL time type (SQLDate, SQLTime,
025:         * SQLTimestamp)
026:         *
027:         * @version $Revision: 1.10 $
028:         **/
029:        public class SqlTemporalExpression extends ScalarExpression {
030:            protected SqlTemporalExpression(QueryExpression qs) {
031:                super (qs);
032:            }
033:
034:            /**
035:             * 
036:             * @param qs the QueryExpression
037:             * @param mapping the mapping associated to this expression
038:             * @param te the TableExpression where this expression refers to
039:             */
040:            public SqlTemporalExpression(QueryExpression qs,
041:                    JavaTypeMapping mapping, LogicSetExpression te) {
042:                super (qs, mapping, te);
043:            }
044:
045:            /**
046:             * Generates statement as "FUNCTION_NAME"
047:             * @param functionName
048:             * @param qs QueryExpression
049:             */
050:            public SqlTemporalExpression(String functionName, QueryExpression qs) {
051:                super (qs);
052:                st.append(functionName);
053:            }
054:
055:            /**
056:             * Generates statement as e.g. FUNCTION_NAME(arg[,argN])
057:             * @param functionName
058:             * @param args ScalarExpression list
059:             */
060:            public SqlTemporalExpression(String functionName, List args) {
061:                super (functionName, args);
062:            }
063:
064:            /**
065:             * Performs a function on two arguments.
066:             * op(operand1,operand2)
067:             * operand1 op operand2 
068:             * @param operand1 the first expression
069:             * @param op the operator between operands
070:             * @param operand2 the second expression
071:             */
072:            public SqlTemporalExpression(ScalarExpression operand1,
073:                    DyadicOperator op, ScalarExpression operand2) {
074:                super (operand1, op, operand2);
075:            }
076:
077:            public BooleanExpression eq(ScalarExpression expr) {
078:                if (expr instanceof  NullLiteral) {
079:                    return expr.eq(this );
080:                } else if (expr instanceof  SqlTemporalExpression) {
081:                    return new BooleanExpression(this , OP_EQ, expr);
082:                } else {
083:                    return super .eq(expr);
084:                }
085:            }
086:
087:            public BooleanExpression noteq(ScalarExpression expr) {
088:                if (expr instanceof  NullLiteral) {
089:                    return expr.noteq(this );
090:                } else if (expr instanceof  SqlTemporalExpression) {
091:                    return new BooleanExpression(this , OP_NOTEQ, expr);
092:                } else {
093:                    return super .noteq(expr);
094:                }
095:            }
096:
097:            public BooleanExpression lt(ScalarExpression expr) {
098:                if (expr instanceof  SqlTemporalExpression) {
099:                    return new BooleanExpression(this , OP_LT, expr);
100:                } else {
101:                    return super .lt(expr);
102:                }
103:            }
104:
105:            public BooleanExpression lteq(ScalarExpression expr) {
106:                if (expr instanceof  SqlTemporalExpression) {
107:                    return new BooleanExpression(this , OP_LTEQ, expr);
108:                } else {
109:                    return super .lteq(expr);
110:                }
111:            }
112:
113:            public BooleanExpression gt(ScalarExpression expr) {
114:                if (expr instanceof  SqlTemporalExpression) {
115:                    return new BooleanExpression(this , OP_GT, expr);
116:                } else {
117:                    return super .gt(expr);
118:                }
119:            }
120:
121:            public BooleanExpression gteq(ScalarExpression expr) {
122:                if (expr instanceof  SqlTemporalExpression) {
123:                    return new BooleanExpression(this , OP_GTEQ, expr);
124:                } else {
125:                    return super .gteq(expr);
126:                }
127:            }
128:
129:            public BooleanExpression in(ScalarExpression expr) {
130:                return new BooleanExpression(this , OP_IN, expr);
131:            }
132:
133:            /**
134:             * Method to return an expression for the day of the month (for this date).
135:             * @return The expression for the day of the month.
136:             **/
137:            public NumericExpression getDayMethod() {
138:                return qs.getStoreManager().getDatastoreAdapter().getDayMethod(
139:                        this );
140:            }
141:
142:            /**
143:             * Method to return an expression for the month (for this date).
144:             * @return The expression for the month.
145:             **/
146:            public NumericExpression getMonthMethod() {
147:                return qs.getStoreManager().getDatastoreAdapter()
148:                        .getMonthMethod(this );
149:            }
150:
151:            /**
152:             * Method to return an expression for the year (for this date).
153:             * @return The expression for the year.
154:             **/
155:            public NumericExpression getYearMethod() {
156:                return qs.getStoreManager().getDatastoreAdapter()
157:                        .getYearMethod(this );
158:            }
159:
160:            /**
161:             * Method to return an expression for the hour (for this time).
162:             * @return The expression for the hour.
163:             **/
164:            public NumericExpression getHourMethod() {
165:                return qs.getStoreManager().getDatastoreAdapter()
166:                        .getHourMethod(this );
167:            }
168:
169:            /**
170:             * Method to return an expression for the minute (for this time).
171:             * @return The expression for the month.
172:             **/
173:            public NumericExpression getMinuteMethod() {
174:                return qs.getStoreManager().getDatastoreAdapter()
175:                        .getMinuteMethod(this );
176:            }
177:
178:            /**
179:             * Method to return an expression for the second (for this time).
180:             * @return The expression for the second.
181:             **/
182:            public NumericExpression getSecondMethod() {
183:                return qs.getStoreManager().getDatastoreAdapter()
184:                        .getSecondMethod(this);
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.