KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > util > xml > query > QueryDefinition


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.bridge.util.xml.query;
11
12 import java.util.Collection JavaDoc;
13 import org.w3c.dom.*;
14
15 import org.mmbase.bridge.*;
16 import org.mmbase.storage.search.*;
17
18 /**
19  * Defines a query and possible options for the fields to index.
20  *
21  * XXX What's the difference between a Query and a QueryDefinition?
22  *
23  * @author Pierre van Rooden
24  * @version $Id: QueryDefinition.java,v 1.7 2006/04/10 15:25:43 michiel Exp $
25  * @since MMBase-1.8
26  **/

27 public class QueryDefinition {
28
29     /**
30      * The query to run
31      */

32     public Query query = null;
33
34     /**
35      * If <code>true</code>, the query in this definition returns cluster nodes
36      * XXX: how is this different from query instanceof NodeQuery
37      */

38     public boolean isMultiLevel = false;
39
40     /**
41      * The NodeManager of the 'main' nodetype in this query (if appropriate).
42      * XXX: How is this different from NodeQuery#getNodeManager() ?
43      */

44     public NodeManager elementManager = null;
45
46     /**
47      * The step in the query describing the 'main' nodetype (if appropriate).
48      * XXX: How is this different from NodeQuery#getNodeStep() ?
49      */

50     public Step elementStep = null;
51
52
53     /**
54      * A collection of FieldDefinition objects..
55      */

56     public Collection JavaDoc fields = null;
57
58
59     public QueryDefinition() {
60     }
61     /**
62      * Constructor, copies all data from the specified QueryDefinition object.
63      */

64     public QueryDefinition(QueryDefinition queryDefinition) {
65         this.query = queryDefinition.query;
66         this.isMultiLevel = queryDefinition.isMultiLevel;
67         this.elementManager = queryDefinition.elementManager;
68         this.elementStep = queryDefinition.elementStep;
69         this.fields = queryDefinition.fields;
70     }
71
72     /**
73      * Configures the query definition, using data from a DOM element
74      */

75     public void configure(Element queryElement) {
76     }
77
78
79     public String JavaDoc toString() {
80         return
81             (query == null ? "NULL" : (query.getClass().getName() + " " + query.toSql())) +
82             " " + (isMultiLevel ? "(MULTILEVEL)" : "") +
83             elementStep;
84     }
85 }
86
87
Popular Tags