openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r774877 - /openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
Date Thu, 14 May 2009 18:45:34 GMT
Author: faywang
Date: Thu May 14 18:45:33 2009
New Revision: 774877

URL: http://svn.apache.org/viewvc?rev=774877&view=rev
Log:
OPENJPA-1013: case/simple case expression support

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java?rev=774877&r1=774876&r2=774877&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
Thu May 14 18:45:33 2009
@@ -820,14 +820,13 @@
                 org.apache.openjpa.kernel.exps.Expression expr = 
                     ((Expressions.BinaryLogicalExpression)whens.get(i)).
                     toKernelExpression(factory, model);
-                Value action = ((ExpressionImpl<?>)thens.get(i)).
-                    toValue(factory, model);
+                Value action = Expressions.toValue(
+                        (ExpressionImpl<?>)thens.get(i), factory, model);
                 exps[i] = factory.whenCondition(expr, action);
             }
 
-            Value other = ((ExpressionImpl<?>)otherwise).
-                toValue(factory, model);
-
+            Value other = Expressions.toValue(
+                    (ExpressionImpl<?>)otherwise, factory, model);
             return factory.generalCaseExpression(exps, other);
         }
     }
@@ -895,13 +894,13 @@
                 org.apache.openjpa.kernel.exps.Literal val = null;
                 //TODO: Boolean literal, String literal    
                 val = factory.newLiteral(whens.get(i), Literal.TYPE_NUMBER);
-                Value action = ((ExpressionImpl<?>)thens.get(i)).
-                    toValue(factory, model);                
+                Value action = Expressions.toValue(
+                        (ExpressionImpl<?>)thens.get(i), factory, model);
                 exps[i] = factory.whenScalar(val, action);
             }
 
-            Value other = ((ExpressionImpl<?>)otherwise).
-                toValue(factory, model);
+            Value other = Expressions.toValue(
+                    (ExpressionImpl<?>)otherwise, factory, model);
             return factory.simpleCaseExpression(caseOperandExpr, exps, other);
         }
     }



Mime
View raw message