KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jcr > query > QueryResult


1 /*
2  * $Id: QueryResult.java,v 1.2 2004/07/24 00:16:24 benjmestrallet Exp $
3  *
4  * Copyright 2002-2004 Day Management AG, Switzerland.
5  *
6  * Licensed under the Day RI License, Version 2.0 (the "License"),
7  * as a reference implementation of the following specification:
8  *
9  * Content Repository API for Java Technology, revision 0.12
10  * <http://www.jcp.org/en/jsr/detail?id=170>
11  *
12  * You may not use this file except in compliance with the License.
13  * You may obtain a copy of the License files at
14  *
15  * http://www.day.com/content/en/licenses/day-ri-license-2.0
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */

24 package javax.jcr.query;
25
26 import javax.jcr.*;
27
28 /**
29  * A QueryResult object. Returned in an iterator by {@link javax.jcr.query.Query#execute()
30  * Query.execute()}
31  *
32  * @author Peeter Piegaze
33  */

34 public interface QueryResult {
35
36   /**
37    * Returns a node meeting the search criteria. If the query executed
38    * included a full text SEARCH clause then this method returns the parent
39    * node of the property returned by getProperty, below.
40    *
41    * @return a Node
42    */

43   public Node getNode();
44
45   /**
46    * Returns the paths (there may be more than one) of the matching node.
47    * This method may be used to avoid the overhead of accessing the matching
48    * node itself, if only the paths are required.
49    *
50    * @return a StringIterator
51    */

52   public StringIterator getNodePaths();
53
54   /**
55    * Returns the UUID of the matching node. If the node does not have a UUID,
56    * it returns null.
57    *
58    * @return a String
59    */

60   public String JavaDoc getUUID();
61
62   /**
63    * If the query executed included a full text SEARCH clause then this
64    * method returns a property whose value matched the text search. If this
65    * method returns a property, then the getNode method (above) must return
66    * that property's parent. If the query did not include a SEARCH clause
67    * then this method returns null.
68    *
69    * @return a Property
70    */

71   public Property getProperty();
72
73   /**
74    * If the query executed included a full text SEARCH clause then this
75    * method returns the name of the property returned by getProperty, above.
76    * This method may be used to avoid the overhead of accessing the matching
77    * property itself, if only the name is required. If the query did not
78    * include a SEARCH clause then this method returns null.
79    *
80    * @return a String
81    */

82   public String JavaDoc getPropertyName();
83
84   /**
85    * The relevance of this QueryResult. The details of this metric are
86    * implementation specific. The only requirement is that the returned
87    * integer must be equal to or greater than zero (i >= 0) and that higher
88    * score number means “more relevant”. Implementations that do not support
89    * this metric are free to return a score of zero (0) for every QueryResult.
90    * <p/>
91    * If the JCRQL clause ORDER BY SCORE was invoked (or a similar directive
92    * in another language) then the QueryResultIterator returned by
93    * Query.execute must order its returned QueryResult objects accordingly,
94    * using this score value.
95    *
96    * @return an int
97    */

98   public int getScore();
99 }
100
101
Popular Tags