cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1497778 - in /cxf/branches/2.6.x-fixes: ./ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/ldap/ rt/rs/extensions/search/src/main/java/org/apa...
Date Fri, 28 Jun 2013 14:00:58 GMT
Author: sergeyb
Date: Fri Jun 28 14:00:58 2013
New Revision: 1497778

URL: http://svn.apache.org/r1497778
Log:
Merged revisions 1497776 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

................
  r1497776 | sergeyb | 2013-06-28 14:57:55 +0100 (Fri, 28 Jun 2013) | 9 lines
  
  Merged revisions 1497774 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1497774 | sergeyb | 2013-06-28 14:51:10 +0100 (Fri, 28 Jun 2013) | 1 line
    
    [CXF-5101] More options to get the parsed values validated
  ........
................

Added:
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/PropertyValidationException.java
      - copied unchanged from r1497776, cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/PropertyValidationException.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/PropertyValidator.java
      - copied unchanged from r1497776, cxf/branches/2.7.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/PropertyValidator.java
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/jpa/AbstractJPATypedQueryVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/ldap/LdapQueryVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/AbstractSearchConditionVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/AbstractUntypedSearchConditionVisitor.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/branches/2.7.x-fixes:r1497776
  Merged /cxf/trunk:r1497774

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/jpa/AbstractJPATypedQueryVisitor.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/AbstractJPATypedQueryVisitor.java?rev=1497778&r1=1497777&r2=1497778&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/AbstractJPATypedQueryVisitor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/AbstractJPATypedQueryVisitor.java
Fri Jun 28 14:00:58 2013
@@ -164,12 +164,15 @@ public abstract class AbstractJPATypedQu
     
     private Predicate buildPredicate(PrimitiveStatement ps) {
         String name = ps.getProperty();
+        Object propertyValue = ps.getValue();
+        validatePropertyValue(name, propertyValue);
+        
         name = super.getRealPropertyName(name);
         ClassValue cv = getPrimitiveFieldClass(ps,
                                                name, 
                                                ps.getValue().getClass(), 
                                                ps.getValueType(), 
-                                               ps.getValue()); 
+                                               propertyValue); 
         CollectionCheckInfo collInfo = cv.getCollectionCheckInfo();
         Path<?> path = getPath(root, name, cv, collInfo);
         

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/ldap/LdapQueryVisitor.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/ldap/LdapQueryVisitor.java?rev=1497778&r1=1497777&r2=1497778&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/ldap/LdapQueryVisitor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/ldap/LdapQueryVisitor.java
Fri Jun 28 14:00:58 2013
@@ -48,9 +48,10 @@ public class LdapQueryVisitor<T> extends
         PrimitiveStatement statement = sc.getStatement();
         if (statement != null) {
             if (statement.getProperty() != null) {
-                String rvalStr = statement.getValue().toString();
                 String name = getRealPropertyName(statement.getProperty());
-               
+                String rvalStr = getPropertyValue(name, statement.getValue());
+                validatePropertyValue(name, rvalStr);
+                
                 sb.append("(");
                 if (sc.getConditionType() == ConditionType.NOT_EQUALS) {
                     sb.append("!");

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.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/sql/SQLPrinterVisitor.java?rev=1497778&r1=1497777&r2=1497778&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
Fri Jun 28 14:00:58 2013
@@ -67,9 +67,12 @@ public class SQLPrinterVisitor<T> extend
         PrimitiveStatement statement = sc.getStatement();
         if (statement != null) {
             if (statement.getProperty() != null) {
-                String rvalStr = statement.getValue().toString().replaceAll("\\*", "%");
                 String name = getRealPropertyName(statement.getProperty());
-               
+                String value = getPropertyValue(name, statement.getValue());
+                validatePropertyValue(name, value);
+                String rvalStr = value.replaceAll("\\*", "%");
+                
+                                
                 if (tableAlias != null) {
                     name = tableAlias + "." + name;
                 }

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/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/visitor/AbstractSearchConditionVisitor.java?rev=1497778&r1=1497777&r2=1497778&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/AbstractSearchConditionVisitor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/AbstractSearchConditionVisitor.java
Fri Jun 28 14:00:58 2013
@@ -36,6 +36,7 @@ public abstract class AbstractSearchCond
     
     private Map<String, String> fieldMap;
     private Map<String, Class<?>> primitiveFieldTypeMap;
+    private PropertyValidator<Object> validator;
     
     protected AbstractSearchConditionVisitor(Map<String, String> fieldMap) {
         this.fieldMap = fieldMap;
@@ -158,4 +159,14 @@ public abstract class AbstractSearchCond
             return collectionProps != null && collectionProps.contains(name);
         }
     }
+    
+    protected void validatePropertyValue(String name, Object value) {
+        if (validator != null) {
+            validator.validate(name, value);
+        }
+    }
+    
+    public void setValidator(PropertyValidator<Object> validator) {
+        this.validator = validator;
+    }
 }

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/AbstractUntypedSearchConditionVisitor.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/visitor/AbstractUntypedSearchConditionVisitor.java?rev=1497778&r1=1497777&r2=1497778&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/AbstractUntypedSearchConditionVisitor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/AbstractUntypedSearchConditionVisitor.java
Fri Jun 28 14:00:58 2013
@@ -35,6 +35,10 @@ public abstract class AbstractUntypedSea
     public VisitorState<StringBuilder> getVisitorState() {
         return this.state;
     }
+
+    protected String getPropertyValue(String name, Object value) {
+        return value.toString();
+    }
     
     protected StringBuilder getStringBuilder() {
         return getVisitorState().get();
@@ -52,5 +56,4 @@ public abstract class AbstractUntypedSea
         StringBuilder sb = removeStringBuilder();
         return sb == null ? null : sb.toString();
     }
-    
 }



Mime
View raw message