01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.bridge.util.xml.query;
11:
12: import java.util.Collection;
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.9 2006/09/13 10:03:59 michiel Exp $
25: * @since MMBase-1.8
26: * @javadoc
27: **/
28: public class QueryDefinition {
29:
30: /**
31: * The query to run
32: */
33: public Query query = null;
34:
35: /**
36: * If <code>true</code>, the query in this definition returns cluster nodes
37: * XXX: how is this different from query instanceof NodeQuery
38: */
39: public boolean isMultiLevel = false;
40:
41: /**
42: * The NodeManager of the 'main' nodetype in this query (if appropriate).
43: * XXX: How is this different from NodeQuery#getNodeManager() ?
44: */
45: public NodeManager elementManager = null;
46:
47: /**
48: * The step in the query describing the 'main' nodetype (if appropriate).
49: * XXX: How is this different from NodeQuery#getNodeStep() ?
50: */
51: public Step elementStep = null;
52:
53: /**
54: * A collection of FieldDefinition objects..
55: */
56: public Collection<FieldDefinition> fields = null;
57:
58: public QueryDefinition() {
59: }
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: public String toString() {
79: return (query == null ? "NULL" : (query.getClass().getName()
80: + " " + query.toSql()))
81: + " "
82: + (isMultiLevel ? "(MULTILEVEL)" : "")
83: + elementStep;
84: }
85: }
|