KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > storage > search > SearchQuery


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.storage.search;
11
12 import java.util.List JavaDoc;
13 /**
14  * Encapsulates a request for a search of the object cloud.
15  * <p>
16  * This corresponds to a SELECT query in SQL syntax.
17  *
18  * @author Rob van Maris
19  * @version $Id: SearchQuery.java,v 1.3 2004/04/01 20:57:48 robmaris Exp $
20  * @since MMBase-1.7
21  */

22 public interface SearchQuery {
23     /**
24      * Default maxNumber value, corresponds to no maximum.
25      * @see SearchQuery#getMaxNumber
26      */

27     int DEFAULT_MAX_NUMBER = -1;
28     
29     /**
30      * Default offset value, corresponds to no offset.
31      * @see SearchQuery#getOffset
32      */

33     int DEFAULT_OFFSET = 0;
34
35     /**
36      * Tests if the search request is to return distinct results. In that case duplicate nodes will be removed from the result.
37      * <p>
38      * This corresponds to the use of "DISTINCT" in SQL SELECT-syntax
39      * .
40      */

41     boolean isDistinct();
42     
43     /**
44      * Tests if this is an aggregating query, i.e. containing aggregated fields.
45      */

46     boolean isAggregating();
47
48     /**
49      * Gets the steps in the search request.
50      * <p>
51      * This corresponds to the tables in SQL SELECT-syntax.
52      */

53     List JavaDoc getSteps();
54
55     /**
56      * Gets the stepfields in the search request.
57      * <p>
58      * This corresponds to the fields in SQL SELECT-syntax.
59      */

60     List JavaDoc getFields();
61
62     /**
63      * Gets the constraints on the search results.
64      * <p>
65      * This corresponds to (part of) the constraints in the WHERE-clause in SQL SELECT-syntax.
66      */

67     Constraint getConstraint();
68
69     /**
70      * Gets the maximum number of results to be returned, or -1 if the number of results to be returned is unlimited.
71      * <p>
72      * Note: limiting the number of results may not be supported by the database layer.
73      */

74     int getMaxNumber();
75
76     /**
77      * Gets the (zerobased) offset in the list of results, of the first result to return. Note that, since it is zerobased, it is equal to the number of results that are skipped.<p>
78      * Note: skipping results may not be supported by the database layer.
79      */

80     int getOffset();
81
82     /**
83      * Gets the SortOrder objects in the order they are to be applied.
84      * This specifies the sorting order of the search results.
85      * <p>
86      * This corresponds to the ORDER BY clause in SQL SELECT syntax.
87      */

88     List JavaDoc getSortOrders();
89
90     /**
91      * Compares this query to the specified object. The result is
92      * <code>true</code> if and only if the argument is a non-null
93      * SearchQuery object representing the same query.
94      *
95      * @param obj The object to compare with.
96      * @return <code>true</code> if the objects are equal,
97      * <code>false</code> otherwise.
98      */

99     public boolean equals(Object JavaDoc obj);
100     
101     // javadoc is inherited
102
public int hashCode();
103
104     /**
105      * Returns a string representation of this SearchQuery.
106      * The string representation has the form
107      * "SearchQuery(distinct:&lt;distinct&gt;,
108      * steps:&lt;steps&gt;, fields:&lt;fields&gt;,
109      * constraint:&lt;constraint&gt;, sortorders:&lt;sortorders&gt;,
110      * max:&lt;max&gt;, offset:&lt;offset&gt;)"
111      * where
112      * <ul>
113      * <li><em>&lt;distinct&gt;</em> is value returned by
114      * {@link #isDistinct isDistinct()}
115      * <li><em>&lt;steps&gt;</em> is the list returned by
116      * {@link #getSteps getSteps()}
117      * <li><em>&lt;fields&gt;</em> is the list returned by
118      * {@link #getFields getFields()}
119      * <li><em>&lt;constraint&gt;</em> is the constraint returned by
120      * {@link #getConstraint getConstraint()}
121      * <li><em>&lt;sortorders&gt;</em> is the list returned by
122      * {@link #getSortOrders getSortOrders()}
123      * <li><em>&lt;max&gt;</em> is value returned by
124      * {@link #getMaxNumber getMaxNumber()}
125      * <li><em>&lt;offset&gt;</em> is value returned by
126      * {@link #getOffset getOffset()}
127      * </ul>
128      *
129      * @return A string representation of this SearchQuery.
130      */

131     public String JavaDoc toString();
132     
133     /** @link dependency
134      * @label constraint
135      * @clientRole 0-1
136      * @supplierRole 0-1*/

137     /*#Constraint lnkConstraint;*/
138 }
139
Popular Tags