View File | Revision Log | Show Annotations | Download File | View Changeset
/hippo/attic/forge/searchext/searchext/trunk/src/site/xdoc/query-component-usage.xml
Revision: 58772
Committed: Thu Mar 2 15:49:18 2017 UTC (3 years, 4 months ago) by jhoffman
Content type: text/xml
File size: 3519 byte(s)
Log Message:
Moved project from forge.onehippo.org/svn/ without history

File Contents

# Content
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 Copyright 2010-2013 Hippo B.V. (http://www.onehippo.com)
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 -->
17 <!DOCTYPE document PUBLIC "-//Apache Software Foundation//DTD XDOC 1.0//EN"
18 "http://maven.apache.org/dtd/xdoc_1_0.dtd">
19 <document>
20 <properties>
21 <title>Query component usage</title>
22 </properties>
23 <body>
24
25 <section name="QueryComponent">
26
27 <p>The query component is usable out-of-the-box. You just have to declare and configure it in your HST
28 configuration components.
29 </p>
30
31 <source><![CDATA[<sv:node sv:name="query">
32 <sv:property sv:name="jcr:primaryType" sv:type="Name">
33 <sv:value>hst:component</sv:value>
34 </sv:property>
35 <sv:property sv:name="hst:componentclassname" sv:type="String">
36 <sv:value>org.onehippo.forge.searchext.query.component.QueryComponent</sv:value>
37 </sv:property>
38 <sv:property sv:name="hst:parameternames" sv:type="String">
39 <sv:value>extension</sv:value>
40 <sv:value>transformer</sv:value>
41 </sv:property>
42 <sv:property sv:name="hst:parametervalues" sv:type="String">
43 <sv:value>org.onehippo.forge.searchext.query.extension.**Extension</sv:value>
44 <sv:value>org.onehippo.forge.searchext.query.transformer.**QueryResultTransformer</sv:value>
45 </sv:property>
46 </sv:node>]]></source>
47
48 </section>
49
50 <section name="Extend QueryComponent">
51
52 <p>You can easily extend the query component. To execute the whole process, just call one of the doBeforeRender
53 method.
54 </p>
55
56 <p>Example:</p>
57 <source><![CDATA[public class MyCustomizedQueryComponent extends QueryComponent {
58 @Override public void doBeforeRender(HstRequest request, HstResponse response) {
59 QueryConfiguration configuration = new QueryConfiguration(this, request);
60 configuration.put(QueryParameter.query, "cat");
61 configuration.put(QueryParameter.beans, HippoBean.class.getName());
62 doBeforeRender(request, response, configuration, new QueryExtension(),
63 new HippoBeanIteratorResultTransformer());
64 }
65 }]]></source>
66
67 </section>
68
69 <section name="Use QueryComponent in your own component">
70
71 <p>If you already have a component which require a query feature, you can easily create a delegate object, which
72 has the exact same behavior as the QueryComponent, by calling one of its createDelegate method.
73 </p>
74
75 <p>Example:</p>
76 <source><![CDATA[public class MyOwnComponentWithQueryFeature extends BaseHstComponent {
77 @Override public void doBeforeRender(HstRequest request, HstResponse response) {
78 QueryConfiguration configuration = new QueryConfiguration(this, request);
79 configuration.put(QueryParameter.query, "cat");
80 configuration.put(QueryParameter.beans, HippoBean.class.getName());
81 QueryComponent.createDelegate(configuration, new QueryExtension(), new HippoBeanIteratorResultTransformer())
82 .delegate();
83 }
84 }]]></source>
85
86 </section>
87
88 </body>
89 </document>

Properties

Name Value
svn:eol-style native
svn:keywords Id