cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Prototyping Search PropertyNameConverter
Date Tue, 22 Dec 2015 16:44:31 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 717fd2c11 -> d7ea93c74


Prototyping Search PropertyNameConverter


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d7ea93c7
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d7ea93c7
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d7ea93c7

Branch: refs/heads/3.0.x-fixes
Commit: d7ea93c747902f7987283739163fed68f76596a7
Parents: 717fd2c
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Tue Dec 22 16:41:53 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Tue Dec 22 16:44:09 2015 +0000

----------------------------------------------------------------------
 .../search/AbstractSearchConditionParser.java   | 10 ++++++++
 .../jaxrs/ext/search/PropertyNameConverter.java | 25 ++++++++++++++++++++
 .../cxf/jaxrs/ext/search/SearchUtils.java       |  1 +
 3 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d7ea93c7/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
index e0be04b..8dfdd80 100644
--- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
+++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
@@ -67,6 +67,16 @@ public abstract class AbstractSearchConditionParser<T> implements
SearchConditio
     
     protected String getActualSetterName(String setter) {
         String beanPropertyName = beanPropertiesMap == null ? null : beanPropertiesMap.get(setter);
+        if (beanPropertyName == null) {
+            Message m = JAXRSUtils.getCurrentMessage();
+            if (m != null) {
+                Object converterProp = m.getContextualProperty(SearchUtils.BEAN_PROPERTY_CONVERTER);
+                if (converterProp != null) {
+                    PropertyNameConverter converter = (PropertyNameConverter)converterProp;
+                    beanPropertyName = converter.getPropertyName(setter);
+                }
+            }
+        }
         return beanPropertyName != null ? beanPropertyName : setter;
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/d7ea93c7/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/PropertyNameConverter.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/PropertyNameConverter.java
b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/PropertyNameConverter.java
new file mode 100644
index 0000000..9e8b836
--- /dev/null
+++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/PropertyNameConverter.java
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.jaxrs.ext.search;
+
+public interface PropertyNameConverter {
+
+    String getPropertyName(String setter);
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/d7ea93c7/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
index c35007d..45013c5 100644
--- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
+++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
@@ -39,6 +39,7 @@ public final class SearchUtils {
     public static final String TIMEZONE_SUPPORT_PROPERTY = "search.timezone.support";
     public static final String LAX_PROPERTY_MATCH = "search.lax.property.match";
     public static final String BEAN_PROPERTY_MAP = "search.bean.property.map";
+    public static final String BEAN_PROPERTY_CONVERTER = "search.bean.property.converter";
     public static final String SEARCH_VISITOR_PROPERTY = "search.visitor";
     public static final String DECODE_QUERY_VALUES = "search.decode.values";
     


Mime
View raw message