cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r867253 [26/46] - in /websites/production/cxf/content: ./ 2008/04/28/ 2008/06/20/ 2009/02/10/ 2009/08/04/ cache/ docs/ docs/cxf-architecture.thumbs/ docs/cxf-dependency-graphs.thumbs/ docs/logbrowser-configuration.thumbs/ docs/logbrowser-so...
Date Mon, 24 Jun 2013 17:10:57 GMT
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 Mon Jun 24 17:10:51 2013
@@ -26,7 +26,17 @@
 <meta name="keywords" content="business integration, EAI, SOA, Service Oriented Architecture, web services, SOAP, JBI, JMS, WSDL, XML, EDI, Electronic Data Interchange, standards support, integration standards, application integration, middleware, software, solutions, services, CXF, open source">
 <meta name="description" content="Apache CXF, Services Framework - JAX-RS Search">
 
-
+  <link href='http://cxf.apache.org/resources/highlighter/styles/shCore.css' rel='stylesheet' type='text/css' />
+  <link href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
+  
+  <script type="text/javascript">
+  SyntaxHighlighter.defaults['toolbar'] = false;
+  SyntaxHighlighter.all();
+  </script>
+ 
     <title>
 Apache CXF -- JAX-RS Search
     </title>
@@ -44,19 +54,15 @@ Apache CXF -- JAX-RS Search
     <td id="cell-1-0">&nbsp;</td>
     <td id="cell-1-1">&nbsp;</td>
     <td id="cell-1-2">
-      <div style="padding: 5px;">
-        <div id="banner">
-          <!-- Banner -->
-<div id="banner-content">
+      <!-- Banner -->
+<div class="banner" id="banner"><p>
 <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="left" colspan="1" nowrap>
 <a shape="rect" href="http://cxf.apache.org/" title="Apache CXF"><span style="font-weight: bold; font-size: 170%; color: white">Apache CXF</span></a>
 </td><td align="right" colspan="1" nowrap>
 <a shape="rect" href="http://www.apache.org/" title="The Apache Sofware Foundation"><img border="0" alt="ASF Logo" src="http://cxf.apache.org/images/asf-logo.png"></a>
 </td></tr></table>
-</div>
-          <!-- Banner -->
-        </div>
-      </div>
+</p></div>
+      <!-- Banner -->
       <div id="top-menu">
         <table border="0" cellpadding="1" cellspacing="0" width="100%">
           <tr>
@@ -96,7 +102,7 @@ Apache CXF -- JAX-RS Search
 
 
 <hr>
-<ul class="alternate" type="square"><li>Search
+<ul class="alternate" type="square"><li>Search<br clear="none">
 
 <form enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box" action="http://www.google.com/cse">
   <div>
@@ -137,9 +143,9 @@ Apache CXF -- JAX-RS Search
 <p>For example, the following query</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 ?_s=name==CXF;version=ge=2.2
-</pre>
+]]></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">
@@ -148,14 +154,14 @@ An expression such as "name==CXF*" can b
 <p>More complex composite expressions can also be expressed easily enough, examples:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">// Find all employees younger than 25 or older than 35 living in London
-</span>/employees?_s=(age=lt=25,age=gt=35);city==London
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+// Find all employees younger than 25 or older than 35 living in London
+/employees?_s=(age=lt=25,age=gt=35);city==London
 
-<span class="code-comment">// Find all books on math or physics published in 1999 only.
-</span>/books?_s=date=lt=2000-01-01;date=gt=1999-01-01;(sub==math,sub==physics)
+// Find all books on math or physics published in 1999 only.
+/books?_s=date=lt=2000-01-01;date=gt=1999-01-01;(sub==math,sub==physics)
 
-</pre>
+]]></script>
 </div></div>
 
 <p>Here is a summary of FIQL operators:</p>
@@ -172,12 +178,12 @@ An expression such as "name==CXF*" can b
 <p>Note, when passing the FIQL queries via URI query parameters,  either '_search' or '_s' query parameter has to be used to mark a FIQL expression for it not to 'interfere' with other optional query parameters. Starting from CXF 2.7.2 it is also possible to use the whole query component to convey a FIQL expression, example,</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-comment">// Find all books on math or physics published in 1999 only.
-</span>/books?date=lt=2000-01-01;date=gt=1999-01-01;(sub==math,sub==physics)
+// Find all books on math or physics published in 1999 only.
+/books?date=lt=2000-01-01;date=gt=1999-01-01;(sub==math,sub==physics)
 
-</pre>
+]]></script>
 </div></div>
 
 <p>Note that no "_s" or "_search" query parameter is available, the whole query string starting after "?" represents an actual FIQL expression.<br clear="none">
@@ -201,13 +207,13 @@ Please use "search.use.all.query.compone
 <p>The following dependency is required starting from CXF 2.6.0:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-   <span class="code-tag">&lt;dependency&gt;</span>
-      <span class="code-tag">&lt;groupId&gt;</span>org.apache.cxf<span class="code-tag">&lt;/groupId&gt;</span>
-      <span class="code-tag">&lt;artifactId&gt;</span>cxf-rt-rs-extension-search<span class="code-tag">&lt;/artifactId&gt;</span>
-      <span class="code-tag">&lt;version&gt;</span>2.6.0<span class="code-tag">&lt;/version&gt;</span>
-   <span class="code-tag">&lt;/dependency&gt;</span>
-</pre>
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
+   &lt;dependency&gt;
+      &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
+      &lt;artifactId&gt;cxf-rt-rs-extension-search&lt;/artifactId&gt;
+      &lt;version&gt;2.6.0&lt;/version&gt;
+   &lt;/dependency&gt;
+]]></script>
 </div></div>
 
 <p>Additionally, in CXF 2.6.0, <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/SearchContextProvider.java">SearchContextProvider</a> needs to be registered as jaxrs:provider. </p>
@@ -221,26 +227,26 @@ Please use "search.use.all.query.compone
 <p>So, suppose a list or map of Book instances is available. Here is one possible approach:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"books"</span>)
-<span class="code-keyword">public</span> class Books {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("books")
+public class Books {
 
-<span class="code-keyword">private</span> Map&lt;<span class="code-object">Long</span>, Book&gt; books;
+private Map&lt;Long, Book&gt; books;
 @Context
-<span class="code-keyword">private</span> SearchContext context;
+private SearchContext context;
 
  @GET
- <span class="code-keyword">public</span> List&lt;Book&gt; getBook() {
+ public List&lt;Book&gt; getBook() {
 
    SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
-   <span class="code-comment">// SearchCondition#isMet method can also be used to build a list of matching beans
-</span>
-   <span class="code-comment">// iterate over all the values in the books map and <span class="code-keyword">return</span> a collection of matching beans
-</span>   List&lt;Book&gt; found = sc.findAll(books.values());
-   <span class="code-keyword">return</span> found;
+   // SearchCondition#isMet method can also be used to build a list of matching beans
+
+   // iterate over all the values in the books map and return a collection of matching beans
+   List&lt;Book&gt; found = sc.findAll(books.values());
+   return found;
  }
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>Note that a searchContext.getCondition(Book.class) call may return an arbitrary complex SearchCondition, it can be a simple primitive<br clear="none">
@@ -264,80 +270,80 @@ expression or a more complex, composite 
 <p>The preferred approach, when working with typed beans, is to register a bean properties map, using a "search.bean.property.map" contextual property or directly with SearchContext. For example, given</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-keyword">public</span> class Book {
+public class Book {
 
-    <span class="code-keyword">private</span> <span class="code-object">int</span> id;
-    <span class="code-keyword">private</span> OwnerInfo ownerinfo;
-    <span class="code-comment">//setters and getters omitted <span class="code-keyword">for</span> brewity
-</span>}
+    private int id;
+    private OwnerInfo ownerinfo;
+    //setters and getters omitted for brewity
+}
 
 @Embeddable
-<span class="code-keyword">public</span> class OwnerInfo {
+public class OwnerInfo {
 
-    <span class="code-keyword">private</span> Address address;
-    <span class="code-keyword">private</span> Name name;
-    <span class="code-comment">//setters and getters omitted <span class="code-keyword">for</span> brewity
-</span>}
+    private Address address;
+    private Name name;
+    //setters and getters omitted for brewity
+}
 
 @Embeddable
-<span class="code-keyword">public</span> class Name {
+public class Name {
 
-    <span class="code-keyword">private</span> <span class="code-object">String</span> name;
-    <span class="code-comment">//setters and getters omitted <span class="code-keyword">for</span> brewity
-</span>}
+    private String name;
+    //setters and getters omitted for brewity
+}
 
-</pre>
+]]></script>
 </div></div>
 
 <p>and the following map:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;map&gt;</span>
- <span class="code-tag"><span class="code-comment">&lt;!-- 'oname' is alias for the actual nested bean property --&gt;</span></span>
- <span class="code-tag">&lt;entry key=<span class="code-quote">"oname"</span> value=<span class="code-quote">"ownerinfo.name.name"</span>/&gt;</span>
-<span class="code-tag">&lt;/map&gt;</span>
-</pre>
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
+&lt;map&gt;
+ &lt;!-- 'oname' is alias for the actual nested bean property --&gt;
+ &lt;entry key="oname" value="ownerinfo.name.name"/&gt;
+&lt;/map&gt;
+]]></script>
 </div></div>
 
 <p>will let users type and bookmark queries (and without seeing them producing unexpected results) like this one:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">//Find all the books owned by Fred with id greater than 100
-</span>/books?_s=id=gt=100;oname=Fred
-</pre>
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+//Find all the books owned by Fred with id greater than 100
+/books?_s=id=gt=100;oname=Fred
+]]></script>
 </div></div>  
 
 <p>Note, a property name such as "ownerinfo.name.name" uses '.' to let the parser navigate to the actual Name bean which has a 'name' property. This can be optimized in cases where the owner bean is known to have either a constructor or static valueOf() method accepting the 'name' property, for example, given</p>
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">public</span> class Name {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+public class Name {
 
-    <span class="code-keyword">private</span> <span class="code-object">String</span> name;
-    <span class="code-keyword">public</span> Name() {
+    private String name;
+    public Name() {
     } 
-    <span class="code-keyword">public</span> Name(<span class="code-object">String</span> name) {
-        <span class="code-keyword">this</span>.name = name;
+    public Name(String name) {
+        this.name = name;
     }
-    <span class="code-comment">//setters and getters omitted <span class="code-keyword">for</span> brewity
-</span>}
-</pre>
+    //setters and getters omitted for brewity
+}
+]]></script>
 </div></div>
 <p>the mapping between "oname" and "ownerinfo.name" will work too.</p>
 
 <p>You can also have many to one mappings, for example</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;map&gt;</span>
- <span class="code-tag"><span class="code-comment">&lt;!-- 'oname' and 'owner' are aliases for the 'ownerinfo.name.name' bean property --&gt;</span></span>
- <span class="code-tag">&lt;entry key=<span class="code-quote">"oname"</span> value=<span class="code-quote">"ownerinfo.name.name"</span>/&gt;</span>
- <span class="code-tag">&lt;entry key=<span class="code-quote">"owner"</span> value=<span class="code-quote">"ownerinfo.name.name"</span>/&gt;</span>
-<span class="code-tag">&lt;/map&gt;</span>
-</pre>
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
+&lt;map&gt;
+ &lt;!-- 'oname' and 'owner' are aliases for the 'ownerinfo.name.name' bean property --&gt;
+ &lt;entry key="oname" value="ownerinfo.name.name"/&gt;
+ &lt;entry key="owner" value="ownerinfo.name.name"/&gt;
+&lt;/map&gt;
+]]></script>
 </div></div>
 
 
@@ -365,19 +371,19 @@ expression or a more complex, composite 
 <p>org.apache.cxf.jaxrs.ext.search.SearchBean is a utility bean class which can simplify analyzing the captured FIQL expressions and converting them to the other language expressions, in cases where having to update the bean class such as Book.class with all the properties that may need to be supported is not practical or the properties need to be managed manually. For example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">// ?_s=<span class="code-quote">"level=gt=10"</span>
-</span>SearchCondition&lt;SearchBean&gt; sc = searchContext.getCondition(SearchBean.class);
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+// ?_s="level=gt=10"
+SearchCondition&lt;SearchBean&gt; sc = searchContext.getCondition(SearchBean.class);
 
-Map\&lt;, <span class="code-object">String</span>\&gt; fieldMap = <span class="code-keyword">new</span> HashMap\&lt;<span class="code-object">String</span>, <span class="code-object">String</span>\&gt;();
-fieldMap.put(<span class="code-quote">"level"</span>, <span class="code-quote">"LEVEL_COLUMN"</span>);
+Map\&lt;, String\&gt; fieldMap = new HashMap\&lt;String, String\&gt;();
+fieldMap.put("level", "LEVEL_COLUMN");
 
-SQLPrinterVisitor&lt;SearchBean&gt; visitor = <span class="code-keyword">new</span> SQLPrinterVisitor&lt;SearchBean&gt;(fieldMap, <span class="code-quote">"table"</span>, <span class="code-quote">"LEVEL_COLUMN"</span>);
+SQLPrinterVisitor&lt;SearchBean&gt; visitor = new SQLPrinterVisitor&lt;SearchBean&gt;(fieldMap, "table", "LEVEL_COLUMN");
 sc.accept(visitor);
 assertEquals("SELECT LEVEL_COLUMN FROM table 
               WHERE LEVEL_COLUMN &gt; '10'",
               visitor.getResult());
-</pre>
+]]></script>
 </div></div>
 
 
@@ -391,10 +397,10 @@ A custom <a shape="rect" class="external
 <p>org.apache.cxf.jaxrs.ext.search.sql.SQLPrinterVisitor can be used for creating SQL expressions. For example: </p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">// ?_s=<span class="code-quote">"name==ami*;level=gt=10"</span>
-</span>SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
-SQLPrinterVisitor&lt;Book&gt; visitor = <span class="code-keyword">new</span> SQLPrinterVisitor&lt;Book&gt;(<span class="code-quote">"table"</span>);
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+// ?_s="name==ami*;level=gt=10"
+SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
+SQLPrinterVisitor&lt;Book&gt; visitor = new SQLPrinterVisitor&lt;Book&gt;("table");
 sc.accept(visitor);
 assertEquals("SELECT * FROM table 
               WHERE 
@@ -402,25 +408,25 @@ assertEquals("SELECT * FROM table 
               AND 
               level &gt; '10'",
               visitor.getResult());
-</pre>
+]]></script>
 </div></div>
 
 <p>Note that SQLPrinterVisitor can also be initialized with the names of columns and the field aliases map:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">// ?_s=<span class="code-quote">"level=gt=10"</span>
-</span>SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+// ?_s="level=gt=10"
+SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
 
-Map&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt; fieldMap = <span class="code-keyword">new</span> HashMap&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt;();
-fieldMap.put(<span class="code-quote">"level"</span>, <span class="code-quote">"LEVEL_COLUMN"</span>);
+Map&lt;String, String&gt; fieldMap = new HashMap&lt;String, String&gt;();
+fieldMap.put("level", "LEVEL_COLUMN");
 
-SQLPrinterVisitor&lt;Book&gt; visitor = <span class="code-keyword">new</span> SQLPrinterVisitor&lt;Book&gt;(fieldMap, <span class="code-quote">"table"</span>, <span class="code-quote">"LEVEL_COLUMN"</span>);
+SQLPrinterVisitor&lt;Book&gt; visitor = new SQLPrinterVisitor&lt;Book&gt;(fieldMap, "table", "LEVEL_COLUMN");
 sc.accept(visitor);
 assertEquals("SELECT LEVEL_COLUMN FROM table 
               WHERE LEVEL_COLUMN &gt; '10'",
               visitor.getResult());
-</pre>
+]]></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>
@@ -433,98 +439,98 @@ javax.persistence.TypedQuery or javax.pe
 <p>For example, given:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-keyword">public</span> class Book {
+public class Book {
 
-    <span class="code-keyword">private</span> <span class="code-object">String</span> title;
-    <span class="code-keyword">private</span> Date date;
-    <span class="code-keyword">private</span> OwnerInfo ownerinfo;
-    <span class="code-comment">//setters and getters omitted <span class="code-keyword">for</span> brewity
-</span>}
+    private String title;
+    private Date date;
+    private OwnerInfo ownerinfo;
+    //setters and getters omitted for brewity
+}
 
 @Embeddable
-<span class="code-keyword">public</span> class OwnerInfo {
+public class OwnerInfo {
 
-    <span class="code-keyword">private</span> Address address;
-    <span class="code-keyword">private</span> Name name;
-    <span class="code-comment">//setters and getters omitted <span class="code-keyword">for</span> brewity
-</span>}
+    private Address address;
+    private Name name;
+    //setters and getters omitted for brewity
+}
 
 @Embeddable
-<span class="code-keyword">public</span> class Name {
+public class Name {
 
-    <span class="code-keyword">private</span> <span class="code-object">String</span> name;
-    <span class="code-comment">//setters and getters omitted <span class="code-keyword">for</span> brewity
-</span>}
+    private String name;
+    //setters and getters omitted for brewity
+}
 
 @Embeddable
-<span class="code-keyword">public</span> class Address {
+public class Address {
 
-    <span class="code-keyword">private</span> <span class="code-object">String</span> street;
-    <span class="code-comment">//setters and getters omitted <span class="code-keyword">for</span> brewity
-</span>}
+    private String street;
+    //setters and getters omitted for brewity
+}
 
 
-</pre>
+]]></script>
 </div></div>
 
 <p>the following code can be used:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">import</span> javax.persistence.EntityManager;
-<span class="code-keyword">import</span> javax.persistence.TypedQuery;
-
-<span class="code-comment">// init EntityManager as required
-</span><span class="code-keyword">private</span> EntityManager entityManager;
-
-<span class="code-comment">// Find the books owned by Barry who lives in London, published starting from the first month of 2000 
-</span><span class="code-comment">// ?_s=<span class="code-quote">"date=ge=2000-01-01;ownername=barry;address=london"</span>
-</span>
-<span class="code-comment">// <span class="code-keyword">this</span> map will have to be set as a contextual property on the jaxrs endpoint
-</span><span class="code-comment">// it assumes that Book bean has nested OwnerInfo bean with nested Address and Name beans, 
-</span><span class="code-comment">// with the latter containing 'street' and 'name' property respectively
-</span>
-Map&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt; beanPropertiesMap = <span class="code-keyword">new</span> HashMap&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt;();
-beanPropertiesMap.put(<span class="code-quote">"address"</span>, <span class="code-quote">"ownerInfo.address.street"</span>);
-beanPropertiesMap.put(<span class="code-quote">"ownername"</span>, <span class="code-quote">"ownerInfo.name.name"</span>);
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+
+// init EntityManager as required
+private EntityManager entityManager;
+
+// Find the books owned by Barry who lives in London, published starting from the first month of 2000 
+// ?_s="date=ge=2000-01-01;ownername=barry;address=london"
+
+// this map will have to be set as a contextual property on the jaxrs endpoint
+// it assumes that Book bean has nested OwnerInfo bean with nested Address and Name beans, 
+// with the latter containing 'street' and 'name' property respectively
+
+Map&lt;String, String&gt; beanPropertiesMap = new HashMap&lt;String, String&gt;();
+beanPropertiesMap.put("address", "ownerInfo.address.street");
+beanPropertiesMap.put("ownername", "ownerInfo.name.name");
 
-<span class="code-comment">// the actual application code
-</span>SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
+// the actual application code
+SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
 SearchConditionVisitor&lt;Book, TypedQuery&lt;Book&gt;&gt; visitor = 
-    <span class="code-keyword">new</span> JPATypedQueryVisitor&lt;Book&gt;(entityManager, Book.class);
+    new JPATypedQueryVisitor&lt;Book&gt;(entityManager, Book.class);
 sc.accept(visitor);
 
 TypedQuery&lt;Book&gt; typedQuery = visitor.getQuery();
 List&lt;Book&gt; books = typedQuery.getResultList();
-</pre>
+]]></script>
 </div></div>
 
 <p>Using CriteriaQuery is preferred in cases when the actual result has to be shaped into a bean of different type, using one of JPA2 CriteriaBuilder's shape methods (array(), construct() or tuple()). For example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+
+// Find the books owned by Barry who lives in London, published starting from the first month of 2000 
+// ?_s="date=ge=2000-01-01;ownername=barry;address=london"
 
-<span class="code-comment">// Find the books owned by Barry who lives in London, published starting from the first month of 2000 
-</span><span class="code-comment">// ?_s=<span class="code-quote">"date=ge=2000-01-01;ownername=barry;address=london"</span>
-</span>
-<span class="code-comment">// <span class="code-keyword">this</span> map will have to be set as a contextual property on the jaxrs endpoint
-</span>Map&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt; beanPropertiesMap = <span class="code-keyword">new</span> HashMap&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt;();
-beanPropertiesMap.put(<span class="code-quote">"address"</span>, <span class="code-quote">"ownerInfo.address.street"</span>);
-beanPropertiesMap.put(<span class="code-quote">"ownername"</span>, <span class="code-quote">"ownerInfo.name.name"</span>);
-
-<span class="code-comment">// the actual application code
-</span><span class="code-comment">// Only Book 'id' and 'title' properties are extracted from the list of found books
-</span> 
+// this map will have to be set as a contextual property on the jaxrs endpoint
+Map&lt;String, String&gt; beanPropertiesMap = new HashMap&lt;String, String&gt;();
+beanPropertiesMap.put("address", "ownerInfo.address.street");
+beanPropertiesMap.put("ownername", "ownerInfo.name.name");
+
+// the actual application code
+// Only Book 'id' and 'title' properties are extracted from the list of found books
+ 
 SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
 JPACriteriaQueryVisitor&lt;Book, Tuple&gt; visitor = 
-    <span class="code-keyword">new</span> JPACriteriaQueryVisitor&lt;Book, Tuple&gt;(entityManager, Book.class, Tuple.class);
+    new JPACriteriaQueryVisitor&lt;Book, Tuple&gt;(entityManager, Book.class, Tuple.class);
 sc.accept(visitor);
 
-List&lt;SingularAttribute&lt;Book, ?&gt;&gt; selections = <span class="code-keyword">new</span> LinkedList&lt;SingularAttribute&lt;Book, ?&gt;&gt;();
-<span class="code-comment">// Book_ class is generated by JPA2 compiler
-</span>selections.add(Book_.id);
+List&lt;SingularAttribute&lt;Book, ?&gt;&gt; selections = new LinkedList&lt;SingularAttribute&lt;Book, ?&gt;&gt;();
+// Book_ class is generated by JPA2 compiler
+selections.add(Book_.id);
 selections.add(Book_.title);
 
 visitor.selectTuple(selections);
@@ -532,13 +538,13 @@ visitor.selectTuple(selections);
 TypedQuery&lt;Tuple&gt; query = visitor.getQuery();
 
 List&lt;Tuple&gt; tuples = typedQuery.getResultList();
-<span class="code-keyword">for</span> (Tuple tuple : tuples) {
-  <span class="code-object">int</span> bookId = tuple.get(<span class="code-quote">"id"</span>, <span class="code-object">String</span>.class);
-  <span class="code-object">String</span> title = tuple.get(<span class="code-quote">"title"</span>, <span class="code-object">String</span>.class);
-  <span class="code-comment">// add bookId &amp; title to the response data
-</span>}
+for (Tuple tuple : tuples) {
+  int bookId = tuple.get("id", String.class);
+  String title = tuple.get("title", String.class);
+  // add bookId &amp; title to the response data
+}
 
-</pre>
+]]></script>
 </div></div> 
 
 
@@ -550,33 +556,33 @@ JPACriteriaQueryVisitor will be enhanced
 <p>Or, instead of using Tuple, use a capturing bean like BeanInfo:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-keyword">public</span> <span class="code-keyword">static</span> class BookInfo {
-        <span class="code-keyword">private</span> <span class="code-object">int</span> id;
-        <span class="code-keyword">private</span> <span class="code-object">String</span> title;
+public static class BookInfo {
+        private int id;
+        private String title;
 
-        <span class="code-keyword">public</span> BookInfo() {
+        public BookInfo() {
             
         }
         
-        <span class="code-keyword">public</span> BookInfo(<span class="code-object">Integer</span> id, <span class="code-object">String</span> title) {
-            <span class="code-keyword">this</span>.id = id;
-            <span class="code-keyword">this</span>.title = title;
+        public BookInfo(Integer id, String title) {
+            this.id = id;
+            this.title = title;
         }
-        <span class="code-comment">//setters and getters omitted <span class="code-keyword">for</span> brewity
-</span> }
+        //setters and getters omitted for brewity
+ }
+
+// actual application code:
 
-<span class="code-comment">// actual application code:
-</span>
 SearchCondition&lt;Book&gt; sc = searchContext.getCondition(Book.class);
 JPACriteriaQueryVisitor&lt;Book, BookInfo&gt; visitor = 
-    <span class="code-keyword">new</span> JPACriteriaQueryVisitor&lt;Book, BookInfo&gt;(entityManager, Book.class, BookInfo.class);
+    new JPACriteriaQueryVisitor&lt;Book, BookInfo&gt;(entityManager, Book.class, BookInfo.class);
 sc.accept(visitor);
 
-List&lt;SingularAttribute&lt;Book, ?&gt;&gt; selections = <span class="code-keyword">new</span> LinkedList&lt;SingularAttribute&lt;Book, ?&gt;&gt;();
-<span class="code-comment">// Book_ class is generated by JPA2 compiler
-</span>selections.add(Book_.id);
+List&lt;SingularAttribute&lt;Book, ?&gt;&gt; selections = new LinkedList&lt;SingularAttribute&lt;Book, ?&gt;&gt;();
+// Book_ class is generated by JPA2 compiler
+selections.add(Book_.id);
 selections.add(Book_.title);
 
 visitor.selectConstruct(selections);
@@ -584,99 +590,99 @@ visitor.selectConstruct(selections);
 TypedQuery&lt;BookInfo&gt; query = visitor.getQuery();
 
 List&lt;BookInfo&gt; bookInfo = typedQuery.getResultList();
-<span class="code-keyword">return</span> bookInfo;
+return bookInfo;
 
-</pre>
+]]></script>
 </div></div>
 
 <p>JPA2 typed converters also support join operations in cases when explicit collections are used, for example, given:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-@Entity(name = <span class="code-quote">"Book"</span>)
-<span class="code-keyword">public</span> class Book {
+@Entity(name = "Book")
+public class Book {
+
+    private List&lt;BookReview&gt; reviews = new LinkedList&lt;BookReview&gt;();
+    private List&lt;String&gt; authors = new LinkedList&lt;String&gt;();
+    // other properties omitted
 
-    <span class="code-keyword">private</span> List&lt;BookReview&gt; reviews = <span class="code-keyword">new</span> LinkedList&lt;BookReview&gt;();
-    <span class="code-keyword">private</span> List&lt;<span class="code-object">String</span>&gt; authors = <span class="code-keyword">new</span> LinkedList&lt;<span class="code-object">String</span>&gt;();
-    <span class="code-comment">// other properties omitted
-</span>
     @OneToMany
-    <span class="code-keyword">public</span> List&lt;BookReview&gt; getReviews() {
-        <span class="code-keyword">return</span> reviews;
+    public List&lt;BookReview&gt; getReviews() {
+        return reviews;
     }
 
-    <span class="code-keyword">public</span> void setReviews(List&lt;BookReview&gt; reviews) {
-        <span class="code-keyword">this</span>.reviews = reviews;
+    public void setReviews(List&lt;BookReview&gt; reviews) {
+        this.reviews = reviews;
     }
 
     @ElementCollection
-    <span class="code-keyword">public</span> List&lt;<span class="code-object">String</span>&gt; getAuthors() {
-        <span class="code-keyword">return</span> authors;
+    public List&lt;String&gt; getAuthors() {
+        return authors;
     }
 
-    <span class="code-keyword">public</span> void setAuthors(List&lt;<span class="code-object">String</span>&gt; authors) {
-        <span class="code-keyword">this</span>.authors = authors;
+    public void setAuthors(List&lt;String&gt; authors) {
+        this.authors = authors;
     }
 }
 
 @Entity
-<span class="code-keyword">public</span> class BookReview {
-    <span class="code-keyword">private</span> Review review;
-    <span class="code-keyword">private</span> List&lt;<span class="code-object">String</span>&gt; authors = <span class="code-keyword">new</span> LinkedList&lt;<span class="code-object">String</span>&gt;();
-    <span class="code-keyword">private</span> Book book;
-    <span class="code-comment">// other properties omitted    
-</span>
-    <span class="code-keyword">public</span> Review getReview() {
-        <span class="code-keyword">return</span> review;
+public class BookReview {
+    private Review review;
+    private List&lt;String&gt; authors = new LinkedList&lt;String&gt;();
+    private Book book;
+    // other properties omitted    
+
+    public Review getReview() {
+        return review;
     }
 
-    <span class="code-keyword">public</span> void setReview(Review review) {
-        <span class="code-keyword">this</span>.review = review;
+    public void setReview(Review review) {
+        this.review = review;
     }
 
     @OneToOne
-    <span class="code-keyword">public</span> Book getBook() {
-        <span class="code-keyword">return</span> book;
+    public Book getBook() {
+        return book;
     }
 
-    <span class="code-keyword">public</span> void setBook(Book book) {
-        <span class="code-keyword">this</span>.book = book;
+    public void setBook(Book book) {
+        this.book = book;
     }
 
     @ElementCollection
-    <span class="code-keyword">public</span> List&lt;<span class="code-object">String</span>&gt; getAuthors() {
-        <span class="code-keyword">return</span> authors;
+    public List&lt;String&gt; getAuthors() {
+        return authors;
     }
 
-    <span class="code-keyword">public</span> void setAuthors(List&lt;<span class="code-object">String</span>&gt; authors) {
-        <span class="code-keyword">this</span>.authors = authors;
+    public void setAuthors(List&lt;String&gt; authors) {
+        this.authors = authors;
     }
 
-    <span class="code-keyword">public</span> <span class="code-keyword">static</span> <span class="code-keyword">enum</span> Review {
+    public static enum Review {
         GOOD,
         BAD
     }
 }
 
-</pre>
+]]></script>
 </div></div>
 
 <p>the following will find "all the books with good reviews written by Ted":</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-SearchCondition&lt;Book&gt; filter = <span class="code-keyword">new</span> FiqlParser&lt;Book&gt;(Book.class).parse(<span class="code-quote">"reviews.review==good;reviews.authors==Ted"</span>);
-<span class="code-comment">// in practice, map <span class="code-quote">"reviews.review"</span> to <span class="code-quote">"review"</span>, <span class="code-quote">"reviews.authors"</span> to <span class="code-quote">"reviewAuthor"</span> 
-</span><span class="code-comment">// and have a simple query like <span class="code-quote">"review==good;reviewAuthor==Ted"</span> instead
-</span>
-SearchConditionVisitor&lt;Book, TypedQuery&lt;Book&gt;&gt; jpa = <span class="code-keyword">new</span> JPATypedQueryVisitor&lt;Book&gt;(em, Book.class);
+SearchCondition&lt;Book&gt; filter = new FiqlParser&lt;Book&gt;(Book.class).parse("reviews.review==good;reviews.authors==Ted");
+// in practice, map "reviews.review" to "review", "reviews.authors" to "reviewAuthor" 
+// and have a simple query like "review==good;reviewAuthor==Ted" instead
+
+SearchConditionVisitor&lt;Book, TypedQuery&lt;Book&gt;&gt; jpa = new JPATypedQueryVisitor&lt;Book&gt;(em, Book.class);
 filter.accept(jpa);
 TypedQuery&lt;Book&gt; query = jpa.getQuery();
-<span class="code-keyword">return</span> query.getResultList();
+return query.getResultList();
 
-</pre>
+]]></script>
 </div></div>
 
 
@@ -689,24 +695,24 @@ TypedQuery&lt;Book&gt; query = jpa.getQu
 <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" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 TypedQuery&lt;Book&gt; query = jpa.getQuery();
-<span class="code-keyword">return</span> query.getResultList().size();
-</pre>
+return query.getResultList().size();
+]]></script>
 </div></div>
 
 <p>However this can be very inefficient for large number of records, so using a CriteriaBuilder count operation is recommended, for example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-SearchCondition&lt;Book&gt; filter = <span class="code-keyword">new</span> FiqlParser&lt;Book&gt;(Book.class).parse(<span class="code-quote">"reviews.review==good;reviews.authors==Ted"</span>);
+SearchCondition&lt;Book&gt; filter = new FiqlParser&lt;Book&gt;(Book.class).parse("reviews.review==good;reviews.authors==Ted");
 
-JPACriteriaQueryVisitor&lt;Book, <span class="code-object">Long</span>&gt; jpa = <span class="code-keyword">new</span> JPACriteriaQueryVisitor&lt;Book, <span class="code-object">Long</span>&gt;(em, Book.class, <span class="code-object">Long</span>.class);
+JPACriteriaQueryVisitor&lt;Book, Long&gt; jpa = new JPACriteriaQueryVisitor&lt;Book, Long&gt;(em, Book.class, Long.class);
 filter.accept(jpa);
-<span class="code-object">long</span> count = jpa.count();
+long count = jpa.count();
 
-</pre>
+]]></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">
@@ -723,15 +729,15 @@ Queries for specific terms and phrases a
 <p>Example, "find the documents containing a 'text' term":</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">import</span> org.apache.lucene.search.Query;
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+import org.apache.lucene.search.Query;
 
-SearchCondition&lt;SearchBean&gt; filter = <span class="code-keyword">new</span> FiqlParser&lt;SearchBean&gt;(SearchBean.class).parse(<span class="code-quote">"ct==text"</span>);
-LuceneQueryVisitor&lt;SearchBean&gt; lucene = <span class="code-keyword">new</span> LuceneQueryVisitor&lt;SearchBean&gt;(<span class="code-quote">"ct"</span>, <span class="code-quote">"contents"</span>);
+SearchCondition&lt;SearchBean&gt; filter = new FiqlParser&lt;SearchBean&gt;(SearchBean.class).parse("ct==text");
+LuceneQueryVisitor&lt;SearchBean&gt; lucene = new LuceneQueryVisitor&lt;SearchBean&gt;("ct", "contents");
 lucene.visit(filter);
 org.apache.lucene.search.Query termQuery = lucene.getQuery();
-<span class="code-comment">// use Query</span>
-</pre>
+// use Query
+]]></script>
 </div></div>
 
 <p>Note, "new LuceneQueryVisitor&lt;SearchBean&gt;("ct", "contents");" is a simple constructor which lets create a mapping between the "ct" name used in the query and the actual default content field. It is not required to use this mapping but it is recommended as it keeps the query expression shorter and does not leak the actual internal Lucene field name.</p>
@@ -741,14 +747,14 @@ org.apache.lucene.search.Query termQuery
 <p>Phrases are supported too. Suppose you have few documents with each of them containing name and value pairs like "name=Fred", "name=Barry" and you'd like to list only the documents containing "name=Fred":</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-SearchCondition&lt;SearchBean&gt; filter = <span class="code-keyword">new</span> FiqlParser&lt;SearchBean&gt;(SearchBean.class).parse(<span class="code-quote">"name==Fred"</span>);
-LuceneQueryVisitor&lt;SearchBean&gt; lucene = <span class="code-keyword">new</span> LuceneQueryVisitor&lt;SearchBean&gt;(<span class="code-quote">"contents"</span>);
+SearchCondition&lt;SearchBean&gt; filter = new FiqlParser&lt;SearchBean&gt;(SearchBean.class).parse("name==Fred");
+LuceneQueryVisitor&lt;SearchBean&gt; lucene = new LuceneQueryVisitor&lt;SearchBean&gt;("contents");
 lucene.visit(filter);
 org.apache.lucene.search.Query phraseQuery = lucene.getQuery();
-<span class="code-comment">// use query</span>
-</pre>
+// 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>
@@ -778,18 +784,18 @@ org.apache.lucene.search.Query phraseQue
 
 <p>The converter is created like all other converters:</p>
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+
+// FIQL "oclass=Bar"
 
-<span class="code-comment">// FIQL <span class="code-quote">"oclass=Bar"</span>
-</span>
-<span class="code-comment">// map 'oclass' used in the FIQL query to the actual property name, 'objectClass'
-</span>LdapQueryVisitor&lt;Condition&gt; visitor = 
-   <span class="code-keyword">new</span> LdapQueryVisitor&lt;Condition&gt;(Collections.singletonMap(<span class="code-quote">"oclass"</span>, <span class="code-quote">"objectClass"</span>));
+// map 'oclass' used in the FIQL query to the actual property name, 'objectClass'
+LdapQueryVisitor&lt;Condition&gt; visitor = 
+   new LdapQueryVisitor&lt;Condition&gt;(Collections.singletonMap("oclass", "objectClass"));
 
 filter.accept(visitor.visitor());
-<span class="code-object">String</span> ldap = visitor.getQuery();
+String ldap = visitor.getQuery();
 
-</pre>
+]]></script>
 </div></div>
 
 <h3><a shape="rect" name="JAX-RSSearch-Customvisitors"></a>Custom visitors</h3>
@@ -799,43 +805,43 @@ filter.accept(visitor.visitor());
 <h4><a shape="rect" name="JAX-RSSearch-Untypedconverters"></a>Untyped converters</h4>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">public</span> class CustomSQLVisitor&lt;T&gt; <span class="code-keyword">extends</span> AbstractSearchConditionVisitor&lt;T, <span class="code-object">String</span>&gt; {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+public class CustomSQLVisitor&lt;T&gt; extends AbstractSearchConditionVisitor&lt;T, String&gt; {
 
-<span class="code-keyword">private</span> <span class="code-object">String</span> tableName;
-<span class="code-keyword">private</span> StringBuilder sb = <span class="code-keyword">new</span> StringBuilder();
+private String tableName;
+private StringBuilder sb = new StringBuilder();
 
-<span class="code-keyword">public</span> void visit(SearchCondition&lt;T&gt; sc) {
+public void visit(SearchCondition&lt;T&gt; sc) {
         
-        <span class="code-keyword">if</span> (sb == <span class="code-keyword">null</span>) {
-            sb = <span class="code-keyword">new</span> StringBuilder();
-            <span class="code-comment">// start the expression as needed, example
-</span>            <span class="code-comment">// sb.append(<span class="code-quote">"Select from "</span>).append(tableName);
-</span>        }
+        if (sb == null) {
+            sb = new StringBuilder();
+            // start the expression as needed, example
+            // sb.append("Select from ").append(tableName);
+        }
         
         PrimitiveStatement statement = sc.getStatement();
-        <span class="code-keyword">if</span> (statement != <span class="code-keyword">null</span>) {
-                <span class="code-comment">// ex <span class="code-quote">"a &gt; b"</span>
-</span>                <span class="code-comment">// use statement.getValue()
-</span>                <span class="code-comment">// use statement.getConditionType() such as greaterThan, lessThan
-</span>                <span class="code-comment">// use statement.getProperty();
-</span>                <span class="code-comment">// to convert <span class="code-quote">"a &gt; b"</span> into SQL expression
-</span>                sb.append(toSQL(statement));         
-        } <span class="code-keyword">else</span> {
-            <span class="code-comment">// composite expression, ex <span class="code-quote">"a &gt; b;c &lt; d"</span>
-</span>            <span class="code-keyword">for</span> (SearchCondition&lt;T&gt; condition : sc.getSearchConditions()) {
-                <span class="code-comment">// pre-process, example sb.append(<span class="code-quote">"("</span>);
-</span>                condition.accept(<span class="code-keyword">this</span>);
-                <span class="code-comment">// post-process, example sb.append(<span class="code-quote">")"</span>);
-</span>            }
+        if (statement != null) {
+                // ex "a &gt; b"
+                // use statement.getValue()
+                // use statement.getConditionType() such as greaterThan, lessThan
+                // use statement.getProperty();
+                // to convert "a &gt; b" into SQL expression
+                sb.append(toSQL(statement));         
+        } else {
+            // composite expression, ex "a &gt; b;c &lt; d"
+            for (SearchCondition&lt;T&gt; condition : sc.getSearchConditions()) {
+                // pre-process, example sb.append("(");
+                condition.accept(this);
+                // post-process, example sb.append(")");
+            }
         }
     }
 
-    <span class="code-keyword">public</span> <span class="code-object">String</span> getQuery() {
-        <span class="code-keyword">return</span> sb.toString();
+    public String getQuery() {
+        return sb.toString();
     }
 }
-</pre>
+]]></script>
 </div></div>
 
 <h4><a shape="rect" name="JAX-RSSearch-Typedconverters"></a>Typed converters</h4>
@@ -843,42 +849,42 @@ filter.accept(visitor.visitor());
 <p>import org.custom.search.Query;</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">public</span> class CustomTypedVisitor&lt;T&gt; <span class="code-keyword">extends</span> AbstractSearchConditionVisitor&lt;T, Query&gt; {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+public class CustomTypedVisitor&lt;T&gt; extends AbstractSearchConditionVisitor&lt;T, Query&gt; {
 
-<span class="code-keyword">private</span> Stack&lt;List&lt;Query&gt;&gt; queryStack = <span class="code-keyword">new</span> Stack&lt;List&lt;Query&gt;&gt;();
+private Stack&lt;List&lt;Query&gt;&gt; queryStack = new Stack&lt;List&lt;Query&gt;&gt;();
 
-<span class="code-keyword">public</span> void visit(SearchCondition&lt;T&gt; sc) {
+public void visit(SearchCondition&lt;T&gt; sc) {
                 
         PrimitiveStatement statement = sc.getStatement();
-        <span class="code-keyword">if</span> (statement != <span class="code-keyword">null</span>) {
-                <span class="code-comment">// ex <span class="code-quote">"a &gt; b"</span>
-</span>                <span class="code-comment">// use statement.getValue()
-</span>                <span class="code-comment">// use statement.getConditionType() such as greaterThan, lessThan
-</span>                <span class="code-comment">// use statement.getProperty();
-</span>                <span class="code-comment">// to convert <span class="code-quote">"a &gt; b"</span> into Query object
-</span>                Query query = buildSimpleQuery(statement);
+        if (statement != null) {
+                // ex "a &gt; b"
+                // use statement.getValue()
+                // use statement.getConditionType() such as greaterThan, lessThan
+                // use statement.getProperty();
+                // to convert "a &gt; b" into Query object
+                Query query = buildSimpleQuery(statement);
                 queryStack.peek().add(query);                 
 
-        } <span class="code-keyword">else</span> {
-            <span class="code-comment">// composite expression, ex <span class="code-quote">"a &gt; b;c &lt; d"</span>
-</span>            queryStack.push(<span class="code-keyword">new</span> ArrayList&lt;Query&gt;());
+        } else {
+            // composite expression, ex "a &gt; b;c &lt; d"
+            queryStack.push(new ArrayList&lt;Query&gt;());
 
-            <span class="code-keyword">for</span> (SearchCondition&lt;T&gt; condition : sc.getSearchConditions()) {
-                condition.accept(<span class="code-keyword">this</span>);
+            for (SearchCondition&lt;T&gt; condition : sc.getSearchConditions()) {
+                condition.accept(this);
             }
 
-            <span class="code-object">boolean</span> orCondition = sc.getConditionType() == ConditionType.OR;
+            boolean orCondition = sc.getConditionType() == ConditionType.OR;
             List&lt;Query&gt; queries = queryStack.pop();
             queryStack.peek().add(createCompositeQuery(queries, orCondition));
         }
     }
 
-    <span class="code-keyword">public</span> Query getResult() {
-        <span class="code-keyword">return</span> queryStack.peek().get(0);
+    public Query getResult() {
+        return queryStack.peek().get(0);
     }
 }
-</pre>
+]]></script>
 </div></div>
 
 
@@ -887,24 +893,24 @@ filter.accept(visitor.visitor());
 <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" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-@Path(<span class="code-quote">"/search"</span>)
-<span class="code-keyword">public</span> class SearchEngine {
+@Path("/search")
+public class SearchEngine {
     @Context
-    <span class="code-keyword">private</span> UriInfo ui;
+    private UriInfo ui;
 
     @GET
-    <span class="code-keyword">public</span> List&lt;Book&gt; findBooks() {
-        MultivaluedMap&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt; params = ui.getQueryParameters();
-        <span class="code-object">String</span> fiqlQuery = params.getFirst(<span class="code-quote">"_s"</span>);
-        <span class="code-comment">// delegate to your own custom handler 
-</span>
-        <span class="code-comment">// note that the original search expression can also be retrieved 
-</span>        <span class="code-comment">// using a SearchContext.getSearchExpression() method
-</span>}
+    public List&lt;Book&gt; findBooks() {
+        MultivaluedMap&lt;String, String&gt; params = ui.getQueryParameters();
+        String fiqlQuery = params.getFirst("_s");
+        // delegate to your own custom handler 
 
-</pre>
+        // note that the original search expression can also be retrieved 
+        // using a SearchContext.getSearchExpression() method
+}
+
+]]></script>
 </div></div>
 
 <h2><a shape="rect" name="JAX-RSSearch-ConvertingFIQLquerieswithQueryContext"></a>Converting FIQL queries with QueryContext</h2>
@@ -914,61 +920,61 @@ get the converted query expression, with
 
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">import</span> java.util.ArrayList;
-<span class="code-keyword">import</span> java.util.List;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.search.QueryContextProvider;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.search.SearchBean;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.search.visitor.SBThrealLocalVisitorState;
-<span class="code-keyword">import</span> org.apache.cxf.jaxrs.ext.search.sql.SQLPrinterVisitor;
-
-<span class="code-keyword">import</span> books.BookStore;
-
-<span class="code-comment">// Register the visitor:
-</span>JAXRSServerFactoryBean sf = <span class="code-keyword">new</span> JAXRSServerFactoryBean();
-List&lt;<span class="code-object">Object</span>&gt; providers = <span class="code-keyword">new</span> ArrayList&lt;<span class="code-object">Object</span>&gt;();
-providers.add(<span class="code-keyword">new</span> QueryContextProvider());
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.ext.search.QueryContextProvider;
+import org.apache.cxf.jaxrs.ext.search.SearchBean;
+import org.apache.cxf.jaxrs.ext.search.visitor.SBThrealLocalVisitorState;
+import org.apache.cxf.jaxrs.ext.search.sql.SQLPrinterVisitor;
+
+import books.BookStore;
+
+// Register the visitor:
+JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+List&lt;Object&gt; providers = new ArrayList&lt;Object&gt;();
+providers.add(new QueryContextProvider());
 sf.setProviders(providers);
 
-SQLPrinterVisitor&lt;SearchBean&gt; sqlVisitor = <span class="code-keyword">new</span> SQLPrinterVisitor&lt;SearchBean&gt;(<span class="code-quote">"books"</span>);
-sqlVisitor.setVisitorState(<span class="code-keyword">new</span> SBThrealLocalVisitorState());
-sf.getProperties(<span class="code-keyword">true</span>).put(<span class="code-quote">"search.visitor"</span>, sqlVisitor);
+SQLPrinterVisitor&lt;SearchBean&gt; sqlVisitor = new SQLPrinterVisitor&lt;SearchBean&gt;("books");
+sqlVisitor.setVisitorState(new SBThrealLocalVisitorState());
+sf.getProperties(true).put("search.visitor", sqlVisitor);
 
 
 sf.setResourceClasses(BookStore.class);
 server = sf.create();
-</pre>
+]]></script>
 </div></div> 
 
 <p>and convert the queries:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"/"</span>)
-<span class="code-keyword">public</span> class BookStore { 
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("/")
+public class BookStore { 
     @GET
-    @Path(<span class="code-quote">"/books/{expression}"</span>)
-    @Produces(<span class="code-quote">"application/xml"</span>)
-    <span class="code-keyword">public</span> List&lt;Book&gt; getBookQueryContext(@PathParam(<span class="code-quote">"expression"</span>) <span class="code-object">String</span> expression, 
+    @Path("/books/{expression}")
+    @Produces("application/xml")
+    public List&lt;Book&gt; getBookQueryContext(@PathParam("expression") String expression, 
                                       @Context QueryContext searchContext) 
-        <span class="code-keyword">throws</span> BookNotFoundFault {
-        <span class="code-object">String</span> sqlExpression = searchContext.getConvertedExpression(expression);
-        <span class="code-comment">// pass it to the SQL DB and <span class="code-keyword">return</span> the list of Books
-</span>    }
+        throws BookNotFoundFault {
+        String sqlExpression = searchContext.getConvertedExpression(expression);
+        // pass it to the SQL DB and return the list of Books
+    }
 }
-</pre>
+]]></script>
 </div></div>
 
 <p>where the client code may look like this:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-object">String</span> address = <span class="code-quote">"http:<span class="code-comment">//localhost:8080/bookstore/books/id=ge=123"</span>;
-</span>WebClient client = WebClient.create(address);
-client.accept(<span class="code-quote">"application/xml"</span>);
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+String address = "http://localhost:8080/bookstore/books/id=ge=123";
+WebClient client = WebClient.create(address);
+client.accept("application/xml");
 List&lt;Book&gt; books = client.getCollection(Book.class);
-</pre>
+]]></script>
 </div></div>
 
 <p>Note, given that SQLPrinterVisitor will be shared between multiple requests it has to be made thread-safe by injecting a thread-local<br clear="none">
@@ -981,28 +987,28 @@ org.apache.cxf.jaxrs.ext.search.visitor.
 <p>If you'd like to generalize the processing of search queries and use FIQL visitors, you may want to consider setting up a contextual property "search.use.plain.queries" to "true" and get the plain query expressions converted to FIQL expressions internally. </p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-comment">// GET /search?a=a1&amp;a=v2
-</span><span class="code-object">String</span> exp = searchContext.getSearchExpression();
-assertEquals(<span class="code-quote">"(a==a1,a==a2)"</span>, exp);
+// GET /search?a=a1&amp;a=v2
+String exp = searchContext.getSearchExpression();
+assertEquals("(a==a1,a==a2)", exp);
 
-<span class="code-comment">// GET /search?a=a1&amp;b=b1
-</span>exp = searchContext.getSearchExpression();
-assertEquals(<span class="code-quote">"(a==a1;b==b1)"</span>, exp);
+// GET /search?a=a1&amp;b=b1
+exp = searchContext.getSearchExpression();
+assertEquals("(a==a1;b==b1)", exp);
 
-</pre>
+]]></script>
 </div></div> 
 
 <p>Also, by default, if a query property name ends with "From" then "=ge=" (greater or equals to) will be used, and if ends with "Till" then "=lt=" will be used, for example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-comment">// GET /search?ageFrom=10&amp;ageTill=20
-</span><span class="code-object">String</span> exp = searchContext.getSearchExpression();
-assertEquals(<span class="code-quote">"(age=ge=10,age=le=20)"</span>, exp);
-</pre>
+// GET /search?ageFrom=10&amp;ageTill=20
+String exp = searchContext.getSearchExpression();
+assertEquals("(age=ge=10,age=le=20)", exp);
+]]></script>
 </div></div> 
 
 <p>This can allow the plain query expressions mapped to typed bean properties and further used with all the existing converters.</p>
@@ -1012,16 +1018,16 @@ assertEquals(<span class="code-quote">"(
 <p>By default, a FIQL expression is expected to be available in either '_s' or '_search' query.<br clear="none">
 For example, "find all the books with an 'id' property value less than 123":</p>
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
 GET /books?_s=id=lt=123
-</pre>
+]]></script>
 </div></div>
 
 <p>Starting from CXF 2.6.2, it is possible to work with FIQL expressions included in URI path segments, for example, the same query can be expressed<br clear="none">
 in a number of ways:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
 
 GET /books/id=lt=123
 GET /books[id=lt=123]
@@ -1030,58 +1036,58 @@ GET /books;id=lt=123
 
 //etc, etc
 
-</pre>
+]]></script>
 </div></div>
 
 <p>Such expressions can be captured in the code using JAX-RS annotations:</p>
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"search"</span>)
-<span class="code-keyword">public</span> class BooksResource {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("search")
+public class BooksResource {
    @Context
-   <span class="code-keyword">private</span> SearchContext context;
+   private SearchContext context;
 
-   <span class="code-comment">//GET /books[id=lt=123]
-</span>   @GET
-   @Path(<span class="code-quote">"books[{search}]"</span>) 
-   <span class="code-keyword">public</span> List&lt;Book&gt; findSelectedBooks(@PathParam(<span class="code-quote">"search"</span>) <span class="code-object">String</span> searchExpression) {
-       <span class="code-keyword">return</span> doFindSelectedBooks(searchExpression);
+   //GET /books[id=lt=123]
+   @GET
+   @Path("books[{search}]") 
+   public List&lt;Book&gt; findSelectedBooks(@PathParam("search") String searchExpression) {
+       return doFindSelectedBooks(searchExpression);
    }
 
-   <span class="code-comment">//GET /books(id=lt=123)
-</span>   @GET
-   @Path(<span class="code-quote">"books({search})"</span>) 
-   <span class="code-keyword">public</span> List&lt;Book&gt; findSelectedBooks(@PathParam(<span class="code-quote">"search"</span>) <span class="code-object">String</span> searchExpression) {
-       <span class="code-keyword">return</span> doFindSelectedBooks(searchExpression);
+   //GET /books(id=lt=123)
+   @GET
+   @Path("books({search})") 
+   public List&lt;Book&gt; findSelectedBooks(@PathParam("search") String searchExpression) {
+       return doFindSelectedBooks(searchExpression);
    }
 
-   <span class="code-comment">//GET /books/id=lt=123
-</span>   @GET
-   @Path(<span class="code-quote">"books/{search}"</span>) 
-   <span class="code-keyword">public</span> List&lt;Book&gt; findSelectedBooks(@PathParam(<span class="code-quote">"search"</span>) <span class="code-object">String</span> searchExpression) {
-       <span class="code-keyword">return</span> doFindSelectedBooks(searchExpression);
+   //GET /books/id=lt=123
+   @GET
+   @Path("books/{search}") 
+   public List&lt;Book&gt; findSelectedBooks(@PathParam("search") String searchExpression) {
+       return doFindSelectedBooks(searchExpression);
    }
 
-   <span class="code-comment">//GET /books;id=lt=123
-</span>   @GET
-   @Path(<span class="code-quote">"books;{search}"</span>) 
-   <span class="code-keyword">public</span> List&lt;Book&gt; findSelectedBooks(@PathParam(<span class="code-quote">"search"</span>) <span class="code-object">String</span> searchExpression) {
-       <span class="code-keyword">return</span> doFindSelectedBooks(searchExpression);
+   //GET /books;id=lt=123
+   @GET
+   @Path("books;{search}") 
+   public List&lt;Book&gt; findSelectedBooks(@PathParam("search") String searchExpression) {
+       return doFindSelectedBooks(searchExpression);
    }
 
-   <span class="code-keyword">public</span> List&lt;Book&gt; doFindSelectedBooks(<span class="code-object">String</span> searchExpression) {
+   public List&lt;Book&gt; doFindSelectedBooks(String searchExpression) {
        SearchCondition&lt;Book&gt; sc = context.getCondition(searchExpression, Book.class);
    
-       <span class="code-comment">// JPA2 enity manager is initialized earlier
-</span>       JPATypedQuery&lt;Book&gt; visitor = <span class="code-keyword">new</span> JPATypedQueryVisitor&lt;Book&gt;(entityManager, Book.class);
+       // JPA2 enity manager is initialized earlier
+       JPATypedQuery&lt;Book&gt; visitor = new JPATypedQueryVisitor&lt;Book&gt;(entityManager, Book.class);
        sc.accept(visitor);
    
        TypedQuery&lt;Book&gt; typedQuery = visitor.getQuery();
-       <span class="code-keyword">return</span> typedQuery.getResultList();
+       return typedQuery.getResultList();
    }
 
 }
-</pre>
+]]></script>
 </div></div> 
 
 <p>Note that if you have an expression added to a URI path segment with a ";" character acting as a separator, example, "/books;id=lt=123",<br clear="none">
@@ -1095,39 +1101,39 @@ then a boolean contextual property "igno
 <p>Consider the query like "find chapters with a given chapter id from all the books with 'id' less than 123".<br clear="none">
 One easy way to manage such queries is to make FIQL and JAX-RS work together. For example:    </p>
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"search"</span>)
-<span class="code-keyword">public</span> class BooksResource {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("search")
+public class BooksResource {
    @Context
-   <span class="code-keyword">private</span> SearchContext context;
+   private SearchContext context;
 
-   <span class="code-comment">//GET /books[id=lt=123]/chapter/1
-</span>   @GET
-   @Path(<span class="code-quote">"books[{search}]/chapter/{id}"</span>) 
-   <span class="code-keyword">public</span> List&lt;Chapter&gt; findSelectedChapters(@PathParam(<span class="code-quote">"search"</span>) <span class="code-object">String</span> searchExpression,
-                                       @PathParam(<span class="code-quote">"id"</span>) <span class="code-object">int</span> chapterIndex) {
-       <span class="code-keyword">return</span> doFindSelectedChapters(searchExpression, chapterIndex);
+   //GET /books[id=lt=123]/chapter/1
+   @GET
+   @Path("books[{search}]/chapter/{id}") 
+   public List&lt;Chapter&gt; findSelectedChapters(@PathParam("search") String searchExpression,
+                                       @PathParam("id") int chapterIndex) {
+       return doFindSelectedChapters(searchExpression, chapterIndex);
    }
 
-   <span class="code-keyword">public</span> List&lt;Chapter&gt; doFindSelectedChapters(<span class="code-object">String</span> searchExpression, <span class="code-object">int</span> chapterIndex) {
+   public List&lt;Chapter&gt; doFindSelectedChapters(String searchExpression, int chapterIndex) {
        SearchCondition&lt;Book&gt; sc = context.getCondition(searchExpression, Book.class);
    
-       <span class="code-comment">// JPA2 enity manager is initialized earlier
-</span>       JPATypedQuery&lt;Book&gt; visitor = <span class="code-keyword">new</span> JPATypedQueryVisitor&lt;Book&gt;(entityManager, Book.class);
+       // JPA2 enity manager is initialized earlier
+       JPATypedQuery&lt;Book&gt; visitor = new JPATypedQueryVisitor&lt;Book&gt;(entityManager, Book.class);
        sc.accept(visitor);
    
        TypedQuery&lt;Book&gt; typedQuery = visitor.getQuery();
        List&lt;Book&gt; books = typedQuery.getResultList();
 
-       List&lt;Chapter&gt; chapters = <span class="code-keyword">new</span> ArrayList&lt;Chapter&gt;(books.size);
-       <span class="code-keyword">for</span> (Book book : books) {
+       List&lt;Chapter&gt; chapters = new ArrayList&lt;Chapter&gt;(books.size);
+       for (Book book : books) {
            chapters.add(book.getChapter(chapterIndex)); 
        }   
-       <span class="code-keyword">return</span> chapters;
+       return chapters;
    }
 
 }
-</pre>
+]]></script>
 </div></div> 
 
 <h3><a shape="rect" name="JAX-RSSearch-Complexqueries"></a>Complex queries</h3>
@@ -1139,41 +1145,41 @@ One easy way to manage such queries is t
 <p>One way to handle is to follow the example from the previous section with few modifications: </p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-@Path(<span class="code-quote">"search"</span>)
-<span class="code-keyword">public</span> class BooksResource {
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@Path("search")
+public class BooksResource {
    @Context
-   <span class="code-keyword">private</span> SearchContext context;
+   private SearchContext context;
 
-   <span class="code-comment">//GET /books(id=gt=300)/chapters(id=lt=5)
-</span>   @GET
-   @Path(<span class="code-quote">"books({search1})/chapter/{search2}"</span>) 
-   <span class="code-keyword">public</span> List&lt;Chapter&gt; findSelectedChapters(@PathParam(<span class="code-quote">"search1"</span>) <span class="code-object">String</span> bookExpression,
-                                       @PathParam(<span class="code-quote">"search2"</span>) <span class="code-object">String</span> chapterExpression) {
-       <span class="code-keyword">return</span> doFindSelectedBooks(bookExpression, chapterExpression);
+   //GET /books(id=gt=300)/chapters(id=lt=5)
+   @GET
+   @Path("books({search1})/chapter/{search2}") 
+   public List&lt;Chapter&gt; findSelectedChapters(@PathParam("search1") String bookExpression,
+                                       @PathParam("search2") String chapterExpression) {
+       return doFindSelectedBooks(bookExpression, chapterExpression);
    }
 
-   <span class="code-keyword">public</span> List&lt;Chapter&gt; doFindSelectedChapters(<span class="code-object">String</span> bookExpression, <span class="code-object">String</span> chapterExpression) {
-       <span class="code-comment">// find the books first
-</span>       
+   public List&lt;Chapter&gt; doFindSelectedChapters(String bookExpression, String chapterExpression) {
+       // find the books first
+       
        SearchCondition&lt;Book&gt; bookCondition = context.getCondition(searchExpression, Book.class);
    
-       JPATypedQuery&lt;Book&gt; visitor = <span class="code-keyword">new</span> JPATypedQueryVisitor&lt;Book&gt;(entityManager, Book.class);
+       JPATypedQuery&lt;Book&gt; visitor = new JPATypedQueryVisitor&lt;Book&gt;(entityManager, Book.class);
        bookCondition.visit(visitor);
        TypedQuery&lt;Book&gt; typedQuery = visitor.getQuery();
        List&lt;Book&gt; books = typedQuery.getResultList();
 
-       <span class="code-comment">// now get the chapters
-</span>       SearchCondition&lt;Chapter&gt; chapterCondition = context.getCondition(chapterExpression, Chapter.class);
-       List&lt;Chapter&gt; chapters = <span class="code-keyword">new</span> ArrayList&lt;Chapter&gt;();
-       <span class="code-keyword">for</span> (Book book : books) {
+       // now get the chapters
+       SearchCondition&lt;Chapter&gt; chapterCondition = context.getCondition(chapterExpression, Chapter.class);
+       List&lt;Chapter&gt; chapters = new ArrayList&lt;Chapter&gt;();
+       for (Book book : books) {
            chapters.addAll(chapterCondition.findAll(book.getChapters()); 
        }   
-       <span class="code-keyword">return</span> chapters;
+       return chapters;
    }
 
 }
-</pre>
+]]></script>
 </div></div> 
 
 <p>In this case two conditions are created and the 2nd condition is used to filter the chapters from the books filtered by the 1st condition.</p>
@@ -1181,39 +1187,39 @@ One easy way to manage such queries is t
 <p>Perhaps a simpler approach, especially in case of JPA2, is to start looking for Chapters immediately, assuming Chapter classes have a one to one bidirectional relationship with Book:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
-<span class="code-keyword">public</span> class Chapter {
-   <span class="code-keyword">private</span> <span class="code-object">int</span> id;
-   <span class="code-keyword">private</span> Book book;
+public class Chapter {
+   private int id;
+   private Book book;
 
-   @OneToOne(mappedBy=<span class="code-quote">"book"</span>)
-   <span class="code-keyword">public</span> Book getBook() {}
+   @OneToOne(mappedBy="book")
+   public Book getBook() {}
 }
 
-@Path(<span class="code-quote">"search"</span>)
-<span class="code-keyword">public</span> class BooksResource {
+@Path("search")
+public class BooksResource {
    @Context
-   <span class="code-keyword">private</span> SearchContext context;
+   private SearchContext context;
 
-   <span class="code-comment">//GET /chapters(bookId=gt=300,id=lt=5)
-</span>   @GET
-   @Path(<span class="code-quote">"chapters({search})"</span>) 
-   <span class="code-keyword">public</span> List&lt;Chapter&gt; findSelectedChapters(@PathParam(<span class="code-quote">"search"</span>) <span class="code-object">String</span> chapterExpression) {
+   //GET /chapters(bookId=gt=300,id=lt=5)
+   @GET
+   @Path("chapters({search})") 
+   public List&lt;Chapter&gt; findSelectedChapters(@PathParam("search") String chapterExpression) {
        
        SearchCondition&lt;Chapter&gt; chapterCondition = context.getCondition(chapterExpression, Chapter.class);
    
-       JPATypedQuery&lt;Chapter&gt; visitor = <span class="code-keyword">new</span> JPATypedQueryVisitor&lt;Chapter&gt;(entityManager, Chapter.class);
+       JPATypedQuery&lt;Chapter&gt; visitor = new JPATypedQueryVisitor&lt;Chapter&gt;(entityManager, Chapter.class);
        chapterCondition.visit(visitor);
        TypedQuery&lt;Chapter&gt; typedQuery = visitor.getQuery();
-       <span class="code-keyword">return</span> typedQuery.getResultList();
+       return typedQuery.getResultList();
    }
 
 }
 
-Note <span class="code-keyword">this</span> code assumes that <span class="code-quote">"bookId"</span> is mapped to <span class="code-quote">"Book.id"</span> property with the help of the contextual <span class="code-quote">"search.bean.property.map"</span> property as explained earlier.
+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.
 
-</pre>
+]]></script>
 </div></div>
 
 <h2><a shape="rect" name="JAX-RSSearch-BuildingFIQLqueries"></a>Building FIQL queries</h2>
@@ -1221,76 +1227,76 @@ Note <span class="code-keyword">this</sp
 <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" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 SearchConditionBuilder b = SearchConditionBuilder.instance();
-<span class="code-object">String</span> fiqlQuery = b.is(<span class="code-quote">"id"</span>).greaterThan(123).query();
+String fiqlQuery = b.is("id").greaterThan(123).query();
 
-WebClient wc = WebClient.create(<span class="code-quote">"http:<span class="code-comment">//books.com/search"</span>);
-</span>wc.query(<span class="code-quote">"_s"</span>, fiqlQuery);
-<span class="code-comment">// find all the books with id greater than 123 
-</span>Collection books = wc.getCollection(Book.class);
-</pre>
+WebClient wc = WebClient.create("http://books.com/search");
+wc.query("_s", fiqlQuery);
+// find all the books with id greater than 123 
+Collection books = wc.getCollection(Book.class);
+]]></script>
 </div></div>
 
 <p>Here is an example of building more complex queries:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">// OR condition
-</span><span class="code-object">String</span> ret = b.is(<span class="code-quote">"foo"</span>).greaterThan(20).or().is(<span class="code-quote">"foo"</span>).lessThan(10).query();
-assertEquals(<span class="code-quote">"foo=gt=20,foo=lt=10"</span>, ret);
-
-<span class="code-comment">// AND condition
-</span><span class="code-object">String</span> ret = b.is(<span class="code-quote">"foo"</span>).greaterThan(20).and().is(<span class="code-quote">"bar"</span>).equalTo(<span class="code-quote">"plonk"</span>).query();
-assertEquals(<span class="code-quote">"foo=gt=20;bar==plonk"</span>, ret);
-
-<span class="code-comment">// Complex condition
-</span><span class="code-object">String</span> ret = b.is(<span class="code-quote">"foo"</span>).equalTo(123.4).or().and(
-            b.is(<span class="code-quote">"bar"</span>).equalTo(<span class="code-quote">"asadf*"</span>), 
-            b.is(<span class="code-quote">"baz"</span>).lessThan(20)).query();
-assertEquals(<span class="code-quote">"foo==123.4,(bar==asadf*;baz=lt=20.0)"</span>, ret);
-</pre>
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+// OR condition
+String ret = b.is("foo").greaterThan(20).or().is("foo").lessThan(10).query();
+assertEquals("foo=gt=20,foo=lt=10", ret);
+
+// AND condition
+String ret = b.is("foo").greaterThan(20).and().is("bar").equalTo("plonk").query();
+assertEquals("foo=gt=20;bar==plonk", ret);
+
+// Complex condition
+String ret = b.is("foo").equalTo(123.4).or().and(
+            b.is("bar").equalTo("asadf*"), 
+            b.is("baz").lessThan(20)).query();
+assertEquals("foo==123.4,(bar==asadf*;baz=lt=20.0)", ret);
+]]></script>
 </div></div>
 
 <p>Note, starting from CXF 2.7.1 the following can be used to make connecting multiple primitive expressions simpler:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">// AND condition, '.and(<span class="code-quote">"bar"</span>)' is a shortcut <span class="code-keyword">for</span> <span class="code-quote">"and().is("</span>bar<span class="code-quote">")"</span>, similar shortcut is supported <span class="code-keyword">for</span> 'or'
-</span><span class="code-object">String</span> ret = b.is(<span class="code-quote">"foo"</span>).greaterThan(20).and(<span class="code-quote">"bar"</span>).equalTo(<span class="code-quote">"plonk"</span>).query();
-assertEquals(<span class="code-quote">"foo=gt=20;bar==plonk"</span>, ret);
-</pre>
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+// AND condition, '.and("bar")' is a shortcut for "and().is("bar")", similar shortcut is supported for 'or'
+String ret = b.is("foo").greaterThan(20).and("bar").equalTo("plonk").query();
+assertEquals("foo=gt=20;bar==plonk", ret);
+]]></script>
 </div></div>
 
 <p>More updates to the builder API are available on the trunk:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">// OR condition
-</span><span class="code-object">String</span> ret = b.is(<span class="code-quote">"foo"</span>).equalTo(20).or().is(<span class="code-quote">"foo"</span>).equalTo(10).query();
-assertEquals(<span class="code-quote">"foo==20,foo==10"</span>, ret);
-
-<span class="code-comment">// Same query, shorter expression
-</span><span class="code-object">String</span> ret = b.is(<span class="code-quote">"foo"</span>).equalTo(20, 10).query();
-assertEquals(<span class="code-quote">"foo==20,foo==10"</span>, ret);
-</pre>
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+// OR condition
+String ret = b.is("foo").equalTo(20).or().is("foo").equalTo(10).query();
+assertEquals("foo==20,foo==10", ret);
+
+// Same query, shorter expression
+String ret = b.is("foo").equalTo(20, 10).query();
+assertEquals("foo==20,foo==10", ret);
+]]></script>
 </div></div> 
 
 <p>and</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">// Connecting composite or() and and() expressions will add <span class="code-quote">"()"</span> implicitly:
-</span><span class="code-object">String</span> ret = b.is(<span class="code-quote">"foo"</span>).equalTo(20, 10).and(<span class="code-quote">"bar"</span>).lessThan(10).query();
-assertEquals(<span class="code-quote">"(foo==20,foo==10);bar=lt=10"</span>, ret);
-
-<span class="code-comment">// wrap() method can be used to wrap explicitly:
-</span>
-<span class="code-object">String</span> ret = b.is(<span class="code-quote">"foo"</span>).equalTo(10).and(<span class="code-quote">"bar"</span>).lessThan(10).wrap().or(<span class="code-quote">"bar"</span>).greaterThan(25).query();
-assertEquals(<span class="code-quote">"(foo==20;bar=lt=10),bar=gt=25"</span>, ret);
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+// Connecting composite or() and and() expressions will add "()" implicitly:
+String ret = b.is("foo").equalTo(20, 10).and("bar").lessThan(10).query();
+assertEquals("(foo==20,foo==10);bar=lt=10", ret);
+
+// wrap() method can be used to wrap explicitly:
+
+String ret = b.is("foo").equalTo(10).and("bar").lessThan(10).wrap().or("bar").greaterThan(25).query();
+assertEquals("(foo==20;bar=lt=10),bar=gt=25", ret);
 
 
-</pre>
+]]></script>
 </div></div> 
 
 
@@ -1300,17 +1306,17 @@ assertEquals(<span class="code-quote">"(
 <p>By default, the date values have to have the following <a shape="rect" class="external-link" href="http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html" rel="nofollow">format</a>: "yyyy-MM-dd", for example:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 ?_search=date=le=2010-03-11
-</pre>
+]]></script>
 </div></div> 
 
 <p>A custom date format can be supported. Use "search.date-format" contextual property, example, "search.date-format"="yyyy-MM-dd'T'HH:mm:ss" will let users type:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 ?_search=time=le=2010-03-11T18:00:00
-</pre>
+]]></script>
 </div></div>
 
 <p>If needed, "search.timezone.support" can be enabled to get the timezones supported too.</p>
@@ -1318,18 +1324,18 @@ assertEquals(<span class="code-quote">"(
 <p>At the moment, for custom date formats be recognized by SearchConditionBuilder, FIQLSearchConditionBuilder has to be created explicitly:</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Map&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt; props = <span class="code-keyword">new</span> HashMap&lt;<span class="code-object">String</span>, <span class="code-object">String</span>&gt;();
-props.put(<span class="code-quote">"search.date-format"</span>, <span class="code-quote">"yyyy-MM-dd'T'HH:mm:ss"</span>);
-props.put(<span class="code-quote">"search.timezone.support"</span>, <span class="code-quote">"<span class="code-keyword">false</span>"</span>);
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+Map&lt;String, String&gt; props = new HashMap&lt;String, String&gt;();
+props.put("search.date-format", "yyyy-MM-dd'T'HH:mm:ss");
+props.put("search.timezone.support", "false");
 
-Date d = df.parse(<span class="code-quote">"2011-03-01 12:34:00"</span>);
+Date d = df.parse("2011-03-01 12:34:00");
         
-FiqlSearchConditionBuilder bCustom = <span class="code-keyword">new</span> FiqlSearchConditionBuilder(props);
+FiqlSearchConditionBuilder bCustom = new FiqlSearchConditionBuilder(props);
         
-<span class="code-object">String</span> ret = bCustom.is(<span class="code-quote">"foo"</span>).equalTo(d).query();
-assertEquals(<span class="code-quote">"foo==2011-03-01T12:34:00"</span>, ret);
-</pre>
+String ret = bCustom.is("foo").equalTo(d).query();
+assertEquals("foo==2011-03-01T12:34:00", ret);
+]]></script>
 </div></div>
 
 <h2><a shape="rect" name="JAX-RSSearch-Alternativequerylanguages"></a>Alternative query languages</h2>



Mime
View raw message