cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r898788 - in /websites/production/cxf/content: cache/docs.pageCache docs/jax-rs-search.html
Date Fri, 21 Feb 2014 17:47:55 GMT
Author: buildbot
Date: Fri Feb 21 17:47:55 2014
New Revision: 898788

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/jax-rs-search.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/jax-rs-search.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-search.html (original)
+++ websites/production/cxf/content/docs/jax-rs-search.html Fri Feb 21 17:47:55 2014
@@ -118,11 +118,11 @@ Apache CXF -- JAX-RS Search
            <!-- Content -->
            <div class="wiki-content">
 <div id="ConfluenceContent"><h1 id="JAX-RSSearch-JAX-RSSearch">JAX-RS Search</h1><p>&#160;</p><p><style
type="text/css">/*<![CDATA[*/
-div.rbtoc1392752871779 {padding: 0px;}
-div.rbtoc1392752871779 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1392752871779 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1393004854902 {padding: 0px;}
+div.rbtoc1393004854902 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1393004854902 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1392752871779">
+/*]]>*/</style></p><div class="toc-macro rbtoc1393004854902">
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSSearch-JAX-RSSearch">JAX-RS
Search</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSSearch-AdvancedSearchQueries">Advanced
Search Queries</a></li><li><a shape="rect" href="#JAX-RSSearch-SupportedQueryLanguages">Supported
Query Languages</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSSearch-FeedItemQueryLanguage">Feed
Item Query Language</a></li><li><a shape="rect" href="#JAX-RSSearch-OpenDataProtocol">Open
Data Protocol</a></li></ul>
@@ -140,7 +140,7 @@ div.rbtoc1392752871779 li {margin-left: 
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSSearch-FIQL">FIQL</a></li><li><a
shape="rect" href="#JAX-RSSearch-OData">OData</a></li></ul>
 </li><li><a shape="rect" href="#JAX-RSSearch-Usingdatesinqueries">Using
dates in queries</a></li><li><a shape="rect" href="#JAX-RSSearch-Alternativequerylanguages">Alternative
query languages</a></li></ul>
 </li></ul>
-</div><h2 id="JAX-RSSearch-AdvancedSearchQueries">Advanced Search Queries</h2><p>CXF
supports mapping the advanced query expressions to the typed Search API with the help of query
language specific parsers.&#160; &#160;</p><h2 id="JAX-RSSearch-SupportedQueryLanguages">Supported
Query Languages</h2><h3 id="JAX-RSSearch-FeedItemQueryLanguage">Feed Item Query
Language</h3><p><a shape="rect" class="external-link" href="http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00"
rel="nofollow">Feed Item Query Language</a>(FIQL) is supported since CXF 2.3..</p><p>For
example, the following query</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div><h2 id="JAX-RSSearch-AdvancedSearchQueries">Advanced Search Queries</h2><p>CXF
supports mapping the advanced query expressions to the typed Search API with the help of query
language specific parsers.&#160; &#160;</p><h2 id="JAX-RSSearch-SupportedQueryLanguages">Supported
Query Languages</h2><h3 id="JAX-RSSearch-FeedItemQueryLanguage">Feed Item Query
Language</h3><p><a shape="rect" class="external-link" href="http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00"
rel="nofollow">Feed Item Query Language</a>(FIQL) is supported since CXF 2.3.0.</p><p>For
example, the following query</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[?_s=name==CXF;version=ge=2.2
 ]]></script>
 </div></div><p>lets users search for all the Apache projects with the name
'CXF' and the version greater or equal to '2.2'. The initial '=' separates the name of the
query '_s' from the FIQL expression, while '==' and '=ge=' convey 'equals to' and 'greater
or equals to' respectively.<br clear="none"> An expression such as "name==CXF*" can
be used to do the partial equality check (example: the name should start from "CXF").</p><p>More
complex composite expressions can also be expressed easily enough, examples:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
@@ -258,7 +258,7 @@ assertEquals(&quot;SELECT LEVEL_COLUMN F
               WHERE LEVEL_COLUMN &gt; &#39;10&#39;&quot;,
               visitor.getResult());
 ]]></script>
-</div></div><h2 id="JAX-RSSearch-Convertingthequeries">Converting the queries</h2><p>SearchCondition
can also be used to convert the search requirements (originally expressed in FIQL) into other
query languages. <br clear="none"> A custom <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java">SearchConditionVisitor</a>
implementation can be used to convert SearchCondition objects into custom expressions or typed
objects. CXF ships visitors for converting expressions to SQL, JPA 2.0 CriteriaQuery or TypedQuery,
Lucene Query.</p><h3 id="JAX-RSSearch-SQL">SQL</h3><p>org.apache.cxf.jaxrs.ext.search.sql.SQLPrinterVisitor
can be used for creating SQL expressions. For example:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h2 id="JAX-RSSearch-Convertingthequeries">Converting the queries</h2><p>SearchCondition
can also be used to convert the search requirements (originally expressed in FIQL/OData) into
other query languages. <br clear="none"> A custom <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java">SearchConditionVisitor</a>
implementation can be used to convert SearchCondition objects into custom expressions or typed
objects. CXF ships visitors for converting expressions to SQL, JPA 2.0 CriteriaQuery or TypedQuery,
Lucene Query.</p><h3 id="JAX-RSSearch-SQL">SQL</h3><p>org.apache.cxf.jaxrs.ext.search.sql.SQLPrinterVisitor
can be used for creating SQL expressions. For example:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[//
?_s=&quot;name==ami*;level=gt=10&quot;
 SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
 SQLPrinterVisitor&lt;Book&gt; visitor = new SQLPrinterVisitor&lt;Book&gt;(&quot;table&quot;);
@@ -283,7 +283,7 @@ assertEquals(&quot;SELECT LEVEL_COLUMN F
               WHERE LEVEL_COLUMN &gt; &#39;10&#39;&quot;,
               visitor.getResult());
 ]]></script>
-</div></div><p>The fields map can help hide the names of the actual table
columns/record fields from the Web frontend. Example, the users will know that the 'level'
property is available while internally it will be converted to a LEVEL_COLUMN name.</p><h3
id="JAX-RSSearch-JPA2.0">JPA 2.0</h3><p>CXF 2.6.4 and CXF 2.7.1 introduce org.apache.cxf.jaxrs.ext.search.jpa.JPATypedQueryVisitor
and org.apache.cxf.jaxrs.ext.search.jpa.JPACriteriaQueryVisitor which can be used to capture
FIQL expressions into <br clear="none"> javax.persistence.TypedQuery or javax.persistence.criteria.CriteriaQuery
objects.</p><p>For example, given:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The fields map can help hide the names of the actual table
columns/record fields from the Web frontend. Example, the users will know that the 'level'
property is available while internally it will be converted to a LEVEL_COLUMN name.</p><h3
id="JAX-RSSearch-JPA2.0">JPA 2.0</h3><p>CXF 2.6.4 and CXF 2.7.1 introduce org.apache.cxf.jaxrs.ext.search.jpa.JPATypedQueryVisitor
and org.apache.cxf.jaxrs.ext.search.jpa.JPACriteriaQueryVisitor which can be used to capture
FIQL/OData expressions into <br clear="none"> javax.persistence.TypedQuery or javax.persistence.criteria.CriteriaQuery
objects.</p><p>For example, given:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public
class Book {
 
     private String title;
@@ -491,7 +491,7 @@ TypedQuery&lt;Book&gt; query = jpa.getQu
 return query.getResultList();
 
 ]]></script>
-</div></div><p>org.apache.cxf.jaxrs.ext.search.jpa.JPALanguageVisitor for
converting FIQL expressions into JPQL expressions have also been introduced.</p><h4
id="JAX-RSSearch-Countexpressions">Count expressions</h4><p>Count expressions
are supported at the two levels,</p><p>First, one may want to get the count of
records matching a given search expression, this actually can be done by checking the size
of the result list:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+</div></div><p>org.apache.cxf.jaxrs.ext.search.jpa.JPALanguageVisitor for
converting FIQL/OData expressions into JPQL expressions have also been introduced.</p><h4
id="JAX-RSSearch-Countexpressions">Count expressions</h4><p>Count expressions
are supported at the two levels,</p><p>First, one may want to get the count of
records matching a given search expression, this actually can be done by checking the size
of the result list:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[TypedQuery&lt;Book&gt;
query = jpa.getQuery();
 return query.getResultList().size();
 ]]></script>
@@ -503,7 +503,7 @@ filter.accept(jpa);
 long count = jpa.count();
 
 ]]></script>
-</div></div><p>Second, one may want to find say all the books written by
at least two authors or all the books with no reviews.<br clear="none"> If a collection
entity such as BookReview has a non primitive type, then typing "reviews==0" is all what is
needed, otherwise a count extension needs to be used, for example: "count(authors)=ge=2"</p><h3
id="JAX-RSSearch-Lucene">Lucene</h3><p>Mapping of FIQL expressions to Lucene
(4.0.0-BETA) Query is supported starting from CXF 2.7.1.</p><p>org.apache.cxf.jaxrs.ext.search.lucene.LuceneQueryVisitor
can be used to support the default (content) field or specific custom field queries.<br
clear="none"> Queries for specific terms and phrases are supported.</p><p>Example,
"find the documents containing a 'text' term":</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>&#160;</p><p>Second, <strong>only
when using FIQL</strong>, a count extension can be used. For example, one may want to
find 'all the books written by at least two authors or all the books with no reviews'.<br
clear="none"> If a collection entity such as BookReview has a non primitive type, then
typing "reviews==0" is all what is needed, otherwise a count extension needs to be used, for
example: "count(authors)=ge=2"</p><h3 id="JAX-RSSearch-Lucene">Lucene</h3><p>Mapping
of FIQL/OData expressions to Lucene (4.0.0-BETA) Query is supported starting from CXF 2.7.1.</p><p>org.apache.cxf.jaxrs.ext.search.lucene.LuceneQueryVisitor
can be used to support the default (content) field or specific custom field queries.<br
clear="none"> Queries for specific terms and phrases are supported.</p><p>Example,
"find the documents containing a 'text' term":</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[import
org.apache.lucene.search.Query;
 
 SearchCondition&lt;SearchBean&gt; filter = new FiqlParser&lt;SearchBean&gt;(SearchBean.class).parse(&quot;ct==text&quot;);
@@ -519,7 +519,7 @@ lucene.visit(filter);
 org.apache.lucene.search.Query phraseQuery = lucene.getQuery();
 // use query
 ]]></script>
-</div></div><p>In this example, the visitor is requested to create Lucene
org.apache.lucene.search.PhraseQuery against the specified contents field ("contents"). The
visitor can also accept a contentsFieldMap map property when different phrases may need to
be checked against different contents fields.</p><p>The current limitation is
that no typed Date queries are supported yet (except for the equality match), for example,
"find all the documents issued before a given date", to be supported shortly.</p><h3
id="JAX-RSSearch-LDAP">LDAP</h3><p>Mapping of FIQL expressions to LDAP queries
as defined by <a shape="rect" class="external-link" href="http://tools.ietf.org/html/rfc4515"
rel="nofollow">RFC-4515</a> is supported starting from CXF 2.7.1 with the help of
org.apache.cxf.jaxrs.ext.search.ldap.LdapQueryVisitor. Use this visitor when working with
LDAP or OSGI.</p><p>Here is a summary of LDAP filter operators:</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th cols
 pan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"="</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Equal</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"!"</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Not Equal</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"&lt;="</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Less Or Equal</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"&gt;="</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Greater or Equal</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"&amp;"</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>AND</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"|"</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>OR</p></td>
 </tr></tbody></table></div><p>FIQL "=le=" and "=lt=" will both
map to "&lt;=", while "=ge=" and "=gt=" to "&gt;=".</p><p>For example:</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>FIQL</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>LDAP</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>"name==bar*"</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>"(name=bar*)"</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"name!=bar"</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>"(!name=bar)"</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"name!=bar;id=gt=10"</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>"(&amp;(!name=bar)(id&gt;=10))"</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"name!=bar;(id=gt=10,id=lt=5)"</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>"(&amp;(!name=bar)(
 |(id&gt;=10)(id&lt;=5)))"</p></td></tr></tbody></table></div><p>The
converter is created like all other converters:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>In this example, the visitor is requested to create Lucene
org.apache.lucene.search.PhraseQuery against the specified contents field ("contents"). The
visitor can also accept a contentsFieldMap map property when different phrases may need to
be checked against different contents fields.</p><p>The current limitation is
that no typed Date queries are supported yet (except for the equality match), for example,
"find all the documents issued before a given date", to be supported shortly.</p><h3
id="JAX-RSSearch-LDAP">LDAP</h3><p>Mapping of FIQL/OData expressions to LDAP
queries as defined by <a shape="rect" class="external-link" href="http://tools.ietf.org/html/rfc4515"
rel="nofollow">RFC-4515</a> is supported starting from CXF 2.7.1 with the help of
org.apache.cxf.jaxrs.ext.search.ldap.LdapQueryVisitor. Use this visitor when working with
LDAP or OSGI.</p><p>Here is a summary of LDAP filter operators:</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><t
 h colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"="</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Equal</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"!"</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Not Equal</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"&lt;="</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Less Or Equal</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"&gt;="</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Greater or Equal</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"&amp;"</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>AND</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"|"</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>OR</p
 ></td></tr></tbody></table></div><p>FIQL "=le=" and
"=lt=" will both map to "&lt;=", while "=ge=" and "=gt=" to "&gt;=".</p><p>For
example:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>FIQL</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>LDAP</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"name==bar*"</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>"(name=bar*)"</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"name!=bar"</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>"(!name=bar)"</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"name!=bar;id=gt=10"</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>"(&amp;(!name=bar)(id&gt;=10))"</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>"name!=bar;(id=gt=10,id=lt=5)"</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>"(&amp;(!name
 =bar)(|(id&gt;=10)(id&lt;=5)))"</p></td></tr></tbody></table></div><p>The
converter is created like all other converters:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[//
FIQL &quot;oclass=Bar&quot;
 
 // map &#39;oclass&#39; used in the FIQL query to the actual property name, &#39;objectClass&#39;
@@ -603,7 +603,7 @@ public void visit(SearchCondition&lt;T&g
     }
 }
 ]]></script>
-</div></div><h4 id="JAX-RSSearch-Customparsing">Custom parsing</h4><p>If
needed you can access a FIQL query directly and delegate it further to your own custom FIQL
handler:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><h4 id="JAX-RSSearch-Customparsing">Custom parsing</h4><p>If
needed you can access a FIQL/OData query directly and delegate it further to your own custom
FIQL handler:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Path(&quot;/search&quot;)
 public class SearchEngine {
     @Context
@@ -612,7 +612,7 @@ public class SearchEngine {
     @GET
     public List&lt;Book&gt; findBooks() {
         MultivaluedMap&lt;String, String&gt; params = ui.getQueryParameters();
-        String fiqlQuery = params.getFirst(&quot;_s&quot;);
+        String query = params.getFirst(&quot;_s&quot;); // or $filter, etc
         // delegate to your own custom handler 
 
         // note that the original search expression can also be retrieved 
@@ -836,7 +836,7 @@ public class BooksResource {
 
 }
 ]]></script>
-</div></div><p>Note this code assumes that "bookId" is mapped to "Book.id"
property with the help of the contextual "search.bean.property.map" property as explained
earlier.</p><h2 id="JAX-RSSearch-Validation">Validation</h2><p>First
option is to have a bean capturing specific property values do a domain specific validation.
For example, a Book.class may have its setName(String name) method validating the name value.
<br clear="none"> Another option is to inject a custom <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/PropertyValidator.java">validator</a>
into a visitor which is used to build the untyped or typed query.</p><p>Finally,
avoid letting users to use properties whose values which can not be well validated in the
application code. Using a typed capturing bean like Book.class offers a perfect option to
limit a number of supported properties to the ones known t
 o be related to Books.</p><h2 id="JAX-RSSearch-Buildingthequeries">Building the
queries</h2><h3 id="JAX-RSSearch-FIQL">FIQL</h3><p>CXF 2.4.0 introduces
<a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/client/SearchConditionBuilder.java">SearchConditionBuilder</a>
which makes it simpler to build FIQL queries. SearchConditionBuilder is an abstract class
that returns a FIQL builder by default:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Note this code assumes that "bookId" is mapped to "Book.id"
property with the help of the contextual "search.bean.property.map" property as explained
earlier.</p><h2 id="JAX-RSSearch-Validation">Validation</h2><p>First
option is to have a bean capturing specific property values do a domain specific validation.
For example, a Book.class may have its setName(String name) method validating the name value.
<br clear="none"> Another option is to inject a custom <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/visitor/PropertyValidator.java">validator</a>
into a visitor which is used to build the untyped or typed query.</p><p>Finally,
avoid letting users to use properties whose values which can not be well validated in the
application code. Using a typed capturing bean like Book.class offers a perfect option to
limit a number of supported properties to the ones known t
 o be related to Books.</p><p>Bean Validation 1.1 can also be used.</p><h2
id="JAX-RSSearch-Buildingthequeries">Building the queries</h2><h3 id="JAX-RSSearch-FIQL">FIQL</h3><p>CXF
2.4.0 introduces <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/client/SearchConditionBuilder.java">SearchConditionBuilder</a>
which makes it simpler to build FIQL queries. SearchConditionBuilder is an abstract class
that returns a FIQL builder by default:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[SearchConditionBuilder
b = SearchConditionBuilder.instance();
 String fiqlQuery = b.is(&quot;id&quot;).greaterThan(123).query();
 



Mime
View raw message