cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1406118 - in /cxf/branches/2.6.x-fixes: ./ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/
Date Tue, 06 Nov 2012 13:00:17 GMT
Author: sergeyb
Date: Tue Nov  6 13:00:16 2012
New Revision: 1406118

URL: http://svn.apache.org/viewvc?rev=1406118&view=rev
Log:
Merged revisions 1397180 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1397180 | sergeyb | 2012-10-11 18:20:15 +0100 (Thu, 11 Oct 2012) | 1 line
  
  Prototyping support for mapping FIQL to Lucene Query
........

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1397180

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-blocked' - no diff available.

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java?rev=1406118&r1=1406117&r2=1406118&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
Tue Nov  6 13:00:16 2012
@@ -29,13 +29,14 @@ public abstract class AbstractSearchCond
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractSearchConditionVisitor.class);
     
     private Map<String, String> fieldMap;
+    private Map<String, Class<?>> primitiveFieldTypeMap;
     
     protected AbstractSearchConditionVisitor(Map<String, String> fieldMap) {
         this.fieldMap = fieldMap;
     }
     
     protected String getRealPropertyName(String name) {
-        if (fieldMap != null) {
+        if (fieldMap != null && !fieldMap.isEmpty()) {
             if (fieldMap.containsKey(name)) {
                 return fieldMap.get(name);
             } else {
@@ -44,4 +45,19 @@ public abstract class AbstractSearchCond
         }
         return name;
     }
+
+    protected Class<?> getPrimitiveFieldClass(String name, Class<?> defaultCls)
{
+        Class<?> cls = null;
+        if (primitiveFieldTypeMap != null) {
+            cls = primitiveFieldTypeMap.get(name);
+        }
+        if (cls == null) {  
+            cls = defaultCls;
+        }
+        return cls;
+    }
+
+    public void setPrimitiveFieldTypeMap(Map<String, Class<?>> primitiveFieldTypeMap)
{
+        this.primitiveFieldTypeMap = primitiveFieldTypeMap;
+    }
 }

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java?rev=1406118&r1=1406117&r2=1406118&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
Tue Nov  6 13:00:16 2012
@@ -103,10 +103,10 @@ public class JPATypedQueryVisitor<T> ext
     @SuppressWarnings({ "unchecked", "rawtypes" })
     private Predicate buildPredicate(ConditionType ct, String name, Object value) {
 
-        Class<? extends Comparable> clazz = (Class<? extends Comparable>) value
-                        .getClass();
-        
         name = super.getRealPropertyName(name);
+        Class<? extends Comparable> clazz = (Class<? extends Comparable>)
+            getPrimitiveFieldClass(name, value.getClass());
+        
         
         Path<?> path = getPath(root, name);
         



Mime
View raw message