KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > JRDataset


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine;
29
30 /**
31  * Interface representing a data set that can be used in a report.
32  * <p>
33  * A data set consists of parameters, fields, variables, groups and an optional query.
34  * When a data set gets instantiated, parameter values and a data source is passed to it.
35  * <p>
36  * A report has one main data set and multiple sub data sets that can be instantiated by charts and crosstabs.
37  *
38  * @author Lucian Chirita (lucianc@users.sourceforge.net)
39  * @version $Id: JRDataset.java 1408 2006-09-28 12:52:05 +0300 (Thu, 28 Sep 2006) teodord $
40  *
41  * @see net.sf.jasperreports.engine.JRDatasetRun
42  * @see net.sf.jasperreports.engine.JRReport#getMainDataset()
43  * @see net.sf.jasperreports.engine.JRReport#getDatasets()
44  */

45 public interface JRDataset
46 {
47     /**
48      * Return NULL when a resource is missing.
49      */

50     public static final byte WHEN_RESOURCE_MISSING_TYPE_NULL = 1;
51     /**
52      * Return empty string when a resource is missing.
53      */

54     public static final byte WHEN_RESOURCE_MISSING_TYPE_EMPTY = 2;
55     /**
56      * Return the key when a resource is missing.
57      */

58     public static final byte WHEN_RESOURCE_MISSING_TYPE_KEY = 3;
59     /**
60      * Throw an exception when a resource is missing.
61      */

62     public static final byte WHEN_RESOURCE_MISSING_TYPE_ERROR = 4;
63
64     
65     /**
66      * Returns the dataset name.
67      *
68      * @return the name of the dataset
69      */

70     public String JavaDoc getName();
71
72     
73     /**
74      * The name of the scriptlet class to be used when iterating this dataset.
75      *
76      * @return the scriplet class name
77      */

78     public String JavaDoc getScriptletClass();
79
80     
81     /**
82      * Returns the dataset's parameters.
83      *
84      * @return the dataset's parameters
85      */

86     public JRParameter[] getParameters();
87
88     
89     /**
90      * Returns the query of the dataset.
91      * <p>
92      * The query is used by passing a connection is passed to the dataset when instantiating.
93      *
94      * @return the query of the dataset
95      */

96     public JRQuery getQuery();
97
98     
99     /**
100      * Returns the dataset's fields.
101      *
102      * @return the dataset's fields
103      */

104     public JRField[] getFields();
105
106     
107     /**
108      * Returns the dataset's sort fields.
109      *
110      * @return the dataset's sort fields
111      */

112     public JRSortField[] getSortFields();
113
114     
115     /**
116      * Returns the dataset's variables.
117      *
118      * @return the dataset's variables
119      */

120     public JRVariable[] getVariables();
121
122     
123     /**
124      * Returns the dataset's groups.
125      *
126      * @return the dataset's groups
127      */

128     public JRGroup[] getGroups();
129     
130     
131     /**
132      * Decides whether this dataset is the main report dataset or a sub dataset.
133      *
134      * @return <code>true</code> iff this dataset is the main report dataset
135      */

136     public boolean isMainDataset();
137
138
139     /**
140      * Returns the resource bundle base name.
141      * <p>
142      * The resource bundle is used when evaluating expressions.
143      *
144      * @return the resource bundle base name
145      */

146     public String JavaDoc getResourceBundle();
147
148
149     /**
150      * Returns the resource missing handling type.
151      *
152      * @return the resource missing handling type
153      */

154     public byte getWhenResourceMissingType();
155     
156     
157     /**
158      * Sets the resource missing handling type.
159      * @param whenResourceMissingType the resource missing handling type
160      */

161     public void setWhenResourceMissingType(byte whenResourceMissingType);
162
163
164     /**
165      * Returns this dataset's properties map.
166      *
167      * @return this dataset's properties map
168      */

169     public JRPropertiesMap getPropertiesMap();
170
171     
172     /**
173      * Returns the dataset filter expression.
174      * <p>
175      * This expression is used to filter the rows of the
176      * {@link JRDataSource data source} that this dataset will iterate on.
177      * </p>
178      * <p>
179      * This expression (if not null) is evaluated immediately after a new row is
180      * {@link JRDataSource#next() produced} by the data source.
181      * The evaluation is performed using field and variable values corresponding to the new row.
182      * When the result of the evaluation is <code>Boolean.TRUE</code> the row gets processed by the report
183      * filling engine.
184      * When the result is null or <code>Boolean.FALSE</code>, the current row will be skipped and the datasource will be asked for the next row.
185      * </p>
186      *
187      * @return the dataset filter expression
188      */

189     public JRExpression getFilterExpression();
190 }
191
Popular Tags