KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > deployment > xml > Query


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  *
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or 1any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  *
22  * Initial developer: JOnAS team
23  * --------------------------------------------------------------------------
24  * $Id: Query.java,v 1.6 2004/05/10 11:45:44 sauthieg Exp $
25  * --------------------------------------------------------------------------
26  */

27 package org.objectweb.jonas_ejb.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
30 /**
31  * This class defines the implementation of the element query
32  *
33  * @author JOnAS team
34  */

35
36 public class Query extends AbsElement {
37
38     /**
39      * description
40      */

41     private String JavaDoc description = null;
42
43     /**
44      * query-method
45      */

46     private QueryMethod queryMethod = null;
47
48     /**
49      * result-type-mapping
50      */

51     private String JavaDoc resultTypeMapping = null;
52
53     /**
54      * ejb-ql
55      */

56     private String JavaDoc ejbQl = null;
57
58
59     /**
60      * Constructor
61      */

62     public Query() {
63         super();
64     }
65
66     /**
67      * Gets the description
68      * @return the description
69      */

70     public String JavaDoc getDescription() {
71         return description;
72     }
73
74     /**
75      * Set the description
76      * @param description description
77      */

78     public void setDescription(String JavaDoc description) {
79         this.description = description;
80     }
81
82     /**
83      * Gets the query-method
84      * @return the query-method
85      */

86     public QueryMethod getQueryMethod() {
87         return queryMethod;
88     }
89
90     /**
91      * Set the query-method
92      * @param queryMethod queryMethod
93      */

94     public void setQueryMethod(QueryMethod queryMethod) {
95         this.queryMethod = queryMethod;
96     }
97
98     /**
99      * Gets the result-type-mapping
100      * @return the result-type-mapping
101      */

102     public String JavaDoc getResultTypeMapping() {
103         return resultTypeMapping;
104     }
105
106     /**
107      * Set the result-type-mapping
108      * @param resultTypeMapping resultTypeMapping
109      */

110     public void setResultTypeMapping(String JavaDoc resultTypeMapping) {
111         this.resultTypeMapping = resultTypeMapping;
112     }
113
114     /**
115      * Gets the ejb-ql
116      * @return the ejb-ql
117      */

118     public String JavaDoc getEjbQl() {
119         return ejbQl;
120     }
121
122     /**
123      * Set the ejb-ql
124      * @param ejbQl ejbQl
125      */

126     public void setEjbQl(String JavaDoc ejbQl) {
127         this.ejbQl = ejbQl;
128     }
129
130     /**
131      * Represents this element by it's XML description.
132      * @param indent use this indent for prexifing XML representation.
133      * @return the XML description of this object.
134      */

135     public String JavaDoc toXML(int indent) {
136         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
137         sb.append(indent(indent));
138         sb.append("<query>\n");
139
140         indent += 2;
141
142         // description
143
sb.append(xmlElement(description, "description", indent));
144         // query-method
145
if (queryMethod != null) {
146             sb.append(queryMethod.toXML(indent));
147         }
148         // result-type-mapping
149
sb.append(xmlElement(resultTypeMapping, "result-type-mapping", indent));
150         // ejb-ql
151
sb.append(xmlElement(ejbQl, "ejb-ql", indent));
152         indent -= 2;
153         sb.append(indent(indent));
154         sb.append("</query>\n");
155
156         return sb.toString();
157     }
158 }
159
Popular Tags