1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package ar.com.fdvs.dj.domain;
31
32 import ar.com.fdvs.dj.core.DJConstants;
33 import ar.com.fdvs.dj.domain.builders.StyleBuilder;
34 import ar.com.fdvs.dj.domain.constants.Stretching;
35 import ar.com.fdvs.dj.domain.entities.DJVariable;
36 import ar.com.fdvs.dj.domain.entities.Entity;
37 import ar.com.fdvs.dj.domain.entities.Parameter;
38 import ar.com.fdvs.dj.domain.entities.columns.AbstractColumn;
39 import ar.com.fdvs.dj.domain.entities.columns.ExpressionColumn;
40 import ar.com.fdvs.dj.domain.entities.columns.SimpleColumn;
41
42 import java.util.*;
43
44
45
46
47 public class DynamicReport extends DJBaseElement {
48
49 private static final long serialVersionUID = Entity.SERIAL_VERSION_UID;
50
51 private String reportName;
52
53
54
55
56
57
58
59
60
61
62
63
64
65 private String language = DJConstants.REPORT_LANGUAGE_JAVA;
66
67 private String title;
68 private boolean titleIsJrExpression = false;
69
70 private String subtitle;
71 private Style titleStyle = new StyleBuilder(false,"reportTitleStyle")
72 .setStretching(Stretching.NO_STRETCH)
73 .build();
74 private Style subtitleStyle = new StyleBuilder(false,"reportSubtitleStyle")
75 .setStretching(Stretching.NO_STRETCH)
76 .build();
77
78 private Locale reportLocale = Locale.getDefault();
79 private String resourceBundle = null;
80
81 protected Map fontsMap = new HashMap();
82
83 private List<AbstractColumn> columns = new ArrayList<AbstractColumn>();
84
85
86 private List columnsGroups = new ArrayList();
87
88
89 private List charts = new ArrayList();
90
91
92 private List newCharts = new ArrayList();
93
94 private DynamicReportOptions options;
95
96
97
98
99
100 private List fields = new ArrayList();
101
102
103 private List parameters = new ArrayList();
104
105 private List<DJVariable> variables = new ArrayList<DJVariable>();
106
107 private Map properties = new HashMap();
108
109 private String templateFileName = null;
110 private boolean templateImportDatasets = false;
111 private boolean templateImportFields = false;
112 private boolean templateImportVariables = false;
113 private boolean templateImportParameters = true;
114
115 private List autoTexts = new ArrayList();
116
117 private Map styles = new LinkedHashMap();
118
119 private DJQuery query;
120
121 private String whenNoDataText;
122 private Style whenNoDataStyle;
123 private boolean whenNoDataShowTitle = true;
124 private boolean whenNoDataShowColumnHeader = true;
125
126 private boolean allowDetailSplit = true;
127
128
129
130
131
132
133
134
135
136
137
138 private byte whenNoDataType = DJConstants.WHEN_NO_DATA_TYPE_NO_PAGES;
139
140
141
142
143
144
145
146
147
148 private byte whenResourceMissing = DJConstants.WHEN_RESOURCE_MISSING_TYPE_KEY;
149
150
151 public void addStyle(Style style) {
152 styles.put(style.getName(), style);
153 }
154
155 public Map getStyles() {
156 return styles;
157 }
158
159 public void setStyles(Map styles) {
160 this.styles = styles;
161 }
162
163 public void setProperty(String name, String value) {
164 properties.put(name, value);
165 }
166
167 public DynamicReport() {}
168
169 public DynamicReport(String title, List columns, List columnsGroups, List charts, DynamicReportOptions options) {
170 this.title = title;
171 this.columns = columns;
172 this.columnsGroups = columnsGroups;
173 this.charts = charts;
174 this.options = options;
175 }
176
177 public String getTitle() {
178 return title;
179 }
180
181 public void setTitle(String title) {
182 this.title = title;
183 }
184
185 public List<AbstractColumn> getColumns() {
186 return columns;
187 }
188
189 public void setColumns(List<AbstractColumn> columns) {
190 this.columns = columns;
191 }
192
193 public List getColumnsGroups() {
194 return columnsGroups;
195 }
196
197 public void setColumnsGroups(List columnsGroups) {
198 this.columnsGroups = columnsGroups;
199 }
200
201 public DynamicReportOptions getOptions() {
202 return options;
203 }
204
205 public void setOptions(DynamicReportOptions options) {
206 this.options = options;
207 }
208
209 public String getSubtitle() {
210 return subtitle;
211 }
212
213 public void setSubtitle(String subtitle) {
214 this.subtitle = subtitle;
215 }
216
217 public Style getSubtitleStyle() {
218 return subtitleStyle;
219 }
220
221 public void setSubtitleStyle(Style subtitleStyle) {
222 this.subtitleStyle = subtitleStyle;
223 }
224
225 public Style getTitleStyle() {
226 return titleStyle;
227 }
228
229 public void setTitleStyle(Style titleStyle) {
230 this.titleStyle = titleStyle;
231 }
232
233 public void setTitleStyle(Style titleStyle, boolean isExp) {
234 this.titleStyle = titleStyle;
235 this.titleIsJrExpression = isExp;
236 }
237
238 public String getTemplateFileName() {
239 return templateFileName;
240 }
241
242 public void setTemplateFileName(String templateFileName) {
243 this.templateFileName = templateFileName;
244 }
245
246 public List getFields() {
247 return fields;
248 }
249
250 public void setFields(List fields) {
251 this.fields = fields;
252 }
253
254 public List getCharts() {
255 return charts;
256 }
257
258 public void setCharts(List charts) {
259 this.charts = charts;
260 }
261
262 public List getNewCharts() {
263 return newCharts;
264 }
265
266 public void setNewCharts(List charts) {
267 this.newCharts = charts;
268 }
269
270 public List getAutoTexts() {
271 return autoTexts;
272 }
273
274 public void setAutoTexts(List autoTexts) {
275 this.autoTexts = autoTexts;
276 }
277
278 public Locale getReportLocale() {
279 return reportLocale;
280 }
281
282 public void setReportLocale(Locale reportLocale) {
283 this.reportLocale = reportLocale;
284 }
285
286 public String getResourceBundle() {
287 return resourceBundle;
288 }
289
290 public void setResourceBundle(String resourceBundle) {
291 this.resourceBundle = resourceBundle;
292 }
293
294 public DJQuery getQuery() {
295 return query;
296 }
297
298 public void setQuery(DJQuery query) {
299 this.query = query;
300 }
301
302 public Map getFontsMap() {
303 return fontsMap;
304 }
305
306 public void setFontsMap(Map fontsMap) {
307 this.fontsMap = fontsMap;
308 }
309
310 public byte getWhenNoDataType() {
311 return whenNoDataType;
312 }
313
314 public void setWhenNoDataType(byte whenNoDataType) {
315 this.whenNoDataType = whenNoDataType;
316 }
317
318 public byte getWhenResourceMissing() {
319 return whenResourceMissing;
320 }
321
322 public void setWhenResourceMissing(byte whenResourceMissing) {
323 this.whenResourceMissing = whenResourceMissing;
324 }
325
326 public String getWhenNoDataText() {
327 return whenNoDataText;
328 }
329
330 public void setWhenNoDataText(String whenNoDataText) {
331 this.whenNoDataText = whenNoDataText;
332 }
333
334 public Style getWhenNoDataStyle() {
335 return whenNoDataStyle;
336 }
337
338 public void setWhenNoDataStyle(Style whenNoDataStyle) {
339 this.whenNoDataStyle = whenNoDataStyle;
340 }
341
342 public boolean isWhenNoDataShowTitle() {
343 return whenNoDataShowTitle;
344 }
345
346 public void setWhenNoDataShowTitle(boolean whenNoDataShowTitle) {
347 this.whenNoDataShowTitle = whenNoDataShowTitle;
348 }
349
350 public boolean isWhenNoDataShowColumnHeader() {
351 return whenNoDataShowColumnHeader;
352 }
353
354 public void setWhenNoDataShowColumnHeader(boolean whenNoDataShowColumnHeader) {
355 this.whenNoDataShowColumnHeader = whenNoDataShowColumnHeader;
356 }
357
358 public List getParameters() {
359 return parameters;
360 }
361
362 public void addParameter(String name, String className){
363 this.parameters.add(new Parameter(name, className));
364 }
365
366 public void setParameters(List parameters) {
367 this.parameters = parameters;
368 }
369
370 public boolean isAllowDetailSplit() {
371 return allowDetailSplit;
372 }
373
374 public void setAllowDetailSplit(boolean allowDetailSplit) {
375 this.allowDetailSplit = allowDetailSplit;
376 }
377
378 public boolean isTemplateImportDatasets() {
379 return templateImportDatasets;
380 }
381
382 public void setTemplateImportDatasets(boolean templateImportDatasets) {
383 this.templateImportDatasets = templateImportDatasets;
384 }
385
386 public boolean isTemplateImportFields() {
387 return templateImportFields;
388 }
389
390 public void setTemplateImportFields(boolean templateImportFields) {
391 this.templateImportFields = templateImportFields;
392 }
393
394 public boolean isTemplateImportVariables() {
395 return templateImportVariables;
396 }
397
398 public void setTemplateImportVariables(boolean templateImportVariables) {
399 this.templateImportVariables = templateImportVariables;
400 }
401
402 public boolean isTemplateImportParameters() {
403 return templateImportParameters;
404 }
405
406 public void setTemplateImportParameters(boolean templateImportParameters) {
407 this.templateImportParameters = templateImportParameters;
408 }
409
410 public Map getProperties() {
411 return properties;
412 }
413
414
415
416
417
418 public void setProperties(Map properties) {
419 this.properties = properties;
420 }
421
422 public String getReportName() {
423 return reportName;
424 }
425
426 public void setReportName(String reportName) {
427 this.reportName = reportName;
428 }
429
430
431
432
433
434 public List getAllFields(){
435 ArrayList l = new ArrayList();
436 for (Iterator iter = this.columns.iterator(); iter.hasNext();) {
437 Object o = iter.next();
438 ColumnProperty columnProperty = null;
439
440 if (o instanceof SimpleColumn && !(o instanceof ExpressionColumn)) {
441 SimpleColumn propcol = (SimpleColumn)o;
442 columnProperty = propcol.getColumnProperty();
443 l.add(columnProperty);
444 }
445 }
446
447 l.addAll(this.getFields());
448
449 return l;
450
451 }
452
453 public boolean isTitleIsJrExpression() {
454 return titleIsJrExpression;
455 }
456
457 public void setTitleIsJrExpression(boolean titleIsJrExpression) {
458 this.titleIsJrExpression = titleIsJrExpression;
459 }
460
461 public List<DJVariable> getVariables() {
462 return variables;
463 }
464
465 public void setVariables(List<DJVariable> variables) {
466 this.variables = variables;
467 }
468
469 public String getLanguage() {
470 return language;
471 }
472
473
474
475
476
477 public void setLanguage(String language) {
478 this.language = language;
479 }
480
481 }