cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1516153 - in /cxf/trunk/rt/rs/extensions/search/src: main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
Date Wed, 21 Aug 2013 13:18:58 GMT
Author: sergeyb
Date: Wed Aug 21 13:18:57 2013
New Revision: 1516153

URL: http://svn.apache.org/r1516153
Log:
[CXF-5198] Getting expressions with camel case supported when SearchBean is used

Modified:
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java
    cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java

Modified: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java?rev=1516153&r1=1516152&r2=1516153&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SimpleSearchCondition.java
Wed Aug 21 13:18:57 2013
@@ -154,7 +154,8 @@ public class SimpleSearchCondition<T> im
                 : ((SearchBean)condition).getKeySet();
             
             for (String getter : keySet) {
-                ConditionType ct = getters2operators == null ? sharedType : getters2operators.get(getter);
+                ConditionType ct = getters2operators == null ? sharedType 
+                    : getters2operators.get(getter.toLowerCase());
                 if (ct == null) {
                     continue;
                 }

Modified: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java?rev=1516153&r1=1516152&r2=1516153&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
Wed Aug 21 13:18:57 2013
@@ -59,6 +59,18 @@ public class SQLPrinterVisitorTest exten
     }
     
     @Test
+    public void testSQLCamelNameSearchBean() throws SearchParseException {
+        FiqlParser<SearchBean> beanParser = new FiqlParser<SearchBean>(SearchBean.class);
+        SearchCondition<SearchBean> filter = beanParser.parse("theName==ami*;theLevel=gt=10");
+        SQLPrinterVisitor<SearchBean> visitor = new SQLPrinterVisitor<SearchBean>("table");
+        filter.accept(visitor);
+        String sql = visitor.getQuery();
+        
+        assertTrue("SELECT * FROM table WHERE (theName LIKE 'ami%') AND (theLevel > '10')".equals(sql)
+                   || "SELECT * FROM table WHERE (theLevel > '10') AND (theName LIKE 'ami%')".equals(sql));
+    }
+    
+    @Test
     public void testSQL2() throws SearchParseException {
         SearchCondition<Condition> filter = parser.parse("name==ami*,level=gt=10");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");



Mime
View raw message