KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > metadata > parser > JdoQuery


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.metadata.parser;
13
14 import com.versant.core.common.Debug;
15
16 import java.io.PrintStream JavaDoc;
17
18 /**
19  * A named query in the meta data.
20  */

21 public final class JdoQuery extends JdoElement {
22
23     // query
24
public String JavaDoc name;
25     public String JavaDoc language;
26     public int ignoreCache;
27     public int includeSubclasses;
28     public String JavaDoc ordering;
29     public int rangeStart;
30     public int rangeEnd;
31
32     // filter
33
public String JavaDoc filter;
34
35     // sql
36
public String JavaDoc sql;
37
38     // declare
39
public String JavaDoc imports;
40     public String JavaDoc parameters;
41     public String JavaDoc variables;
42
43     // result
44
public String JavaDoc result;
45     public String JavaDoc resultClass;
46     public String JavaDoc grouping;
47     public int unique;
48
49     public JdoExtension[] extensions;
50
51     public JdoClass parent;
52
53     public JdoElement getParent() {
54         return parent;
55     }
56
57     /**
58      * Get the fully qualified name of the candidate class for the query.
59      */

60     public String JavaDoc getCandidateClass() {
61         return parent.parent.name + "." + parent.name;
62     }
63
64     /**
65      * Get information for this element to be used in building up a
66      * context string.
67      *
68      * @see #getContext
69      */

70     public String JavaDoc getSubContext() {
71         return "query[" + name + "]";
72     }
73
74     public String JavaDoc toString() {
75         StringBuffer JavaDoc s = new StringBuffer JavaDoc();
76         s.append("query[");
77         s.append(name);
78         s.append("] language=");
79         s.append(language);
80         s.append(" ignore-cache=");
81         s.append(ignoreCache);
82         s.append(" include-subclasses=");
83         s.append(includeSubclasses);
84         s.append("\nfilter[");
85         s.append(filter);
86         s.append("]");
87         s.append("\ndeclarations imports=");
88         s.append(imports);
89         s.append(" parameters=");
90         s.append(parameters);
91         s.append(" variables=");
92         s.append(variables);
93         s.append(" ordering=");
94         s.append(ordering);
95         s.append("\nresult class=");
96         s.append(resultClass);
97         s.append(" grouping=");
98         s.append(grouping);
99         s.append(" unique=");
100         s.append(unique);
101
102         return s.toString();
103     }
104
105     public void dump() {
106         dump(Debug.OUT, "");
107     }
108
109     public void dump(PrintStream JavaDoc out, String JavaDoc indent) {
110         out.println(indent + this);
111         String JavaDoc is = indent + " ";
112         if (extensions != null) {
113             for (int i = 0; i < extensions.length; i++) {
114                 extensions[i].dump(out, is);
115             }
116         }
117     }
118 }
119
Popular Tags