1 /*
2 * JasperReports - Free Java Reporting Library.
3 * Copyright (C) 2001 - 2019 TIBCO Software Inc. All rights reserved.
4 * http://www.jaspersoft.com
5 *
6 * Unless you have purchased a commercial license agreement from Jaspersoft,
7 * the following license terms apply:
8 *
9 * This program is part of JasperReports.
10 *
11 * JasperReports is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * JasperReports is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
23 */
24 package net.sf.jasperreports.engine;
25
26 import net.sf.jasperreports.annotations.properties.Property;
27 import net.sf.jasperreports.annotations.properties.PropertyScope;
28 import net.sf.jasperreports.export.CommonExportConfiguration;
29 import net.sf.jasperreports.export.ExporterConfiguration;
30 import net.sf.jasperreports.export.ExporterInput;
31 import net.sf.jasperreports.export.ExporterOutput;
32 import net.sf.jasperreports.export.HtmlReportConfiguration;
33 import net.sf.jasperreports.export.ReportExportConfiguration;
34 import net.sf.jasperreports.export.SimpleExporterInput;
35 import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
36 import net.sf.jasperreports.export.SimpleWriterExporterOutput;
37 import net.sf.jasperreports.export.XlsReportConfiguration;
38 import net.sf.jasperreports.properties.PropertyConstants;
39
40
41 /**
42 * Instances of this class are used for defining and setting exporter parameters.
43 * <p>
44 * The {@link JasperPrint} object needed for the export can be specified in many ways: an instance of <tt>JasperPrint</tt>,
45 * an input stream, a file on disk, or an URL. The export engine will search for this object through parameters in the following
46 * order: JASPER_PRINT_LIST, JASPER_PRINT, INPUT_STREAM, INPUT_URL, INPUT_FILE, INPUT_FILE_NAME.
47 * <p>
48 * The output type of the export process can also vary: a string buffer, an output stream / writer of a file on disk. The order of
49 * parameters used by JasperReports when looking for the output depends on the final document format and is explained in detail
50 * for each format (see documentation for the children of this class).
51 * <p>
52 * JasperReports allows users to export only a page range from the entire report or even a single page. The engine first
53 * searches for the PAGE_INDEX parameter. If this is not present, it looks for the START_PAGE_INDEX and END_PAGE_INDEX
54 * parameters. The engine will try to narrow the page range (which is initially the entire report) by using these two
55 * parameters, if present.
56 *
57 * @deprecated Replaced by {@link ExporterInput}, {@link ExporterConfiguration} and {@link ExporterOutput}.
58 * @author Teodor Danciu (teodord@users.sourceforge.net)
59 */
60 public class JRExporterParameter
61 {
62
63
64 /**
65 *
66 */
67 private String name;
68
69
70 /**
71 *
72 */
73 protected JRExporterParameter(String name)
74 {
75 this.name = name;
76 }
77
78
79 @Override
80 public String toString()
81 {
82 return this.name;
83 }
84
85
86 /**
87 * @deprecated Replaced by {@link SimpleExporterInput#SimpleExporterInput(JasperPrint)}.
88 */
89 public static final JRExporterParameter JASPER_PRINT = new JRExporterParameter("JasperPrint Object");
90
91
92 /**
93 * @deprecated Replaced by {@link SimpleExporterInput#getInstance(java.util.List)}.
94 */
95 public static final JRExporterParameter JASPER_PRINT_LIST = new JRExporterParameter("JasperPrint List");
96
97
98 /**
99 * @deprecated Replaced by {@link SimpleExporterInput#SimpleExporterInput(java.io.InputStream)}.
100 */
101 public static final JRExporterParameter INPUT_STREAM = new JRExporterParameter("InputStream Object");
102
103
104 /**
105 * @deprecated Replaced by {@link SimpleExporterInput#SimpleExporterInput(java.net.URL)}.
106 */
107 public static final JRExporterParameter INPUT_URL = new JRExporterParameter("URL Object");
108
109
110 /**
111 * @deprecated Replaced by {@link SimpleExporterInput#SimpleExporterInput(java.io.File)}.
112 */
113 public static final JRExporterParameter INPUT_FILE = new JRExporterParameter("Input File");
114
115
116 /**
117 * @deprecated Replaced by {@link SimpleExporterInput#SimpleExporterInput(String)}.
118 */
119 public static final JRExporterParameter INPUT_FILE_NAME = new JRExporterParameter("Input File Name");
120
121
122 /**
123 * @deprecated Replaced by {@link SimpleWriterExporterOutput#SimpleWriterExporterOutput(StringBuffer)}.
124 */
125 public static final JRExporterParameter OUTPUT_STRING_BUFFER = new JRExporterParameter("Output StringBuffer Object");
126
127
128 /**
129 * @deprecated Replaced by {@link SimpleWriterExporterOutput#SimpleWriterExporterOutput(java.io.Writer)}.
130 */
131 public static final JRExporterParameter OUTPUT_WRITER = new JRExporterParameter("Output Writer Object");
132
133
134 /**
135 * @deprecated Replaced by {@link SimpleWriterExporterOutput#SimpleWriterExporterOutput(java.io.OutputStream)}
136 * and {@link SimpleOutputStreamExporterOutput#SimpleOutputStreamExporterOutput(java.io.OutputStream)}.
137 */
138 public static final JRExporterParameter OUTPUT_STREAM = new JRExporterParameter("OutputStream Object");
139
140
141 /**
142 * @deprecated Replaced by {@link SimpleWriterExporterOutput#SimpleWriterExporterOutput(java.io.File)}
143 * and {@link SimpleOutputStreamExporterOutput#SimpleOutputStreamExporterOutput(java.io.File)}.
144 */
145 public static final JRExporterParameter OUTPUT_FILE = new JRExporterParameter("Output File");
146
147
148 /**
149 * @deprecated Replaced by {@link SimpleWriterExporterOutput#SimpleWriterExporterOutput(String)}
150 * and {@link SimpleOutputStreamExporterOutput#SimpleOutputStreamExporterOutput(String)}.
151 */
152 public static final JRExporterParameter OUTPUT_FILE_NAME = new JRExporterParameter("Output File Name");
153
154
155 /**
156 * @deprecated Replaced by {@link ReportExportConfiguration#getPageIndex()}.
157 */
158 public static final JRExporterParameter PAGE_INDEX = new JRExporterParameter("Page Index");
159
160
161 /**
162 * @deprecated Replaced by {@link ReportExportConfiguration#getStartPageIndex()}.
163 */
164 public static final JRExporterParameter START_PAGE_INDEX = new JRExporterParameter("Start Page Index");
165
166
167 /**
168 * @deprecated Replaced by {@link ReportExportConfiguration#getEndPageIndex()}.
169 */
170 public static final JRExporterParameter END_PAGE_INDEX = new JRExporterParameter("End Page Index");
171
172
173 /**
174 * @deprecated Replaced by {@link SimpleWriterExporterOutput#SimpleWriterExporterOutput(java.io.File, String)},
175 * {@link SimpleWriterExporterOutput#SimpleWriterExporterOutput(String, String)}
176 * and {@link SimpleWriterExporterOutput#SimpleWriterExporterOutput(java.io.OutputStream, String)}.
177 */
178 public static final JRExporterParameter CHARACTER_ENCODING = new JRExporterParameter("Character Encoding");
179
180
181 /**
182 * @deprecated Replaced by {@link ReportExportConfiguration#getProgressMonitor()}.
183 */
184 public static final JRExporterParameter PROGRESS_MONITOR = new JRExporterParameter("Progress Monitor");
185
186
187 /**
188 * @deprecated Replaced by {@link ReportExportConfiguration#getOffsetX()}.
189 */
190 public static final JRExporterParameter OFFSET_X = new JRExporterParameter("Offset X");
191
192
193 /**
194 * @deprecated Replace by {@link ReportExportConfiguration#getOffsetY()}.
195 */
196 public static final JRExporterParameter OFFSET_Y = new JRExporterParameter("Offset Y");
197
198
199 /**
200 * @deprecated Replaced by {@link JasperReportsContext}.
201 */
202 public static final JRExporterParameter CLASS_LOADER = new JRExporterParameter("Class Loader");
203
204
205 /**
206 * URL stream handler factory to be used while exporting the report.
207 * <p/>
208 * The values should be of type {@link java.net.URLStreamHandlerFactory java.net.URLStreamHandlerFactory}.
209 *
210 * @see net.sf.jasperreports.engine.util.JRResourcesUtil#createURL(String, java.net.URLStreamHandlerFactory)
211 * @deprecated Replaced by {@link JasperReportsContext}.
212 */
213 public static final JRExporterParameter URL_HANDLER_FACTORY = new JRExporterParameter("URL Handler Factory");
214
215
216 /**
217 * @deprecated Replaced by {@link ReportExportConfiguration#getHyperlinkProducerFactory()}.
218 */
219 public static final JRExporterParameter HYPERLINK_PRODUCER_FACTORY = new JRExporterParameter("Hyperlink producer factory");
220
221
222 /**
223 * @deprecated Replaced by {@link ReportExportConfiguration#getExporterFilter()}.
224 */
225 public static final JRExporterParameter FILTER = new JRExporterParameter("Filter");
226
227
228 /**
229 * A global (per context) property that establishes the priority of export parameters against
230 * report hints.
231 *
232 * If the property is true, export parameters override report hints; this is the
233 * default behavior.
234 *
235 * This property cannot be used as a report export hint.
236 * @deprecated Replaced by {@link CommonExportConfiguration#PROPERTY_EXPORT_CONFIGURATION_OVERRIDE_REPORT_HINTS}.
237 */
238 @Property(
239 category = PropertyConstants.CATEGORY_EXPORT,
240 defaultValue = PropertyConstants.BOOLEAN_TRUE,
241 scopes = {PropertyScope.CONTEXT},
242 sinceVersion = PropertyConstants.VERSION_2_0_2,
243 valueType = Boolean.class
244 )
245 public static final String PROPERTY_EXPORT_PARAMETERS_OVERRIDE_REPORT_HINTS =
246 JRPropertiesUtil.PROPERTY_PREFIX + "export.parameters.override.report.hints";
247
248 /**
249 * Export parameter that can override the
250 * {@link #PROPERTY_EXPORT_PARAMETERS_OVERRIDE_REPORT_HINTS PROPERTY_EXPORT_PARAMETERS_OVERRIDE_REPORT_HINTS}
251 * property.
252 * @deprecated To be removed.
253 */
254 public static final JRExporterParameter PARAMETERS_OVERRIDE_REPORT_HINTS = new JRExporterParameter("Parameters override hints flag");
255
256
257 /**
258 * @deprecated Replaced by {@link HtmlReportConfiguration#isIgnorePageMargins()}
259 * and {@link XlsReportConfiguration#isIgnorePageMargins()}.
260 */
261 public static final JRExporterParameter IGNORE_PAGE_MARGINS = new JRExporterParameter("Ignore page margins");
262
263 }
264