Codebase list jasperreports / 03686a0
New upstream version 6.3.1 Emmanuel Bourg 6 years ago
279 changed file(s) with 15879 addition(s) and 1949 deletion(s). Raw diff Collapse all Expand all
11
22 <description>Helps build the JasperReports distribution files.</description>
33
4 <property name="version" value="6.3.0"/>
4 <property name="version" value="6.3.1"/>
55
66 <path id="project-classpath">
77 <path refid="project-lib"/>
4949 <target name="antlr.generate" description="Generates source files for ANTLR grammars">
5050 <mkdir dir="./build/antlr-generated-sources"/>
5151 <antlr target="src/net/sf/jasperreports/olap/mapping/mapping.g"/>
52 </target>
53 <target name="antlr.gen-json" description="Generates source files for the JSON query language ANTLR grammar">
54 <mkdir dir="./build/antlr-generated-sources"/>
55 <ivy:cachepath pathid="project-lib" log="download-only" conf="compile"/>
56 <antlr target="src/net/sf/jasperreports/engine/json/parser/json_grammar.g">
57 <classpath refid="project-classpath"/>
58 </antlr>
5259 </target>
5360
5461 <target name="jar" depends="compile" description="Builds the JasperReports JAR file.">
180187 </target>
181188
182189 <property name="sf.net" value="false"/>
183 <property name="scm-tag" value="jr-6-3-0"/>
190 <property name="scm-tag" value="jr-6-3-1"/>
184191
185192 <target name="preparedocs" description="Prepares Documentation Folder.">
186193 <mkdir dir="./dist/docs"/>
00
11 JasperReports Library Change Log
22 =============================================
3
4 JasperReports 6.3.1 (2016-10-03)
5 ---------------------------------------------
6
7 - new JSONQL query language with advanced syntax for queries and for field mapping
8 expressions to allow more complex field mapping scenarios including the ability to map
9 fields to the parent node values; this new query language and its respective query executer,
10 which offers XPath-like capabilities, deprecate the existing JSON query language and
11 the former query executer;
12
13 - support for request headers was added to HTTP data adapters as well as improved
14 parameter mapping using custom parameter properties to markup dataset parameters which
15 contribute to the HTTP request; the new sample under /demo/samples/httpdataadapters shows
16 some of these improvements;
17
18 - new evaluationTime attribute added to dataset parameter definition to control the exact
19 moment when the default value expression of the parameter is evaluated; the default evaluation
20 time for parameters which do not specify a value for the attribute is controlled using the
21 net.sf.jasperreports.parameter.evaluation.time configuration property;
22
23 - support for property expressions added for dataset fields to allow more flexibility in
24 data source and query executer field mapping;
25
26 - the use of the fieldDescription attribute in data source and query executer field mapping
27 is now deprecated by the introduction of special field level custom properties for each type
28 of data source and query executer;
29
30 - support for property expressions in dataset was added to allow more flexibility in dataset
31 and report configuration, including the ability to control export properties using report parameters;
32 the report and dataset property expressions can be evaluated at different moments and this is
33 controlled by the their evaluationTime attribute; when evaluationTime attribute is not specified
34 for a property expression, it defaults to the value specified by the
35 net.sf.jasperreports.property.evaluation.time configuration property;
36
37 - multiple chart customizer objects can be registered per chart element using new configuration
38 properties having the net.sf.jasperreports.customizer.class.{arbitrary_name} format;
39 the new sample under /demo/samples/chartcustomizers introduces a set of pre-defined chart
40 customizers which are ready to use in reports;
41
42 - the data adapter extension is now enabled by default in all JasperReports deployments;
43
44 - the XLS, XLSX, DOCX and PPTX exporters were enhanced to support specifying metadata
45 information such as title, subject, author, keywords and creator application for the
46 generated documents using export configuration properties;
47
48 - minor bug fixes and improvements;
49
50
51
52
353
454 JasperReports 6.3.0 (2016-06-20)
555 ---------------------------------------------
00 <differences>
11 <difference>
2 <className>net/sf/jasperreports/components/ComponentsXmlDigesterConfigurer</className>
3 <differenceType>7004</differenceType>
4 <method>*addBarcodeRules(*)</method>
2 <className>net/sf/jasperreports/data/http/HttpDataLocation</className>
3 <differenceType>7012</differenceType>
4 <method>*getHeaders()</method>
55 </difference>
66 <difference>
7 <className>net/sf/jasperreports/engine/fonts/FontUtil</className>
8 <differenceType>7004</differenceType>
9 <method>*getFontSetInfo(*)</method>
7 <className>net/sf/jasperreports/data/json/JsonDataAdapter</className>
8 <differenceType>7012</differenceType>
9 <method>*getLanguage()</method>
1010 </difference>
1111 <difference>
12 <className>net/sf/jasperreports/engine/xml/BaseSaxParserFactory</className>
13 <differenceType>7013</differenceType>
14 <method>*getGrammarPoolCache()</method>
12 <className>net/sf/jasperreports/data/json/JsonDataAdapter</className>
13 <differenceType>7012</differenceType>
14 <method>*setLanguage(net.sf.jasperreports.data.json.JsonExpressionLanguageEnum)</method>
1515 </difference>
1616 <difference>
17 <className>net/sf/jasperreports/engine/xml/JRXmlTemplateWriter</className>
18 <differenceType>7005</differenceType>
19 <method>*writeTemplate(net.sf.jasperreports.engine.JRTemplate, java.io.Writer, java.lang.String)</method>
20 <to>*writeTemplate(net.sf.jasperreports.engine.JasperReportsContext, net.sf.jasperreports.engine.JRTemplate, java.lang.String)</to>
17 <className>net/sf/jasperreports/engine/JRField</className>
18 <differenceType>7012</differenceType>
19 <method>*getPropertyExpressions()</method>
2120 </difference>
2221 <difference>
23 <className>net/sf/jasperreports/engine/xml/JRXmlTemplateWriter</className>
24 <differenceType>7006</differenceType>
25 <method>*writeTemplate(net.sf.jasperreports.engine.JRTemplate, java.io.Writer, java.lang.String)</method>
26 <to>java.lang.String</to>
22 <className>net/sf/jasperreports/engine/JRParameter</className>
23 <differenceType>7012</differenceType>
24 <method>*getEvaluationTime()</method>
2725 </difference>
2826 <difference>
29 <className>net/sf/jasperreports/export/HtmlReportConfiguration</className>
27 <className>net/sf/jasperreports/engine/fill/JRFillTextElement</className>
28 <differenceType>7002</differenceType>
29 <method>*getPrintElementHeight()</method>
30 </difference>
31 <difference>
32 <className>net/sf/jasperreports/engine/fill/BandReportFillerParent</className>
3033 <differenceType>7012</differenceType>
31 <method>*isConvertSvgToImage()</method>
34 <method>*abortSubfiller(net.sf.jasperreports.engine.fill.JRBaseFiller)</method>
35 </difference>
36 <difference>
37 <className>net/sf/jasperreports/engine/fill/JRSubreportRunner</className>
38 <differenceType>7012</differenceType>
39 <method>*abort()</method>
40 </difference>
41 <difference>
42 <className>net/sf/jasperreports/extensions/DefaultExtensionsRegistry</className>
43 <differenceType>7005</differenceType>
44 <method>*loadRegistries(java.net.URL, java.util.Map)</method>
45 <to>*loadRegistries(net.sf.jasperreports.engine.JRPropertiesMap, java.util.Map)</to>
46 </difference>
47 <difference>
48 <className>net/sf/jasperreports/export/AbstractXlsExporterConfiguration</className>
49 <differenceType>3005</differenceType>
50 </difference>
51 <difference>
52 <className>net/sf/jasperreports/export/*ExporterConfiguration</className>
53 <differenceType>7012</differenceType>
54 <method>*getMetadata*()</method>
55 </difference>
56 <difference>
57 <className>net/sf/jasperreports/web/servlets/*Servlet</className>
58 <differenceType>8001</differenceType>
59 </difference>
60 <difference>
61 <className>net/sf/jasperreports/engine/fill/JRFillChart</className>
62 <differenceType>6001</differenceType>
63 <field>*ustomizer*</field>
64 </difference>
65 <difference>
66 <className>net/sf/jasperreports/engine/fill/JRBaseFiller</className>
67 <differenceType>6010</differenceType>
68 <field>whenNoDataType</field>
69 </difference>
70 <difference>
71 <className>net/sf/jasperreports/data/*DataFileServiceFactory</className>
72 <differenceType>7005</differenceType>
73 <method>*createService(net.sf.jasperreports.engine.JasperReportsContext, net.sf.jasperreports.data.DataFile)</method>
74 <to>*createService(net.sf.jasperreports.engine.ParameterContributorContext, net.sf.jasperreports.data.DataFile)</to>
75 </difference>
76 <difference>
77 <className>net/sf/jasperreports/data/DataFileResolver</className>
78 <differenceType>7005</differenceType>
79 <method>*(net.sf.jasperreports.engine.JasperReportsContext)</method>
80 <to>*(net.sf.jasperreports.engine.ParameterContributorContext)</to>
81 </difference>
82 <difference>
83 <className>net/sf/jasperreports/data/RepositoryDataLocationService</className>
84 <differenceType>7005</differenceType>
85 <method>*RepositoryDataLocationService(net.sf.jasperreports.engine.JasperReportsContext, net.sf.jasperreports.data.RepositoryDataLocation)</method>
86 <to>*RepositoryDataLocationService(net.sf.jasperreports.engine.ParameterContributorContext, net.sf.jasperreports.data.RepositoryDataLocation)</to>
87 </difference>
88 <difference>
89 <className>net/sf/jasperreports/data/http/HttpDataService</className>
90 <differenceType>7005</differenceType>
91 <method>*HttpDataService(net.sf.jasperreports.engine.JasperReportsContext, net.sf.jasperreports.data.http.HttpDataLocation)</method>
92 <to>*HttpDataService(net.sf.jasperreports.engine.ParameterContributorContext, net.sf.jasperreports.data.http.HttpDataLocation)</to>
93 </difference>
94 <difference>
95 <className>net/sf/jasperreports/data/http/HttpDataService</className>
96 <differenceType>7004</differenceType>
97 <method>*collectParameters(java.util.List, java.util.Map, java.lang.String)</method>
98 </difference>
99 <difference>
100 <className>net/sf/jasperreports/engine/JRDataset</className>
101 <differenceType>7012</differenceType>
102 <method>*getPropertyExpressions()</method>
103 </difference>
104 <difference>
105 <className>net/sf/jasperreports/engine/JRReport</className>
106 <differenceType>7012</differenceType>
107 <method>*getPropertyExpressions()</method>
32108 </difference>
33109 </differences>
1010 <property ref="net.sf.jasperreports.csv.column.names.{arbitrary_name}"/>
1111 <property ref="net.sf.jasperreports.csv.date.pattern"/>
1212 <property ref="net.sf.jasperreports.csv.encoding"/>
13 <property ref="net.sf.jasperreports.csv.field.column.name"/>
14 <property ref="net.sf.jasperreports.csv.field.column.index"/>
1315 <property ref="net.sf.jasperreports.csv.field.delimiter"/>
1416 <property ref="net.sf.jasperreports.csv.locale.code"/>
1517 <property ref="net.sf.jasperreports.csv.number.pattern"/>
2325 <property ref="net.sf.jasperreports.hql.field.mapping.descriptions"/>
2426 <property ref="net.sf.jasperreports.hql.query.list.page.size"/>
2527 <property ref="net.sf.jasperreports.hql.query.run.type"/>
28 <property ref="net.sf.jasperreports.http.data.url"/>
29 <property ref="net.sf.jasperreports.http.data.username"/>
30 <property ref="net.sf.jasperreports.http.data.password"/>
31 <property ref="net.sf.jasperreports.http.data.url.parameter"/>
32 <property ref="net.sf.jasperreports.http.data.post.parameter"/>
33 <property ref="net.sf.jasperreports.http.data.header"/>
34 <property ref="net.sf.jasperreports.javabean.field.property"/>
35 <property ref="net.sf.jasperreports.json.field.expression"/>
2636 <property ref="net.sf.jasperreports.jdbc.cached.rowset"/>
2737 <property ref="net.sf.jasperreports.jdbc.concurrency"/>
2838 <property ref="net.sf.jasperreports.jdbc.fetch.size"/>
3040 <property ref="net.sf.jasperreports.jdbc.max.field.size"/>
3141 <property ref="net.sf.jasperreports.jdbc.result.set.type"/>
3242 <property ref="net.sf.jasperreports.jdbc.time.zone"/>
43 <property ref="net.sf.jasperreports.olap.field.mapping"/>
3344 <property ref="net.sf.jasperreports.query.chunk.token.separators"/>
3445 <property ref="net.sf.jasperreports.query.executer.factory.{language}"/>
46 <property ref="net.sf.jasperreports.sql.field.column.name"/>
47 <property ref="net.sf.jasperreports.sql.field.column.label"/>
48 <property ref="net.sf.jasperreports.sql.field.column.index"/>
49 <property ref="net.sf.jasperreports.xls.column.indexes.{arbitrary_name}"/>
50 <property ref="net.sf.jasperreports.xls.column.names.{arbitrary_name}"/>
51 <property ref="net.sf.jasperreports.xls.date.pattern"/>
52 <property ref="net.sf.jasperreports.xls.field.column.name"/>
53 <property ref="net.sf.jasperreports.xls.field.column.index"/>
54 <property ref="net.sf.jasperreports.xls.locale.code"/>
55 <property ref="net.sf.jasperreports.xls.number.pattern"/>
3556 <property ref="net.sf.jasperreports.xls.source"/>
57 <property ref="net.sf.jasperreports.xls.timezone.id"/>
3658 <property ref="net.sf.jasperreports.xml.source"/>
3759 <property ref="net.sf.jasperreports.xpath.executer.factory"/>
60 <property ref="net.sf.jasperreports.xpath.field.mapping"/>
3861 </content>
3962 </category>
4063
7194 <property ref="net.sf.jasperreports.chart.render.type"/>
7295 <property ref="net.sf.jasperreports.chart.renderer.factory.{render_type}"/>
7396 <property ref="net.sf.jasperreports.chart.theme"/>
97 <property ref="net.sf.jasperreports.customizer.class.{arbitrary_name}"/>
98 <property ref="net.sf.jasperreports.customizer.{arbitrary_name}.{property_name}"/>
99 <property ref="net.sf.jasperreports.consume.space.on.overflow"/>
74100 <property ref="net.sf.jasperreports.default.first.line.indent"/>
75101 <property ref="net.sf.jasperreports.default.font.name"/>
76102 <property ref="net.sf.jasperreports.default.font.size"/>
80106 <property ref="net.sf.jasperreports.default.spacing.after"/>
81107 <property ref="net.sf.jasperreports.default.spacing.before"/>
82108 <property ref="net.sf.jasperreports.default.tab.stop.width"/>
109 <property ref="net.sf.jasperreports.default.locale"/>
110 <property ref="net.sf.jasperreports.default.timezone"/>
83111 <property ref="net.sf.jasperreports.evaluator.class.reference.fix.enabled"/>
84112 <property ref="net.sf.jasperreports.evaluator.ignore.npe"/>
113 <property ref="net.sf.jasperreports.frame.border.split.type"/>
85114 <property ref="net.sf.jasperreports.image.encoder"/>
86115 <property ref="net.sf.jasperreports.image.reader"/>
87116 <property ref="net.sf.jasperreports.markup.processor.factory.{markup}"/>
88117 <property ref="net.sf.jasperreports.page.break.no.pagination"/>
118 <property ref="net.sf.jasperreports.parameter.evaluation.time"/>
119 <property ref="net.sf.jasperreports.property.evaluation.time"/>
89120 <property ref="net.sf.jasperreports.print.collapse.missing.bookmark.levels"/>
90121 <property ref="net.sf.jasperreports.print.create.bookmarks"/>
91122 <property ref="net.sf.jasperreports.print.keep.full.text"/>
92 <property ref="net.sf.jasperreports.text.truncate.at.char"/>
93 <property ref="net.sf.jasperreports.text.truncate.suffix"/>
94 <property ref="net.sf.jasperreports.text.measurer.factory"/>
95 <property ref="net.sf.jasperreports.text.save.line.breaks"/>
96123 <property ref="net.sf.jasperreports.style.evaluation.time.enabled"/>
97124 <property ref="net.sf.jasperreports.subreport.runner.factory"/>
98 <property ref="net.sf.jasperreports.virtualizer.files.delete.on.exit"/>
99 <property ref="net.sf.jasperreports.virtual.page.element.size"/>
100 <property ref="net.sf.jasperreports.default.locale"/>
101 <property ref="net.sf.jasperreports.default.timezone"/>
102125 <property ref="net.sf.jasperreports.text.pattern.date"/>
103126 <property ref="net.sf.jasperreports.text.pattern.time"/>
104127 <property ref="net.sf.jasperreports.text.pattern.datetime"/>
105128 <property ref="net.sf.jasperreports.text.pattern.integer"/>
106129 <property ref="net.sf.jasperreports.text.pattern.number"/>
107 <property ref="net.sf.jasperreports.frame.border.split.type"/>
130 <property ref="net.sf.jasperreports.text.measurer.factory"/>
131 <property ref="net.sf.jasperreports.text.save.line.breaks"/>
132 <property ref="net.sf.jasperreports.text.truncate.at.char"/>
133 <property ref="net.sf.jasperreports.text.truncate.suffix"/>
134 <property ref="net.sf.jasperreports.virtualizer.files.delete.on.exit"/>
135 <property ref="net.sf.jasperreports.virtual.page.element.size"/>
136 <property ref="net.sf.jasperreports.when.no.data.type"/>
108137 </content>
109138 </category>
110139
158187 <property ref="net.sf.jasperreports.components.filter.char" />
159188 <property ref="net.sf.jasperreports.components.table.generate.pdf.tags" />
160189 <property ref="net.sf.jasperreports.components.table.interactive" />
190 <property ref="net.sf.jasperreports.components.table.floating.header" />
161191 <property ref="net.sf.jasperreports.components.table.column.field" />
162192 <property ref="net.sf.jasperreports.components.table.column.variable" />
163193 <property ref="net.sf.jasperreports.components.table.column.sortable" />
212242 <property ref="net.sf.jasperreports.export.docx.flexible.row.height"/>
213243 <property ref="net.sf.jasperreports.export.docx.frames.as.nested.tables"/>
214244 <property ref="net.sf.jasperreports.export.docx.hidden.text"/>
245 <property ref="net.sf.jasperreports.export.docx.metadata.application"/>
246 <property ref="net.sf.jasperreports.export.docx.metadata.author"/>
247 <property ref="net.sf.jasperreports.export.docx.metadata.keywords"/>
248 <property ref="net.sf.jasperreports.export.docx.metadata.subject"/>
249 <property ref="net.sf.jasperreports.export.docx.metadata.title"/>
215250 <property ref="net.sf.jasperreports.export.docx.new.line.as.paragraph"/>
216251
217252 <property ref="net.sf.jasperreports.export.flash.element.allow.script.access"/>
291326 <property ref="net.sf.jasperreports.export.pdfa.conformance"/>
292327 <property ref="net.sf.jasperreports.export.pdfa.icc.profile.path"/>
293328
329 <property ref="net.sf.jasperreports.export.pptx.metadata.application"/>
330 <property ref="net.sf.jasperreports.export.pptx.metadata.author"/>
331 <property ref="net.sf.jasperreports.export.pptx.metadata.keywords"/>
332 <property ref="net.sf.jasperreports.export.pptx.metadata.subject"/>
333 <property ref="net.sf.jasperreports.export.pptx.metadata.title"/>
334
294335 <property ref="net.sf.jasperreports.export.text.character.height"/>
295336 <property ref="net.sf.jasperreports.export.text.character.width"/>
296337 <property ref="net.sf.jasperreports.export.text.line.separator"/>
340381
341382 <property ref="net.sf.jasperreports.export.xls.max.rows.per.sheet"/>
342383
384 <property ref="net.sf.jasperreports.export.xls.metadata.application"/>
385 <property ref="net.sf.jasperreports.export.xls.metadata.author"/>
386 <property ref="net.sf.jasperreports.export.xls.metadata.keywords"/>
387 <property ref="net.sf.jasperreports.export.xls.metadata.subject"/>
388 <property ref="net.sf.jasperreports.export.xls.metadata.title"/>
389
343390 <property ref="net.sf.jasperreports.export.xls.one.page.per.sheet"/>
344391
345392 <property ref="net.sf.jasperreports.export.xls.page.scale"/>
473520 </configProperty>
474521
475522
523 <!-- net.sf.jasperreports.csv.field.column.name -->
524
525 <configProperty name="net.sf.jasperreports.csv.field.column.name">
526 <description>
527 Property specifying the name of the column in the CSV data to which the dataset field is mapped to, in case CSV data is used.
528 </description>
529 <api>net/sf/jasperreports/engine/data/JRCsvDataSource.html#PROPERTY_FIELD_COLUMN_NAME</api>
530 <default>N/A</default>
531 <scope>Field</scope>
532 <since>6.3.1</since>
533 </configProperty>
534
535
536 <!-- net.sf.jasperreports.csv.field.column.index -->
537
538 <configProperty name="net.sf.jasperreports.csv.field.column.index">
539 <description>
540 Property specifying the 0-based index of the column in the CSV data to which the dataset field is mapped to, in case CSV data is used.
541 </description>
542 <api>net/sf/jasperreports/engine/data/JRCsvDataSource.html#PROPERTY_FIELD_COLUMN_INDEX</api>
543 <default>N/A</default>
544 <scope>Field</scope>
545 <since>6.3.1</since>
546 </configProperty>
547
548
476549 <!-- net.sf.jasperreports.csv.field.delimiter -->
477550
478551 <configProperty name="net.sf.jasperreports.csv.field.delimiter">
526599
527600 <configProperty name="net.sf.jasperreports.csv.source">
528601 <description>
602 String property representing a valid path to the requested resource containing the CSV data. It can be:
603 <ul>
604 <li>a resource on the classpath</li>
605 <li>a file from the filesystem, with an absolute or relative path</li>
606 <li>an url</li>
607 </ul>
529608 </description>
530609 <api>net/sf/jasperreports/engine/query/JRCsvQueryExecuterFactory.html#CSV_SOURCE</api>
531610 <default>N/A</default>
649728 <default>list</default>
650729 <scope>Global | Dataset</scope>
651730 <since>1.2.0</since>
731 </configProperty>
732
733
734 <!-- net.sf.jasperreports.http.data.url -->
735
736 <configProperty name="net.sf.jasperreports.http.data.url">
737 <description>
738 Property that specifies the base URL to be used by the HTTP data adapters.
739 If present in the dataset or at report parameter level, it overrides the URL specified in the data adapter definition, or the value provided
740 by the report parameter having the now deprecated <api href="net/sf/jasperreports/data/http/HttpDataService.html#PARAMETER_URL">HTTP_DATA_URL</api> name.
741 When specified at parameter level, it does not need to provide a value. Instead, it is used to mark the report parameter that would provide the URL value.
742 If multiple parameters have this property set, the last one will be used to provide the URL value.
743 </description>
744 <api>net/sf/jasperreports/data/http/HttpDataService.html#PROPERTY_URL</api>
745 <default>N/A</default>
746 <scope>Dataset | Parameter</scope>
747 <since>6.3.1</since>
748 </configProperty>
749
750
751 <!-- net.sf.jasperreports.http.data.username -->
752
753 <configProperty name="net.sf.jasperreports.http.data.username">
754 <description>
755 Property that specifies the user name to be used by the HTTP data adapters with basic authentication.
756 If present in the dataset or at report parameter level, it overrides the user name specified in the data adapter definition, or the value provided
757 by the report parameter having the now deprecated <api href="net/sf/jasperreports/data/http/HttpDataService.html#PARAMETER_USERNAME">HTTP_DATA_USERNAME</api> name.
758 When specified at parameter level, it does not need to provide a value. Instead, it is used to mark the report parameter that would provide the user name value.
759 If multiple parameters have this property set, the last one will be used to provide the user name value.
760 </description>
761 <api>net/sf/jasperreports/data/http/HttpDataService.html#PROPERTY_USERNAME</api>
762 <default>N/A</default>
763 <scope>Dataset | Parameter</scope>
764 <since>6.3.1</since>
765 </configProperty>
766
767
768 <!-- net.sf.jasperreports.http.data.password -->
769
770 <configProperty name="net.sf.jasperreports.http.data.password">
771 <description>
772 Property that specifies the password to be used by the HTTP data adapters with basic authentication.
773 If present in the dataset or at report parameter level, it overrides the password specified in the data adapter definition, or the value provided
774 by the report parameter having the now deprecated <api href="net/sf/jasperreports/data/http/HttpDataService.html#PARAMETER_PASSWORD">HTTP_DATA_PASSWORD</api> name.
775 When specified at parameter level, it does not need to provide a value. Instead, it is used to mark the report parameter that would provide the password value.
776 If multiple parameters have this property set, the last one will be used to provide the password value.
777 </description>
778 <api>net/sf/jasperreports/data/http/HttpDataService.html#PROPERTY_PASSWORD</api>
779 <default>N/A</default>
780 <scope>Dataset | Parameter</scope>
781 <since>6.3.1</since>
782 </configProperty>
783
784
785 <!-- net.sf.jasperreports.http.data.url.parameter -->
786
787 <configProperty name="net.sf.jasperreports.http.data.url.parameter">
788 <description>
789 Property which specifies that the current parameter will append a request parameter value to the base URL when HTTP data adapters are used.
790 The value of this property indicates the name of the request parameter to be appended. In case the property is used, but no value is provided, the name of the request
791 parameter will be the same as the current report parameter name.
792 Request parameters introduced this way override the request parameters having the same name which were declared at data adapter level or were provided
793 by the report parameters having the now deprecated <api href="net/sf/jasperreports/data/http/HttpDataService.html#PARAMETER_PREFIX_URL_PARAMETER">HTTP_DATA_URL_PARAMETER_</api> prefix.
794 If multiple parameters try to provide a value for the same request parameter, the request parameter will be sent multiple times, becoming a request parameter of type array.
795 </description>
796 <api>net/sf/jasperreports/data/http/HttpDataService.html#PROPERTY_URL_PARAMETER</api>
797 <default>N/A</default>
798 <scope>Parameter</scope>
799 <since>6.3.1</since>
800 </configProperty>
801
802
803 <!-- net.sf.jasperreports.http.data.post.parameter -->
804
805 <configProperty name="net.sf.jasperreports.http.data.post.parameter">
806 <description>
807 Property which specifies that the current parameter will contribute a POST request parameter value when HTTP data adapters are used.
808 The value of this property indicates the name of the request parameter to be contributed. In case the property is used, but no value is provided, the name of the request
809 parameter will be the same as the current report parameter name.
810 Request parameters introduced this way override the request parameters having the same name which were declared at data adapter level or were provided
811 by the report parameters having the now deprecated <api href="net/sf/jasperreports/data/http/HttpDataService.html#PARAMETER_PREFIX_POST_PARAMETER">HTTP_DATA_POST_PARAMETER_</api> prefix.
812 If multiple parameters try to provide a value for the same request parameter, the request parameter will be sent multiple times, becoming a request parameter of type array.
813 </description>
814 <api>net/sf/jasperreports/data/http/HttpDataService.html#PROPERTY_POST_PARAMETER</api>
815 <default>N/A</default>
816 <scope>Parameter</scope>
817 <since>6.3.1</since>
818 </configProperty>
819
820
821 <!-- net.sf.jasperreports.http.data.header -->
822
823 <configProperty name="net.sf.jasperreports.http.data.header">
824 <description>
825 Property which specifies that the current parameter will contribute a request header value when HTTP data adapters are used.
826 The value of this property indicates the name of the request header to be contributed. In case the property is used, but no value is provided, the name of the request
827 header will be the same as the current report parameter name.
828 Request headers introduced this way override the request headers having the same name which were declared at data adapter level.
829 If multiple parameters try to provide a value for the same request header, the request header will be added multiple times to the request.
830 </description>
831 <api>net/sf/jasperreports/data/http/HttpDataService.html#PROPERTY_HEADER</api>
832 <default>N/A</default>
833 <scope>Parameter</scope>
834 <since>6.3.1</since>
835 </configProperty>
836
837
838 <!-- net.sf.jasperreports.javabean.field.property -->
839
840 <configProperty name="net.sf.jasperreports.javabean.field.property">
841 <description>
842 Property specifying the JavaBean property name for the dataset field in case an JavaBean data source is used.
843 This mapping was previously specified using the <code>fieldDescription</code> attribute, but using this custom property is now recommended.
844 </description>
845 <api>net/sf/jasperreports/engine/data/JRAbstractBeanDataSource.html#PROPERTY_JAVABEAN_FIELD_PROPERTY</api>
846 <default>N/A</default>
847 <scope>Field</scope>
848 <since>6.3.1</since>
849 </configProperty>
850
851
852 <!-- net.sf.jasperreports.json.field.expression -->
853
854 <configProperty name="net.sf.jasperreports.json.field.expression">
855 <description>
856 Property specifying the JSON expression for the dataset field in case an XML data source is used.
857 This mapping was previously specified using the <code>fieldDescription</code> attribute, but using this custom property is now recommended.
858 </description>
859 <api>net/sf/jasperreports/engine/data/JsonDataSource.html#PROPERTY_FIELD_EXPRESSION</api>
860 <default>N/A</default>
861 <scope>Field</scope>
862 <since>6.3.1</since>
652863 </configProperty>
653864
654865
772983 </configProperty>
773984
774985
986 <!-- net.sf.jasperreports.sql.field.column.name -->
987
988 <configProperty name="net.sf.jasperreports.sql.field.column.name">
989 <description>
990 Property specifying the name of the column in the JDBC result set to which the dataset field is mapped to, in case an SQL query is used.
991 </description>
992 <api>net/sf/jasperreports/engine/JRResultSetDataSource.html#PROPERTY_FIELD_COLUMN_NAME</api>
993 <default>N/A</default>
994 <scope>Field</scope>
995 <since>6.3.1</since>
996 </configProperty>
997
998
999 <!-- net.sf.jasperreports.sql.field.column.label -->
1000
1001 <configProperty name="net.sf.jasperreports.sql.field.column.label">
1002 <description>
1003 Property specifying the label of the column in the JDBC result set to which the dataset field is mapped to, in case an SQL query is used.
1004 </description>
1005 <api>net/sf/jasperreports/engine/JRResultSetDataSource.html#PROPERTY_FIELD_COLUMN_LABEL</api>
1006 <default>N/A</default>
1007 <scope>Field</scope>
1008 <since>6.3.1</since>
1009 </configProperty>
1010
1011
1012 <!-- net.sf.jasperreports.sql.field.column.index -->
1013
1014 <configProperty name="net.sf.jasperreports.sql.field.column.index">
1015 <description>
1016 Property specifying the 1-based index of the column in the JDBC result set to which the dataset field is mapped to, in case an SQL query is used.
1017 </description>
1018 <api>net/sf/jasperreports/engine/JRResultSetDataSource.html#PROPERTY_FIELD_COLUMN_INDEX</api>
1019 <default>N/A</default>
1020 <scope>Field</scope>
1021 <since>6.3.1</since>
1022 </configProperty>
1023
1024
1025 <!-- net.sf.jasperreports.xls.column.indexes.{arbitrary_name} -->
1026
1027 <configProperty name="net.sf.jasperreports.xls.column.indexes.{arbitrary_name}">
1028 <description>
1029 Property having this prefix hold the comma separated values of the column indexes to be extracted from the Excel source.
1030 </description>
1031 <api>net/sf/jasperreports/engine/query/AbstractXlsQueryExecuterFactory.html#XLS_COLUMN_INDEXES</api>
1032 <default>N/A</default>
1033 <scope>Global | Dataset</scope>
1034 <since>5.5.2</since>
1035 </configProperty>
1036
1037
1038 <!-- net.sf.jasperreports.xls.column.names.{arbitrary_name} -->
1039
1040 <configProperty name="net.sf.jasperreports.xls.column.names.{arbitrary_name}">
1041 <description>
1042 Property having this prefix hold the comma separated names of the columns to be extracted from the Excel source.
1043 </description>
1044 <api>net/sf/jasperreports/engine/query/AbstractXlsQueryExecuterFactory.html#XLS_COLUMN_NAMES</api>
1045 <default>N/A</default>
1046 <scope>Global | Dataset</scope>
1047 <since>5.5.2</since>
1048 </configProperty>
1049
1050
1051 <!-- net.sf.jasperreports.xls.field.column.name -->
1052
1053 <configProperty name="net.sf.jasperreports.xls.field.column.name">
1054 <description>
1055 Property specifying the name of the column in the Excel data to which the dataset field is mapped to, in case Excel data is used.
1056 </description>
1057 <api>net/sf/jasperreports/engine/data/AbstractXlsDataSource.html#PROPERTY_FIELD_COLUMN_NAME</api>
1058 <default>N/A</default>
1059 <scope>Field</scope>
1060 <since>6.3.1</since>
1061 </configProperty>
1062
1063
1064 <!-- net.sf.jasperreports.xls.field.column.index -->
1065
1066 <configProperty name="net.sf.jasperreports.xls.field.column.index">
1067 <description>
1068 Property specifying the 0-based index of the column in the Excel data to which the dataset field is mapped to, in case Excel data is used.
1069 </description>
1070 <api>net/sf/jasperreports/engine/data/AbstractXlsDataSource.html#PROPERTY_FIELD_COLUMN_INDEX</api>
1071 <default>N/A</default>
1072 <scope>Field</scope>
1073 <since>6.3.1</since>
1074 </configProperty>
1075
1076
1077 <!-- net.sf.jasperreports.xls.date.pattern -->
1078
1079 <configProperty name="net.sf.jasperreports.xls.date.pattern">
1080 <description>
1081 Property holding the value of the date format pattern to be used when parsing the Excel data.
1082 </description>
1083 <api>net/sf/jasperreports/engine/query/AbstractXlsQueryExecuterFactory.html#XLS_DATE_PATTERN</api>
1084 <default>N/A</default>
1085 <scope>Global | Dataset</scope>
1086 <since>5.5.2</since>
1087 </configProperty>
1088
1089
1090 <!-- net.sf.jasperreports.xls.locale.code -->
1091
1092 <configProperty name="net.sf.jasperreports.xls.locale.code">
1093 <description>
1094 String property specifying the code of the locale to be used when parsing the Excel data.
1095 <p/>
1096 The allowed format is: language[_country[_variant]]
1097 </description>
1098 <api>net/sf/jasperreports/engine/query/AbstractXlsQueryExecuterFactory.html#XLS_LOCALE_CODE</api>
1099 <default>N/A</default>
1100 <scope>Global | Dataset</scope>
1101 <since>5.5.2</since>
1102 </configProperty>
1103
1104
1105 <!-- net.sf.jasperreports.xls.number.pattern -->
1106
1107 <configProperty name="net.sf.jasperreports.xls.number.pattern">
1108 <description>
1109 Property holding the value of the number format pattern to be used when parsing the Excel data.
1110 </description>
1111 <api>net/sf/jasperreports/engine/query/AbstractXlsQueryExecuterFactory.html#XLS_NUMBER_PATTERN</api>
1112 <default>N/A</default>
1113 <scope>Global | Dataset</scope>
1114 <since>5.5.2</since>
1115 </configProperty>
1116
1117
1118 <!-- net.sf.jasperreports.xls.source -->
1119
1120 <configProperty name="net.sf.jasperreports.xls.source">
1121 <description>
1122 String property representing a valid path to the requested resource containing the Excel data. It can be:
1123 <ul>
1124 <li>a resource on the classpath</li>
1125 <li>a file from the filesystem, with an absolute or relative path</li>
1126 <li>an url</li>
1127 </ul>
1128 </description>
1129 <api>net/sf/jasperreports/engine/query/AbstractXlsQueryExecuterFactory.html#XLS_SOURCE</api>
1130 <default>N/A</default>
1131 <scope>Global | Dataset</scope>
1132 <since>5.5.2</since>
1133 </configProperty>
1134
1135
1136 <!-- net.sf.jasperreports.xls.timezone.id -->
1137
1138 <configProperty name="net.sf.jasperreports.xls.timezone.id">
1139 <description>
1140 String property specifying value of the time zone id to be used when parsing the Excel data.
1141 </description>
1142 <api>net/sf/jasperreports/engine/query/AbstractXlsQueryExecuterFactory.html#XLS_TIMEZONE_ID</api>
1143 <default>N/A</default>
1144 <scope>Global | Dataset</scope>
1145 <since>5.5.2</since>
1146 </configProperty>
1147
1148
1149 <!-- net.sf.jasperreports.xml.source -->
1150
1151 <configProperty name="net.sf.jasperreports.xml.source">
1152 <description>
1153 String property representing a valid path to the requested resource containing the XML data. It can be:
1154 <ul>
1155 <li>a resource on the classpath</li>
1156 <li>a file from the filesystem, with an absolute or relative path</li>
1157 <li>an url</li>
1158 </ul>
1159 </description>
1160 <api>net/sf/jasperreports/engine/query/JRXPathQueryExecuterFactory.html#XML_SOURCE</api>
1161 <default>N/A</default>
1162 <scope>Global | Dataset</scope>
1163 <since>4.7.1</since>
1164 </configProperty>
1165
1166
7751167 <!-- net.sf.jasperreports.xpath.executer.factory -->
7761168
7771169 <configProperty name="net.sf.jasperreports.xpath.executer.factory">
7881180 </configProperty>
7891181
7901182
1183 <!-- net.sf.jasperreports.xpath.field.expression -->
1184
1185 <configProperty name="net.sf.jasperreports.xpath.field.expression">
1186 <description>
1187 Property specifying the XPath expression for the dataset field in case an XML data source is used.
1188 This mapping was previously specified using the <code>fieldDescription</code> attribute, but using this custom property is now recommended.
1189 </description>
1190 <api>net/sf/jasperreports/engine/data/AbstractXmlDataSource.html#PROPERTY_FIELD_EXPRESSION</api>
1191 <default>N/A</default>
1192 <scope>Field</scope>
1193 <since>6.3.1</since>
1194 </configProperty>
1195
1196
7911197 <!-- net.sf.jasperreports.compiler.{language} -->
7921198
7931199 <configProperty name="net.sf.jasperreports.compiler.{language}">
8671273 parser is used (either a stock one from Apache or one embedded into a
8681274 SUN JDK).
8691275 </description>
870 <api>net/sf/jasperreports/engine/xml/JRReportSaxParserFactory.html#PROPERTY_CACHE_SCHEMAS</api>
1276 <api>net/sf/jasperreports/engine/xml/BaseSaxParserFactory.html#PROPERTY_CACHE_SCHEMAS</api>
8711277 <default>true</default>
8721278 <scope>Global</scope>
8731279 <since>3.1.0</since>
10481454 <li><code>net.sf.jasperreports.style.fill</code></li>
10491455 <li><code>net.sf.jasperreports.style.radius</code></li>
10501456 <li><code>net.sf.jasperreports.style.scaleImage</code></li>
1051 <li><code>net.sf.jasperreports.style.hAlign</code></li>
1052 <li><code>net.sf.jasperreports.style.vAlign</code></li>
1457 <li><code>net.sf.jasperreports.style.hAlign</code> - deprecated since v.6.0.2 - replaced with net.sf.jasperreports.style.hTextAlign or net.sf.jasperreports.style.hImageAlign</li>
1458 <li><code>net.sf.jasperreports.style.vAlign</code> - deprecated since v.6.0.2 - replaced with net.sf.jasperreports.style.vTextAlign or net.sf.jasperreports.style.vImageAlign</li>
10531459 <li><code>net.sf.jasperreports.style.hTextAlign</code></li>
10541460 <li><code>net.sf.jasperreports.style.vTextAlign</code></li>
10551461 <li><code>net.sf.jasperreports.style.hImageAlign</code></li>
10661472 <li><code>net.sf.jasperreports.style.pdfFontName</code></li>
10671473 <li><code>net.sf.jasperreports.style.pdfEncoding</code></li>
10681474 <li><code>net.sf.jasperreports.style.isPdfEmbedded</code></li>
1069 <li><code>net.sf.jasperreports.style.pattern</code> - the value of this property is overriden by the <code>&lt;patternExpression/&gt;</code>, if present.</li>
1475 <li><code>net.sf.jasperreports.style.pattern</code> - the value of this property is overridden by the <code>&lt;patternExpression/&gt;</code>, if present.</li>
10701476 <br/>
10711477 </ul>
10721478 </li>
11921598 Properties having this prefix indicate the JRRenderable implementation to be used when rendering
11931599 a chart element having a rendering type specified in the property suffix.
11941600 </description>
1195 <api>net/sf/jasperreports/engine/JRChart.html#PROPERTY_CHART_RENDER_TYPE</api>
1601 <api>net/sf/jasperreports/charts/util/JRChart.html#PROPERTY_CHART_RENDER_TYPE</api>
11961602 <default>N/A</default>
11971603 <scope>Global</scope>
11981604 <since>2.0.5</since>
12051611 <description>
12061612 Property used to specify the chart theme name.
12071613 </description>
1208 <api>net/sf/jasperreports/engine/JRChart.html#PROPERTY_CHART_THEME</api>
1614 <api>net/sf/jasperreports/engine/ChartRenderableFactory.html#PROPERTY_CHART_RENDERER_FACTORY_PREFIX</api>
12091615 <default>default</default>
12101616 <scope>Global | Report</scope>
12111617 <since>3.1.0</since>
1618 </configProperty>
1619
1620
1621 <!-- net.sf.jasperreports.customizer.class.{arbitrary_name} -->
1622
1623 <configProperty name="net.sf.jasperreports.customizer.class.{arbitrary_name}">
1624 <description>
1625 Properties having this prefix specify the name of a class that implements the <api href="net/sf/jasperreports/engine/JRChartCustomizer.html">JRChartCustomizer</api>
1626 interface and has an empty constructor.
1627 This class will be used to instantiate a chart customizer object that will be then called to customize the chart produced by the element.
1628 The {arbitrary_name} suffix of the property is considered to be the name of the chart customizer instance and in case the chart customizer class
1629 implements the <api href="net/sf/jasperreports/engine/NamedChartCustomizer.html">NamedChartCustomizer</api> interface, this name is passed to it after instantiation
1630 using the setName(String) method.
1631 Named customizer implementations such as the ones extending the <api href="net/sf/jasperreports/engine/JRAbstractChartCustomizer.html">JRAbstractChartCustomizer</api> could
1632 use this name to read custom chart element properties that are supposed to be their own, because they have this name as part of the full custom property name in the form of
1633 net.sf.jasperreports.customizer.{arbitrary_name}.{property_name}.
1634 </description>
1635 <api>net/sf/jasperreports/engine/JRChartCustomizer.html#CUSTOMIZER_CLASS_PROPERTY_PREFIX</api>
1636 <default>N/A</default>
1637 <scope>Chart</scope>
1638 <since>6.3.1</since>
1639 </configProperty>
1640
1641
1642 <!-- net.sf.jasperreports.customizer.{arbitrary_name}.{property_name} -->
1643
1644 <configProperty name="net.sf.jasperreports.customizer.{arbitrary_name}.{property_name}">
1645 <description>
1646 Properties having this form are usually supposed to be read by NamedChartCustomizer instances assigned to a chart element using a custom property in the form of
1647 net.sf.jasperreports.customizer.class.{arbitrary_name}.
1648 </description>
1649 <api>net/sf/jasperreports/engine/NamedChartCustomizer.html</api>
1650 <default>N/A</default>
1651 <scope>Global | Report | Chart</scope>
1652 <since>6.3.1</since>
1653 </configProperty>
1654
1655
1656 <!-- net.sf.jasperreports.consume.space.on.overflow -->
1657
1658 <configProperty name="net.sf.jasperreports.consume.space.on.overflow">
1659 <description>
1660 Property used to force the expanding text fields to occupy all remaining space at the bottom of the page so that no other element renders there.
1661 </description>
1662 <api>net/sf/jasperreports/engine/fill/JRFillTextElement.html#PROPERTY_CONSUME_SPACE_ON_OVERFLOW</api>
1663 <default>true</default>
1664 <scope>Global | Report | Element</scope>
1665 <since>6.3.1</since>
12121666 </configProperty>
12131667
12141668
15542008 </configProperty>
15552009
15562010
2011 <!-- net.sf.jasperreports.when.no.data.type -->
2012
2013 <configProperty name="net.sf.jasperreports.when.no.data.type">
2014 <description>
2015 Property that specifies a default value for the <code>whenNoDataType</code> attribute of report.
2016 </description>
2017 <api>net/sf/jasperreports/engine/JRReport.html#CONFIG_PROPERTY_WHEN_NO_DATA_TYPE</api>
2018 <default>NoPages</default>
2019 <scope>Global | Report</scope>
2020 <since>6.3.1</since>
2021 </configProperty>
2022
2023
15572024 <!-- net.sf.jasperreports.subreport.runner.factory -->
15582025
15592026 <configProperty name="net.sf.jasperreports.subreport.runner.factory">
20192486 <scope>Global | Report | Component | Column</scope>
20202487 <since>4.7.1</since>
20212488 </configProperty>
2489
2490
2491 <!-- net.sf.jasperreports.components.table.floating.header -->
2492
2493 <configProperty name="net.sf.jasperreports.components.table.floating.header">
2494 <description>
2495 Property that enables/disables the floating header in the table component when scrolling.
2496 <br/>
2497 If the interactivity has been disabled by setting <a href="#net.sf.jasperreports.components.table.interactive">net.sf.jasperreports.components.table.interactive</a> to <code>false</code>, then setting this property will have no effect.
2498 </description>
2499 <api>net/sf/jasperreports/components/table/fill/TableReport.html#PROPERTY_FLOATING_HEADER</api>
2500 <default>true</default>
2501 <scope>Global | Report | Component</scope>
2502 <since>6.3.1</since>
2503 </configProperty>
20222504
20232505
20242506 <!-- net.sf.jasperreports.components.table.column.field -->
20922574 <description>
20932575 Property that specifies a default value for the <code>whenNoDataType</code> attribute of table components.
20942576 </description>
2095 <api>net/sf/jasperreports/components/table/TableComponent.html#PROPERTY_WHEN_NO_DATA_TYPE</api>
2577 <api>net/sf/jasperreports/components/table/TableComponent.html#CONFIG_PROPERTY_WHEN_NO_DATA_TYPE</api>
20962578 <default>Blank</default>
20972579 <scope>Global | Report</scope>
20982580 <since>6.0.0</since>
26563138 <br/><br/>
26573139 <b>Note: </b>For accurate results it's recommended that column names in the list to follow the same order as the original columns.
26583140 </description>
2659 <api>net/sf/jasperreports/export/CsvMetadataExporterConfiguration.html#PROPERTY_COLUMN_NAMES_PREFIX</api>
3141 <api>net/sf/jasperreports/export/CsvMetadataReportConfiguration.html#PROPERTY_COLUMN_NAMES_PREFIX</api>
26603142 <default>N/A</default>
26613143 <scope>Report</scope>
26623144 <since>4.0.0</since>
27853267 Its value is used as default for the
27863268 <api href="net/sf/jasperreports/export/CsvMetadataReportConfiguration.html#isWriteHeader()">isWriteHeader()</api> CSV metadata export configuration setting.
27873269 </description>
2788 <api>net/sf/jasperreports/export/CsvMetadataExporterConfiguration.html#PROPERTY_WRITE_HEADER</api>
3270 <api>net/sf/jasperreports/export/CsvMetadataReportConfiguration.html#PROPERTY_WRITE_HEADER</api>
27893271 <default>false</default>
27903272 <scope>Global | Report</scope>
27913273 <since>4.0.0</since>
28143296 <description>
28153297 This flag property specifies whether page margins should be ignored when the report is exported using a grid-based exporter.
28163298 <br/>
2817 Its value is used as default for the <api href="net/sf/jasperreports/export/XlsExporterConfiguration.html#isIgnorePageMargins()">Excel</api>
2818 and <api href="net/sf/jasperreports/export/HtmlExporterConfiguration.html#isIgnorePageMargins()">HTML</api> isIgnorePageMargins() export
3299 Its value is used as default for the <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#isIgnorePageMargins()">Excel</api>
3300 and <api href="net/sf/jasperreports/export/HtmlReportConfiguration.html#isIgnorePageMargins()">HTML</api> isIgnorePageMargins() export
28193301 configuration setting.
28203302 <br/>
28213303 If the property is <code>true</code>, any page in the document will be exported without taking into account its margins.
28223304 </description>
2823 <api>net/sf/jasperreports/export/ExporterConfiguration.html#PROPERTY_IGNORE_PAGE_MARGINS</api>
3305 <api>net/sf/jasperreports/export/ReportExportConfiguration.html#PROPERTY_IGNORE_PAGE_MARGINS</api>
28243306 <default>false</default>
28253307 <scope>Global | Report</scope>
28263308 <since>2.0.5</since>
28383320 <br/>
28393321 If set to <code>false</code>, the frame content will be integrated into the master/page table.
28403322 </description>
2841 <api>net/sf/jasperreports/export/DocxExporterConfiguration.html#PROPERTY_FRAMES_AS_NESTED_TABLES</api>
3323 <api>net/sf/jasperreports/export/DocxReportConfiguration.html#PROPERTY_FRAMES_AS_NESTED_TABLES</api>
28423324 <default>true</default>
28433325 <scope>Global | Report | Element</scope>
28443326 <since>3.5.3</since>
28763358 </configProperty>
28773359
28783360
3361 <!-- net.sf.jasperreports.export.docx.metadata.application -->
3362
3363 <configProperty name="net.sf.jasperreports.export.docx.metadata.application">
3364 <description>
3365 Property that contains the application information to use for the generated DOCX metadata.
3366 <br/>
3367 Its value is used as default for the
3368 <api href="net/sf/jasperreports/export/DocxExporterConfiguration.html#getMetadataApplication()">getMetadataApplication()</api> DOCX export configuration setting.
3369 </description>
3370 <api>net/sf/jasperreports/export/DocxExporterConfiguration.html#PROPERTY_METADATA_APPLICATION</api>
3371 <default>N/A</default>
3372 <scope>Global | Report</scope>
3373 <since>6.3.1</since>
3374 </configProperty>
3375
3376
3377 <!-- net.sf.jasperreports.export.docx.metadata.author -->
3378
3379 <configProperty name="net.sf.jasperreports.export.docx.metadata.author">
3380 <description>
3381 Property that contains the author information to use for the generated DOCX metadata.
3382 <br/>
3383 Its value is used as default for the
3384 <api href="net/sf/jasperreports/export/DocxExporterConfiguration.html#getMetadataAuthor()">getMetadataAutor()</api> DOCX export configuration setting.
3385 </description>
3386 <api>net/sf/jasperreports/export/DocxExporterConfiguration.html#PROPERTY_METADATA_AUTHOR</api>
3387 <default>N/A</default>
3388 <scope>Global | Report</scope>
3389 <since>6.3.1</since>
3390 </configProperty>
3391
3392
3393 <!-- net.sf.jasperreports.export.docx.metadata.keywords -->
3394
3395 <configProperty name="net.sf.jasperreports.export.docx.metadata.keywords">
3396 <description>
3397 Property that contains the keywords to use for the generated DOCX metadata.
3398 <br/>
3399 Its value is used as default for the
3400 <api href="net/sf/jasperreports/export/DocxExporterConfiguration.html#getMetadataKeywords()">getMetadataKeywords()</api> DOCX export configuration setting.
3401 </description>
3402 <api>net/sf/jasperreports/export/DocxExporterConfiguration.html#PROPERTY_METADATA_KEYWORDS</api>
3403 <default>N/A</default>
3404 <scope>Global | Report</scope>
3405 <since>6.3.1</since>
3406 </configProperty>
3407
3408
3409 <!-- net.sf.jasperreports.export.docx.metadata.subject -->
3410
3411 <configProperty name="net.sf.jasperreports.export.docx.metadata.subject">
3412 <description>
3413 Property that contains the subject information to use for the generated DOCX metadata.
3414 <br/>
3415 Its value is used as default for the
3416 <api href="net/sf/jasperreports/export/DocxExporterConfiguration.html#getMetadataSubject()">getMetadataSubject()</api> DOCX export configuration setting.
3417 </description>
3418 <api>net/sf/jasperreports/export/DocxExporterConfiguration.html#PROPERTY_METADATA_SUBJECT</api>
3419 <default>N/A</default>
3420 <scope>Global | Report</scope>
3421 <since>6.3.1</since>
3422 </configProperty>
3423
3424
3425 <!-- net.sf.jasperreports.export.docx.metadata.title -->
3426
3427 <configProperty name="net.sf.jasperreports.export.docx.metadata.title">
3428 <description>
3429 Property that contains the title information to use for the generated DOCX metadata.
3430 <br/>
3431 Its value is used as default for the
3432 <api href="net/sf/jasperreports/export/DocxExporterConfiguration.html#getMetadataTitle()">getMetadataTitle()</api> DOCX export configuration setting.
3433 </description>
3434 <api>net/sf/jasperreports/export/DocxExporterConfiguration.html#PROPERTY_METADATA_TITLE</api>
3435 <default>N/A</default>
3436 <scope>Global | Report</scope>
3437 <since>6.3.1</since>
3438 </configProperty>
3439
3440
28793441 <!-- net.sf.jasperreports.export.docx.new.line.as.paragraph -->
28803442
28813443 <configProperty name="net.sf.jasperreports.export.docx.new.line.as.paragraph">
28873449 <api href="net/sf/jasperreports/export/DocxReportConfiguration.html#isNewLineAsParagraph()">isNewLineAsParagraph()</api> DOCX export configuration setting.
28883450 The property itself defaults to <code>false</code> (for backward compatibility reasons).
28893451 </description>
2890 <api>net/sf/jasperreports/export/DocxExporterConfiguration.html#PROPERTY_NEW_LINE_AS_PARAGRAPH</api>
3452 <api>net/sf/jasperreports/export/DocxReportConfiguration.html#PROPERTY_NEW_LINE_AS_PARAGRAPH</api>
28913453 <default>false</default>
28923454 <scope>Global | Report | Element</scope>
28933455 <since>6.1.1</since>
29163478 Its value is used as default for the
29173479 <api href="net/sf/jasperreports/export/HtmlReportConfiguration.html#isAccessibleHtml()">isAccessibleHtml()</api> HTML export configuration setting.
29183480 </description>
2919 <api>net/sf/jasperreports/export/HtmlExporterConfiguration.html#PROPERTY_ACCESSIBLE</api>
3481 <api>net/sf/jasperreports/export/HtmlReportConfiguration.html#PROPERTY_ACCESSIBLE</api>
29203482 <default>false</default>
29213483 <scope>Global | Report</scope>
29223484 <since>3.7.5</since>
29303492 This property specifies whether <api href="net/sf/jasperreports/engine/JRPrintFrame.html">JRPrintFrame</api> frames are to be exported as nested HTML tables.
29313493 <br/>
29323494 Its value is used as default for the
2933 <api href="net/sf/jasperreports/export/HtmlExporterConfiguration.html#isFramesAsNestedTables()">isFramesAsNestedTables()</api> HTML export configuration setting.
3495 <api href="net/sf/jasperreports/engine/export/JRHtmlReportConfiguration.html#isFramesAsNestedTables()">isFramesAsNestedTables()</api> HTML export configuration setting.
29343496 <br/>
29353497 If set to <code>false</code>, the frame content will be integrated into the master/page HTML table.
29363498 </description>
2937 <api>net/sf/jasperreports/engine/export/JRHtmlExporterConfiguration.html#PROPERTY_FRAMES_AS_NESTED_TABLES</api>
3499 <api>net/sf/jasperreports/engine/export/JRHtmlReportConfiguration.html#PROPERTY_FRAMES_AS_NESTED_TABLES</api>
29383500 <default>true</default>
29393501 <scope>Global | Report | Element</scope>
29403502 <since>2.0.1</since>
30333595 This property specifies whether the SVG graphics should be rasterized as images.
30343596 The property provides a default value for the <api href="net/sf/jasperreports/export/HtmlReportConfiguration.html#isConvertSvgToImage()">isConvertSvgToImage()</api> export setting.
30353597 </description>
3036 <api>net/sf/jasperreports/engine/export/HtmlReportConfiguration.html#PROPERTY_CONVERT_SVG_TO_IMAGE</api>
3598 <api>net/sf/jasperreports/export/HtmlReportConfiguration.html#PROPERTY_CONVERT_SVG_TO_IMAGE</api>
30373599 <default>false</default>
30383600 <scope>Global | Report | Element</scope>
30393601 <since>6.3.0</since>
30473609 This property specifies whether the image should be Base64 encoded and embedded into the src attribute of the image tag, and not referenced as separate resource.
30483610 The property provides a default value for the <api href="net/sf/jasperreports/export/HtmlReportConfiguration.html#isEmbedImage()">isEmbedImage()</api> export setting.
30493611 </description>
3050 <api>net/sf/jasperreports/engine/export/HtmlReportConfiguration.html#PROPERTY_EMBED_IMAGE</api>
3612 <api>net/sf/jasperreports/export/HtmlReportConfiguration.html#PROPERTY_EMBED_IMAGE</api>
30513613 <default>false</default>
30523614 <scope>Global | Report | Element</scope>
30533615 <since>6.2.1</since>
30603622 <description>
30613623 This property specifies whether the HTML embedded SVG should have the font family names replaced with the web fonts coming from font extensions, similar to what we do for text elements.
30623624 </description>
3063 <api>net/sf/jasperreports/engine/export/HtmlReportConfiguration.html#PROPERTY_EMBEDDED_SVG_USE_FONTS</api>
3625 <api>net/sf/jasperreports/export/HtmlReportConfiguration.html#PROPERTY_EMBEDDED_SVG_USE_FONTS</api>
30643626 <default>false</default>
30653627 <scope>Global | Report | Element</scope>
30663628 <since>6.2.2</since>
30913653 Its value is used as default for the
30923654 <api href="net/sf/jasperreports/export/HtmlReportConfiguration.html#isRemoveEmptySpaceBetweenRows()">isRemoveEmptySpaceBetweenRows()</api> HTML export configuration setting.
30933655 </description>
3094 <api>net/sf/jasperreports/export/HtmlExporterConfiguration.html#PROPERTY_REMOVE_EMPTY_SPACE_BETWEEN_ROWS</api>
3656 <api>net/sf/jasperreports/export/HtmlReportConfiguration.html#PROPERTY_REMOVE_EMPTY_SPACE_BETWEEN_ROWS</api>
30953657 <default>false</default>
30963658 <scope>Global | Report</scope>
30973659 <since>2.0.1</since>
31083670 Its value is used as default for the
31093671 <api href="net/sf/jasperreports/export/HtmlReportConfiguration.html#getSizeUnit()">getSizeUnit()</api> HTML export configuration setting.
31103672 </description>
3111 <api>net/sf/jasperreports/export/HtmlExporterConfiguration.html#PROPERTY_SIZE_UNIT</api>
3673 <api>net/sf/jasperreports/export/HtmlReportConfiguration.html#PROPERTY_SIZE_UNIT</api>
31123674 <default>px</default>
31133675 <scope>Global | Report</scope>
31143676 <since>2.0.1</since>
31373699 Its value is used as default for the
31383700 <api href="net/sf/jasperreports/export/HtmlReportConfiguration.html#isWhitePageBackground()">isWhitePageBackground()</api> HTML export configuration setting.
31393701 </description>
3140 <api>net/sf/jasperreports/export/HtmlExporterConfiguration.html#PROPERTY_WHITE_PAGE_BACKGROUND</api>
3702 <api>net/sf/jasperreports/export/HtmlReportConfiguration.html#PROPERTY_WHITE_PAGE_BACKGROUND</api>
31413703 <default>true</default>
31423704 <scope>Global | Report</scope>
31433705 <since>2.0.1</since>
31563718 Note that this CSS property is not currently supported by all browsers. An alternative approach for forcing word breaks in HTML is to save the
31573719 line breaks at fill time via the <a href="#net.sf.jasperreports.text.save.line.breaks">net.sf.jasperreports.text.save.line.breaks</a> property.
31583720 </description>
3159 <api>net/sf/jasperreports/export/HtmlExporterConfiguration.html#PROPERTY_WRAP_BREAK_WORD</api>
3721 <api>net/sf/jasperreports/export/HtmlReportConfiguration.html#PROPERTY_WRAP_BREAK_WORD</api>
31603722 <default>false</default>
31613723 <scope>Global | Report</scope>
31623724 <since>2.0.1</since>
33053867 When set to <code>true</code>, the exporter will assume that the specified pattern is well defined.
33063868 If the pattern is invalid, it won't be taken into account by the Excel file viewer.
33073869 </description>
3308 <api>net/sf/jasperreports/export/JxlExporterConfiguration.html#PROPERTY_COMPLEX_FORMAT</api>
3870 <api>net/sf/jasperreports/export/JxlReportConfiguration.html#PROPERTY_COMPLEX_FORMAT</api>
33093871 <default>false</default>
33103872 <scope>Global | Report | Element</scope>
33113873 <since>3.7.6</since>
33243886 If set to <code>false</code>, the rows in the ODS document do not increase in height automatically and the user has to enlarge them manually. Otherwise,
33253887 the table rows will adjust their height automatically in order to fit their content in.
33263888 </description>
3327 <api>net/sf/jasperreports/export/OdsExporterConfiguration.html#PROPERTY_ODS_FLEXIBLE_ROW_HEIGHT</api>
3889 <api>net/sf/jasperreports/export/OdsReportConfiguration.html#PROPERTY_ODS_FLEXIBLE_ROW_HEIGHT</api>
33283890 <default>false</default>
33293891 <scope>Global | Report</scope>
33303892 <since>5.0.4</since>
33433905 If set to <code>false</code>, the table rows in the ODT document do not increase in height automatically and the user has to enlarge them manually.
33443906 Otherwise, the table rows will adjust their height automatically in order to fit their content in.
33453907 </description>
3346 <api>net/sf/jasperreports/export/OdtExporterConfiguration.html#PROPERTY_ODT_FLEXIBLE_ROW_HEIGHT</api>
3908 <api>net/sf/jasperreports/export/OdtReportConfiguration.html#PROPERTY_ODT_FLEXIBLE_ROW_HEIGHT</api>
33473909 <default>false</default>
33483910 <scope>Global | Report</scope>
33493911 <since>5.0.4</since>
33613923 <br/>
33623924 If the property is <code>true</code>, export parameters override report hints; this is the default behavior.
33633925 </description>
3364 <api>net/sf/jasperreports/export/ExporterConfiguration.html#PROPERTY_EXPORT_PARAMETERS_OVERRIDE_REPORT_HINTS</api>
3926 <api>net/sf/jasperreports/engine/JRExporterParameter.html#PROPERTY_EXPORT_PARAMETERS_OVERRIDE_REPORT_HINTS</api>
33653927 <default>true</default>
33663928 <scope>Global</scope>
33673929 </configProperty>
34694031 Its value is used as default for the
34704032 <api href="net/sf/jasperreports/export/PdfReportConfiguration.html#isForceLineBreakPolicy()">isForceLineBreakPolicy()</api> PDF export configuration setting.
34714033 </description>
3472 <api>net/sf/jasperreports/export/PdfExporterConfiguration.html#PROPERTY_FORCE_LINEBREAK_POLICY</api>
4034 <api>net/sf/jasperreports/export/PdfReportConfiguration.html#PROPERTY_FORCE_LINEBREAK_POLICY</api>
34734035 <default>false</default>
34744036 <scope>Global | Report</scope>
34754037 <since>2.0.1</since>
34884050 Its value is used as default for the
34894051 <api href="net/sf/jasperreports/export/PdfReportConfiguration.html#isForceSvgShapes()">isForceSvgShapes()</api> PDF export configuration setting.
34904052 </description>
3491 <api>net/sf/jasperreports/export/PdfExporterConfiguration.html#PROPERTY_FORCE_SVG_SHAPES</api>
4053 <api>net/sf/jasperreports/export/PdfReportConfiguration.html#PROPERTY_FORCE_SVG_SHAPES</api>
34924054 <default>true</default>
34934055 <scope>Global | Report</scope>
34944056 <since>2.0.1</since>
36584220 <configProperty name="net.sf.jasperreports.export.pdf.permissions.denied">
36594221 <description>
36604222 Property that contains the denied user permissions of the PDF document, if it is encrypted. This property works in conjunction with
3661 the <a href="net.sf.jasperreports.export.pdf.permissions.allowed">net.sf.jasperreports.export.pdf.permissions.allowed</a>. If present, denied permissions
4223 the <a href="#net.sf.jasperreports.export.pdf.permissions.allowed">net.sf.jasperreports.export.pdf.permissions.allowed</a>. If present, denied permissions
36624224 will be excluded from the allowed values. This property may contain one or many permission names enumerated in
36634225 <api href="net/sf/jasperreports/export/type/PdfPermissionsEnum.html">PdfPermissionsEnum</api> class, separated by a pipe (|) sign:
36644226 <ul>
36744236 </ul>
36754237 <br/>
36764238 Its value is used as default for the
3677 <api href="net/sf/jasperreports/export/PdfExporterConfiguration.html#getAllowedPermissionsHint()">getDeniedPermissionsHint()</api> PDF export configuration setting.
4239 <api href="net/sf/jasperreports/export/PdfExporterConfiguration.html#getDeniedPermissions()">getDeniedPermissions()</api> PDF export configuration setting.
36784240 By default there are no user permissions allowed for the document.
36794241 </description>
36804242 <api>net/sf/jasperreports/export/PdfExporterConfiguration.html#PROPERTY_PERMISSIONS_DENIED</api>
36954257 <br/>
36964258 Possible values are <code>default</code> and <code>none</code>.
36974259 </description>
3698 <api>net/sf/jasperreports/export/PdfExporterConfiguration.html#PRINT_SCALING</api>
4260 <api>net/sf/jasperreports/export/PdfExporterConfiguration.html#PROPERTY_PRINT_SCALING</api>
36994261 <default>default</default>
37004262 <scope>Global | Report</scope>
37014263 <since>3.6.1</since>
37734335 Its value is used as default for the
37744336 <api href="net/sf/jasperreports/export/PdfExporterConfiguration.html#isTagged()">isTagged()</api> PDF export configuration setting.
37754337 </description>
3776 <api>net/sf/jasperreports/export/PdfExporterConfiguration.html#PROPERTY_PDF_TAGGED</api>
4338 <api>net/sf/jasperreports/export/PdfExporterConfiguration.html#PROPERTY_TAGGED</api>
37774339 <default>false</default>
37784340 <scope>Global | Report</scope>
37794341 <since>3.1.2</since>
37954357 <since>3.1.2</since>
37964358 </configProperty>
37974359
3798
4360
4361 <!-- net.sf.jasperreports.export.pptx.metadata.application -->
4362
4363 <configProperty name="net.sf.jasperreports.export.pptx.metadata.application">
4364 <description>
4365 Property that contains the application information to use for the generated PPTX metadata.
4366 <br/>
4367 Its value is used as default for the
4368 <api href="net/sf/jasperreports/export/PptxExporterConfiguration.html#getMetadataApplication()">getMetadataApplication()</api> PPTX export configuration setting.
4369 </description>
4370 <api>net/sf/jasperreports/export/PptxExporterConfiguration.html#PROPERTY_METADATA_APPLICATION</api>
4371 <default>N/A</default>
4372 <scope>Global | Report</scope>
4373 <since>6.3.1</since>
4374 </configProperty>
4375
4376
4377 <!-- net.sf.jasperreports.export.pptx.metadata.author -->
4378
4379 <configProperty name="net.sf.jasperreports.export.pptx.metadata.author">
4380 <description>
4381 Property that contains the author information to use for the generated PPTX metadata.
4382 <br/>
4383 Its value is used as default for the
4384 <api href="net/sf/jasperreports/export/PptxExporterConfiguration.html#getMetadataAuthor()">getMetadataAutor()</api> PPTX export configuration setting.
4385 </description>
4386 <api>net/sf/jasperreports/export/PptxExporterConfiguration.html#PROPERTY_METADATA_AUTHOR</api>
4387 <default>N/A</default>
4388 <scope>Global | Report</scope>
4389 <since>6.3.1</since>
4390 </configProperty>
4391
4392
4393 <!-- net.sf.jasperreports.export.pptx.metadata.keywords -->
4394
4395 <configProperty name="net.sf.jasperreports.export.pptx.metadata.keywords">
4396 <description>
4397 Property that contains the keywords to use for the generated PPTX metadata.
4398 <br/>
4399 Its value is used as default for the
4400 <api href="net/sf/jasperreports/export/PptxExporterConfiguration.html#getMetadataKeywords()">getMetadataKeywords()</api> PPTX export configuration setting.
4401 </description>
4402 <api>net/sf/jasperreports/export/PptxExporterConfiguration.html#PROPERTY_METADATA_KEYWORDS</api>
4403 <default>N/A</default>
4404 <scope>Global | Report</scope>
4405 <since>6.3.1</since>
4406 </configProperty>
4407
4408
4409 <!-- net.sf.jasperreports.export.pptx.metadata.subject -->
4410
4411 <configProperty name="net.sf.jasperreports.export.pptx.metadata.subject">
4412 <description>
4413 Property that contains the subject information to use for the generated PPTX metadata.
4414 <br/>
4415 Its value is used as default for the
4416 <api href="net/sf/jasperreports/export/PptxExporterConfiguration.html#getMetadataSubject()">getMetadataSubject()</api> PPTX export configuration setting.
4417 </description>
4418 <api>net/sf/jasperreports/export/PptxExporterConfiguration.html#PROPERTY_METADATA_SUBJECT</api>
4419 <default>N/A</default>
4420 <scope>Global | Report</scope>
4421 <since>6.3.1</since>
4422 </configProperty>
4423
4424
4425 <!-- net.sf.jasperreports.export.pptx.metadata.title -->
4426
4427 <configProperty name="net.sf.jasperreports.export.pptx.metadata.title">
4428 <description>
4429 Property that contains the title information to use for the generated PPTX metadata.
4430 <br/>
4431 Its value is used as default for the
4432 <api href="net/sf/jasperreports/export/PptxExporterConfiguration.html#getMetadataTitle()">getMetadataTitle()</api> PPTX export configuration setting.
4433 </description>
4434 <api>net/sf/jasperreports/export/PptxExporterConfiguration.html#PROPERTY_METADATA_TITLE</api>
4435 <default>N/A</default>
4436 <scope>Global | Report</scope>
4437 <since>6.3.1</since>
4438 </configProperty>
4439
4440
37994441 <!-- net.sf.jasperreports.export.text.character.width -->
38004442
38014443 <configProperty name="net.sf.jasperreports.export.text.character.width">
38054447 Its value is used as default for the
38064448 <api href="net/sf/jasperreports/export/TextReportConfiguration.html#getCharWidth()">getCharWidth()</api> Text export configuration setting.
38074449 </description>
3808 <api>net/sf/jasperreports/export/TextExporterConfiguration.html#PROPERTY_CHARACTER_WIDTH</api>
4450 <api>net/sf/jasperreports/export/TextReportConfiguration.html#PROPERTY_CHARACTER_WIDTH</api>
38094451 <default>N/A</default>
38104452 <scope>Global | Report</scope>
38114453 <since>3.6.1</since>
38374479 Its value is used as default for the
38384480 <api href="net/sf/jasperreports/export/TextReportConfiguration.html#getCharHeight()">getCharHeight()</api> Text export configuration setting.
38394481 </description>
3840 <api>net/sf/jasperreports/export/TextExporterConfiguration.html#PROPERTY_CHARACTER_HEIGHT</api>
4482 <api>net/sf/jasperreports/export/TextReportConfiguration.html#PROPERTY_CHARACTER_HEIGHT</api>
38414483 <default>N/A</default>
38424484 <scope>Global | Report</scope>
38434485 <since>3.6.1</since>
38534495 Its value is used as default for the
38544496 <api href="net/sf/jasperreports/export/TextReportConfiguration.html#getPageWidthInChars()">getPageWidthInChars()</api> Text export configuration setting.
38554497 </description>
3856 <api>net/sf/jasperreports/export/TextExporterConfiguration.html#PROPERTY_PAGE_WIDTH</api>
4498 <api>net/sf/jasperreports/export/TextReportConfiguration.html#PROPERTY_PAGE_WIDTH</api>
38574499 <default>N/A</default>
38584500 <scope>Global | Report</scope>
38594501 <since>3.6.1</since>
38854527 Its value is used as default for the
38864528 <api href="net/sf/jasperreports/export/TextReportConfiguration.html#getPageHeightInChars()">getPageHeightInChars()</api> Text export configuration setting.
38874529 </description>
3888 <api>net/sf/jasperreports/export/TextExporterConfiguration.html#PROPERTY_PAGE_HEIGHT</api>
4530 <api>net/sf/jasperreports/export/TextReportConfiguration.html#PROPERTY_PAGE_HEIGHT</api>
38894531 <default>N/A</default>
38904532 <scope>Global | Report</scope>
38914533 <since>3.6.1</since>
40144656 Its value is used as default for the
40154657 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#isCollapseRowSpan()">isCollapseRowSpan()</api> Excel export configuration setting.
40164658 </description>
4017 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_COLLAPSE_ROW_SPAN</api>
4659 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_COLLAPSE_ROW_SPAN</api>
40184660 <default>false</default>
40194661 <scope>Global | Report</scope>
40204662 <since>2.0.1</since>
40464688 <br/>
40474689 The order of the columns is important and for accurate results they should be in the same order as the original columns.
40484690 </description>
4049 <api>net/sf/jasperreports/export/XlsMetadataExporterConfiguration.html#PROPERTY_COLUMN_NAMES_PREFIX</api>
4691 <api>net/sf/jasperreports/export/XlsMetadataReportConfiguration.html#PROPERTY_COLUMN_NAMES_PREFIX</api>
40504692 <default>N/A</default>
40514693 <scope>Report</scope>
40524694 <since>4.0.2</since>
40634705 one can adjust the current column width by setting this property with an integer value measured in pixels. The JR engine
40644706 will perform the pixel-to-character width mapping using this value instead of the element's <code>width</code> attribute.
40654707 <br/>
4066 If defined, this property will override the <api href="net/sf/jasperreports/engine/export/JRXlsAbstractExporter.html#PROPERTY_COLUMN_WIDTH_RATIO">PROPERTY_COLUMN_WIDTH_RATIO</api>
4708 If defined, this property will override the <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_COLUMN_WIDTH_RATIO">PROPERTY_COLUMN_WIDTH_RATIO</api>
40674709 value for the current column
40684710 </description>
40694711 <api>net/sf/jasperreports/engine/export/JRXlsAbstractExporter.html#PROPERTY_COLUMN_WIDTH</api>
40904732 </ul>
40914733 Global settings are overriden by report level settings and report level settings are overriden by element level settings. If
40924734 present, a <api href="net/sf/jasperreports/engine/export/JRXlsAbstractExporter.html#PROPERTY_COLUMN_WIDTH">PROPERTY_COLUMN_WIDTH</api> property will override the
4093 <api href="net/sf/jasperreports/engine/export/JRXlsAbstractExporter.html#PROPERTY_COLUMN_WIDTH_RATIO">PROPERTY_COLUMN_WIDTH_RATIO</api> value for that column only.
4094 </description>
4095 <api>net/sf/jasperreports/engine/export/JRXlsAbstractExporter.html#PROPERTY_COLUMN_WIDTH_RATIO</api>
4735 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_COLUMN_WIDTH_RATIO">PROPERTY_COLUMN_WIDTH_RATIO</api> value for that column only.
4736 </description>
4737 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_COLUMN_WIDTH_RATIO</api>
40964738 <default>N/A</default>
40974739 <scope>Global | Report | Element</scope>
40984740 <since>4.1.3</since>
41124754 <br/>
41134755 This property has effect only if the enclosing sheet is protected.
41144756 </description>
4115 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_CELL_HIDDEN</api>
4757 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_CELL_HIDDEN</api>
41164758 <default>false</default>
41174759 <scope>Global | Report | Element</scope>
41184760 <since>3.7.5</since>
41304772 <br/>
41314773 By default the property is considered (<code>true</code>), but it only has effect if the enclosing sheet is protected.
41324774 </description>
4133 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_CELL_LOCKED</api>
4775 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_CELL_LOCKED</api>
41344776 <default>true</default>
41354777 <scope>Global | Report | Element</scope>
41364778 <since>3.7.5</since>
41904832 Its value is used as default for the
41914833 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#isDetectCellType()">isDetectCellType()</api> Excel export configuration setting.
41924834 </description>
4193 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_DETECT_CELL_TYPE</api>
4835 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_DETECT_CELL_TYPE</api>
41944836 <default>false</default>
41954837 <scope>Global | Report</scope>
41964838 <since>2.0.1</since>
42184860 <br/>
42194861 See also the <a href="#net.sf.jasperreports.export.xls.fit.width">net.sf.jasperreports.export.xls.fit.width</a> property.
42204862 </description>
4221 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_FIT_HEIGHT</api>
4863 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_FIT_HEIGHT</api>
42224864 <default>N/A</default>
42234865 <scope>Global | Report</scope>
42244866 <since>3.7.5</since>
42474889 <br/>
42484890 See also the <a href="#net.sf.jasperreports.export.xls.fit.height">net.sf.jasperreports.export.xls.fit.height</a> property.
42494891 </description>
4250 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_FIT_WIDTH</api>
4892 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_FIT_WIDTH</api>
42514893 <default>N/A</default>
42524894 <scope>Global | Report</scope>
42534895 <since>3.7.5</since>
42674909 <br/>
42684910 Global settings are overriden by report level settings; report level settings are overriden by element (sheet) level settings.
42694911 </description>
4270 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_FIRST_PAGE_NUMBER</api>
4912 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_FIRST_PAGE_NUMBER</api>
42714913 <default>N/A</default>
42724914 <scope>Global | Report | Element</scope>
42734915 <since>4.6.0</since>
42834925 Its value is used as default for the
42844926 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#isFontSizeFixEnabled()">isFontSizeFixEnabled()</api> Excel export configuration setting.
42854927 </description>
4286 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_FONT_SIZE_FIX_ENABLED</api>
4928 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_FONT_SIZE_FIX_ENABLED</api>
42874929 <default>false</default>
42884930 <scope>Global | Report</scope>
42894931 <since>2.0.1</since>
43224964 If set to <code>true</code>, local anchors will be excluded from export.
43234965 Otherwise they will be exported along with elements they belong to.
43244966 </description>
4325 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_IGNORE_ANCHORS</api>
4967 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_IGNORE_ANCHORS</api>
43264968 <default>false</default>
43274969 <scope>Global | Report</scope>
43284970 <since>4.6.0</since>
43414983 If the property is set at element level, its value will be applied only to the sheet containing that element.
43424984 Other sheets in the document will not be affected.
43434985 </description>
4344 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_IGNORE_CELL_BACKGROUND</api>
4986 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_IGNORE_CELL_BACKGROUND</api>
43454987 <default>false</default>
43464988 <scope>Global | Report | Element (since 6.2.0)</scope>
43474989 <since>3.6.2</since>
43605002 If the property is set at element level, its value will be applied only to the sheet containing that element.
43615003 Other sheets in the document will not be affected.
43625004 </description>
4363 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_IGNORE_CELL_BORDER</api>
5005 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_IGNORE_CELL_BORDER</api>
43645006 <default>false</default>
43655007 <scope>Global | Report | Element (since 6.2.0)</scope>
43665008 <since>2.0.1</since>
43765018 Its value is used as default for the
43775019 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#isIgnoreGraphics()">isIgnoreGraphics()</api> Excel export configuration setting.
43785020 </description>
4379 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_IGNORE_GRAPHICS</api>
5021 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_IGNORE_GRAPHICS</api>
43805022 <default>false</default>
43815023 <scope>Global | Report</scope>
43825024 <since>2.0.1</since>
43985040 Its value is used as default for the
43995041 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#getImageAnchorType()">getImageAnchorType()</api> Excel export configuration setting.
44005042 </description>
4401 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_IMAGE_ANCHOR_TYPE</api>
5043 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_IMAGE_ANCHOR_TYPE</api>
44025044 <default><code>MoveNoSize</code></default>
44035045 <scope>Global | Report | Element</scope>
44045046 <since>5.0.4</since>
44145056 Its value is used as default for the
44155057 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#isImageBorderFixEnabled()">isImageBorderFixEnabled()</api> Excel export configuration setting.
44165058 </description>
4417 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_IMAGE_BORDER_FIX_ENABLED</api>
5059 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_IMAGE_BORDER_FIX_ENABLED</api>
44185060 <default>false</default>
44195061 <scope>Global | Report</scope>
44205062 <since>3.0.0</since>
44305072 Its value is used as default for the
44315073 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#getMaxRowsPerSheet()">getMaxRowsPerSheet()</api> Excel export configuration setting.
44325074 </description>
4433 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_MAXIMUM_ROWS_PER_SHEET</api>
5075 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_MAXIMUM_ROWS_PER_SHEET</api>
44345076 <default>0</default>
44355077 <scope>Global | Report</scope>
44365078 <since>2.0.1</since>
44375079 </configProperty>
44385080
44395081
5082 <!-- net.sf.jasperreports.export.xls.metadata.application -->
5083
5084 <configProperty name="net.sf.jasperreports.export.xls.metadata.application">
5085 <description>
5086 Property that contains the application information to use for the generated XLS metadata.
5087 <br/>
5088 Its value is used as default for the
5089 <api href="net/sf/jasperreports/export/XlsExporterConfiguration.html#getMetadataApplication()">getMetadataApplication()</api> XLS export configuration setting.
5090 </description>
5091 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_METADATA_APPLICATION</api>
5092 <default>N/A</default>
5093 <scope>Global | Report</scope>
5094 <since>6.3.1</since>
5095 </configProperty>
5096
5097
5098 <!-- net.sf.jasperreports.export.xls.metadata.author -->
5099
5100 <configProperty name="net.sf.jasperreports.export.xls.metadata.author">
5101 <description>
5102 Property that contains the author information to use for the generated XLS metadata.
5103 <br/>
5104 Its value is used as default for the
5105 <api href="net/sf/jasperreports/export/XlsExporterConfiguration.html#getMetadataAuthor()">getMetadataAutor()</api> XLS export configuration setting.
5106 </description>
5107 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_METADATA_AUTHOR</api>
5108 <default>N/A</default>
5109 <scope>Global | Report</scope>
5110 <since>6.3.1</since>
5111 </configProperty>
5112
5113
5114 <!-- net.sf.jasperreports.export.xls.metadata.keywords -->
5115
5116 <configProperty name="net.sf.jasperreports.export.xls.metadata.keywords">
5117 <description>
5118 Property that contains the keywords to use for the generated XLS metadata.
5119 <br/>
5120 Its value is used as default for the
5121 <api href="net/sf/jasperreports/export/XlsExporterConfiguration.html#getMetadataKeywords()">getMetadataKeywords()</api> XLS export configuration setting.
5122 </description>
5123 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_METADATA_KEYWORDS</api>
5124 <default>N/A</default>
5125 <scope>Global | Report</scope>
5126 <since>6.3.1</since>
5127 </configProperty>
5128
5129
5130 <!-- net.sf.jasperreports.export.xls.metadata.subject -->
5131
5132 <configProperty name="net.sf.jasperreports.export.xls.metadata.subject">
5133 <description>
5134 Property that contains the subject information to use for the generated XLS metadata.
5135 <br/>
5136 Its value is used as default for the
5137 <api href="net/sf/jasperreports/export/XlsExporterConfiguration.html#getMetadataSubject()">getMetadataSubject()</api> XLS export configuration setting.
5138 </description>
5139 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_METADATA_SUBJECT</api>
5140 <default>N/A</default>
5141 <scope>Global | Report</scope>
5142 <since>6.3.1</since>
5143 </configProperty>
5144
5145
5146 <!-- net.sf.jasperreports.export.xls.metadata.title -->
5147
5148 <configProperty name="net.sf.jasperreports.export.xls.metadata.title">
5149 <description>
5150 Property that contains the title information to use for the generated XLS metadata.
5151 <br/>
5152 Its value is used as default for the
5153 <api href="net/sf/jasperreports/export/XlsExporterConfiguration.html#getMetadataTitle()">getMetadataTitle()</api> XLS export configuration setting.
5154 </description>
5155 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_METADATA_TITLE</api>
5156 <default>N/A</default>
5157 <scope>Global | Report</scope>
5158 <since>6.3.1</since>
5159 </configProperty>
5160
5161
44405162 <!-- net.sf.jasperreports.export.xls.one.page.per.sheet -->
44415163
44425164 <configProperty name="net.sf.jasperreports.export.xls.one.page.per.sheet">
44465168 Its value is used as default for the
44475169 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#isOnePagePerSheet()">isOnePagePerSheet()</api> Excel export configuration setting.
44485170 </description>
4449 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_ONE_PAGE_PER_SHEET</api>
5171 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_ONE_PAGE_PER_SHEET</api>
44505172 <default>false</default>
44515173 <scope>Global | Report</scope>
44525174 <since>2.0.1</since>
44625184 Its value is used as default for the
44635185 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#isRemoveEmptySpaceBetweenColumns()">isRemoveEmptySpaceBetweenColumns()</api> Excel export configuration setting.
44645186 </description>
4465 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS</api>
5187 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS</api>
44665188 <default>false</default>
44675189 <scope>Global | Report</scope>
44685190 <since>2.0.1</since>
44785200 Its value is used as default for the
44795201 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#isRemoveEmptySpaceBetweenRows()">isRemoveEmptySpaceBetweenRows()</api> Excel export configuration setting.
44805202 </description>
4481 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_REMOVE_EMPTY_SPACE_BETWEEN_ROWS</api>
5203 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_REMOVE_EMPTY_SPACE_BETWEEN_ROWS</api>
44825204 <default>false</default>
44835205 <scope>Global | Report</scope>
44845206 <since>2.0.1</since>
45165238 <br/>
45175239 The property only has effect when <code>net.sf.jasperreports.export.xls.detect.cell.type</code> is set.
45185240 </description>
4519 <api>net/sf/jasperreports/engine/export/XlsExporterConfiguration.html#PROPERTY_USE_TIMEZONE</api>
5241 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_USE_TIMEZONE</api>
45205242 <default>false</default>
45215243 <scope>Global | Report | Element</scope>
45225244 <since>4.5.0</since>
45355257 If the property is set at element level, its value will be applied only to the sheet containing that element.
45365258 Other sheets in the document will not be affected.
45375259 </description>
4538 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_WHITE_PAGE_BACKGROUND</api>
5260 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_WHITE_PAGE_BACKGROUND</api>
45395261 <default>true</default>
45405262 <scope>Global | Report | Element (since 6.2.0)</scope>
45415263 <since>2.0.1</since>
46235345 <li><api href="net/sf/jasperreports/engine/export/ooxml/JRXlsxExporter.html">JRXlsxExporter</api></li>
46245346 </ul>
46255347 </description>
4626 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_FREEZE_COLUMN</api>
5348 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_FREEZE_COLUMN</api>
46275349 <default>N/A</default>
46285350 <scope>Global | Report</scope>
46295351 <since>4.1.1</since>
46355357 <configProperty name="net.sf.jasperreports.export.xls.freeze.column.edge">
46365358 <description>
46375359 Property that indicates the vertical edge of the freeze pane, relative to the current cell. If set, it overrides the
4638 <api href="net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_FREEZE_COLUMN">PROPERTY_FREEZE_COLUMN</api> value.
5360 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_FREEZE_COLUMN">PROPERTY_FREEZE_COLUMN</api> value.
46395361 <br/>
46405362 Allowed values are:
46415363 <ul>
46795401 <li><api href="net/sf/jasperreports/engine/export/ooxml/JRXlsxExporter.html">JRXlsxExporter</api></li>
46805402 </ul>
46815403 </description>
4682 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_FREEZE_ROW</api>
5404 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_FREEZE_ROW</api>
46835405 <default>N/A</default>
46845406 <scope>Global | Report</scope>
46855407 <since>4.1.1</since>
46915413 <configProperty name="net.sf.jasperreports.export.xls.freeze.row.edge">
46925414 <description>
46935415 Property that indicates the horizontal edge of the freeze pane, relative to the current cell. If set, it overrides the
4694 <api href="net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_FREEZE_ROW">PROPERTY_FREEZE_ROW</api> value.
5416 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_FREEZE_ROW">PROPERTY_FREEZE_ROW</api> value.
46955417 <br/>
46965418 Allowed values are:
46975419 <ul>
47405462 <br/>
47415463 This property is by default not set (<code>null</code>).
47425464 </description>
4743 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_PAGE_SCALE</api>
5465 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_PAGE_SCALE</api>
47445466 <default>N/A</default>
47455467 <scope>Global | Report | Element</scope>
47465468 <since>4.6.0</since>
47585480 <br/>
47595481 This property is by default not set (<code>null</code>).
47605482 </description>
4761 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_PASSWORD</api>
5483 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_PASSWORD</api>
47625484 <default>N/A</default>
47635485 <scope>Global | Report</scope>
47645486 <since>3.0.1</since>
48625584 Its value is used as default for the
48635585 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#getSheetDirection()">getSheetDirection()</api> Excel export configuration setting.
48645586 </description>
4865 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_SHEET_DIRECTION</api>
5587 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_SHEET_DIRECTION</api>
48665588 <default>LTR</default>
48675589 <scope>Global | Report</scope>
48685590 <since>3.7.5</since>
48785600 Its value is used as default for the
48795601 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#getSheetFooterCenter()">getSheetFooterCenter()</api> Excel export configuration setting.
48805602 </description>
4881 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_SHEET_FOOTER_CENTER</api>
5603 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_SHEET_FOOTER_CENTER</api>
48825604 <default>N/A</default>
48835605 <scope>Global | Report</scope>
48845606 <since>3.7.5</since>
48945616 Its value is used as default for the
48955617 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#getSheetFooterLeft()">getSheetFooterLeft()</api> Excel export configuration setting.
48965618 </description>
4897 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_SHEET_FOOTER_LEFT</api>
5619 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_SHEET_FOOTER_LEFT</api>
48985620 <default>N/A</default>
48995621 <scope>Global | Report</scope>
49005622 <since>3.7.5</since>
49105632 Its value is used as default for the
49115633 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#getSheetFooterRight()">getSheetFooterRight()</api> Excel export configuration setting.
49125634 </description>
4913 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_SHEET_FOOTER_RIGHT</api>
5635 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_SHEET_FOOTER_RIGHT</api>
49145636 <default>N/A</default>
49155637 <scope>Global | Report</scope>
49165638 <since>3.7.5</since>
49265648 Its value is used as default for the
49275649 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#getSheetHeaderCenter()">getSheetHeaderCenter()</api> Excel export configuration setting.
49285650 </description>
4929 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_SHEET_HEADER_CENTER</api>
5651 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_SHEET_HEADER_CENTER</api>
49305652 <default>N/A</default>
49315653 <scope>Global | Report</scope>
49325654 <since>3.7.5</since>
49425664 Its value is used as default for the
49435665 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#getSheetHeaderLeft()">getSheetHeaderLeft()</api> Excel export configuration setting.
49445666 </description>
4945 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_SHEET_HEADER_LEFT</api>
5667 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_SHEET_HEADER_LEFT</api>
49465668 <default>N/A</default>
49475669 <scope>Global | Report</scope>
49485670 <since>3.7.5</since>
49585680 Its value is used as default for the
49595681 <api href="net/sf/jasperreports/export/XlsReportConfiguration.html#getSheetHeaderRight()">getSheetHeaderRight()</api> Excel export configuration setting.
49605682 </description>
4961 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_SHEET_HEADER_RIGHT</api>
5683 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_SHEET_HEADER_RIGHT</api>
49625684 <default>N/A</default>
49635685 <scope>Global | Report</scope>
49645686 <since>3.7.5</since>
50815803 <br/>
50825804 These properties are by default not set.
50835805 </description>
5084 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_SHEET_NAMES_PREFIX</api>
5806 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_SHEET_NAMES_PREFIX</api>
50855807 <default>N/A</default>
50865808 <scope>Report</scope>
50875809 <since>3.5.2</since>
51245846 If multiple elements in a sheet provide this property, the last read value will be considered.
51255847 Global settings are overriden by report level settings; report level settings are overriden by element (sheet) level settings.
51265848 </description>
5127 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_SHOW_GRIDLINES</api>
5849 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_SHOW_GRIDLINES</api>
51285850 <default>true</default>
51295851 <scope>Global | Report | Element</scope>
51305852 <since>4.8.0</since>
51655887 <br/>
51665888 If set to <code>false</code>, text wrapping is forbidden, otherwise it is allowed.
51675889 </description>
5168 <api>net/sf/jasperreports/export/XlsExporterConfiguration.html#PROPERTY_WRAP_TEXT</api>
5890 <api>net/sf/jasperreports/export/XlsReportConfiguration.html#PROPERTY_WRAP_TEXT</api>
51695891 <default>true</default>
51705892 <scope>Global | Report | Element</scope>
51715893 <since>3.7.3</since>
51815903 Its value is used as default for the
51825904 <api href="net/sf/jasperreports/export/XlsMetadataReportConfiguration.html#isWriteHeader()">isWriteHeader()</api> Excel metadata export configuration setting.
51835905 </description>
5184 <api>net/sf/jasperreports/export/XlsMetadataExporterConfiguration.html#PROPERTY_WRITE_HEADER</api>
5906 <api>net/sf/jasperreports/export/XlsMetadataReportConfiguration.html#PROPERTY_WRITE_HEADER</api>
51855907 <default>false</default>
51865908 <scope>Element</scope>
51875909 <since>4.0.2</since>
54576179 the bookmark will be created as a direct descendant of its nearest parent.
54586180 </p>
54596181 </description>
5460 <api>net/sf/jasperreports/export/PdfExporterConfiguration.html#PROPERTY_COLLAPSE_MISSING_BOOKMARK_LEVELS</api>
6182 <api>net/sf/jasperreports/export/PdfReportConfiguration.html#PROPERTY_COLLAPSE_MISSING_BOOKMARK_LEVELS</api>
54616183 <default>false</default>
54626184 <scope>Global | Report</scope>
54636185 <since>3.7.3</since>
55246246 </configProperty>
55256247
55266248
6249 <!-- net.sf.jasperreports.parameter.evaluation.time -->
6250
6251 <configProperty name="net.sf.jasperreports.parameter.evaluation.time">
6252 <description>
6253 Specifies the default value for the <api href="net/sf/jasperreports/engine/JRParameter.html#getEvaluationTime()">getEvaluationTime()</api> property of a dataset parameter.
6254 <br/>
6255 Possible values are defined by the <api href="net/sf/jasperreports/engine/type/ParameterEvaluationTimeType.html">ParameterEvaluationTimeType</api> enumeration.
6256 <ul>
6257 <li><code>Early</code> - Evaluate the parameter default value expression before parameter contributors.</li>
6258 <li><code>Late</code> - Evaluate the parameter default value expression after parameter contributors.</li>
6259 </ul>
6260 </description>
6261 <api>net/sf/jasperreports/engine/type/ParameterEvaluationTimeType.html#PROPERTY_EVALUATION_TIME</api>
6262 <default>Late</default>
6263 <scope>Global | Dataset</scope>
6264 <since>6.3.1</since>
6265 </configProperty>
6266
6267
6268 <!-- net.sf.jasperreports.property.evaluation.time -->
6269
6270 <configProperty name="net.sf.jasperreports.property.evaluation.time">
6271 <description>
6272 Specifies the default value for the <api href="net/sf/jasperreports/engine/DatasetPropertyExpression.html#getEvaluationTime()">getEvaluationTime()</api> setting of a dataset property expression.
6273 <br/>
6274 Possible values are defined by the <api href="net/sf/jasperreports/engine/type/PropertyEvaluationTimeType.html">PropertyEvaluationTimeType</api> enumeration.
6275 <ul>
6276 <li><code>Early</code> - Evaluate the property expression before parameter contributors.</li>
6277 <li><code>Late</code> - Evaluate the property expression after parameter contributors.</li>
6278 <li><code>Late</code> - Evaluate the property expression at the end of the report.</li>
6279 </ul>
6280 </description>
6281 <api>net/sf/jasperreports/engine/type/PropertyEvaluationTimeType.html#PROPERTY_EVALUATION_TIME</api>
6282 <default>Early</default>
6283 <scope>Global | Dataset</scope>
6284 <since>6.3.1</since>
6285 </configProperty>
6286
6287
55276288 <!-- net.sf.jasperreports.default.locale -->
55286289
55296290 <configProperty name="net.sf.jasperreports.default.locale">
56976458 </configProperty>
56986459
56996460
6461 <!-- net.sf.jasperreports.olap.field.mapping -->
6462
6463 <configProperty name="net.sf.jasperreports.olap.field.mapping">
6464 <description>
6465 Property specifying the mapping for the dataset field in case an OLAP data source is used.
6466 This mapping was previously specified using the <code>fieldDescription</code> attribute, but using this custom property is now recommended.
6467 </description>
6468 <api>net/sf/jasperreports/olap/JROlapDataSource.html#PROPERTY_FIELD_MAPPING</api>
6469 <default>N/A</default>
6470 <scope>Field</scope>
6471 <since>6.3.1</since>
6472 </configProperty>
6473
6474
57006475 <!-- net.sf.jasperreports.xml.load.unknown.entities -->
57016476
57026477 <configProperty name="net.sf.jasperreports.xml.load.unknown.entities">
1818 <feature name="alternaterowcolor" sample="scriptlet" title="Alternate Row Colors In The Detail Section"/>
1919 <feature name="charts" sample="charts" title="Charts"/>
2020 <feature name="chartcustomizers" sample="charts" title="Altering Charts (Chart Customizers)"/>
21 <feature name="chartcustomizers" sample="chartcustomizers" title="Multiple Chart Customizers"/>
2122 <feature name="chartthemes" sample="chartthemes" title="Enhancing Charts Look and Feel (Chart Themes)"/>
2223 <feature name="conditionalstyles" sample="jasper" title="Conditional Styles"/>
2324 <feature name="crosstabs" sample="crosstabs" title="Crosstabs"/>
9293 <feature name="hibernate" sample="hibernate" title="Hibernate (HQL) Query Executer"/>
9394 <feature name="mondrian" sample="mondrian" title="Mondrian (MDX) Query Executer" complete="false"/>
9495 <feature name="query" sample="query" title="Parameterized Queries (Dynamic Queries)"/>
96 <feature name="exceldataadapter" sample="exceldataadapter" title="Excel Data Adapter"/>
9597 <feature name="xlsdatasource" sample="xlsdatasource" title="XLS Data Source"/>
9698 <feature name="xmldatasource" sample="xmldatasource" title="XML Data Source"/>
9799 <feature name="xpathqueryexecuter" sample="xmldatasource" title="XPath Query Executer"/>
98100 <feature name="jsondatasource" sample="jsondatasource" title="JSON Data Source"/>
101 <feature name="jsonqldatasource" sample="jsonqldatasource" title="JSONQL Data Source"/>
102 <feature name="httpdataadapter" sample="httpdataadapter" title="HTTP Data Adapters"/>
99103 </content>
100104 </category>
101105
00 <?xml version="1.0" encoding="UTF-8"?>
11
22 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4 xmlns:jr="http://jasperreports.sourceforge.net/jasperreports">
3 >
54
65 <xsl:output method="html"/>
76 <xsl:param name="sf.net"/>
9089 font-weight: bold;
9190 text-decoration: none;
9291 color: inherit;
92 }
93
94 table.doctable {
95 border-collapse: collapse;
96 font-family: Arial, Verdana, Helvetica, sans-serif;
97 font-size: 12px;
98 font-weight: normal;
99 margin: 10px 0;
100 text-align: left;
101 }
102
103 table.doctable th, table.doctable td {
104 border-bottom: 1px solid gray;
105 padding: 5px 10px;
106 }
107
108 table.doctable tr.full_border th, table.doctable tr.full_border td {
109 border: 1px solid gray;
110 }
111
112 table.doctable.alternate_bg tr:nth-child(even), tr.grey_bg {
113 background-color: #f2f2f2;
114 }
115
116 .green {
117 color: green;
118 }
119
120 .red {
121 color: red;
122 }
123
124 .large {
125 font-size: 20px;
126 }
127
128 .maxWidth170 {
129 max-width: 170px;
130 }
131
132 .minWidth300 {
133 min-width: 300px;
93134 }
94135
95136 </style>
471512 <br/>
472513 </xsl:template>
473514
515 <xsl:template match="localAnchor">
516 <xsl:element name="a">
517 <xsl:if test="@name">
518 <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
519 </xsl:if>
520 <xsl:if test="@href">
521 <xsl:attribute name="href">
522 <xsl:value-of select="@href"/>
523 </xsl:attribute>
524 </xsl:if>
525 <xsl:value-of select="."/>
526 </xsl:element>
527 </xsl:template>
528
529 <xsl:template match="sup">
530 <xsl:element name="sup"><xsl:apply-templates/></xsl:element>
531 </xsl:template>
532
533 <xsl:template match="span">
534 <xsl:element name="span">
535 <xsl:if test="@class">
536 <xsl:attribute name="class">
537 <xsl:value-of select="@class"/>
538 </xsl:attribute>
539 </xsl:if>
540 <xsl:apply-templates/>
541 </xsl:element>
542 </xsl:template>
543
544 <xsl:template match="table">
545 <xsl:element name="table">
546 <xsl:if test="@class">
547 <xsl:attribute name="class">
548 <xsl:value-of select="@class"/>
549 </xsl:attribute>
550 </xsl:if>
551 <xsl:apply-templates/>
552 </xsl:element>
553 </xsl:template>
554
555 <xsl:template match="th">
556 <xsl:element name="th">
557 <xsl:if test="@rowspan">
558 <xsl:attribute name="rowspan">
559 <xsl:value-of select="@rowspan"/>
560 </xsl:attribute>
561 </xsl:if>
562 <xsl:if test="@colspan">
563 <xsl:attribute name="colspan">
564 <xsl:value-of select="@colspan"/>
565 </xsl:attribute>
566 </xsl:if>
567 <xsl:apply-templates/>
568 </xsl:element>
569 </xsl:template>
570
571 <xsl:template match="tr">
572 <xsl:element name="tr">
573 <xsl:if test="@class">
574 <xsl:attribute name="class">
575 <xsl:value-of select="@class"/>
576 </xsl:attribute>
577 </xsl:if>
578 <xsl:apply-templates/>
579 </xsl:element>
580 </xsl:template>
581
582 <xsl:template match="td">
583 <xsl:element name="td">
584 <xsl:if test="@class">
585 <xsl:attribute name="class">
586 <xsl:value-of select="@class"/>
587 </xsl:attribute>
588 </xsl:if>
589 <xsl:if test="@rowspan">
590 <xsl:attribute name="rowspan">
591 <xsl:value-of select="@rowspan"/>
592 </xsl:attribute>
593 </xsl:if>
594 <xsl:if test="@colspan">
595 <xsl:attribute name="colspan">
596 <xsl:value-of select="@colspan"/>
597 </xsl:attribute>
598 </xsl:if>
599 <xsl:apply-templates/>
600 </xsl:element>
601 </xsl:template>
474602
475603 </xsl:stylesheet>
1414 <dependency org="com.fasterxml.jackson.core" name="jackson-annotations" rev="2.1.4"/>
1515 <dependency org="com.fasterxml.jackson.core" name="jackson-core" rev="2.1.4"/>
1616 <dependency org="com.fasterxml.jackson.core" name="jackson-databind" rev="2.1.4"/>
17 <dependency org="com.google.zxing" name="core" rev="2.3.0"/>
17 <dependency org="com.google.zxing" name="core" rev="3.2.1"/>
1818 <dependency org="com.lowagie" name="itext" rev="2.1.7.js5"/>
1919 <dependency org="commons-beanutils" name="commons-beanutils" rev="1.9.0"/>
2020 <dependency org="commons-collections" name="commons-collections" rev="3.2.2"/>
22 <resolvers>
33 <chain name="maven">
44 <ibiblio name="ibiblio" m2compatible="true" usepoms="false"/>
5 <ibiblio name="jasperreports" m2compatible="true" usepoms="false" checkmodified="true" changingPattern=".*-SNAPSHOT.*"
6 root="http://jasperreports.sourceforge.net/maven2"/>
75 <ibiblio name="jaspersoft" m2compatible="true" usepoms="false" checkmodified="true" changingPattern=".*-SNAPSHOT.*"
8 root="http://jaspersoft.artifactoryonline.com/jaspersoft/third-party-ce-artifacts/"/>
6 root="http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/"/>
97 </chain>
108 </resolvers>
119 </ivysettings>
22 <modelVersion>4.0.0</modelVersion>
33 <groupId>net.sf.jasperreports</groupId>
44 <artifactId>jasperreports</artifactId>
5 <version>6.3.0</version>
5 <version>6.3.1</version>
66 <packaging>jar</packaging>
77 <name>JasperReports</name>
88 <url>http://jasperreports.sourceforge.net</url>
1515 </license>
1616 </licenses>
1717 <scm>
18 <connection>git://git.code.sf.net/p/jasperreports/code jasperreports-code</connection>
19 <tag>jr-6-3-0</tag>
20 <url>http://sourceforge.net/p/jasperreports/code/ci/master/tree/</url>
18 <connection>scm:git:https://github.com/Jaspersoft/jasperreports.git</connection>
19 <tag>jr-6-3-1</tag>
20 <url>https://github.com/Jaspersoft/jasperreports</url>
2121 </scm>
2222 <properties>
2323 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5252 </developers>
5353 <repositories>
5454 <repository>
55 <id>jasperreports</id>
56 <url>http://jasperreports.sourceforge.net/maven2</url>
57 </repository>
58 <repository>
5955 <id>jaspersoft-third-party</id>
60 <url>http://jaspersoft.artifactoryonline.com/jaspersoft/third-party-ce-artifacts/</url>
56 <url>http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/</url>
6157 </repository>
6258 </repositories>
6359 <build>
10096 <include>**/*.csv</include>
10197 <include>**/*.png</include>
10298 <include>**/*.jpg</include>
99 <include>**/*.json</include>
103100 </includes>
104101 </testResource>
105102 </testResources>
167164 <groupId>org.codehaus.mojo</groupId>
168165 <artifactId>clirr-maven-plugin</artifactId>
169166 <configuration>
170 <comparisonVersion>6.2.2</comparisonVersion>
167 <comparisonVersion>6.3.0</comparisonVersion>
171168 <ignoredDifferencesFile>${basedir}/clirr-ignore.xml</ignoredDifferencesFile>
172169 </configuration>
173170 </plugin>
182179 <snapshotRepository>
183180 <id>jr-ce-snapshots</id>
184181 <name>JasperReports CE Snapshots</name>
185 <url>http://jaspersoft.artifactoryonline.com/jaspersoft/jr-ce-snapshots</url>
182 <url>http://jaspersoft.jfrog.io/jaspersoft/jr-ce-snapshots</url>
186183 </snapshotRepository>
187184 </distributionManagement>
188185 <dependencies>
502499 <dependency>
503500 <groupId>com.google.zxing</groupId>
504501 <artifactId>core</artifactId>
505 <version>2.3.0</version>
502 <version>3.2.1</version>
506503 <scope>compile</scope>
507504 </dependency>
508505 <dependency>
00 Manifest-Version: 1.0
11 Built-By: TIBCO Software Inc.
22 Specification-Title: JasperReports Library
3 Specification-Version: 6.3.0
3 Specification-Version: 6.3.1
44 Specification-Vendor: TIBCO Software Inc.
55 Implementation-Title: net.sf.jasperreports.engine
6 Implementation-Version: 6.3.0
6 Implementation-Version: 6.3.1
77 Implementation-Vendor: TIBCO Software Inc.
88 Bundle-ManifestVersion: 2
99 Bundle-Name: JasperReports Library
10 Bundle-Version: 6.3.0
10 Bundle-Version: 6.3.1
1111 Bundle-Vendor: TIBCO Software Inc.
1212 Bundle-SymbolicName: net.sf.jasperreports.engine
1313 Bundle-ClassPath: .
2626 net.sf.jasperreports.default.spacing.before=0
2727 net.sf.jasperreports.default.spacing.after=0
2828 net.sf.jasperreports.default.tab.stop.width=40
29
30 net.sf.jasperreports.when.no.data.type=NoPages
2931
3032 # Query executer settings
3133 net.sf.jasperreports.query.executer.factory.sql=net.sf.jasperreports.engine.query.JRJdbcQueryExecuterFactory
4951 net.sf.jasperreports.query.executer.factory.XLS=net.sf.jasperreports.engine.query.ExcelQueryExecuterFactory
5052 net.sf.jasperreports.query.executer.factory.xlsx=net.sf.jasperreports.engine.query.ExcelQueryExecuterFactory
5153 net.sf.jasperreports.query.executer.factory.XLSX=net.sf.jasperreports.engine.query.ExcelQueryExecuterFactory
54
55 # Simple JSON query executer
5256 net.sf.jasperreports.query.executer.factory.json=net.sf.jasperreports.engine.query.JsonQueryExecuterFactory
5357 net.sf.jasperreports.query.executer.factory.JSON=net.sf.jasperreports.engine.query.JsonQueryExecuterFactory
58
59 # JSONQL query executer
60 net.sf.jasperreports.query.executer.factory.jsonql=net.sf.jasperreports.engine.query.JsonQLQueryExecuterFactory
61 net.sf.jasperreports.query.executer.factory.JSONQL=net.sf.jasperreports.engine.query.JsonQLQueryExecuterFactory
5462
5563 net.sf.jasperreports.query.executer.factory.olap4j=net.sf.jasperreports.olap.Olap4jQueryExecuterFactory
5664 net.sf.jasperreports.query.executer.factory.OLAP4J=net.sf.jasperreports.olap.Olap4jQueryExecuterFactory
314322 net.sf.jasperreports.legacy.element.stretch.enabled=false
315323
316324 net.sf.jasperreports.template.xml.parser.factory=net.sf.jasperreports.engine.xml.TemplateSaxParserFactory
325
326 net.sf.jasperreports.parameter.evaluation.time=Late
327 net.sf.jasperreports.property.evaluation.time=Early
66 net.sf.jasperreports.extension.registry.factory.sql.clause.functions=net.sf.jasperreports.engine.query.SQLQueryClauseFunctionsExtensions
77 net.sf.jasperreports.extension.registry.factory.date.range.clause.functions=net.sf.jasperreports.types.date.DateRangeQueryClauseExtensions
88
9 #net.sf.jasperreports.extension.registry.factory.parameter.contributor.data.adapter=net.sf.jasperreports.data.DataAdapterParameterContributorExtensionsRegistryFactory
9 net.sf.jasperreports.extension.registry.factory.parameter.contributor.data.adapter=net.sf.jasperreports.data.DataAdapterParameterContributorExtensionsRegistryFactory
1010 net.sf.jasperreports.extension.registry.factory.repository=net.sf.jasperreports.repo.DefaultRepositoryExtensionsRegistryFactory
1111 net.sf.jasperreports.extension.registry.factory.data.adapter.services=net.sf.jasperreports.data.DefaultDataAdapterServiceExtensionsRegistryFactory
1212 #net.sf.jasperreports.extension.registry.factory.sort=net.sf.jasperreports.components.sort.SortParameterContributorExtensionFactory
1717 net.sf.jasperreports.extension.registry.factory.castor.mapping=net.sf.jasperreports.util.CastorMappingExtensionsRegistryFactory
1818 net.sf.jasperreports.extension.castor.mapping.bean=net/sf/jasperreports/data/bean/BeanDataAdapterImpl.xml
1919 net.sf.jasperreports.extension.castor.mapping.csv=net/sf/jasperreports/data/csv/CsvDataAdapterImpl-603.xml
20 net.sf.jasperreports.extension.castor.mapping.csv@6.0.4=net/sf/jasperreports/data/csv/CsvDataAdapterImpl.xml
20 net.sf.jasperreports.extension.castor.mapping.csv@6.0.4=net/sf/jasperreports/data/csv/CsvDataAdapterImpl-610.xml
21 net.sf.jasperreports.extension.castor.mapping.csv@6.1.1=net/sf/jasperreports/data/csv/CsvDataAdapterImpl.xml
2122 net.sf.jasperreports.extension.castor.mapping.ds=net/sf/jasperreports/data/ds/DataSourceDataAdapterImpl.xml
2223 net.sf.jasperreports.extension.castor.mapping.ejbql=net/sf/jasperreports/data/ejbql/EjbqlDataAdapterImpl.xml
2324 net.sf.jasperreports.extension.castor.mapping.excel=net/sf/jasperreports/data/excel/ExcelDataAdapterImpl-603.xml
24 net.sf.jasperreports.extension.castor.mapping.excel@6.0.4=net/sf/jasperreports/data/excel/ExcelDataAdapterImpl.xml
25 net.sf.jasperreports.extension.castor.mapping.excel@6.0.4=net/sf/jasperreports/data/excel/ExcelDataAdapterImpl-610.xml
26 net.sf.jasperreports.extension.castor.mapping.excel@6.1.1=net/sf/jasperreports/data/excel/ExcelDataAdapterImpl.xml
2527 net.sf.jasperreports.extension.castor.mapping.empty=net/sf/jasperreports/data/empty/EmptyDataAdapterImpl.xml
2628 net.sf.jasperreports.extension.castor.mapping.hibernate=net/sf/jasperreports/data/hibernate/HibernateDataAdapterImpl.xml
2729 net.sf.jasperreports.extension.castor.mapping.spring=net/sf/jasperreports/data/hibernate/spring/SpringHibernateDataAdapterImpl.xml
2830 net.sf.jasperreports.extension.castor.mapping.jdbc=net/sf/jasperreports/data/jdbc/JdbcDataAdapterImpl.xml
2931 net.sf.jasperreports.extension.castor.mapping.jndi=net/sf/jasperreports/data/jndi/JndiDataAdapterImpl.xml
3032 net.sf.jasperreports.extension.castor.mapping.json=net/sf/jasperreports/data/json/JsonDataAdapterImpl-603.xml
31 net.sf.jasperreports.extension.castor.mapping.json@6.0.4=net/sf/jasperreports/data/json/JsonDataAdapterImpl.xml
33 net.sf.jasperreports.extension.castor.mapping.json@6.0.4=net/sf/jasperreports/data/json/JsonDataAdapterImpl-630.xml
34 net.sf.jasperreports.extension.castor.mapping.json@6.3.1=net/sf/jasperreports/data/json/JsonDataAdapterImpl.xml
3235 net.sf.jasperreports.extension.castor.mapping.mondrian=net/sf/jasperreports/data/mondrian/MondrianDataAdapterImpl.xml
3336 net.sf.jasperreports.extension.castor.mapping.provider=net/sf/jasperreports/data/provider/DataSourceProviderDataAdapterImpl.xml
3437 net.sf.jasperreports.extension.castor.mapping.qe=net/sf/jasperreports/data/qe/QueryExecuterDataAdapterImpl.xml
3538 net.sf.jasperreports.extension.castor.mapping.xls=net/sf/jasperreports/data/xls/XlsDataAdapterImpl-603.xml
36 net.sf.jasperreports.extension.castor.mapping.xls@6.0.4=net/sf/jasperreports/data/xls/XlsDataAdapterImpl.xml
39 net.sf.jasperreports.extension.castor.mapping.xls@6.0.4=net/sf/jasperreports/data/xls/XlsDataAdapterImpl-610.xml
40 net.sf.jasperreports.extension.castor.mapping.xls@6.1.1=net/sf/jasperreports/data/xls/XlsDataAdapterImpl.xml
3741 net.sf.jasperreports.extension.castor.mapping.xlsx=net/sf/jasperreports/data/xlsx/XlsxDataAdapterImpl-603.xml
38 net.sf.jasperreports.extension.castor.mapping.xlsx@6.0.4=net/sf/jasperreports/data/xlsx/XlsxDataAdapterImpl.xml
42 net.sf.jasperreports.extension.castor.mapping.xlsx@6.0.4=net/sf/jasperreports/data/xlsx/XlsxDataAdapterImpl-610.xml
43 net.sf.jasperreports.extension.castor.mapping.xlsx@6.1.1=net/sf/jasperreports/data/xlsx/XlsxDataAdapterImpl.xml
3944 net.sf.jasperreports.extension.castor.mapping.remote.xml=net/sf/jasperreports/data/xml/RemoteXmlDataAdapterImpl.xml
4045 net.sf.jasperreports.extension.castor.mapping.xml=net/sf/jasperreports/data/xml/XmlDataAdapterImpl-603.xml
4146 net.sf.jasperreports.extension.castor.mapping.xml@6.0.4=net/sf/jasperreports/data/xml/XmlDataAdapterImpl.xml
139139 net.sf.jasperreports.exception.data.olap.field.value.not.retrieved=Unable to get value for OLAP field "{0}" of class {1}.
140140 net.sf.jasperreports.exception.data.olap.incorrect.data.mapping=Incorrect data mapping: the number of positions doesn''t match the number of axes.
141141 net.sf.jasperreports.exception.data.olap.internal.error=Internal error.
142 net.sf.jasperreports.exception.data.olap.missing.field.mapping=Missing field mapping for field "{0}".
142143 net.sf.jasperreports.exception.data.olap.invalid.field.mapping=Invalid field mapping "{0}".
143144 net.sf.jasperreports.exception.data.olap.level.not.found=Could not find level "{0}" on hierarchy #{1} (dimension {2}) on axis #{3}.
144145 net.sf.jasperreports.exception.data.olap.tuple.not.found=No such tuple {0} on axis {1}.
154155 net.sf.jasperreports.exception.data.result.set.metadata.not.retrieved=Unable to retrieve result set metadata.
155156 net.sf.jasperreports.exception.data.result.set.next.record.not.retrieved=Unable to get next record from result set.
156157 net.sf.jasperreports.exception.data.result.set.unknown.column.name=Unknown column name {0} in result set.
158 net.sf.jasperreports.exception.data.result.set.unknown.column.label=Unknown column label {0} in result set.
157159 net.sf.jasperreports.exception.data.sortable.sort.field.not.found=Sort field "{0}" not found in the list of data source fields.
158160 net.sf.jasperreports.exception.data.sorted.field.not.found=Field "{0}" not found in data source.
159161 net.sf.jasperreports.exception.data.source.collection.method.call.error=getFieldValue(...) called on a data source with no records.
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.charts;
24
25 import net.sf.jasperreports.engine.JRChart;
26
27 /**
28 * @author Lucian Chirita (lucianc@users.sourceforge.net)
29 */
30 public interface ChartCopyObjectFactory
31 {
32
33 JRItemLabel copyItemLabel(JRItemLabel itemLabel, JRChart chart);
34
35 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.charts.base;
24
25 import net.sf.jasperreports.charts.ChartCopyObjectFactory;
26 import net.sf.jasperreports.charts.JRItemLabel;
27 import net.sf.jasperreports.engine.JRChart;
28
29 /**
30 * @author Lucian Chirita (lucianc@users.sourceforge.net)
31 */
32 public class ChartCopyBaseObjectFactory implements ChartCopyObjectFactory
33 {
34
35 private static final ChartCopyBaseObjectFactory INSTANCE = new ChartCopyBaseObjectFactory();
36
37 public static ChartCopyBaseObjectFactory instance()
38 {
39 return INSTANCE;
40 }
41
42 @Override
43 public JRItemLabel copyItemLabel(JRItemLabel itemLabel, JRChart chart)
44 {
45 return new JRBaseItemLabel(itemLabel, chart);
46 }
47
48 }
2828
2929 import org.jfree.chart.renderer.category.BarRenderer3D;
3030
31 import net.sf.jasperreports.charts.ChartCopyObjectFactory;
3132 import net.sf.jasperreports.charts.JRBar3DPlot;
3233 import net.sf.jasperreports.charts.JRItemLabel;
3334 import net.sf.jasperreports.engine.JRChart;
8788 */
8889 public JRBaseBar3DPlot(JRChartPlot plot, JRChart chart)
8990 {
91 this(plot, chart, ChartCopyBaseObjectFactory.instance());
92 }
93
94 protected JRBaseBar3DPlot(JRChartPlot plot, JRChart chart, ChartCopyObjectFactory copyObjectFactory)
95 {
9096 super(plot, chart);
9197
9298 JRBar3DPlot barPlot = plot instanceof JRBar3DPlot ? (JRBar3DPlot)plot : null;
9399 if (barPlot == null)
94100 {
95 itemLabel = new JRBaseItemLabel(null, chart);
101 itemLabel = copyObjectFactory.copyItemLabel(null, chart);
96102 }
97103 else
98104 {
100106 categoryAxisTickLabelFont = getCategoryAxisTickLabelFont();
101107 valueAxisLabelFont = barPlot.getValueAxisLabelFont();
102108 valueAxisTickLabelFont = barPlot.getValueAxisTickLabelFont();
103 itemLabel = new JRBaseItemLabel(barPlot.getItemLabel(), chart);
109 itemLabel = copyObjectFactory.copyItemLabel(barPlot.getItemLabel(), chart);
104110 }
105111 }
106112
2626 import java.io.IOException;
2727 import java.io.ObjectInputStream;
2828
29 import net.sf.jasperreports.charts.ChartCopyObjectFactory;
2930 import net.sf.jasperreports.charts.JRBarPlot;
3031 import net.sf.jasperreports.charts.JRItemLabel;
3132 import net.sf.jasperreports.engine.JRChart;
9192 */
9293 public JRBaseBarPlot(JRChartPlot plot, JRChart chart)
9394 {
95 this(plot, chart, ChartCopyBaseObjectFactory.instance());
96 }
97
98 protected JRBaseBarPlot(JRChartPlot plot, JRChart chart, ChartCopyObjectFactory copyObjectFactory)
99 {
94100 super(plot, chart);
95101
96102 JRBarPlot barPlot = plot instanceof JRBarPlot ? (JRBarPlot)plot : null;
97103 if (barPlot == null)
98104 {
99 itemLabel = new JRBaseItemLabel(null, chart);
105 itemLabel = copyObjectFactory.copyItemLabel(null, chart);
100106 }
101107 else
102108 {
104110 categoryAxisTickLabelFont = barPlot.getCategoryAxisTickLabelFont();
105111 valueAxisLabelFont = barPlot.getValueAxisLabelFont();
106112 valueAxisTickLabelFont = barPlot.getValueAxisTickLabelFont();
107 itemLabel = new JRBaseItemLabel(barPlot.getItemLabel(), chart);
113 itemLabel = copyObjectFactory.copyItemLabel(barPlot.getItemLabel(), chart);
108114 }
109115 }
110116
2525 import java.io.IOException;
2626 import java.io.ObjectInputStream;
2727
28 import net.sf.jasperreports.charts.ChartCopyObjectFactory;
2829 import net.sf.jasperreports.charts.JRItemLabel;
2930 import net.sf.jasperreports.charts.JRPie3DPlot;
3031 import net.sf.jasperreports.engine.JRChart;
6970 */
7071 public JRBasePie3DPlot(JRChartPlot chartPlot, JRChart chart)
7172 {
73 this(chartPlot, chart, ChartCopyBaseObjectFactory.instance());
74 }
75
76 protected JRBasePie3DPlot(JRChartPlot chartPlot, JRChart chart, ChartCopyObjectFactory copyObjectFactory)
77 {
7278 super(chartPlot, chart);
7379
7480 JRPie3DPlot pie3DPlot = chartPlot instanceof JRPie3DPlot ? (JRPie3DPlot)chartPlot : null;
7581
7682 if (pie3DPlot == null)
7783 {
78 itemLabel = new JRBaseItemLabel(null, chart);
84 itemLabel = copyObjectFactory.copyItemLabel(null, chart);
7985 }
8086 else
8187 {
82 itemLabel = new JRBaseItemLabel(pie3DPlot.getItemLabel(), chart);
88 itemLabel = copyObjectFactory.copyItemLabel(pie3DPlot.getItemLabel(), chart);
8389 }
8490 }
8591
2525 import java.io.IOException;
2626 import java.io.ObjectInputStream;
2727
28 import net.sf.jasperreports.charts.ChartCopyObjectFactory;
2829 import net.sf.jasperreports.charts.JRItemLabel;
2930 import net.sf.jasperreports.charts.JRPiePlot;
3031 import net.sf.jasperreports.engine.JRChart;
6667 */
6768 public JRBasePiePlot(JRChartPlot chartPlot, JRChart chart)
6869 {
70 this(chartPlot, chart, ChartCopyBaseObjectFactory.instance());
71 }
72
73 protected JRBasePiePlot(JRChartPlot chartPlot, JRChart chart, ChartCopyObjectFactory copyObjectFactory)
74 {
6975 super(chartPlot, chart);
7076
7177 JRPiePlot piePlot = chartPlot instanceof JRPiePlot ? (JRPiePlot)chartPlot : null;
7278
7379 if (piePlot == null)
7480 {
75 itemLabel = new JRBaseItemLabel(null, chart);
81 itemLabel = copyObjectFactory.copyItemLabel(null, chart);
7682 }
7783 else
7884 {
79 itemLabel = new JRBaseItemLabel(piePlot.getItemLabel(), chart);
85 itemLabel = copyObjectFactory.copyItemLabel(piePlot.getItemLabel(), chart);
8086 }
8187 }
8288
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.charts.design;
24
25 import net.sf.jasperreports.charts.ChartCopyObjectFactory;
26 import net.sf.jasperreports.charts.JRItemLabel;
27 import net.sf.jasperreports.engine.JRChart;
28
29 /**
30 * @author Lucian Chirita (lucianc@users.sourceforge.net)
31 */
32 public class ChartCopyDesignObjectFactory implements ChartCopyObjectFactory
33 {
34
35 private static final ChartCopyDesignObjectFactory INSTANCE = new ChartCopyDesignObjectFactory();
36
37 public static ChartCopyDesignObjectFactory instance()
38 {
39 return INSTANCE;
40 }
41
42 @Override
43 public JRItemLabel copyItemLabel(JRItemLabel itemLabel, JRChart chart)
44 {
45 return new JRDesignItemLabel(itemLabel, chart);
46 }
47
48 }
7676 */
7777 public JRDesignBar3DPlot(JRChartPlot plot, JRChart chart)
7878 {
79 super(plot, chart);
79 super(plot, chart, ChartCopyDesignObjectFactory.instance());
8080 }
8181
8282 @Override
8181 */
8282 public JRDesignBarPlot(JRChartPlot plot, JRChart chart)
8383 {
84 super(plot, chart);
84 super(plot, chart, ChartCopyDesignObjectFactory.instance());
8585 }
8686
8787
4747 */
4848 public JRDesignPie3DPlot(JRChartPlot pie3DPlot, JRChart chart)
4949 {
50 super(pie3DPlot, chart);
50 super(pie3DPlot, chart, ChartCopyDesignObjectFactory.instance());
5151 }
5252 }
4747 */
4848 public JRDesignPiePlot(JRChartPlot piePlot, JRChart chart)
4949 {
50 super(piePlot, chart);
50 super(piePlot, chart, ChartCopyDesignObjectFactory.instance());
5151 }
5252 }
3939
4040 /**
4141 * @author Teodor Danciu (teodord@users.sourceforge.net)
42 * @deprecated To be removed.
4243 */
4344 public class JRBshCompiler extends JRAbstractCompiler
4445 {
4545 *
4646 * @author Teodor Danciu (teodord@users.sourceforge.net)
4747 * @see JRBshCompiler
48 * @deprecated To be removed.
4849 */
4950 public class JRBshEvaluator extends JREvaluator
5051 {
4646
4747 /**
4848 * @author Teodor Danciu (teodord@users.sourceforge.net)
49 * @deprecated To be removed.
4950 */
5051 public class JRBshGenerator
5152 {
8484 }
8585 else if (!verifier.getReportDesign().getGroupsMap().containsKey(evaluationGroup))
8686 {
87 verifier.addBrokenRule("Barcode evalution group \""
87 verifier.addBrokenRule("Barcode evaluation group \""
8888 + evaluationGroup + " not found", barcode);
8989 }
9090 }
6666 }
6767 else if (!verifier.getReportDesign().getGroupsMap().containsKey(evaluationGroup))
6868 {
69 verifier.addBrokenRule("Barcode evalution group \""
69 verifier.addBrokenRule("Barcode evaluation group \""
7070 + evaluationGroup + " not found", barcode);
7171 }
7272 }
4646 public static final String PROPERTY_TABLE_NAME = JRPropertiesUtil.PROPERTY_PREFIX + "export.headertoolbar.table.name";
4747 public static final String PROPERTY_COLUMN_UUID = JRPropertiesUtil.PROPERTY_PREFIX + "export.headertoolbar.columnUUID";
4848 public static final String PROPERTY_CELL_ID = JRPropertiesUtil.PROPERTY_PREFIX + "export.headertoolbar.cellID";
49
50 public static final String PROPERTY_FLOATING_HEADER = JRPropertiesUtil.PROPERTY_PREFIX + "export.table.floating.header";
4951 /**
5052 * @deprecated To be removed.
5153 */
140140 public static void copyOwnTextElementStyle(EditTextElementData textElementData, JRDesignTextElement textElement, Locale locale) {
141141 textElementData.setFontName(textElement.getOwnFontName());
142142 textElementData.setFontSize(textElement.getOwnFontsize() != null ? NumberFormat.getNumberInstance(locale).format(textElement.getOwnFontsize()) : null);
143 textElementData.setFloatFontSize(textElement.getOwnFontsize() != null ? textElement.getOwnFontsize() : null);
143144 textElementData.setFontBold(textElement.isOwnBold());
144145 textElementData.setFontItalic(textElement.isOwnItalic());
145146 textElementData.setFontUnderline(textElement.isOwnUnderline());
156157 public static void copyTextElementStyle(EditTextElementData textElementData, JRDesignTextElement textElement, Locale locale) {
157158 textElementData.setFontName(JRStringUtil.htmlEncode(textElement.getFontName()));
158159 textElementData.setFontSize(NumberFormat.getNumberInstance(locale).format(textElement.getFontsize()));
160 textElementData.setFloatFontSize(textElement.getFontsize());
159161 textElementData.setFontBold(textElement.isBold());
160162 textElementData.setFontItalic(textElement.isItalic());
161163 textElementData.setFontUnderline(textElement.isUnderline());
3131 import net.sf.jasperreports.engine.DatasetFilter;
3232 import net.sf.jasperreports.engine.JRException;
3333 import net.sf.jasperreports.engine.JRParameter;
34 import net.sf.jasperreports.engine.JRPropertiesUtil;
3435 import net.sf.jasperreports.engine.ParameterContributor;
3536 import net.sf.jasperreports.engine.ParameterContributorContext;
3637 import net.sf.jasperreports.engine.ReportContext;
5657 ReportContext reportContext = (ReportContext) parameterValues.get(JRParameter.REPORT_CONTEXT);
5758 if (reportContext != null)
5859 {
59 String serializedFilters = context.getDataset().getPropertiesMap().getProperty(FilterCommand.DATASET_FILTER_PROPERTY);
60 String serializedFilters = JRPropertiesUtil.getOwnProperty(context.getDataset(), FilterCommand.DATASET_FILTER_PROPERTY);
6061
6162 if (serializedFilters != null)
6263 {
100100 }
101101
102102 textElement.setFontName(textElementData.getFontName());
103 textElement.setFontSize(textElementData.getFontSize() != null ? textElementData.getFloatFontSize() : null);
103 textElement.setFontSize(textElementData.getFloatFontSize());
104104 textElement.setBold(textElementData.getFontBold());
105105 textElement.setItalic(textElementData.getFontItalic());
106106 textElement.setUnderline(textElementData.getFontUnderline());
243243 contextMap.put("allColumnGroupsData", JacksonUtil.getInstance(jrContext).getJsonString(columnGroupsData));
244244 contextMap.put("tableName", element.getPropertiesMap().getProperty(HeaderToolbarElement.PROPERTY_TABLE_NAME));
245245
246 // floating header
247 contextMap.put("hasFloatingHeader", Boolean.parseBoolean(element.getPropertiesMap().getProperty(HeaderToolbarElement.PROPERTY_FLOATING_HEADER)));
248
246249 // patterns
247250 contextMap.put("numericPatterns", JacksonUtil.getInstance(jrContext).getJsonString(getNumberPatterns(numberPatternsMap)));
248251 contextMap.put("datePatterns", JacksonUtil.getInstance(jrContext).getJsonString(getDatePatterns(datePatterns, locale)));
55 "module": "jive.table",
66 "uimodule": "jive.interactive.column",
77 "allColumnsData": ${allColumnNames},
8 "allColumnGroupsData": ${allColumnGroupsData}
8 "allColumnGroupsData": ${allColumnGroupsData},
9 "hasFloatingHeader": ${hasFloatingHeader}
910 #if (!${templateAlreadyLoaded})
1011 , "genericProperties": {
1112 "fontSizes": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],
13401340 if(!it.initialized) {
13411341 it.isDashboard = $('body').is('.dashboardViewFrame');
13421342 /*
1343 Scrolable table headers
1343 Scrolable table headers
1344
1345 If there is a table that does not have floating header then floating headers for all tables
1346 should be disabled
13441347 */
1345 if(it.isDashboard || $('div#reportViewFrame').length > 0) {
1348 var hasFloatingHeader = true;
1349 $.each(report.components.table, function(index, table) {
1350 if (!table.config.hasFloatingHeader) {
1351 hasFloatingHeader = false;
1352 return false; // break each
1353 }
1354 });
1355
1356 if(hasFloatingHeader && (it.isDashboard || $('div#reportViewFrame').length > 0)) {
13461357 it.setScrollableHeader(it.isDashboard);
13471358 }
13481359
15171528 }
15181529 },
15191530 showVisualElements: function(dim) {
1531 // hide already visible menus, if any
1532 jive.ui.foobar.dropMenu && jive.ui.foobar.dropMenu.jo.hide();
1533 jive.ui.foobar.menus.column && jive.ui.foobar.menus.column.showColumns && jive.ui.foobar.menus.column.showColumns.jo.hide();
1534
15201535 jive.ui.overlay.show(dim);
15211536 jive.ui.marker.show(dim);
15221537 jive.ui.foobar.show(dim);
1523 jive.ui.foobar.dropMenu && jive.ui.foobar.dropMenu.jo.hide();
15241538 }
15251539 }
15261540
671671 iconAvailableHeight,
672672 fillContext.getFillContainerContext().isCurrentOverflow()
673673 );
674 iconsVisible = iconTextField.getPrintElementHeight() <= iconAvailableHeight;
674 iconsVisible = iconTextField.getStretchHeight() <= iconAvailableHeight;
675 //iconsVisible = iconTextField.getPrintElementHeight() <= iconAvailableHeight;
675676 }
676677 catch (JRException e)
677678 {
2424
2525 import java.sql.Connection;
2626 import java.util.Map;
27
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
2730
2831 import net.sf.jasperreports.data.cache.DataCacheHandler;
2932 import net.sf.jasperreports.engine.JRDataSource;
4245 import net.sf.jasperreports.engine.fill.JRFillSubreport;
4346 import net.sf.jasperreports.engine.util.JRReportUtils;
4447
45 import org.apache.commons.logging.Log;
46 import org.apache.commons.logging.LogFactory;
47
4848 /**
4949 * Used to iterate on the list subdataset at fill time.
5050 *
159159 copyConnectionParameter(parameterValues);
160160 dataset.initCalculator();
161161 dataset.setParameterValues(parameterValues);
162
162 dataset.evaluateFieldProperties();
163163 dataset.initDatasource();
164164
165165 dataset.start();
148148 }
149149 else if (!verifier.getReportDesign().getGroupsMap().containsKey(evaluationGroup))
150150 {
151 verifier.addBrokenRule("Map evalution group \""
151 verifier.addBrokenRule("Map evaluation group \""
152152 + evaluationGroup + " not found", map);
153153 }
154154 }
226226 {
227227 printImage.setRenderer(getRenderable());
228228 printImage.setAnchorName(getAnchorName());
229 if (getChartSettings().getHyperlinkWhenExpression() == null || hyperlinkWhen == Boolean.TRUE)
229 if (getChartSettings().getHyperlinkWhenExpression() == null || Boolean.TRUE.equals(hyperlinkWhen))
230230 {
231231 printImage.setHyperlinkReference(getHyperlinkReference());
232232 printImage.setHyperlinkAnchor(getHyperlinkAnchor());
3939 /**
4040 * Property that specifies a default value for the <code>whenNoDataType</code> attribute of table components.
4141 */
42 public static final String PROPERTY_WHEN_NO_DATA_TYPE = JRPropertiesUtil.PROPERTY_PREFIX + "components.table.when.no.data.type";
42 public static final String CONFIG_PROPERTY_WHEN_NO_DATA_TYPE = JRPropertiesUtil.PROPERTY_PREFIX + "components.table.when.no.data.type";
43
44 /**
45 * @deprecated Replaced by {@link #CONFIG_PROPERTY_WHEN_NO_DATA_TYPE}.
46 */
47 public static final String PROPERTY_WHEN_NO_DATA_TYPE = CONFIG_PROPERTY_WHEN_NO_DATA_TYPE;
4348
4449 JRDatasetRun getDatasetRun();
4550
4949 import net.sf.jasperreports.components.table.util.TableUtil;
5050 import net.sf.jasperreports.engine.CompositeDatasetFilter;
5151 import net.sf.jasperreports.engine.DatasetFilter;
52 import net.sf.jasperreports.engine.DatasetPropertyExpression;
5253 import net.sf.jasperreports.engine.JRBand;
5354 import net.sf.jasperreports.engine.JRChild;
5455 import net.sf.jasperreports.engine.JRComponentElement;
102103 import net.sf.jasperreports.engine.type.BandTypeEnum;
103104 import net.sf.jasperreports.engine.type.ModeEnum;
104105 import net.sf.jasperreports.engine.type.OrientationEnum;
106 import net.sf.jasperreports.engine.type.PositionTypeEnum;
105107 import net.sf.jasperreports.engine.type.PrintOrderEnum;
106108 import net.sf.jasperreports.engine.type.RunDirectionEnum;
107109 import net.sf.jasperreports.engine.type.SectionTypeEnum;
141143 /**
142144 * Global property that specifies the character to be used on the column header when the tables's column has a filtered applied
143145 */
144 private static final String PROPERTY_FILTER_CHAR = JRPropertiesUtil.PROPERTY_PREFIX + "components.filter.char";
146 public static final String PROPERTY_FILTER_CHAR = JRPropertiesUtil.PROPERTY_PREFIX + "components.filter.char";
145147
146148 /**
147149 * Global property that specifies the font to be used for the icons on the column header
166168 public static final String PROPERTY_INTERACTIVE_TABLE = JRPropertiesUtil.PROPERTY_PREFIX + "components.table.interactive";
167169
168170 /**
171 * Property that enables/disables the floating header in the table component when scrolling.
172 * If the interactivity has been disabled by setting {@link #PROPERTY_INTERACTIVE_TABLE} to <code>false</code>, then
173 * setting this property will have no effect.
174 *
175 * <p>
176 * It can be set:
177 * <ul>
178 * <li>globally</li>
179 * <li>at report level</li>
180 * <li>at component level</li>
181 * </ul>
182 * </p>
183 *
184 * <p>
185 * The default global value of this property is <code>true</code>
186 * </p>
187 */
188 public static final String PROPERTY_FLOATING_HEADER = JRPropertiesUtil.PROPERTY_PREFIX + "components.table.floating.header";
189
190 /**
169191 * Property that enables/disables the automatic addition of specific custom properties to table cell elements,
170192 * that would in turn trigger the creation of special document accessibility tags during PDF export
171193 *
246268
247269 private final JRPropertiesUtil propertiesUtil;
248270 private boolean isInteractiveTable;
271 private boolean hasFloatingHeader;
249272 private boolean isGeneratePdfTags;
250273 private Map<Column, Pair<Boolean, String>> columnInteractivityMapping;
251274
291314
292315 if (interactiveColumnCount > 0) {
293316 this.isInteractiveTable = true;
317 this.hasFloatingHeader = propertiesUtil.getBooleanProperty(PROPERTY_FLOATING_HEADER, true, fillContext.getComponentElement(), this.parentReport);
294318 }
295319 // end: table interactivity
296320
931955 // setting component name on first column
932956 String tableName = propertiesUtil.getProperty(JRComponentElement.PROPERTY_COMPONENT_NAME, fillContext.getComponentElement());
933957 genericElement.getPropertiesMap().setProperty(HeaderToolbarElement.PROPERTY_TABLE_NAME, tableName);
958
959 // set the hasFloatingHeader property on first column
960 genericElement.getPropertiesMap().setProperty(HeaderToolbarElement.PROPERTY_FLOATING_HEADER, String.valueOf(hasFloatingHeader));
934961 }
935962
936963 genericElement.getPropertiesMap().setProperty(HeaderToolbarElement.PROPERTY_COLUMN_UUID, columnUuid);
15991626 frame.setY(y);
16001627 frame.setWidth(width);
16011628 frame.setHeight(cell.getHeight());
1629 frame.setPositionType(PositionTypeEnum.FLOAT);
16021630 frame.setStretchType(StretchTypeEnum.ELEMENT_GROUP_HEIGHT);
16031631
16041632 frame.setStyle(cell.getStyle());
20382066 WhenNoDataTypeTableEnum.getByName(
20392067 propertiesUtil.getProperty(
20402068 fillContext.getFillDataset(),
2041 TableComponent.PROPERTY_WHEN_NO_DATA_TYPE
2069 TableComponent.CONFIG_PROPERTY_WHEN_NO_DATA_TYPE
20422070 )
20432071 );
20442072 }
21522180 public boolean hasProperties()
21532181 {
21542182 return mainDataset.hasProperties();
2183 }
2184
2185 @Override
2186 public DatasetPropertyExpression[] getPropertyExpressions()
2187 {
2188 return mainDataset.getPropertyExpressions();
21552189 }
21562190
21572191 @Override
2727 import java.util.List;
2828 import java.util.UUID;
2929
30 import net.sf.jasperreports.engine.DatasetPropertyExpression;
3031 import net.sf.jasperreports.engine.JRAbstractScriptlet;
3132 import net.sf.jasperreports.engine.JRDataset;
3233 import net.sf.jasperreports.engine.JRExpression;
217218 {
218219 return properties.hasProperties();
219220 }
221
222 @Override
223 public DatasetPropertyExpression[] getPropertyExpressions()
224 {
225 return tableSubdataset.getPropertyExpressions();
226 }
220227
221228 @Override
222229 public Object clone()
8383 ic.floatingRowHeader = null;
8484 ic.floatingCrossHeader = null;
8585
86 ic.isFloatingColumnHeader = ic.isFloatingRowHeader = ic.isFloatingCrossHeader = null;
87
8688 // hide column selection if visible
8789 ic.active && ic.hide();
8890 });
2929 import java.util.List;
3030
3131 import net.sf.jasperreports.engine.JasperReportsContext;
32 import net.sf.jasperreports.engine.ParameterContributorContext;
3233 import net.sf.jasperreports.engine.util.CompositeClassloader;
3334
3435 /**
3738 public abstract class AbstractClasspathAwareDataAdapterService extends AbstractDataAdapterService
3839 {
3940 public static final String CURRENT_CLASS_LOADER = "CURRENT_CLASS_LOADER";
41
4042 /**
4143 *
44 */
45 public AbstractClasspathAwareDataAdapterService(ParameterContributorContext paramContribContext, ClasspathAwareDataAdapter dataAdapter)
46 {
47 super(paramContribContext, dataAdapter);
48 }
49
50 /**
51 * @deprecated Replaced by {@link #AbstractClasspathAwareDataAdapterService(ParameterContributorContext, ClasspathAwareDataAdapter)}.
4252 */
4353 public AbstractClasspathAwareDataAdapterService(JasperReportsContext jasperReportsContext, ClasspathAwareDataAdapter dataAdapter)
4454 {
2727
2828 import net.sf.jasperreports.engine.JRException;
2929 import net.sf.jasperreports.engine.JasperReportsContext;
30 import net.sf.jasperreports.engine.ParameterContributorContext;
3031
3132 /**
3233 * @author Teodor Danciu (teodord@users.sourceforge.net)
3738 /**
3839 *
3940 */
40 private final JasperReportsContext jasperReportsContext;
41 private final ParameterContributorContext paramContribContext;
4142 private String name;
4243 private DataAdapter dataAdapter;
4344
4445 /**
4546 *
4647 */
48 public AbstractDataAdapterService(ParameterContributorContext paramContribContext, DataAdapter dataAdapter)
49 {
50 this.dataAdapter = dataAdapter;
51 this.paramContribContext = paramContribContext;
52 }
53
54 /**
55 * @deprecated Replaced by {@link #AbstractDataAdapterService(ParameterContributorContext, DataAdapter)}.
56 */
4757 public AbstractDataAdapterService(JasperReportsContext jasperReportsContext, DataAdapter dataAdapter)
4858 {
49 this.dataAdapter = dataAdapter;
50 this.jasperReportsContext = jasperReportsContext;
59 this(new ParameterContributorContext(jasperReportsContext, null, null), dataAdapter);
60 }
61
62 /**
63 *
64 */
65 public ParameterContributorContext getParameterContributorContext()
66 {
67 return paramContribContext;
5168 }
5269
5370 /**
5572 */
5673 public JasperReportsContext getJasperReportsContext()
5774 {
58 return jasperReportsContext;
75 return paramContribContext == null ? null : paramContribContext.getJasperReportsContext();
5976 }
6077
6178 /**
2424
2525 import net.sf.jasperreports.data.http.HttpDataLocation;
2626 import net.sf.jasperreports.data.http.HttpDataService;
27 import net.sf.jasperreports.engine.JasperReportsContext;
27 import net.sf.jasperreports.engine.ParameterContributorContext;
2828
2929 /**
3030 * @author Lucian Chirita (lucianc@users.sourceforge.net)
4444 }
4545
4646 @Override
47 public DataFileService createService(JasperReportsContext context, DataFile dataFile)
47 public DataFileService createService(ParameterContributorContext context, DataFile dataFile)
4848 {
4949 if (dataFile instanceof RepositoryDataLocation)
5050 {
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.data;
24
25 import net.sf.jasperreports.engine.ParameterContributorContext;
26
27
28 /**
29 * @author Teodor Danciu (teodord@users.sourceforge.net)
30 */
31 public interface DataAdapterContributorFactory
32 {
33
34 /**
35 *
36 */
37 public DataAdapterService getDataAdapterService(ParameterContributorContext context, DataAdapter dataAdapter);
38
39 }
6969 if (dataAdapterUri != null)
7070 {
7171 DataAdapterResource dataAdapterResource = RepositoryUtil.getInstance(context.getJasperReportsContext()).getResourceFromLocation(dataAdapterUri, DataAdapterResource.class);
72 ParameterContributor dataAdapterService = DataAdapterServiceUtil.getInstance(context.getJasperReportsContext()).getService(dataAdapterResource.getDataAdapter());
72 ParameterContributor dataAdapterService = DataAdapterServiceUtil.getInstance(context).getService(dataAdapterResource.getDataAdapter());
7373
7474 return Collections.singletonList(dataAdapterService);
7575 }
2626
2727
2828 /**
29 * @deprecated Replaced by {@link DataAdapterContributorFactory}.
2930 * @author Teodor Danciu (teodord@users.sourceforge.net)
3031 */
3132 public interface DataAdapterServiceFactory
2727
2828 import net.sf.jasperreports.engine.JRRuntimeException;
2929 import net.sf.jasperreports.engine.JasperReportsContext;
30 import net.sf.jasperreports.engine.ParameterContributorContext;
3031
3132
3233 /**
3637 {
3738 public static final String EXCEPTION_MESSAGE_KEY_SERVICE_FACTORY_NOT_REGISTERED = "data.adapter.service.factory.not.registered";
3839
39 private JasperReportsContext jasperReportsContext;
40 private ParameterContributorContext paramContribContext;
4041
4142
4243 /**
4344 *
4445 */
45 private DataAdapterServiceUtil(JasperReportsContext jasperReportsContext)
46 private DataAdapterServiceUtil(ParameterContributorContext paramContribContext)
4647 {
47 this.jasperReportsContext = jasperReportsContext;
48 this.paramContribContext = paramContribContext;
4849 }
4950
5051
5152 /**
5253 *
5354 */
55 public static DataAdapterServiceUtil getInstance(ParameterContributorContext paramContribContext)
56 {
57 return new DataAdapterServiceUtil(paramContribContext);
58 }
59
60
61 /**
62 * @deprecated Replaced by {@link #getInstance(ParameterContributorContext)}.
63 */
5464 public static DataAdapterServiceUtil getInstance(JasperReportsContext jasperReportsContext)
5565 {
56 return new DataAdapterServiceUtil(jasperReportsContext);
66 return getInstance(new ParameterContributorContext(jasperReportsContext, null, null));
5767 }
5868
5969
6272 */
6373 public DataAdapterService getService(DataAdapter dataAdapter)
6474 {
65 List<DataAdapterServiceFactory> bundles = jasperReportsContext.getExtensions(
75 JasperReportsContext jasperReportsContext = paramContribContext.getJasperReportsContext();
76
77 List<DataAdapterContributorFactory> bundles = jasperReportsContext.getExtensions(
78 DataAdapterContributorFactory.class);
79 for (Iterator<DataAdapterContributorFactory> it = bundles.iterator(); it.hasNext();)
80 {
81 DataAdapterContributorFactory factory = it.next();
82 DataAdapterService service = factory.getDataAdapterService(paramContribContext, dataAdapter);
83 if (service != null)
84 {
85 return service;
86 }
87 }
88
89 @SuppressWarnings("deprecation")
90 List<DataAdapterServiceFactory> depBundles = jasperReportsContext.getExtensions(
6691 DataAdapterServiceFactory.class);
67 for (Iterator<DataAdapterServiceFactory> it = bundles.iterator(); it.hasNext();)
92 for (@SuppressWarnings("deprecation")
93 Iterator<DataAdapterServiceFactory> it = depBundles.iterator(); it.hasNext();)
6894 {
95 @SuppressWarnings("deprecation")
6996 DataAdapterServiceFactory factory = it.next();
97 @SuppressWarnings("deprecation")
7098 DataAdapterService service = factory.getDataAdapterService(jasperReportsContext, dataAdapter);
7199 if (service != null)
72100 {
73101 return service;
74102 }
75103 }
104
76105 throw
77106 new JRRuntimeException(
78107 EXCEPTION_MESSAGE_KEY_SERVICE_FACTORY_NOT_REGISTERED,
2424
2525 import java.util.List;
2626
27 import net.sf.jasperreports.engine.JasperReportsContext;
27 import net.sf.jasperreports.engine.ParameterContributorContext;
2828
2929 /**
3030 * @author Lucian Chirita (lucianc@users.sourceforge.net)
3232 public class DataFileResolver
3333 {
3434
35 private final JasperReportsContext context;
35 private final ParameterContributorContext context;
3636
37 public static DataFileResolver instance(JasperReportsContext context)
37 public static DataFileResolver instance(ParameterContributorContext context)
3838 {
3939 // not caching for now
4040 return new DataFileResolver(context);
4141 }
4242
43 protected DataFileResolver(JasperReportsContext context)
43 protected DataFileResolver(ParameterContributorContext context)
4444 {
4545 this.context = context;
4646 }
4747
4848 public DataFileService getService(DataFile dataFile)
4949 {
50 List<DataFileServiceFactory> factories = context.getExtensions(DataFileServiceFactory.class);
50 List<DataFileServiceFactory> factories = context.getJasperReportsContext().getExtensions(DataFileServiceFactory.class);
5151 DataFileService dataService = null;
5252 if (factories != null)
5353 {
2222 */
2323 package net.sf.jasperreports.data;
2424
25 import net.sf.jasperreports.engine.JasperReportsContext;
25 import net.sf.jasperreports.engine.ParameterContributorContext;
2626
2727
2828 /**
3131 public interface DataFileServiceFactory
3232 {
3333
34 DataFileService createService(JasperReportsContext context, DataFile dataFile);
34 DataFileService createService(ParameterContributorContext context, DataFile dataFile);
3535
3636 }
2626
2727 import net.sf.jasperreports.engine.JRException;
2828 import net.sf.jasperreports.engine.JasperReportsContext;
29 import net.sf.jasperreports.engine.ParameterContributorContext;
2930
3031 /**
3132 * @author Lucian Chirita (lucianc@users.sourceforge.net)
3334 public class DataFileUtils
3435 {
3536
37 public static DataFileUtils instance(ParameterContributorContext paramContribContext)
38 {
39 return new DataFileUtils(paramContribContext);
40 }
41
42 /**
43 * @deprecated Replaced by {@link #instance(ParameterContributorContext)}.
44 */
3645 public static DataFileUtils instance(JasperReportsContext jasperReportsContext)
3746 {
3847 return new DataFileUtils(jasperReportsContext);
3948 }
4049
41 private final JasperReportsContext jasperReportsContext;
50 private final ParameterContributorContext paramContribContext;
4251
52 protected DataFileUtils(ParameterContributorContext paramContribContext)
53 {
54 super();
55 this.paramContribContext = paramContribContext;
56 }
57
58 /**
59 * @deprecated Replaced by {@link #DataFileUtils(ParameterContributorContext)}.
60 */
4361 protected DataFileUtils(JasperReportsContext jasperReportsContext)
4462 {
45 super();
46 this.jasperReportsContext = jasperReportsContext;
63 this(new ParameterContributorContext(jasperReportsContext, null, null));
4764 }
4865
4966 public DataFileConnection createConnection(DataFile dataFile, Map<String, Object> parameters) throws JRException
5067 {
51 DataFileResolver dataFileResolver = DataFileResolver.instance(jasperReportsContext);
68 DataFileResolver dataFileResolver = DataFileResolver.instance(paramContribContext);
5269 DataFileService dataFileService = dataFileResolver.getService(dataFile);
5370
5471 DataFileConnection dataConnection = dataFileService.getDataFileConnection(parameters);
3434 public class DefaultDataAdapterServiceExtensionsRegistryFactory implements ExtensionsRegistryFactory
3535 {
3636 private static final ExtensionsRegistry extensionsRegistry =
37 new SingletonExtensionRegistry<DataAdapterServiceFactory>(
38 DataAdapterServiceFactory.class, DefaultDataAdapterServiceFactory.getInstance());
37 new SingletonExtensionRegistry<DataAdapterContributorFactory>(
38 DataAdapterContributorFactory.class, DefaultDataAdapterServiceFactory.getInstance());
3939
4040 @Override
4141 public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties)
6262 import net.sf.jasperreports.data.xmla.XmlaDataAdapterService;
6363 import net.sf.jasperreports.engine.JRPropertiesUtil;
6464 import net.sf.jasperreports.engine.JasperReportsContext;
65 import net.sf.jasperreports.engine.ParameterContributorContext;
6566
6667
6768 /**
6869 * @author Teodor Danciu (teodord@users.sourceforge.net)
6970 */
70 public class DefaultDataAdapterServiceFactory implements DataAdapterServiceFactory
71 public class DefaultDataAdapterServiceFactory implements DataAdapterContributorFactory, DataAdapterServiceFactory
7172 {
7273
7374 /**
8485 }
8586
8687 @Override
87 public DataAdapterService getDataAdapterService(JasperReportsContext jasperReportsContext, DataAdapter dataAdapter)
88 public DataAdapterService getDataAdapterService(ParameterContributorContext context, DataAdapter dataAdapter)
8889 {
90 JasperReportsContext jasperReportsContext = context.getJasperReportsContext();
8991 DataAdapterService dataAdapterService = null;
9092
9193 if (dataAdapter instanceof BeanDataAdapter)
9294 {
93 dataAdapterService = new BeanDataAdapterService(jasperReportsContext, (BeanDataAdapter)dataAdapter);
95 dataAdapterService = new BeanDataAdapterService(context, (BeanDataAdapter)dataAdapter);
9496 }
9597 else if (dataAdapter instanceof CsvDataAdapter)
9698 {
97 dataAdapterService = new CsvDataAdapterService(jasperReportsContext, (CsvDataAdapter)dataAdapter);
99 dataAdapterService = new CsvDataAdapterService(context, (CsvDataAdapter)dataAdapter);
98100 }
99101 else if (dataAdapter instanceof DataSourceDataAdapter)
100102 {
101 dataAdapterService = new DataSourceDataAdapterService(jasperReportsContext, (DataSourceDataAdapter)dataAdapter);
103 dataAdapterService = new DataSourceDataAdapterService(context, (DataSourceDataAdapter)dataAdapter);
102104 }
103105 else if (dataAdapter instanceof EmptyDataAdapter)
104106 {
105 dataAdapterService = new EmptyDataAdapterService(jasperReportsContext, (EmptyDataAdapter)dataAdapter);
107 dataAdapterService = new EmptyDataAdapterService(context, (EmptyDataAdapter)dataAdapter);
106108 }
107109 else if (dataAdapter instanceof JndiDataAdapter)
108110 {
109 dataAdapterService = new JndiDataAdapterService(jasperReportsContext, (JndiDataAdapter)dataAdapter);//FIXME maybe want some cache here
111 dataAdapterService = new JndiDataAdapterService(context, (JndiDataAdapter)dataAdapter);//FIXME maybe want some cache here
110112 }
111113 else if (dataAdapter instanceof DataSourceProviderDataAdapter)
112114 {
113 dataAdapterService = new DataSourceProviderDataAdapterService(jasperReportsContext, (DataSourceProviderDataAdapter)dataAdapter);
115 dataAdapterService = new DataSourceProviderDataAdapterService(context, (DataSourceProviderDataAdapter)dataAdapter);
114116 }
115117 else if (dataAdapter instanceof QueryExecuterDataAdapter)
116118 {
117 dataAdapterService = new QueryExecuterDataAdapterService(jasperReportsContext, (QueryExecuterDataAdapter)dataAdapter);
119 dataAdapterService = new QueryExecuterDataAdapterService(context, (QueryExecuterDataAdapter)dataAdapter);
118120 }
119121
120122 // these following three adapters must be kept in order of inheritance hierarchy
121123 else if (dataAdapter instanceof ExcelDataAdapter)
122124 {
123 dataAdapterService = new ExcelDataAdapterService(jasperReportsContext, (ExcelDataAdapter)dataAdapter);
125 dataAdapterService = new ExcelDataAdapterService(context, (ExcelDataAdapter)dataAdapter);
124126 }
125127 else if (dataAdapter instanceof XlsxDataAdapter)
126128 {
127 dataAdapterService = new XlsxDataAdapterService(jasperReportsContext, (XlsxDataAdapter)dataAdapter);
129 dataAdapterService = new XlsxDataAdapterService(context, (XlsxDataAdapter)dataAdapter);
128130 }
129131 else if (dataAdapter instanceof XlsDataAdapter)
130132 {
141143 }
142144 else
143145 {
144 dataAdapterService = new XlsDataAdapterService(jasperReportsContext, (XlsDataAdapter)dataAdapter);
146 dataAdapterService = new XlsDataAdapterService(context, (XlsDataAdapter)dataAdapter);
145147 }
146148 }
147149 // end excel
148150
149151 else if (dataAdapter instanceof XmlDataAdapter)
150152 {
151 dataAdapterService = new XmlDataAdapterService(jasperReportsContext, (XmlDataAdapter)dataAdapter);
153 dataAdapterService = new XmlDataAdapterService(context, (XmlDataAdapter)dataAdapter);
152154 }
153155 else if (dataAdapter instanceof JsonDataAdapter)
154156 {
155 dataAdapterService = new JsonDataAdapterService(jasperReportsContext, (JsonDataAdapter)dataAdapter);
157 dataAdapterService = new JsonDataAdapterService(context, (JsonDataAdapter)dataAdapter);
156158 }
157159 else if (dataAdapter instanceof HibernateDataAdapter)
158160 {
159 dataAdapterService = new HibernateDataAdapterService(jasperReportsContext, (HibernateDataAdapter)dataAdapter);
161 dataAdapterService = new HibernateDataAdapterService(context, (HibernateDataAdapter)dataAdapter);
160162 }
161163 else if (dataAdapter instanceof SpringHibernateDataAdapter)
162164 {
163 dataAdapterService = new SpringHibernateDataAdapterService(jasperReportsContext, (SpringHibernateDataAdapter)dataAdapter);
165 dataAdapterService = new SpringHibernateDataAdapterService(context, (SpringHibernateDataAdapter)dataAdapter);
164166 }
165167 else if (dataAdapter instanceof EjbqlDataAdapter)
166168 {
167 dataAdapterService = new EjbqlDataAdapterService(jasperReportsContext, (EjbqlDataAdapter)dataAdapter);
169 dataAdapterService = new EjbqlDataAdapterService(context, (EjbqlDataAdapter)dataAdapter);
168170 }
169171 else if (dataAdapter instanceof MondrianDataAdapter)
170172 {
171 dataAdapterService = new MondrianDataAdapterService(jasperReportsContext, (MondrianDataAdapter)dataAdapter);
173 dataAdapterService = new MondrianDataAdapterService(context, (MondrianDataAdapter)dataAdapter);
172174 }
173175 else if (dataAdapter instanceof XmlaDataAdapter)
174176 {
175 dataAdapterService = new XmlaDataAdapterService(jasperReportsContext, (XmlaDataAdapter)dataAdapter);
177 dataAdapterService = new XmlaDataAdapterService(context, (XmlaDataAdapter)dataAdapter);
176178 }
177179 else if (dataAdapter.getClass().getName().equals(JdbcDataAdapterImpl.class.getName()))
178180 {
179 dataAdapterService = new JdbcDataAdapterService(jasperReportsContext, (JdbcDataAdapter)dataAdapter);
181 dataAdapterService = new JdbcDataAdapterService(context, (JdbcDataAdapter)dataAdapter);
180182 }
181183
182184 return dataAdapterService;
183185 }
186
187 /**
188 * @deprecated Replaced by {@link #getDataAdapterService(ParameterContributorContext, DataAdapter)}.
189 */
190 @Override
191 public DataAdapterService getDataAdapterService(JasperReportsContext jasperReportsContext, DataAdapter dataAdapter)
192 {
193 return getDataAdapterService(new ParameterContributorContext(jasperReportsContext, null, null), dataAdapter);
194 }
184195
185196 }
2929 import org.apache.commons.logging.LogFactory;
3030
3131 import net.sf.jasperreports.engine.JRException;
32 import net.sf.jasperreports.engine.JasperReportsContext;
32 import net.sf.jasperreports.engine.ParameterContributorContext;
3333 import net.sf.jasperreports.repo.RepositoryUtil;
3434
3535 /**
4343 private final RepositoryUtil repository;
4444 private final RepositoryDataLocation dataLocation;
4545
46 public RepositoryDataLocationService(JasperReportsContext context, RepositoryDataLocation dataLocation)
46 public RepositoryDataLocationService(ParameterContributorContext context, RepositoryDataLocation dataLocation)
4747 {
48 this.repository = RepositoryUtil.getInstance(context);
48 this.repository = RepositoryUtil.getInstance(context.getJasperReportsContext());
4949 this.dataLocation = dataLocation;
5050 }
5151
3131 import net.sf.jasperreports.engine.JRException;
3232 import net.sf.jasperreports.engine.JRParameter;
3333 import net.sf.jasperreports.engine.JasperReportsContext;
34 import net.sf.jasperreports.engine.ParameterContributorContext;
3435 import net.sf.jasperreports.engine.data.JRAbstractBeanDataSource;
3536 import net.sf.jasperreports.engine.data.JRBeanArrayDataSource;
3637 import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
4647
4748 /**
4849 *
50 */
51 public BeanDataAdapterService(ParameterContributorContext paramContribContext, BeanDataAdapter beanDataAdapter)
52 {
53 super(paramContribContext, beanDataAdapter);
54 }
55
56 /**
57 * @deprecated Replaced by {@link #BeanDataAdapterService(ParameterContributorContext, BeanDataAdapter)}.
4958 */
5059 public BeanDataAdapterService(JasperReportsContext jasperReportsContext, BeanDataAdapter beanDataAdapter)
5160 {
3636 import net.sf.jasperreports.engine.JRException;
3737 import net.sf.jasperreports.engine.JRParameter;
3838 import net.sf.jasperreports.engine.JasperReportsContext;
39 import net.sf.jasperreports.engine.ParameterContributorContext;
3940 import net.sf.jasperreports.engine.data.JRCsvDataSource;
4041 import net.sf.jasperreports.engine.query.JRCsvQueryExecuterFactory;
4142
5051 /**
5152 *
5253 */
54 public CsvDataAdapterService(ParameterContributorContext paramContribContext, CsvDataAdapter csvDataAdapter)
55 {
56 super(paramContribContext, csvDataAdapter);
57 }
58
59 /**
60 * @deprecated Replaced by {@link #CsvDataAdapterService(ParameterContributorContext, CsvDataAdapter)}.
61 */
5362 public CsvDataAdapterService(JasperReportsContext jasperReportsContext, CsvDataAdapter csvDataAdapter)
5463 {
5564 super(jasperReportsContext, csvDataAdapter);
6675 CsvDataAdapter csvDataAdapter = getCsvDataAdapter();
6776 if (csvDataAdapter != null)
6877 {
69 dataStream = DataFileUtils.instance(getJasperReportsContext()).getDataStream(
78 dataStream = DataFileUtils.instance(getParameterContributorContext()).getDataStream(
7079 csvDataAdapter.getDataFile(), parameters);
7180
7281 Locale locale = csvDataAdapter.getLocale();
3434 import net.sf.jasperreports.engine.JRException;
3535 import net.sf.jasperreports.engine.JRParameter;
3636 import net.sf.jasperreports.engine.JasperReportsContext;
37 import net.sf.jasperreports.engine.ParameterContributorContext;
3738 import net.sf.jasperreports.engine.util.JRClassLoader;
3839
3940 /**
4647
4748 /**
4849 *
50 */
51 public DataSourceDataAdapterService(ParameterContributorContext paramContribContext, DataSourceDataAdapter dsDataAdapter)
52 {
53 super(paramContribContext, dsDataAdapter);
54 }
55
56 /**
57 * @deprecated Replaced by {@link #DataSourceDataAdapterService(ParameterContributorContext, DataSourceDataAdapter)}.
4958 */
5059 public DataSourceDataAdapterService(JasperReportsContext jasperReportsContext, DataSourceDataAdapter dsDataAdapter)
5160 {
3333 import net.sf.jasperreports.data.AbstractDataAdapterService;
3434 import net.sf.jasperreports.engine.JRException;
3535 import net.sf.jasperreports.engine.JasperReportsContext;
36 import net.sf.jasperreports.engine.ParameterContributorContext;
3637 import net.sf.jasperreports.engine.query.JRJpaQueryExecuterFactory;
3738 import net.sf.jasperreports.engine.util.JRClassLoader;
3839
4647
4748 /**
4849 *
50 */
51 public EjbqlDataAdapterService(ParameterContributorContext paramContribContext, EjbqlDataAdapter jsonDataAdapter)
52 {
53 super(paramContribContext, jsonDataAdapter);
54 }
55
56 /**
57 * @deprecated Replaced by {@link #EjbqlDataAdapterService(ParameterContributorContext, EjbqlDataAdapter)}.
4958 */
5059 public EjbqlDataAdapterService(JasperReportsContext jasperReportsContext, EjbqlDataAdapter jsonDataAdapter)
5160 {
2929 import net.sf.jasperreports.engine.JRException;
3030 import net.sf.jasperreports.engine.JRParameter;
3131 import net.sf.jasperreports.engine.JasperReportsContext;
32 import net.sf.jasperreports.engine.ParameterContributorContext;
3233
3334 /**
3435 * @author Teodor Danciu (teodord@users.sourceforge.net)
3839
3940 /**
4041 *
42 */
43 public EmptyDataAdapterService(ParameterContributorContext paramContribContext, EmptyDataAdapter emptyDataAdapter)
44 {
45 super(paramContribContext, emptyDataAdapter);
46 }
47
48 /**
49 * @deprecated Replaced by {@link #EmptyDataAdapterService(ParameterContributorContext, EmptyDataAdapter)}.
4150 */
4251 public EmptyDataAdapterService(JasperReportsContext jasperReportsContext, EmptyDataAdapter emptyDataAdapter)
4352 {
2828 import net.sf.jasperreports.data.xls.AbstractXlsDataAdapterService;
2929 import net.sf.jasperreports.engine.JRException;
3030 import net.sf.jasperreports.engine.JasperReportsContext;
31 import net.sf.jasperreports.engine.ParameterContributorContext;
3132 import net.sf.jasperreports.engine.data.AbstractXlsDataSource;
3233 import net.sf.jasperreports.engine.data.ExcelDataSource;
3334 import net.sf.jasperreports.engine.query.ExcelQueryExecuterFactory;
4041
4142 /**
4243 *
44 */
45 public ExcelDataAdapterService(ParameterContributorContext paramContribContext, ExcelDataAdapter excelDataAdapter)
46 {
47 super(paramContribContext, excelDataAdapter);
48 }
49
50 /**
51 * @deprecated Replaced by {@link #ExcelDataAdapterService(ParameterContributorContext, ExcelDataAdapter)}.
4352 */
4453 public ExcelDataAdapterService(JasperReportsContext jasperReportsContext, ExcelDataAdapter excelDataAdapter)
4554 {
3535 import net.sf.jasperreports.data.AbstractClasspathAwareDataAdapterService;
3636 import net.sf.jasperreports.engine.JRException;
3737 import net.sf.jasperreports.engine.JasperReportsContext;
38 import net.sf.jasperreports.engine.ParameterContributorContext;
3839 import net.sf.jasperreports.engine.query.JRHibernateQueryExecuterFactory;
3940 import net.sf.jasperreports.engine.util.JRClassLoader;
4041
4849
4950 /**
5051 *
52 */
53 public HibernateDataAdapterService(ParameterContributorContext paramContribContext, HibernateDataAdapter jsonDataAdapter)
54 {
55 super(paramContribContext, jsonDataAdapter);
56 }
57
58 /**
59 * @deprecated Replaced by {@link #HibernateDataAdapterService(ParameterContributorContext, HibernateDataAdapter)}.
5160 */
5261 public HibernateDataAdapterService(JasperReportsContext jasperReportsContext, HibernateDataAdapter jsonDataAdapter)
5362 {
3232 import net.sf.jasperreports.data.AbstractDataAdapterService;
3333 import net.sf.jasperreports.engine.JRException;
3434 import net.sf.jasperreports.engine.JasperReportsContext;
35 import net.sf.jasperreports.engine.ParameterContributorContext;
3536 import net.sf.jasperreports.engine.query.JRHibernateQueryExecuterFactory;
3637 import net.sf.jasperreports.engine.util.JRClassLoader;
3738
4647
4748 /**
4849 *
50 */
51 public SpringHibernateDataAdapterService(ParameterContributorContext paramContribContext, SpringHibernateDataAdapter jsonDataAdapter)
52 {
53 super(paramContribContext, jsonDataAdapter);
54 }
55
56 /**
57 * @deprecated Replaced by {@link #SpringHibernateDataAdapterService(ParameterContributorContext, SpringHibernateDataAdapter)}.
4958 */
5059 public SpringHibernateDataAdapterService(JasperReportsContext jasperReportsContext, SpringHibernateDataAdapter jsonDataAdapter)
5160 {
7382 configs[iCount++] = parser.nextToken();
7483 }
7584 Object configure = clazz.getConstructor(String[].class)
76 .newInstance(configs);
85 .newInstance((Object) configs);
7786 if (configure != null) {
7887 Object bsf = clazz.getMethod("getBean", String.class)
7988 .invoke(configure, hbmDA.getBeanId());
4343 List<HttpLocationParameter> getUrlParameters();
4444
4545 List<HttpLocationParameter> getPostParameters();
46
47 List<HttpLocationParameter> getHeaders();
4648
4749 }
2626 import java.net.URI;
2727 import java.net.URISyntaxException;
2828 import java.util.ArrayList;
29 import java.util.HashMap;
2930 import java.util.List;
3031 import java.util.Map;
3132 import java.util.Map.Entry;
32
33 import net.sf.jasperreports.data.AbstractDataAdapterService;
34 import net.sf.jasperreports.data.DataFileConnection;
35 import net.sf.jasperreports.data.DataFileService;
36 import net.sf.jasperreports.engine.JRException;
37 import net.sf.jasperreports.engine.JRRuntimeException;
38 import net.sf.jasperreports.engine.JasperReportsContext;
39 import net.sf.jasperreports.util.SecretsUtil;
4033
4134 import org.apache.commons.logging.Log;
4235 import org.apache.commons.logging.LogFactory;
6053 import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
6154 import org.apache.http.message.BasicNameValuePair;
6255
56 import net.sf.jasperreports.data.AbstractDataAdapterService;
57 import net.sf.jasperreports.data.DataFileConnection;
58 import net.sf.jasperreports.data.DataFileService;
59 import net.sf.jasperreports.engine.JRDataset;
60 import net.sf.jasperreports.engine.JRException;
61 import net.sf.jasperreports.engine.JRParameter;
62 import net.sf.jasperreports.engine.JRPropertiesUtil;
63 import net.sf.jasperreports.engine.JRRuntimeException;
64 import net.sf.jasperreports.engine.ParameterContributorContext;
65 import net.sf.jasperreports.util.SecretsUtil;
66
6367 /**
6468 * @author Lucian Chirita (lucianc@users.sourceforge.net)
6569 */
7175 public static final String EXCEPTION_MESSAGE_KEY_NO_HTTP_URL_SET = "data.http.no.http.url.set";
7276 public static final String EXCEPTION_MESSAGE_KEY_UNKNOWN_REQUEST_METHOD = "data.http.unknown.request.method";
7377
78 /**
79 * @deprecated Replaced by {@link #PROPERTY_URL}.
80 */
7481 public static final String PARAMETER_URL = "HTTP_DATA_URL";
7582
83 /**
84 * @deprecated Replaced by {@link #PROPERTY_USERNAME}.
85 */
7686 public static final String PARAMETER_USERNAME = "HTTP_DATA_USERNAME";
7787
88 /**
89 * @deprecated Replaced by {@link #PROPERTY_PASSWORD}.
90 */
7891 public static final String PARAMETER_PASSWORD = "HTTP_DATA_PASSWORD";
7992
93 /**
94 * @deprecated Replaced by {@link #PROPERTY_URL_PARAMETER}.
95 */
8096 public static final String PARAMETER_PREFIX_URL_PARAMETER = "HTTP_DATA_URL_PARAMETER_";
8197
98 /**
99 * @deprecated Replaced by {@link #PROPERTY_POST_PARAMETER}.
100 */
82101 public static final String PARAMETER_PREFIX_POST_PARAMETER = "HTTP_DATA_POST_PARAMETER_";
83
84 private final JasperReportsContext context;
102
103 /**
104 * Property that specifies the base URL to be used by the HTTP data adapters.
105 */
106 public static final String PROPERTY_URL = JRPropertiesUtil.PROPERTY_PREFIX + "http.data.url";
107
108 /**
109 * Property that specifies the user name to be used by the HTTP data adapters with basic authentication.
110 */
111 public static final String PROPERTY_USERNAME = JRPropertiesUtil.PROPERTY_PREFIX + "http.data.username";
112
113 /**
114 * Property that specifies the password to be used by the HTTP data adapters with basic authentication.
115 */
116 public static final String PROPERTY_PASSWORD = JRPropertiesUtil.PROPERTY_PREFIX + "http.data.password";
117
118 /**
119 * Property that specifies the name of the request parameter to be added to the URL when HTTP data adapter is used.
120 * If the property is present, but has no value, the name of the request parameter is the same as the report parameter name.
121 */
122 public static final String PROPERTY_URL_PARAMETER = JRPropertiesUtil.PROPERTY_PREFIX + "http.data.url.parameter";
123
124 /**
125 * Property that specifies the name of the request POST parameter to be sent when HTTP data adapter is used.
126 * If the property is present, but has no value, the name of the request parameter is the same as the report parameter name.
127 */
128 public static final String PROPERTY_POST_PARAMETER = JRPropertiesUtil.PROPERTY_PREFIX + "http.data.post.parameter";
129
130 /**
131 * Property that specifies the name of the request header to be sent when HTTP data adapter is used.
132 * If the property is present, but has no value, the name of the request header is the same as the report parameter name.
133 */
134 public static final String PROPERTY_HEADER = JRPropertiesUtil.PROPERTY_PREFIX + "http.data.header";
135
136 private final ParameterContributorContext context;
85137
86138 private final HttpDataLocation dataLocation;
87139
88 public HttpDataService(JasperReportsContext context, HttpDataLocation dataLocation)
140 public HttpDataService(ParameterContributorContext context, HttpDataLocation dataLocation)
89141 {
90142 this.context = context;
91143 this.dataLocation = dataLocation;
137189
138190 protected String getUsername(Map<String, Object> parameters)
139191 {
140 String username = (String) parameters.get(PARAMETER_USERNAME);
192 String username = getPropertyOrParameterValue(PROPERTY_USERNAME, PARAMETER_USERNAME, parameters);
141193 if (username == null)
142194 {
143195 username = dataLocation.getUsername();
147199
148200 protected String getPassword(Map<String, Object> parameters)
149201 {
150 String password = (String) parameters.get(PARAMETER_PASSWORD);
202 String password = getPropertyOrParameterValue(PROPERTY_PASSWORD, PARAMETER_PASSWORD, parameters);
151203 if (password == null)
152204 {
153205 password = dataLocation.getPassword();
155207
156208 if (password != null)
157209 {
158 SecretsUtil secrets = SecretsUtil.getInstance(context);
210 SecretsUtil secrets = SecretsUtil.getInstance(context.getJasperReportsContext());
159211 password = secrets.getSecret(AbstractDataAdapterService.SECRETS_CATEGORY, password);
160212 }
161213
197249 new Object[]{method});
198250 }
199251
252 List<NameValuePair> headers = collectHeaders(parameters);
253 if (headers != null)
254 {
255 for (NameValuePair header : headers)
256 {
257 request.addHeader(header.getName(), header.getValue());
258 }
259 }
260
200261 return request;
201262 }
202263
239300
240301 protected List<NameValuePair> collectUrlParameters(Map<String, Object> reportParameters)
241302 {
242 return collectParameters(dataLocation.getUrlParameters(), reportParameters, PARAMETER_PREFIX_URL_PARAMETER);
303 return collectParameters(dataLocation.getUrlParameters(), reportParameters, PROPERTY_URL_PARAMETER, PARAMETER_PREFIX_URL_PARAMETER);
243304 }
244305
245306 protected List<NameValuePair> collectPostParameters(Map<String, Object> reportParameters)
246307 {
247 return collectParameters(dataLocation.getPostParameters(), reportParameters, PARAMETER_PREFIX_POST_PARAMETER);
248 }
249
250 protected List<NameValuePair> collectParameters(List<HttpLocationParameter> staticParameters,
251 Map<String, Object> reportParameters, String reportParameterPrefix)
308 return collectParameters(dataLocation.getPostParameters(), reportParameters, PROPERTY_POST_PARAMETER, PARAMETER_PREFIX_POST_PARAMETER);
309 }
310
311 protected List<NameValuePair> collectHeaders(Map<String, Object> reportParameters)
312 {
313 return collectParameters(dataLocation.getHeaders(), reportParameters, PROPERTY_HEADER, null);
314 }
315
316 protected List<NameValuePair> collectParameters(
317 List<HttpLocationParameter> dataAdapterParameters,
318 Map<String, Object> parameterValues,
319 String propertyName,
320 String parameterPrefix
321 )
252322 {
253323 List<NameValuePair> postParameters = new ArrayList<NameValuePair>();
254324
255 if (staticParameters != null && !staticParameters.isEmpty())
256 {
257 for (HttpLocationParameter parameter : staticParameters)
258 {
259 String name = parameter.getName();
260 String paramValue = parameter.getValue();
325 Map<String, String> requestParamMappings = new HashMap<String, String>();
326 if (
327 context.getDataset() != null
328 && context.getDataset().getParameters() != null
329 )
330 {
331 for (JRParameter parameter : context.getDataset().getParameters())
332 {
333 if (
334 parameter.hasProperties()
335 && parameter.getPropertiesMap().containsProperty(propertyName)
336 )
337 {
338 String requestParamName = parameter.getPropertiesMap().getProperty(propertyName);
339 if (requestParamName == null)
340 {
341 requestParamName = parameter.getName();
342 }
343 requestParamMappings.put(requestParamName, parameter.getName());
344 }
345 }
346 }
347
348 if (dataAdapterParameters != null && !dataAdapterParameters.isEmpty())
349 {
350 for (HttpLocationParameter dataAdapterParameter : dataAdapterParameters)
351 {
352 String dataAdapterParamName = dataAdapterParameter.getName();
353 String paramValue = dataAdapterParameter.getValue();
261354 if (paramValue != null)
262355 {
263 String reportParameterName = reportParameterPrefix + parameter.getName();
264 if (!reportParameters.containsKey(reportParameterName))
356 String prefixConventionParamName = parameterPrefix == null ? null : (parameterPrefix + dataAdapterParamName);
357 String mappedParamName = requestParamMappings.get(dataAdapterParamName);
358 if (
359 (prefixConventionParamName != null
360 && parameterValues.containsKey(prefixConventionParamName))
361 || (requestParamMappings.containsKey(dataAdapterParamName)
362 && parameterValues.containsKey(mappedParamName))
363 )
265364 {
266365 if (log.isDebugEnabled())
267366 {
268 log.debug("adding parameter " + name + " with value " + paramValue);
367 log.debug("data adapter parameter " + dataAdapterParamName + " overridden by the report");
269368 }
270 postParameters.add(new BasicNameValuePair(name, paramValue));
271369 }
272370 else
273371 {
274372 if (log.isDebugEnabled())
275373 {
276 log.debug("static parameter " + parameter.getName() + " overridden by the report");
374 log.debug("adding parameter " + dataAdapterParamName + " with value " + paramValue);
277375 }
376 postParameters.add(new BasicNameValuePair(dataAdapterParamName, paramValue));
278377 }
279378 }
280379 }
281380 }
282381
283 for (Entry<String, Object> paramEntry : reportParameters.entrySet())
284 {
285 String paramName = paramEntry.getKey();
286 Object value = paramEntry.getValue();
287 if (paramName.startsWith(reportParameterPrefix) && value != null)
288 {
289 String name = paramName.substring(reportParameterPrefix.length(), paramName.length());
290 String paramValue = toHttpParameterValue(value);
291 if (log.isDebugEnabled())
382 if (parameterPrefix != null)
383 {
384 for (Entry<String, Object> paramEntry : parameterValues.entrySet())
385 {
386 String paramName = paramEntry.getKey();
387 Object value = paramEntry.getValue();
388 if (paramName.startsWith(parameterPrefix))
292389 {
293 log.debug("adding parameter " + name + " with value " + paramValue);
390 String requestParamName = paramName.substring(parameterPrefix.length(), paramName.length());
391 String mappedParamName = requestParamMappings.get(requestParamName);
392 if (
393 value != null
394 && (!requestParamMappings.containsKey(requestParamName)
395 || !parameterValues.containsKey(mappedParamName))
396 )
397 {
398 String paramValue = toHttpParameterValue(value);
399 if (log.isDebugEnabled())
400 {
401 log.debug("adding parameter " + requestParamName + " with value " + paramValue);
402 }
403 postParameters.add(new BasicNameValuePair(requestParamName, paramValue));
404 }
405 else
406 {
407 if (log.isDebugEnabled())
408 {
409 log.debug("prefix convention parameter " + requestParamName + " overridden by the property mapped parameter");
410 }
411 }
294412 }
295 postParameters.add(new BasicNameValuePair(name, paramValue));
296 }
297 }
413 }
414 }
415
416 if (
417 context.getDataset() != null
418 && context.getDataset().getParameters() != null
419 )
420 {
421 // here, loop through dataset parameters and not through requestParamMappings because we want to support request parameter arrays
422 // by allowing multiple dataset parameters to provide value for the same request parameter
423 for (JRParameter parameter : context.getDataset().getParameters())
424 {
425 if (
426 parameter.hasProperties()
427 && parameter.getPropertiesMap().containsProperty(propertyName)
428 )
429 {
430 String requestParamName = parameter.getPropertiesMap().getProperty(propertyName);
431 if (requestParamName == null)
432 {
433 requestParamName = parameter.getName();
434 }
435
436 String paramName = parameter.getName();
437
438 if (parameterValues.containsKey(paramName))
439 {
440 Object value = parameterValues.get(paramName);
441 String paramValue = toHttpParameterValue(value);
442 if (log.isDebugEnabled())
443 {
444 log.debug("adding parameter " + requestParamName + " with value " + paramValue);
445 }
446 postParameters.add(new BasicNameValuePair(requestParamName, paramValue));
447 }
448 }
449 }
450 }
451
298452 return postParameters;
299453 }
300454
333487
334488 protected String getURL(Map<String, Object> parameters)
335489 {
336 String url = (String) parameters.get(PARAMETER_URL);
490 String url = getPropertyOrParameterValue(PROPERTY_URL, PARAMETER_URL, parameters);
337491 if (url == null)
338492 {
339493 url = dataLocation.getUrl();
341495 return url;
342496 }
343497
498 protected String getPropertyOrParameterValue(String propName, String paramName, Map<String, Object> parameterValues)
499 {
500 String value = null;
501
502 JRDataset dataset = context.getDataset();
503 if (dataset.hasProperties())
504 {
505 value = JRPropertiesUtil.getOwnProperty(dataset, propName);
506 }
507
508 if (parameterValues.containsKey(paramName))
509 {
510 value = (String) parameterValues.get(paramName);
511 }
512
513 if (dataset != null)
514 {
515 JRParameter[] parameters = dataset.getParameters();
516 if (parameters != null)
517 {
518 for (JRParameter parameter : parameters)
519 {
520 if (
521 parameter.hasProperties()
522 && parameter.getPropertiesMap().containsProperty(propName)
523 && parameterValues.containsKey(parameter.getName())
524 )
525 {
526 value = (String)parameterValues.get(parameter.getName());
527 }
528 }
529 }
530 }
531
532 return value;
533 }
534
344535 protected String toHttpParameterValue(Object value)
345536 {
346537 return String.valueOf(value);//FIXME do something smarter than String.valueOf
3939 private String password;
4040 private List<HttpLocationParameter> urlParameters;
4141 private List<HttpLocationParameter> postParameters;
42 private List<HttpLocationParameter> headers;
4243
4344 @Override
4445 public RequestMethod getMethod()
9293 StandardHttpDataLocation clone = (StandardHttpDataLocation) super.clone();
9394 clone.urlParameters = JRCloneUtils.cloneList(urlParameters);
9495 clone.postParameters = JRCloneUtils.cloneList(postParameters);
96 clone.headers = JRCloneUtils.cloneList(headers);
9597 return clone;
9698 }
9799 catch (CloneNotSupportedException e)
122124 {
123125 this.postParameters = postParameters;
124126 }
127
128 @Override
129 public List<HttpLocationParameter> getHeaders()
130 {
131 return headers;
132 }
133
134 public void setHeaders(List<HttpLocationParameter> headers)
135 {
136 this.headers = headers;
137 }
125138
126139 }
2121 <field name="postParameters" type="net.sf.jasperreports.data.http.HttpLocationParameter" collection="arraylist">
2222 <bind-xml name="postParameter" node="element"/>
2323 </field>
24 <field name="headers" type="net.sf.jasperreports.data.http.HttpLocationParameter" collection="arraylist">
25 <bind-xml name="header" node="element"/>
26 </field>
2427 </class>
2528
2629 <class name="net.sf.jasperreports.data.http.HttpLocationParameter">
3636 import net.sf.jasperreports.engine.JRParameter;
3737 import net.sf.jasperreports.engine.JRRuntimeException;
3838 import net.sf.jasperreports.engine.JasperReportsContext;
39 import net.sf.jasperreports.engine.ParameterContributorContext;
3940 import net.sf.jasperreports.engine.util.JRClassLoader;
4041 import net.sf.jasperreports.util.SecretsUtil;
4142
102103 /**
103104 *
104105 */
106 public JdbcDataAdapterService(ParameterContributorContext paramContribContext, JdbcDataAdapter jdbcDataAdapter)
107 {
108 super(paramContribContext, jdbcDataAdapter);
109 }
110
111 /**
112 * @deprecated Replaced by {@link #JdbcDataAdapterService(ParameterContributorContext, JdbcDataAdapter)}.
113 */
105114 public JdbcDataAdapterService(JasperReportsContext jasperReportsContext, JdbcDataAdapter jdbcDataAdapter)
106115 {
107116 super(jasperReportsContext, jdbcDataAdapter);
3636 import net.sf.jasperreports.engine.JRException;
3737 import net.sf.jasperreports.engine.JRParameter;
3838 import net.sf.jasperreports.engine.JasperReportsContext;
39 import net.sf.jasperreports.engine.ParameterContributorContext;
3940
4041
4142 /**
4950
5051 /**
5152 *
53 */
54 public JndiDataAdapterService(ParameterContributorContext paramContribContext, JndiDataAdapter jndiDataAdapter)
55 {
56 super(paramContribContext, jndiDataAdapter);
57 }
58
59 /**
60 * @deprecated Replaced by {@link #JndiDataAdapterService(ParameterContributorContext, JndiDataAdapter)}.
5261 */
5362 public JndiDataAdapterService(JasperReportsContext jasperReportsContext, JndiDataAdapter jndiDataAdapter)
5463 {
4949 @Deprecated
5050 public void setFileName(String fileName);
5151
52 public JsonExpressionLanguageEnum getLanguage();
53
54 public void setLanguage(JsonExpressionLanguageEnum language);
55
5256 public Locale getLocale();
5357
5458 public void setLocale(Locale locale);
0 <?xml version="1.0"?>
1 <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">
2
3 <mapping>
4 <class name="net.sf.jasperreports.data.json.JsonDataAdapterImpl">
5 <map-to xml="jsonDataAdapter"/>
6 <field name="class" type="java.lang.Class" handler="net.sf.jasperreports.data.ClassNameFieldHandler">
7 <bind-xml name="class" node="attribute"/>
8 </field>
9 <field name="name" type="string">
10 <bind-xml name="name" node="element"/>
11 </field>
12 <field name="fileName" type="string" handler="net.sf.jasperreports.util.NoWriteFieldHandler">
13 <bind-xml name="fileName" node="element"/>
14 </field>
15 <field name="dataFile" type="net.sf.jasperreports.data.DataFile">
16 <bind-xml name="dataFile" node="element"/>
17 </field>
18 <field name="useConnection" type="boolean">
19 <bind-xml name="useConnection" node="element"/>
20 </field>
21 <field name="timeZone" type="java.util.TimeZone" handler="net.sf.jasperreports.data.TimeZoneFieldHandler">
22 <bind-xml name="timeZone" node="element"/>
23 </field>
24 <field name="locale" type="java.util.Locale" handler="net.sf.jasperreports.data.LocaleFieldHandler">
25 <bind-xml name="locale" node="element"/>
26 </field>
27 <field name="selectExpression" type="string">
28 <bind-xml name="selectExpression" node="element"/>
29 </field>
30 <field name="datePattern" type="string">
31 <bind-xml name="datePattern" node="element"/>
32 </field>
33 <field name="numberPattern" type="string">
34 <bind-xml name="numberPattern" node="element"/>
35 </field>
36 </class>
37 </mapping>
4242 private Locale locale;
4343 private TimeZone timeZone;
4444 private boolean useConnection = false;
45 private JsonExpressionLanguageEnum language = JsonExpressionLanguageEnum.JSON;
4546
4647 /**
4748 * @deprecated replaced by {@link #getDataFile()}
138139 {
139140 this.dataFile = dataFile;
140141 }
142
143 @Override
144 public JsonExpressionLanguageEnum getLanguage()
145 {
146 return language;
147 }
148
149 @Override
150 public void setLanguage(JsonExpressionLanguageEnum language)
151 {
152 this.language = language;
153 }
154
141155 }
1414 </field>
1515 <field name="dataFile" type="net.sf.jasperreports.data.DataFile">
1616 <bind-xml name="dataFile" node="element"/>
17 </field>
17 </field>
18 <field name="language" type="string" handler="net.sf.jasperreports.data.json.JsonExpressionLanguageFieldHandler">
19 <bind-xml name="language" node="element"/>
20 </field>
1821 <field name="useConnection" type="boolean">
1922 <bind-xml name="useConnection" node="element"/>
2023 </field>
3232 import net.sf.jasperreports.engine.JRException;
3333 import net.sf.jasperreports.engine.JRParameter;
3434 import net.sf.jasperreports.engine.JasperReportsContext;
35 import net.sf.jasperreports.engine.data.JRAbstractTextDataSource;
36 import net.sf.jasperreports.engine.ParameterContributorContext;
3537 import net.sf.jasperreports.engine.data.JsonDataSource;
38 import net.sf.jasperreports.engine.data.JsonQLDataSource;
3639 import net.sf.jasperreports.engine.query.JsonQueryExecuterFactory;
3740
3841 /**
4649 /**
4750 *
4851 */
49 public JsonDataAdapterService(JasperReportsContext jasperReportsContext, JsonDataAdapter jsonDataAdapter)
52 public JsonDataAdapterService(ParameterContributorContext paramContribContext, JsonDataAdapter jsonDataAdapter)
53 {
54 super(paramContribContext, jsonDataAdapter);
55 }
56
57 /**
58 * @deprecated Replaced by {@link #JsonDataAdapterService(ParameterContributorContext, JsonDataAdapter)}.
59 */
60 public JsonDataAdapterService(JasperReportsContext jasperReportsContext, JsonDataAdapter jsonDataAdapter)
5061 {
5162 super(jasperReportsContext, jsonDataAdapter);
5263 }
6071 throws JRException {
6172 JsonDataAdapter jsonDataAdapter = getJsonDataAdapter();
6273 if (jsonDataAdapter != null) {
63 dataStream = DataFileUtils.instance(getJasperReportsContext()).getDataStream(
74 dataStream = DataFileUtils.instance(getParameterContributorContext()).getDataStream(
6475 jsonDataAdapter.getDataFile(), parameters);
6576
6677 if (jsonDataAdapter.isUseConnection()) {
94105 numberPattern);
95106 }
96107 } else {
97 JsonDataSource ds =
98 new JsonDataSource(
99 dataStream,
100 jsonDataAdapter.getSelectExpression()
101 );
108 JRAbstractTextDataSource ds;
109
110 switch (jsonDataAdapter.getLanguage()) {
111 case JSONQL:
112 ds = new JsonQLDataSource(dataStream, jsonDataAdapter.getSelectExpression());
113 break;
114 case JSON:
115 default:
116 ds = new JsonDataSource(dataStream, jsonDataAdapter.getSelectExpression());
117 break;
118 }
102119
103120 Locale locale = jsonDataAdapter.getLocale();
104121 if (locale != null) {
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.data.json;
24
25 import net.sf.jasperreports.engine.type.EnumUtil;
26 import net.sf.jasperreports.engine.type.NamedEnum;
27
28 /**
29 * @author Narcis Marcu (narcism@users.sourceforge.net)
30 */
31 public enum JsonExpressionLanguageEnum implements NamedEnum {
32
33 /**
34 * The first JSON expression language implementation
35 */
36 JSON("json"),
37
38 /**
39 * The JSON QL expression language implementation
40 */
41 JSONQL("jsonql");
42
43
44 private final transient String name;
45
46
47 JsonExpressionLanguageEnum(String name) {
48 this.name = name;
49 }
50
51 @Override
52 public String getName() {
53 return name;
54 }
55
56 public static JsonExpressionLanguageEnum getByName(String name) {
57 return EnumUtil.getEnumByName(values(), name);
58 }
59 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.data.json;
24
25 import org.exolab.castor.mapping.GeneralizedFieldHandler;
26
27 /**
28 * @author Narcis Marcu (narcism@users.sourceforge.net)
29 */
30 public class JsonExpressionLanguageFieldHandler extends GeneralizedFieldHandler {
31
32 public JsonExpressionLanguageFieldHandler() {
33 super();
34 }
35
36 @Override
37 public Object convertUponGet(Object value) {
38 if (value == null) {
39 return null;
40 }
41 return ((JsonExpressionLanguageEnum)value).getName();
42 }
43
44 @Override
45 public Object convertUponSet(Object value) {
46 if (value == null) {
47 return null;
48 }
49 return JsonExpressionLanguageEnum.getByName((String)value);
50 }
51
52 @Override
53 public Class getFieldType() {
54 return JsonExpressionLanguageEnum.class;
55 }
56
57 @Override
58 public Object newInstance(Object parent) throws IllegalStateException {
59 return null;
60 }
61 }
3131 import net.sf.jasperreports.data.jdbc.JdbcDataAdapterService;
3232 import net.sf.jasperreports.engine.JRException;
3333 import net.sf.jasperreports.engine.JasperReportsContext;
34 import net.sf.jasperreports.engine.ParameterContributorContext;
3435 import net.sf.jasperreports.olap.JRMondrianQueryExecuterFactory;
3536
3637 /**
4243
4344 /**
4445 *
46 */
47 public MondrianDataAdapterService(
48 ParameterContributorContext paramContribContext,
49 MondrianDataAdapter jdbcDataAdapter) {
50 super(paramContribContext, jdbcDataAdapter);
51 }
52
53 /**
54 * @deprecated Replaced by {@link #MondrianDataAdapterService(ParameterContributorContext, MondrianDataAdapter)}.
4555 */
4656 public MondrianDataAdapterService(
4757 JasperReportsContext jasperReportsContext,
3232 import net.sf.jasperreports.engine.JRParameter;
3333 import net.sf.jasperreports.engine.JasperReport;
3434 import net.sf.jasperreports.engine.JasperReportsContext;
35 import net.sf.jasperreports.engine.ParameterContributorContext;
3536 import net.sf.jasperreports.engine.util.JRClassLoader;
3637
3738 /**
4344
4445 /**
4546 *
47 */
48 public DataSourceProviderDataAdapterService(
49 ParameterContributorContext paramContribContext,
50 DataSourceProviderDataAdapter dsDataAdapter
51 )
52 {
53 super(paramContribContext, dsDataAdapter);
54 }
55
56 /**
57 * @deprecated Replaced by {@link #DataSourceProviderDataAdapterService(ParameterContributorContext, DataSourceProviderDataAdapter)}.
4658 */
4759 public DataSourceProviderDataAdapterService(
4860 JasperReportsContext jasperReportsContext,
2626
2727 import net.sf.jasperreports.data.AbstractDataAdapterService;
2828 import net.sf.jasperreports.engine.JasperReportsContext;
29 import net.sf.jasperreports.engine.ParameterContributorContext;
2930
3031
3132 /**
3637
3738 /**
3839 *
40 */
41 public QueryExecuterDataAdapterService(ParameterContributorContext paramContribContext, QueryExecuterDataAdapter qeDataAdapter)
42 {
43 super(paramContribContext, qeDataAdapter);
44 }
45
46 /**
47 * @deprecated Replaced by {@link #QueryExecuterDataAdapterService(ParameterContributorContext, QueryExecuterDataAdapter)}.
3948 */
4049 public QueryExecuterDataAdapterService(JasperReportsContext jasperReportsContext, QueryExecuterDataAdapter qeDataAdapter)
4150 {
3636 import net.sf.jasperreports.engine.JRParameter;
3737 import net.sf.jasperreports.engine.JRPropertiesUtil;
3838 import net.sf.jasperreports.engine.JasperReportsContext;
39 import net.sf.jasperreports.engine.ParameterContributorContext;
3940 import net.sf.jasperreports.engine.data.AbstractXlsDataSource;
4041 import net.sf.jasperreports.engine.query.AbstractXlsQueryExecuterFactory;
4142
5253 /**
5354 *
5455 */
56 public AbstractXlsDataAdapterService(ParameterContributorContext paramContribContext, XlsDataAdapter xlsDataAdapter)
57 {
58 super(paramContribContext, xlsDataAdapter);
59 }
60
61 /**
62 * @deprecated Replaced by {@link #AbstractXlsDataAdapterService(ParameterContributorContext, XlsDataAdapter)}.
63 */
5564 public AbstractXlsDataAdapterService(JasperReportsContext jasperReportsContext, XlsDataAdapter xlsDataAdapter)
5665 {
5766 super(jasperReportsContext, xlsDataAdapter);
6877 XlsDataAdapter xlsDataAdapter = getXlsDataAdapter();
6978 if (xlsDataAdapter != null)
7079 {
71 dataStream = DataFileUtils.instance(getJasperReportsContext()).getDataStream(
80 dataStream = DataFileUtils.instance(getParameterContributorContext()).getDataStream(
7281 xlsDataAdapter.getDataFile(), parameters);
7382
7483 Locale locale = xlsDataAdapter.getLocale();
2828 import net.sf.jasperreports.data.excel.ExcelFormatEnum;
2929 import net.sf.jasperreports.engine.JRException;
3030 import net.sf.jasperreports.engine.JasperReportsContext;
31 import net.sf.jasperreports.engine.ParameterContributorContext;
3132 import net.sf.jasperreports.engine.data.AbstractXlsDataSource;
3233 import net.sf.jasperreports.engine.data.XlsDataSource;
3334 import net.sf.jasperreports.engine.query.ExcelQueryExecuterFactory;
4041
4142 /**
4243 *
44 */
45 public XlsDataAdapterService(ParameterContributorContext paramContribContext, XlsDataAdapter xlsDataAdapter)
46 {
47 super(paramContribContext, xlsDataAdapter);
48 }
49
50 /**
51 * @deprecated Replaced by {@link #XlsDataAdapterService(ParameterContributorContext, XlsDataAdapter)}.
4352 */
4453 public XlsDataAdapterService(JasperReportsContext jasperReportsContext, XlsDataAdapter xlsDataAdapter)
4554 {
3030 import net.sf.jasperreports.data.xls.XlsDataAdapter;
3131 import net.sf.jasperreports.engine.JRException;
3232 import net.sf.jasperreports.engine.JasperReportsContext;
33 import net.sf.jasperreports.engine.ParameterContributorContext;
3334 import net.sf.jasperreports.engine.data.AbstractXlsDataSource;
3435 import net.sf.jasperreports.engine.data.JRXlsxDataSource;
3536 import net.sf.jasperreports.engine.query.ExcelQueryExecuterFactory;
4243
4344 /**
4445 *
46 */
47 public XlsxDataAdapterService(ParameterContributorContext paramContribContext, XlsxDataAdapter xlsxDataAdapter)
48 {
49 super(paramContribContext, xlsxDataAdapter);
50 }
51
52 /**
53 * @deprecated Replaced by {@link #XlsxDataAdapterService(ParameterContributorContext, XlsxDataAdapter)}.
4554 */
4655 public XlsxDataAdapterService(JasperReportsContext jasperReportsContext, XlsxDataAdapter xlsxDataAdapter)
4756 {
3434 import net.sf.jasperreports.engine.JRException;
3535 import net.sf.jasperreports.engine.JRParameter;
3636 import net.sf.jasperreports.engine.JasperReportsContext;
37 import net.sf.jasperreports.engine.ParameterContributorContext;
3738 import net.sf.jasperreports.engine.data.JRXmlDataSource;
3839 import net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory;
3940 import net.sf.jasperreports.engine.util.JRXmlUtils;
4647
4748 /**
4849 *
50 */
51 public XmlDataAdapterService(
52 ParameterContributorContext paramContribContext,
53 XmlDataAdapter xmlDataAdapter
54 )
55 {
56 super(paramContribContext, xmlDataAdapter);
57 }
58
59 /**
60 * @deprecated Replaced by {@link #XmlDataAdapterService(ParameterContributorContext, XmlDataAdapter)}.
4961 */
5062 public XmlDataAdapterService(
5163 JasperReportsContext jasperReportsContext,
135147
136148 protected Document loadDataDocument(XmlDataAdapter xmlDataAdapter, Map<String, Object> parameters) throws JRException
137149 {
138 DataFileUtils dataFileUtils = DataFileUtils.instance(getJasperReportsContext());
150 DataFileUtils dataFileUtils = DataFileUtils.instance(getParameterContributorContext());
139151 DataFileStream dataStream = dataFileUtils.getDataStream(
140152 xmlDataAdapter.getDataFile(), parameters);
141153 try
4040 import net.sf.jasperreports.data.AbstractDataAdapterService;
4141 import net.sf.jasperreports.engine.JRException;
4242 import net.sf.jasperreports.engine.JasperReportsContext;
43 import net.sf.jasperreports.engine.ParameterContributorContext;
4344 import net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuterFactory;
4445 import net.sf.jasperreports.olap.xmla.Olap4jXmlaQueryExecuter;
4546 import net.sf.jasperreports.util.SecretsUtil;
5657
5758 /**
5859 *
60 */
61 public XmlaDataAdapterService(ParameterContributorContext paramContribContext, XmlaDataAdapter dataAdapter)
62 {
63 super(paramContribContext, dataAdapter);
64 }
65
66 /**
67 * @deprecated Replaced by {@link #XmlaDataAdapterService(ParameterContributorContext, XmlaDataAdapter)}.
5968 */
6069 public XmlaDataAdapterService(JasperReportsContext jasperReportsContext, XmlaDataAdapter dataAdapter)
6170 {
149149 // creating empty bookmarks in order to preserve the bookmark level
150150 for (int i = parent.getLevel() + 1; i < level; ++i)
151151 {
152 BasePrintBookmark emptyBookmark = createBookmark(parent, "", parentPrintBookmark.getPageIndex(), parentPrintBookmark.getElementAddress());
152 BasePrintBookmark emptyBookmark = createBookmark(parent, "",
153 parentPrintBookmark.getPageIndex(), parentPrintBookmark.getElementAddress(),
154 parent.getLevel() + 1);
153155 this.push(emptyBookmark);
154156 parent = emptyBookmark;
155157 }
156158 }
157159
158 BasePrintBookmark bookmark = createBookmark(parent, label, pageIndex, elementAddress);
160 BasePrintBookmark bookmark = createBookmark(parent, label, pageIndex, elementAddress,
161 isCollapseMissingBookmarkLevels ? level : parent.getLevel() + 1);
159162 this.push(bookmark);
160163 return bookmark;
161164 }
162165
163 protected BasePrintBookmark createBookmark(BasePrintBookmark parent, String label, int pageIndex, String elementAddress)
164 {
165 int level = parent == null ? 0 : (parent.getLevel() + 1);
166 protected BasePrintBookmark createBookmark(BasePrintBookmark parent, String label,
167 int pageIndex, String elementAddress, int level)
168 {
166169 BasePrintBookmark printBookmark = new BasePrintBookmark(label, pageIndex, elementAddress, level);
167170
168171 if (parent != null)
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine;
24
25 import net.sf.jasperreports.engine.type.PropertyEvaluationTimeEnum;
26
27 /**
28 * Report property with a value based on an expression and an evaluation time attribute.
29 *
30 * @author Teodor Danciu (teodord@users.sourceforge.net)
31 */
32 public interface DatasetPropertyExpression extends JRPropertyExpression
33 {
34
35 /**
36 * Specifies when the property expression is evaluated.
37 */
38 public PropertyEvaluationTimeEnum getEvaluationTime();
39
40 }
3232 *
3333 * @author Lucian Chirita (lucianc@users.sourceforge.net)
3434 */
35 public abstract class JRAbstractChartCustomizer implements JRChartCustomizer
35 public abstract class JRAbstractChartCustomizer implements NamedChartCustomizer
3636 {
37 private JRBaseFiller filler;
37 protected JRFillChart chart;
3838 private JRFillChartDataset chartDataset;
39 protected JRBaseFiller filler;
40 private JRPropertiesUtil propertiesUtil;
41
42 private String name;
3943
4044
4145 /**
4751
4852
4953 /**
54 * @deprecated Replaced by {@link #init(JRFillChart)}.
55 */
56 public void init(JRBaseFiller chartFiller, JRFillChart chart)
57 {
58 init(chart);
59 }
60
61
62 /**
5063 * Initializes the chart customizer.
5164 *
52 * @param chartFiller the filler instance
5365 * @param chart the fill chart object
5466 */
55 public void init(JRBaseFiller chartFiller, JRFillChart chart)
56 {
57 this.filler = chartFiller;
67 public void init(JRFillChart chart)
68 {
69 this.chart = chart;
5870 this.chartDataset = (JRFillChartDataset) chart.getDataset();
71 this.filler = chart.getFiller();
72 this.propertiesUtil = filler.getPropertiesUtil();
5973 }
6074
6175
150164 {
151165 return (fromInputDataset ? chartDataset.getInputDataset() : filler.getMainDataset()).getFieldValue(fieldName);
152166 }
167
168 @Override
169 public void setName(String name)
170 {
171 this.name = name;
172 }
173
174 /**
175 *
176 */
177 public final String getCustomizerPropertyName(String propertySuffix)
178 {
179 return CUSTOMIZER_PROPERTY_PREFIX + (name == null ? "" : name) + "." + propertySuffix;
180 }
181
182 /**
183 *
184 */
185 public final Boolean getBooleanProperty(String propertySuffix)
186 {
187 return propertiesUtil.getBooleanProperty(chart, getCustomizerPropertyName(propertySuffix));
188 }
189
190 /**
191 *
192 */
193 public final String getProperty(String propertySuffix)
194 {
195 return propertiesUtil.getProperty(chart, getCustomizerPropertyName(propertySuffix));
196 }
197
198 /**
199 *
200 */
201 public final Integer getIntegerProperty(String propertySuffix)
202 {
203 return propertiesUtil.getIntegerProperty(chart, getCustomizerPropertyName(propertySuffix));
204 }
205
206 /**
207 *
208 */
209 public final Float getFloatProperty(String propertySuffix)
210 {
211 return propertiesUtil.getFloatProperty(chart, getCustomizerPropertyName(propertySuffix));
212 }
213
214 /**
215 *
216 */
217 public final Double getDoubleProperty(String propertySuffix)
218 {
219 return propertiesUtil.getDoubleProperty(chart, getCustomizerPropertyName(propertySuffix));
220 }
153221 }
3535 import java.util.Map;
3636 import java.util.TimeZone;
3737
38 import net.sf.jasperreports.engine.export.DefaultHyperlinkProducerFactory;
3839 import net.sf.jasperreports.engine.export.ExporterFilter;
3940 import net.sf.jasperreports.engine.export.ExporterFilterFactory;
4041 import net.sf.jasperreports.engine.export.ExporterFilterFactoryUtil;
251252 */
252253 private ReportContext reportContext;
253254 protected E exporterContext;
254
255
255
256
257 /**
258 *
259 */
260 protected JRHyperlinkProducerFactory hyperlinkProducerFactory;
261
256262 /**
257263 *
258264 */
12291235
12301236 public JRHyperlinkProducer getHyperlinkProducer(JRPrintHyperlink link)
12311237 {
1232 JRHyperlinkProducerFactory factory = getCurrentItemConfiguration().getHyperlinkProducerFactory();
1233 return factory == null ? null : factory.getHandler(link.getLinkType());
1238 if (hyperlinkProducerFactory == null)
1239 {
1240 hyperlinkProducerFactory = getCurrentItemConfiguration().getHyperlinkProducerFactory();
1241
1242 if (hyperlinkProducerFactory == null)
1243 {
1244 hyperlinkProducerFactory = new DefaultHyperlinkProducerFactory(jasperReportsContext);
1245 }
1246 }
1247
1248 return hyperlinkProducerFactory.getHandler(link.getLinkType());
12341249 }
12351250
12361251 /**
4141 *
4242 * @author Michael McMahon (Michael.McMahon@activewire.net)
4343 */
44 public interface JRChartCustomizer {
44 public interface JRChartCustomizer
45 {
46 public static final String CUSTOMIZER_PROPERTY_PREFIX = JRPropertiesUtil.PROPERTY_PREFIX + "customizer.";
47 public static final String CUSTOMIZER_CLASS_PROPERTY_PREFIX = CUSTOMIZER_PROPERTY_PREFIX + "class.";
4548
4649 /**
4750 * This method is called at fill time, before the chart is rendered.
123123 public static final String VERSION_6_2_2 = "6.2.2";
124124
125125 public static final String VERSION_6_3_0 = "6.3.0";
126
127 public static final String VERSION_6_3_1 = "6.3.1";
126128 }
102102 */
103103 public JRScriptlet[] getScriptlets();
104104
105
105
106 /**
107 * Returns the list of dynamic/expression-based properties for this dataset.
108 *
109 * @return an array containing the expression-based properties of this dataset
110 */
111 public DatasetPropertyExpression[] getPropertyExpressions();
112
113
106114 /**
107115 * Returns the dataset's parameters.
108116 *
688688 /**
689689 *
690690 */
691 private void collect(JRField[] fields)
692 {
693 if (fields != null && fields.length > 0)
694 {
695 for (JRField field : fields)
696 {
697 collectPropertyExpressions(field.getPropertyExpressions());
698 }
699 }
700 }
701
702 /**
703 *
704 */
691705 private void collect(JRVariable[] variables)
692706 {
693707 if (variables != null && variables.length > 0)
14971511 public Collection<JRExpression> collect(JRDataset dataset)
14981512 {
14991513 JRExpressionCollector collector = getCollector(dataset);
1514 collector.collectPropertyExpressions(dataset.getPropertyExpressions());
15001515 collector.collect(dataset.getParameters());
1516 collector.collect(dataset.getFields());
15011517 collector.collect(dataset.getVariables());
15021518 collector.collect(dataset.getGroups());
15031519
6262 * easily overcome restrictions of field-naming conventions when retrieving the field values
6363 * from the data source:
6464 * <pre>
65 * &lt;field name="PersonName" class="java.lang.String" isForPrompting="true"&gt;
65 * &lt;field name="PersonName" class="java.lang.String"
6666 * &lt;fieldDesciption>PERSON NAME&lt;/fieldDesciption&gt;
6767 * &lt;/field&gt;</pre>
6868 * The field description is less important than in previous versions of the library because
105105 */
106106 public String getValueClassName();
107107
108 /**
109 * Returns the list of dynamic/expression-based properties for this field.
110 *
111 * @return an array containing the expression-based properties of this field
112 */
113 public JRPropertyExpression[] getPropertyExpressions();
114
108115
109116 }
2222 */
2323 package net.sf.jasperreports.engine;
2424
25 import net.sf.jasperreports.engine.type.ParameterEvaluationTimeEnum;
2526 import net.sf.jasperreports.engine.util.FileResolver;
2627
2728
360361 public boolean isForPrompting();
361362
362363 /**
364 * Specifies when the default value expression of a parameter is evaluated.
365 */
366 public ParameterEvaluationTimeEnum getEvaluationTime();
367
368 /**
363369 *
364370 */
365371 public JRExpression getDefaultValueExpression();
249249 }
250250
251251 /**
252 * Converts a <code>String</code> value into a <code>double</code>.
253 *
254 * @param value the value
255 * @return the value as a <code>double</code>
256 */
257 public static double asDouble(String value)
258 {
259 return Double.parseDouble(value == null ? value : value.trim());
260 }
261
262 /**
252263 * Class used by {@link JRPropertiesUtil#getProperties(String)}.
253264 *
254265 * @author Lucian Chirita
565576 }
566577
567578 /**
579 * Returns the value of a property as a Boolean, looking first in the supplied properties holder
580 * and then in the system properties.
581 *
582 * @param propertiesHolder the properties holder
583 * @param key the key
584 * @return the property value
585 */
586 public Boolean getBooleanProperty(JRPropertiesHolder propertiesHolder, String key)
587 {
588 String value = getProperty(propertiesHolder, key);
589
590 return value == null ? null : asBoolean(value);
591 }
592
593 /**
568594 * Returns the value of a property as an Integer, looking first in the supplied properties holder
569595 * and then in the system properties.
570596 *
756782 return value == null ? defaultValue : asLong(value);
757783 }
758784
785 /**
786 * Returns the value of a property as a Double, looking first in the supplied properties holder
787 * and then in the system properties.
788 *
789 * @param propertiesHolder the properties holder
790 * @param key the key
791 * @return the property value
792 */
793 public Double getDoubleProperty(JRPropertiesHolder propertiesHolder, String key)
794 {
795 String value = getProperty(propertiesHolder, key);
796
797 return value == null ? null : asDouble(value);
798 }
799
759800 protected static JRPropertiesMap getOwnProperties(JRPropertiesHolder propertiesHolder)
760801 {
761802 return propertiesHolder.hasProperties() ? propertiesHolder.getPropertiesMap() : null;
277277 public interface JRReport extends JRDefaultStyleProvider, JRPropertiesHolder, JRIdentifiable
278278 {
279279
280 /**
281 * Property that specifies a default value for the <code>whenNoDataType</code> attribute of report.
282 */
283 public static final String CONFIG_PROPERTY_WHEN_NO_DATA_TYPE = JRPropertiesUtil.PROPERTY_PREFIX + "when.no.data.type";
280284
281285 /**
282286 * A constant used to specify that the language used by expressions is Java.
437441 */
438442 public void removeProperty(String name);
439443
444 /**
445 * Returns the list of dynamic/expression-based properties for this report.
446 *
447 * @return an array containing the expression-based properties of this report
448 */
449 public DatasetPropertyExpression[] getPropertyExpressions();
450
440451 /**
441452 * Gets an array of imports (needed if report expression require additional classes in order to compile).
442453 */
7272
7373 private static final Log log = LogFactory.getLog(JRResultSetDataSource.class);
7474
75 /**
76 * Property specifying the result set column name for the dataset field.
77 */
78 public static final String PROPERTY_FIELD_COLUMN_NAME = JRPropertiesUtil.PROPERTY_PREFIX + "sql.field.column.name";
79 /**
80 * Property specifying the result set column label for the dataset field.
81 */
82 public static final String PROPERTY_FIELD_COLUMN_LABEL = JRPropertiesUtil.PROPERTY_PREFIX + "sql.field.column.label";
83 /**
84 * Property specifying the result set column index for the dataset field.
85 */
86 public static final String PROPERTY_FIELD_COLUMN_INDEX = JRPropertiesUtil.PROPERTY_PREFIX + "sql.field.column.index";
7587 public static final String INDEXED_COLUMN_PREFIX = "COLUMN_";
7688 private static final int INDEXED_COLUMN_PREFIX_LENGTH = INDEXED_COLUMN_PREFIX.length();
7789
8092 public static final String EXCEPTION_MESSAGE_KEY_RESULT_SET_FIELD_VALUE_NOT_RETRIEVED = "data.result.set.field.value.not.retrieved";
8193 public static final String EXCEPTION_MESSAGE_KEY_RESULT_SET_METADATA_NOT_RETRIEVED = "data.result.set.metadata.not.retrieved";
8294 public static final String EXCEPTION_MESSAGE_KEY_RESULT_SET_UNKNOWN_COLUMN_NAME = "data.result.set.unknown.column.name";
95 public static final String EXCEPTION_MESSAGE_KEY_RESULT_SET_UNKNOWN_COLUMN_LABEL = "data.result.set.unknown.column.label";
8396 public static final String EXCEPTION_MESSAGE_KEY_RESULT_SET_NEXT_RECORD_NOT_RETRIEVED = "data.result.set.next.record.not.retrieved";
8497
8598
147160
148161 if (field != null && resultSet != null)
149162 {
150 Integer columnIndex = getColumnIndex(field.getName());
163 Integer columnIndex = getColumnIndex(field);
151164 Class<?> clazz = field.getValueClass();
152165
153166 try
415428 /**
416429 *
417430 */
418 private Integer getColumnIndex(String fieldName) throws JRException
419 {
431 private Integer getColumnIndex(JRField field) throws JRException
432 {
433 String fieldName = field.getName();
420434 Integer columnIndex = columnIndexMap.get(fieldName);
421435 if (columnIndex == null)
422436 {
423437 try
424438 {
425 columnIndex = searchColumnByName(fieldName);
439 columnIndex = searchColumnByName(field);
426440
427441 if (columnIndex == null)
428442 {
443 columnIndex = searchColumnByLabel(field);
444 }
445
446 if (columnIndex == null)
447 {
448 columnIndex = searchColumnByIndex(field);
449 }
450
451 if (columnIndex == null)
452 {
453 columnIndex = searchColumnByName(fieldName);
454 }
455
456 if (columnIndex == null)
457 {
429458 columnIndex = searchColumnByLabel(fieldName);
430459 }
431460
432461 if (columnIndex == null && fieldName.startsWith(INDEXED_COLUMN_PREFIX))
433462 {
434 columnIndex = Integer.valueOf(fieldName.substring(INDEXED_COLUMN_PREFIX_LENGTH));
435 if (
436 columnIndex.intValue() <= 0
437 || columnIndex.intValue() > resultSet.getMetaData().getColumnCount()
438 )
439 {
440 throw
441 new JRException(
442 EXCEPTION_MESSAGE_KEY_RESULT_SET_COLUMN_INDEX_OUT_OF_RANGE,
443 new Object[]{columnIndex});
444 }
463 columnIndex = searchColumnByIndex(fieldName.substring(INDEXED_COLUMN_PREFIX_LENGTH));
445464 }
446465
447466 if (columnIndex == null)
484503 }
485504
486505
487 protected Integer searchColumnByName(String fieldName) throws SQLException
506 protected Integer searchColumnByName(JRField field) throws SQLException, JRException
507 {
508 if (field.hasProperties())
509 {
510 String name = field.getPropertiesMap().getProperty(PROPERTY_FIELD_COLUMN_NAME);
511 if (name != null)
512 {
513 Integer columnIndex = searchColumnByName(name);
514 if (columnIndex == null)
515 {
516 throw
517 new JRException(
518 EXCEPTION_MESSAGE_KEY_RESULT_SET_UNKNOWN_COLUMN_NAME,
519 new Object[]{name});
520 }
521 return columnIndex;
522 }
523 }
524
525 return null;
526 }
527
528
529 protected Integer searchColumnByName(String name) throws SQLException
488530 {
489531 Integer columnIndex = null;
490532 ResultSetMetaData metadata = resultSet.getMetaData();
491533 for(int i = 1; i <= metadata.getColumnCount(); i++)
492534 {
493535 String columnName = metadata.getColumnName(i);
494 if (fieldName.equalsIgnoreCase(columnName))
536 if (name.equalsIgnoreCase(columnName))
495537 {
496538 columnIndex = Integer.valueOf(i);
497539 break;
501543 }
502544
503545
504 protected Integer searchColumnByLabel(String fieldName) throws SQLException
546 protected Integer searchColumnByLabel(JRField field) throws SQLException, JRException
547 {
548 if (field.hasProperties())
549 {
550 String label = field.getPropertiesMap().getProperty(PROPERTY_FIELD_COLUMN_LABEL);
551 if (label != null)
552 {
553 Integer columnIndex = searchColumnByLabel(label);
554 if (columnIndex == null)
555 {
556 throw
557 new JRException(
558 EXCEPTION_MESSAGE_KEY_RESULT_SET_UNKNOWN_COLUMN_LABEL,
559 new Object[]{label});
560 }
561 return columnIndex;
562 }
563 }
564 return null;
565 }
566
567
568 protected Integer searchColumnByLabel(String label) throws SQLException
505569 {
506570 Integer columnIndex = null;
507571 ResultSetMetaData metadata = resultSet.getMetaData();
508572 for(int i = 1; i <= metadata.getColumnCount(); i++)
509573 {
510574 String columnLabel = metadata.getColumnLabel(i);
511 if (columnLabel != null && fieldName.equalsIgnoreCase(columnLabel))
575 if (columnLabel != null && label.equalsIgnoreCase(columnLabel))
512576 {
513577 columnIndex = Integer.valueOf(i);
514578 break;
515579 }
516580 }
581 return columnIndex;
582 }
583
584
585 protected Integer searchColumnByIndex(JRField field) throws SQLException, JRException
586 {
587 if (field.hasProperties())
588 {
589 String index = field.getPropertiesMap().getProperty(PROPERTY_FIELD_COLUMN_INDEX);
590 if (index != null)
591 {
592 return searchColumnByIndex(index);
593 }
594 }
595
596 return null;
597 }
598
599
600 protected Integer searchColumnByIndex(String index) throws SQLException, JRException
601 {
602 Integer columnIndex = Integer.valueOf(index);
603 if (
604 columnIndex.intValue() <= 0
605 || columnIndex.intValue() > resultSet.getMetaData().getColumnCount()
606 )
607 {
608 throw
609 new JRException(
610 EXCEPTION_MESSAGE_KEY_RESULT_SET_COLUMN_INDEX_OUT_OF_RANGE,
611 new Object[]{columnIndex});
612 }
613
517614 return columnIndex;
518615 }
519616
00 /*
11 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2005 - 2016 Works, Inc. All rights reserved.
2 * Copyright (C) 2005 Works, Inc. All rights reserved.
33 * http://www.works.com
4 * Copyright (C) 2005 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
46 *
57 * Unless you have purchased a commercial license agreement from Jaspersoft,
68 * the following license terms apply:
00 /*
11 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2005 - 2016 Works, Inc. All rights reserved.
2 * Copyright (C) 2005 Works, Inc. All rights reserved.
33 * http://www.works.com
4 * Copyright (C) 2005 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
46 *
57 * Unless you have purchased a commercial license agreement from Jaspersoft,
68 * the following license terms apply:
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine;
24
25 /**
26 * Interface that represents a {@link net.sf.jasperreports.engine.JRChartCustomizer JRChartCustomizer} that is assigned
27 * a name after being instantiated using the default empty constructor. It will use that name to retrieve custom properties from
28 * the chart element, properties that are considered to be for its own use, having the name as part of the property name.
29 *
30 * @author Teodor Danciu (teodord@users.sourceforge.net)
31 */
32 public interface NamedChartCustomizer extends JRChartCustomizer
33 {
34 /**
35 *
36 */
37 public void setName(String name);
38 }
2424
2525 import net.sf.jasperreports.engine.JRException;
2626 import net.sf.jasperreports.engine.analytics.data.MultiAxisDataSource;
27 import net.sf.jasperreports.engine.fill.JRFillCloneFactory;
2728 import net.sf.jasperreports.engine.fill.JRFillObjectFactory;
2829
2930 /**
4041
4142 this.fillDataset = new FillMultiAxisDataset(data, factory);
4243 }
44
45 public FillMultiAxisData(FillMultiAxisData data, JRFillCloneFactory factory)
46 {
47 this.fillDataset = new FillMultiAxisDataset(data.fillDataset, factory);
48 }
4349
4450 public void evaluate(byte evaluationType) throws JRException
4551 {
3030 import net.sf.jasperreports.engine.analytics.data.MultiAxisDataSource;
3131 import net.sf.jasperreports.engine.fill.JRCalculator;
3232 import net.sf.jasperreports.engine.fill.JRExpressionEvalException;
33 import net.sf.jasperreports.engine.fill.JRFillCloneFactory;
3334 import net.sf.jasperreports.engine.fill.JRFillElementDataset;
3435 import net.sf.jasperreports.engine.fill.JRFillExpressionEvaluator;
3536 import net.sf.jasperreports.engine.fill.JRFillObjectFactory;
5556 this.expressionEvaluator = factory.getExpressionEvaluator();
5657
5758 factory.registerElementDataset(this);
59 }
60
61 public FillMultiAxisDataset(FillMultiAxisDataset dataset, JRFillCloneFactory factory)
62 {
63 super(dataset, factory);
64
65 this.jasperReportsContext = dataset.jasperReportsContext;
66 this.data = dataset.data;
67 this.expressionEvaluator = dataset.expressionEvaluator;
5868 }
5969
6070 @Override
106116
107117 public MultiAxisDataSource getDataSource() throws JRException
108118 {
119 //a final increment is needed when incrementType=Group
120 //FIXME perform the increment when the data set ends instead of here
121 increment();
122
109123 return dataService.createDataSource();
110124 }
111125
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.base;
24
25 import net.sf.jasperreports.engine.JRConstants;
26 import net.sf.jasperreports.engine.DatasetPropertyExpression;
27 import net.sf.jasperreports.engine.type.PropertyEvaluationTimeEnum;
28
29 /**
30 * Base implementation of {@link DatasetPropertyExpression}.
31 *
32 * @author Teodor Danciu (teodord@users.sourceforge.net)
33 */
34 public class BaseDatasetPropertyExpression extends JRBasePropertyExpression implements DatasetPropertyExpression
35 {
36 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
37
38 public static final String PROPERTY_EVALUATION_TIME = "evaluationTime";
39
40 private PropertyEvaluationTimeEnum evaluationTime;
41
42 protected BaseDatasetPropertyExpression()
43 {
44 //empty
45 }
46
47 public BaseDatasetPropertyExpression(
48 DatasetPropertyExpression propertyExpression,
49 JRBaseObjectFactory factory)
50 {
51 super(propertyExpression, factory);
52 this.evaluationTime = propertyExpression.getEvaluationTime();
53 }
54
55 @Override
56 public PropertyEvaluationTimeEnum getEvaluationTime()
57 {
58 return evaluationTime;
59 }
60
61 protected void setEvaluationTime(PropertyEvaluationTimeEnum evaluationTime)
62 {
63 Object old = this.evaluationTime;
64 this.evaluationTime = evaluationTime;
65 getEventSupport().firePropertyChange(PROPERTY_EVALUATION_TIME, old, this.evaluationTime);
66 }
67 }
2727 import java.io.Serializable;
2828 import java.util.UUID;
2929
30 import net.sf.jasperreports.engine.DatasetPropertyExpression;
3031 import net.sf.jasperreports.engine.JRConstants;
3132 import net.sf.jasperreports.engine.JRDataset;
3233 import net.sf.jasperreports.engine.JRExpression;
7172 protected WhenResourceMissingTypeEnum whenResourceMissingTypeValue = WhenResourceMissingTypeEnum.NULL;
7273 protected JRPropertiesMap propertiesMap;
7374 protected JRExpression filterExpression;
75
76 private DatasetPropertyExpression[] propertyExpressions;
7477
7578 protected JRBaseDataset(boolean isMain)
7679 {
9194
9295 /* */
9396 this.propertiesMap = dataset.getPropertiesMap().cloneProperties();
97 propertyExpressions = factory.getPropertyExpressions(dataset.getPropertyExpressions());
9498
9599 query = factory.getQuery(dataset.getQuery());
96100
275279 }
276280
277281 @Override
282 public DatasetPropertyExpression[] getPropertyExpressions()
283 {
284 return propertyExpressions;
285 }
286
287 @Override
278288 public JRExpression getFilterExpression()
279289 {
280290 return filterExpression;
300310 {
301311 clone.propertiesMap = (JRPropertiesMap)propertiesMap.clone();
302312 }
313 clone.propertyExpressions = JRCloneUtils.cloneArray(propertyExpressions);
303314
304315 clone.parameters = JRCloneUtils.cloneArray(parameters);
305316 clone.fields = JRCloneUtils.cloneArray(fields);
159159 elementGroup = (JRElementGroup)factory.getVisitResult(element.getElementGroup());
160160
161161 propertiesMap = JRPropertiesMap.getPropertiesClone(element);
162 copyPropertyExpressions(element, factory);
163 }
164
165
166 private void copyPropertyExpressions(JRElement element,
167 JRBaseObjectFactory factory)
168 {
169 JRPropertyExpression[] props = element.getPropertyExpressions();
170 if (props != null && props.length > 0)
171 {
172 propertyExpressions = new JRPropertyExpression[props.length];
173 for (int i = 0; i < props.length; i++)
174 {
175 propertyExpressions[i] = factory.getPropertyExpression(props[i]);
176 }
177 }
162 propertyExpressions = factory.getPropertyExpressions(element.getPropertyExpressions());
178163 }
179164
180165
2828 import net.sf.jasperreports.engine.JRField;
2929 import net.sf.jasperreports.engine.JRPropertiesHolder;
3030 import net.sf.jasperreports.engine.JRPropertiesMap;
31 import net.sf.jasperreports.engine.JRPropertyExpression;
3132 import net.sf.jasperreports.engine.JRRuntimeException;
3233 import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
3334 import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
3435 import net.sf.jasperreports.engine.util.JRClassLoader;
36 import net.sf.jasperreports.engine.util.JRCloneUtils;
3537
3638
3739 /**
6062
6163 protected JRPropertiesMap propertiesMap;
6264
65 private JRPropertyExpression[] propertyExpressions;
66
6367
6468 /**
6569 *
8185 description = field.getDescription();
8286 valueClassName = field.getValueClassName();
8387
84 this.propertiesMap = field.getPropertiesMap().cloneProperties();
85 }
86
88 propertiesMap = field.getPropertiesMap().cloneProperties();
89 propertyExpressions = factory.getPropertyExpressions(field.getPropertyExpressions());
90 }
91
8792
8893 @Override
8994 public String getName()
169174
170175
171176 @Override
177 public JRPropertyExpression[] getPropertyExpressions()
178 {
179 return propertyExpressions;
180 }
181
182
183 @Override
172184 public Object clone()
173185 {
174186 JRBaseField clone = null;
182194 throw new JRRuntimeException(e);
183195 }
184196
185 if (propertiesMap != null)
197 if (propertiesMap != null) // attempt to use properties cloning utility results in clones having this field null, if it was non-null but empty
186198 {
187199 clone.propertiesMap = (JRPropertiesMap)propertiesMap.clone();
188200 }
189
201 clone.propertyExpressions = JRCloneUtils.cloneArray(propertyExpressions);
190202 clone.eventSupport = null;
191203
192204 return clone;
104104 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabMeasure;
105105 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabParameter;
106106 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabRowGroup;
107 import net.sf.jasperreports.engine.DatasetPropertyExpression;
107108 import net.sf.jasperreports.engine.ExpressionReturnValue;
108109 import net.sf.jasperreports.engine.JRAbstractObjectFactory;
109110 import net.sf.jasperreports.engine.JRBand;
16641665 return baseTemplate;
16651666 }
16661667
1668 public JRPropertyExpression[] getPropertyExpressions(JRPropertyExpression[] props)
1669 {
1670 JRPropertyExpression[] propertyExpressions = null;
1671 if (props != null && props.length > 0)
1672 {
1673 propertyExpressions = new JRPropertyExpression[props.length];
1674 for (int i = 0; i < props.length; i++)
1675 {
1676 propertyExpressions[i] = getPropertyExpression(props[i]);
1677 }
1678 }
1679 return propertyExpressions;
1680 }
1681
16671682 public JRPropertyExpression getPropertyExpression(JRPropertyExpression propertyExpression)
16681683 {
16691684 JRPropertyExpression baseProp = null;
16781693 return baseProp;
16791694 }
16801695
1696 public DatasetPropertyExpression[] getPropertyExpressions(DatasetPropertyExpression[] props)
1697 {
1698 DatasetPropertyExpression[] propertyExpressions = null;
1699 if (props != null && props.length > 0)
1700 {
1701 propertyExpressions = new DatasetPropertyExpression[props.length];
1702 for (int i = 0; i < props.length; i++)
1703 {
1704 propertyExpressions[i] = getPropertyExpression(props[i]);
1705 }
1706 }
1707 return propertyExpressions;
1708 }
1709
1710 public DatasetPropertyExpression getPropertyExpression(DatasetPropertyExpression propertyExpression)
1711 {
1712 DatasetPropertyExpression baseProp = null;
1713 if (propertyExpression != null)
1714 {
1715 baseProp = (DatasetPropertyExpression) get(propertyExpression);
1716 if (baseProp == null)
1717 {
1718 baseProp = new BaseDatasetPropertyExpression(propertyExpression, this);
1719 }
1720 }
1721 return baseProp;
1722 }
1723
16811724
16821725 @Override
16831726 public void visitComponentElement(JRComponentElement componentElement)
3232 import net.sf.jasperreports.engine.JRRuntimeException;
3333 import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
3434 import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
35 import net.sf.jasperreports.engine.type.ParameterEvaluationTimeEnum;
3536 import net.sf.jasperreports.engine.util.JRClassLoader;
3637 import net.sf.jasperreports.engine.util.JRCloneUtils;
3738
6061 protected String nestedTypeName;
6162 protected boolean isSystemDefined;
6263 protected boolean isForPrompting = true;
64 protected ParameterEvaluationTimeEnum evaluationTime;
6365
6466 protected transient Class<?> valueClass;
6567 protected transient Class<?> nestedType;
9496 nestedTypeName = parameter.getNestedTypeName();
9597 isSystemDefined = parameter.isSystemDefined();
9698 isForPrompting = parameter.isForPrompting();
99 evaluationTime = parameter.getEvaluationTime();
97100
98101 defaultValueExpression = factory.getExpression(parameter.getDefaultValueExpression());
99102
190193 @Override
191194 public boolean isSystemDefined()
192195 {
193 return this.isSystemDefined;
196 return isSystemDefined;
194197 }
195198
196199 @Override
197200 public boolean isForPrompting()
198201 {
199 return this.isForPrompting;
202 return isForPrompting;
203 }
204
205 @Override
206 public ParameterEvaluationTimeEnum getEvaluationTime()
207 {
208 return evaluationTime;
200209 }
201210
202211 @Override
203212 public JRExpression getDefaultValueExpression()
204213 {
205 return this.defaultValueExpression;
214 return defaultValueExpression;
206215 }
207216
208217
4343 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
4444
4545 public static final String PROPERTY_NAME = "name";
46 public static final String pROPERTY_VALUE_EXPRESSION = "valueExpression";
46 public static final String PROPERTY_VALUE_EXPRESSION = "valueExpression";
47 /**
48 * @deprecated Replaced by {@link #PROPERTY_VALUE_EXPRESSION}.
49 */
50 public static final String pROPERTY_VALUE_EXPRESSION = PROPERTY_VALUE_EXPRESSION;
4751
4852 private String name;
4953 private JRExpression valueExpression;
8488 {
8589 Object old = this.valueExpression;
8690 this.valueExpression = valueExpression;
87 getEventSupport().firePropertyChange(pROPERTY_VALUE_EXPRESSION, old, this.valueExpression);
91 getEventSupport().firePropertyChange(PROPERTY_VALUE_EXPRESSION, old, this.valueExpression);
8892 }
8993
9094 @Override
3232 import java.util.Set;
3333 import java.util.UUID;
3434
35 import net.sf.jasperreports.engine.DatasetPropertyExpression;
3536 import net.sf.jasperreports.engine.JRBand;
3637 import net.sf.jasperreports.engine.JRConstants;
3738 import net.sf.jasperreports.engine.JRDataset;
9293 protected int pageWidth = 595;
9394 protected int pageHeight = 842;
9495 protected OrientationEnum orientationValue = OrientationEnum.PORTRAIT;
95 protected WhenNoDataTypeEnum whenNoDataTypeValue = WhenNoDataTypeEnum.NO_PAGES;
96 protected WhenNoDataTypeEnum whenNoDataTypeValue;
9697 protected SectionTypeEnum sectionType = SectionTypeEnum.BAND;
9798 protected int columnWidth = 555;
9899 protected int columnSpacing;
454455 }
455456
456457 @Override
458 public DatasetPropertyExpression[] getPropertyExpressions()
459 {
460 return mainDataset.getPropertyExpressions();
461 }
462
463 @Override
457464 public String[] getImports()
458465 {
459466 if (importsSet != null)
00 /*
11 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2005 - 2016 Works, Inc. All rights reserved.
2 * Copyright (C) 2005 Works, Inc. All rights reserved.
33 * http://www.works.com
4 * Copyright (C) 2005 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
46 *
57 * Unless you have purchased a commercial license agreement from Jaspersoft,
68 * the following license terms apply:
3131 import java.util.LinkedHashMap;
3232 import java.util.Map;
3333
34 import org.apache.poi.ss.usermodel.Cell;
35 import org.apache.poi.ss.usermodel.FormulaEvaluator;
36 import org.apache.poi.ss.usermodel.Row;
37 import org.apache.poi.ss.usermodel.Sheet;
38 import org.apache.poi.ss.usermodel.Workbook;
39
3440 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
3541 import net.sf.jasperreports.engine.JRException;
3642 import net.sf.jasperreports.engine.JRField;
3945 import net.sf.jasperreports.engine.util.FormatUtils;
4046 import net.sf.jasperreports.repo.RepositoryUtil;
4147
42 import org.apache.poi.ss.usermodel.Cell;
43 import org.apache.poi.ss.usermodel.FormulaEvaluator;
44 import org.apache.poi.ss.usermodel.Row;
45 import org.apache.poi.ss.usermodel.Sheet;
46 import org.apache.poi.ss.usermodel.Workbook;
47
4848
4949 /**
5050 * This data source implementation reads an XLSX or XLS stream.
225225 @Override
226226 public Object getFieldValue(JRField jrField) throws JRException
227227 {
228 String fieldName = jrField.getName();
229228 Class<?> valueClass = jrField.getValueClass();
230229 try
231230 {
232
233 Integer columnIndex = columnNames.get(fieldName);
234 if (columnIndex == null && fieldName.startsWith("COLUMN_"))
235 {
236 columnIndex = Integer.valueOf(fieldName.substring(7));
237 }
238 if (columnIndex == null)
239 {
240 throw
241 new JRException(
242 EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME,
243 new Object[]{fieldName});
244 }
231 Integer columnIndex = getColumnIndex(jrField);
232
245233 Sheet sheet = workbook.getSheetAt(sheetIndex);
246234 Cell cell = sheet.getRow(recordIndex).getCell(columnIndex);
247235 if(cell == null)
2626 import java.text.DecimalFormat;
2727 import java.text.NumberFormat;
2828 import java.text.SimpleDateFormat;
29 import java.util.HashMap;
2930 import java.util.LinkedHashMap;
3031 import java.util.Map;
3132
33 import net.sf.jasperreports.engine.JRException;
34 import net.sf.jasperreports.engine.JRField;
35 import net.sf.jasperreports.engine.JRPropertiesUtil;
3236 import net.sf.jasperreports.engine.JRRewindableDataSource;
3337 import net.sf.jasperreports.engine.JRRuntimeException;
3438
4953 public static final String EXCEPTION_MESSAGE_KEY_XLS_SHEET_INDEX_OUT_OF_RANGE = "data.xls.sheet.index.out.of.range";
5054 public static final String EXCEPTION_MESSAGE_KEY_XLS_SHEET_NOT_FOUND = "data.xls.sheet.not.found";
5155
56 /**
57 * Property specifying the XLS column name for the dataset field.
58 */
59 public static final String PROPERTY_FIELD_COLUMN_NAME = JRPropertiesUtil.PROPERTY_PREFIX + "xls.field.column.name";
60 /**
61 * Property specifying the XLS column index for the dataset field.
62 */
63 public static final String PROPERTY_FIELD_COLUMN_INDEX = JRPropertiesUtil.PROPERTY_PREFIX + "xls.field.column.index";
64 public static final String INDEXED_COLUMN_PREFIX = "COLUMN_";
65 private static final int INDEXED_COLUMN_PREFIX_LENGTH = INDEXED_COLUMN_PREFIX.length();
66
5267 protected String sheetSelection;
5368
5469 protected DateFormat dateFormat = new SimpleDateFormat();
5671 protected Map<String, Integer> columnNames = new LinkedHashMap<String, Integer>();
5772 protected boolean useFirstRowAsHeader;
5873
74 protected Map<String,Integer> columnIndexMap = new HashMap<String,Integer>();
75
5976
6077 /**
6178 * Gets the date format that will be used to parse date fields.
188205 this.sheetSelection = sheetSelection;
189206 }
190207
208
209 protected Integer getColumnIndex(JRField field) throws JRException
210 {
211 String fieldName = field.getName();
212 Integer columnIndex = columnIndexMap.get(fieldName);
213 if (columnIndex == null)
214 {
215 if (field.hasProperties())
216 {
217 String columnName = field.getPropertiesMap().getProperty(PROPERTY_FIELD_COLUMN_NAME);
218 if (columnName != null)
219 {
220 columnIndex = columnNames.get(columnName);
221 if (columnIndex == null)
222 {
223 throw
224 new JRException(
225 EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME,
226 new Object[]{columnName});
227 }
228 }
229 }
230
231 if (columnIndex == null)
232 {
233 if (field.hasProperties())
234 {
235 String index = field.getPropertiesMap().getProperty(PROPERTY_FIELD_COLUMN_INDEX);
236 if (index != null)
237 {
238 columnIndex = Integer.valueOf(index);
239 }
240 }
241 }
242
243 if (columnIndex == null)
244 {
245 columnIndex = columnNames.get(fieldName);
246 }
247
248 if (columnIndex == null && fieldName.startsWith(INDEXED_COLUMN_PREFIX))
249 {
250 columnIndex = Integer.valueOf(fieldName.substring(INDEXED_COLUMN_PREFIX_LENGTH));
251 }
252
253 if (columnIndex == null)
254 {
255 throw
256 new JRException(
257 EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME,
258 new Object[]{fieldName});
259 }
260
261 columnIndexMap.put(fieldName, columnIndex);
262 }
263
264 return columnIndex;
265 }
191266 }
192267
193268
2727 */
2828 package net.sf.jasperreports.engine.data;
2929
30 import java.util.HashMap;
31 import java.util.Map;
32
3033 import org.w3c.dom.Document;
3134 import org.w3c.dom.Node;
3235 import org.w3c.dom.NodeList;
3336
3437 import net.sf.jasperreports.engine.JRException;
3538 import net.sf.jasperreports.engine.JRField;
39 import net.sf.jasperreports.engine.JRPropertiesUtil;
3640 import net.sf.jasperreports.engine.JRRewindableDataSource;
3741
3842 /**
4347 * by an XPath expression from the xml document.
4448 * </p>
4549 * <p>
46 * Each field can provide an additional XPath expresion that will be used to
47 * select its value. This expression must be specified using the "fieldDescription"
48 * element of the field. The expression is evaluated in the context of the current
50 * Each field can provide an additional XPath expression that will be used to
51 * select its value. This expression must be specified using the {@link #PROPERTY_FIELD_EXPRESSION}
52 * custom property at field level. The use of the {@link net.sf.jasperreports.engine.JRField#getDescription() field description} to specify the XPath expression
53 * is still supported, but is now discouraged, the above mentioned custom property taking precedence
54 * over the field description. In case no XPath expression is specified, the name of the field will be used for the selection of the value.
55 * The expression is evaluated in the context of the current
4956 * node thus the expression should be relative to the current node.
5057 * </p>
5158 * <p>
106113 * </p>
107114 * @author Narcis Marcu (narcism@users.sourceforge.net)
108115 */
109 public abstract class AbstractXmlDataSource extends JRAbstractTextDataSource implements JRRewindableDataSource {
116 public abstract class AbstractXmlDataSource<T extends AbstractXmlDataSource<?>> extends JRAbstractTextDataSource implements JRRewindableDataSource
117 {
118 /**
119 * Property specifying the XPath expression for the dataset field.
120 */
121 public static final String PROPERTY_FIELD_EXPRESSION = JRPropertiesUtil.PROPERTY_PREFIX + "xpath.field.expression";
122
123 private Map<String, String> fieldExpressions = new HashMap<String, String>();
124
110125
111126 public abstract Node getCurrentNode();
112127
113 public abstract Object getSelectObject(Node currentNode, String expression) throws JRException ;
128 public abstract Object getSelectObject(Node currentNode, String expression) throws JRException;
114129
115130
116131 /*
125140 {
126141 return null;
127142 }
128 String expression = jrField.getDescription();
143
144 String expression = null;
145 if (fieldExpressions.containsKey(jrField.getName()))
146 {
147 expression = fieldExpressions.get(jrField.getName());
148 }
149 else
150 {
151 expression = getFieldExpression(jrField);
152 fieldExpressions.put(jrField.getName(), expression);
153 }
129154 if (expression == null || expression.length() == 0)
130155 {
131156 return null;
132157 }
158
133159 Object value = null;
134160
135161 Class<?> valueClass = jrField.getValueClass();
179205 * @throws JRException if the sub data source couldn't be created
180206 * @see JRXmlDataSource#JRXmlDataSource(Document, String)
181207 */
182 public abstract AbstractXmlDataSource subDataSource(String selectExpr) throws JRException;
208 public abstract T subDataSource(String selectExpr) throws JRException;
183209
184210 /**
185211 * Creates a sub data source using the current node (record) as the root
191217 * @see JRXmlDataSource#subDataSource(String)
192218 * @see JRXmlDataSource#JRXmlDataSource(Document)
193219 */
194 public AbstractXmlDataSource subDataSource() throws JRException {
220 public T subDataSource() throws JRException {
195221 return subDataSource(".");
196222 }
197223
215241 * @throws JRException if the sub data source couldn't be created
216242 * @see JRXmlDataSource#JRXmlDataSource(Document, String)
217243 */
218 public abstract AbstractXmlDataSource dataSource(String selectExpr) throws JRException;
244 public abstract T dataSource(String selectExpr) throws JRException;
219245
220246 /**
221247 * Creates a sub data source using as root document the document used by "this" data source.
226252 * @see JRXmlDataSource#dataSource(String)
227253 * @see JRXmlDataSource#JRXmlDataSource(Document)
228254 */
229 public AbstractXmlDataSource dataSource() throws JRException {
255 public T dataSource() throws JRException {
230256 return dataSource(".");
231257 }
232258
282308 return result.toString();
283309 }
284310
311 protected String getFieldExpression(JRField field)
312 {
313 String fieldExpression = null;
314 if (field.hasProperties())
315 {
316 fieldExpression = field.getPropertiesMap().getProperty(PROPERTY_FIELD_EXPRESSION);
317 }
318 if (fieldExpression == null || fieldExpression.length() == 0)
319 {
320 fieldExpression = field.getDescription();
321 if (fieldExpression == null || fieldExpression.length() == 0)
322 {
323 fieldExpression = field.getName();
324 }
325 }
326 return fieldExpression;
327 }
285328 }
2222 */
2323 package net.sf.jasperreports.engine.data;
2424
25 import java.util.HashMap;
26 import java.util.Map;
27
28 import org.apache.commons.beanutils.NestedNullException;
29 import org.apache.commons.beanutils.PropertyUtils;
30
2531 import net.sf.jasperreports.engine.JRException;
2632 import net.sf.jasperreports.engine.JRField;
33 import net.sf.jasperreports.engine.JRPropertiesUtil;
2734 import net.sf.jasperreports.engine.JRRewindableDataSource;
28
29 import org.apache.commons.beanutils.NestedNullException;
30 import org.apache.commons.beanutils.PropertyUtils;
3135
3236
3337 /**
3741 {
3842
3943 public static final String EXCEPTION_MESSAGE_KEY_BEAN_FIELD_VALUE_NOT_RETRIEVED = "data.bean.field.value.not.retrieved";
44
45 /**
46 * Property specifying the JavaBean property name for the dataset field.
47 */
48 public static final String PROPERTY_JAVABEAN_FIELD_PROPERTY = JRPropertiesUtil.PROPERTY_PREFIX + "javabean.field.property";
49
4050 /**
4151 * Field mapping that produces the current bean.
4252 * <p/>
5060 */
5161 protected PropertyNameProvider propertyNameProvider;
5262
63 /**
64 * @deprecated To be removed.
65 */
5366 protected static final PropertyNameProvider FIELD_NAME_PROPERTY_NAME_PROVIDER =
5467 new PropertyNameProvider()
5568 {
6073 }
6174 };
6275
76 /**
77 * @deprecated To be removed.
78 */
6379 protected static final PropertyNameProvider FIELD_DESCRIPTION_PROPERTY_NAME_PROVIDER =
6480 new PropertyNameProvider()
6581 {
7490 }
7591 };
7692
93 protected static class DefaultPropertyNameProvider implements PropertyNameProvider
94 {
95 private boolean isUseFieldDescription;
96 private Map<String, String> fieldPropertyNames = new HashMap<String, String>();
97
98 public DefaultPropertyNameProvider(boolean isUseFieldDescription)
99 {
100 this.isUseFieldDescription = isUseFieldDescription;
101 }
102
103 @Override
104 public String getPropertyName(JRField field)
105 {
106 String fieldPropertyName = null;
107
108 if (fieldPropertyNames.containsKey(field.getName()))
109 {
110 fieldPropertyName = fieldPropertyNames.get(field.getName());
111 }
112 else
113 {
114 if (field.hasProperties())
115 {
116 fieldPropertyName = field.getPropertiesMap().getProperty(PROPERTY_JAVABEAN_FIELD_PROPERTY);
117 }
118
119 if (fieldPropertyName == null)
120 {
121 if (isUseFieldDescription && field.getDescription() != null)
122 {
123 fieldPropertyName = field.getDescription();
124 }
125 else
126 {
127 fieldPropertyName = field.getName();
128 }
129 }
130
131 fieldPropertyNames.put(field.getName(), fieldPropertyName);
132 }
133
134 return fieldPropertyName;
135 }
136 }
137
77138 /**
78139 *
79140 */
80141 public JRAbstractBeanDataSource(boolean isUseFieldDescription)
81142 {
82 propertyNameProvider = isUseFieldDescription ?
83 FIELD_DESCRIPTION_PROPERTY_NAME_PROVIDER :
84 FIELD_NAME_PROPERTY_NAME_PROVIDER;
143 propertyNameProvider = new DefaultPropertyNameProvider(isUseFieldDescription);
85144 }
86145
87146
3131 import java.util.Locale;
3232 import java.util.TimeZone;
3333
34 import org.apache.commons.beanutils.locale.LocaleConvertUtilsBean;
35
3436 import net.sf.jasperreports.engine.JRDataSource;
3537 import net.sf.jasperreports.engine.JRException;
3638 import net.sf.jasperreports.engine.util.FormatUtils;
3739 import net.sf.jasperreports.engine.util.JRCloneUtils;
3840 import net.sf.jasperreports.engine.util.JRDateLocaleConverter;
39 import net.sf.jasperreports.engine.util.JRFloatLocaleConverter;
40
41 import org.apache.commons.beanutils.locale.LocaleConvertUtilsBean;
4241
4342 /**
4443 * Abstract text data source, containing methods used to parse text
168167 java.util.Date.class,
169168 locale
170169 );
171
172 // fix for https://issues.apache.org/jira/browse/BEANUTILS-351
173 // remove on upgrade to BeanUtils 1.8.1
174 JRFloatLocaleConverter floatConverter = new JRFloatLocaleConverter(
175 locale == null ? Locale.getDefault() : locale);
176 convertBean.register(floatConverter, Float.class, locale);
177 convertBean.register(floatConverter, Float.TYPE, locale);
178170 }
179171 return convertBean;
180172 }
3636 import java.text.NumberFormat;
3737 import java.util.ArrayList;
3838 import java.util.Date;
39 import java.util.HashMap;
3940 import java.util.LinkedHashMap;
4041 import java.util.List;
4142 import java.util.Map;
4243
44 import org.apache.commons.logging.Log;
45 import org.apache.commons.logging.LogFactory;
46
4347 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
4448 import net.sf.jasperreports.engine.JRException;
4549 import net.sf.jasperreports.engine.JRField;
50 import net.sf.jasperreports.engine.JRPropertiesUtil;
4651 import net.sf.jasperreports.engine.JRRuntimeException;
4752 import net.sf.jasperreports.engine.JasperReportsContext;
4853 import net.sf.jasperreports.engine.util.FormatUtils;
4954 import net.sf.jasperreports.repo.RepositoryUtil;
50
51 import org.apache.commons.logging.Log;
52 import org.apache.commons.logging.LogFactory;
5355
5456
5557 /**
7274 public static final String EXCEPTION_MESSAGE_KEY_MISPLACED_QUOTE = "data.csv.misplaced.quote";
7375 public static final String EXCEPTION_MESSAGE_KEY_NO_MORE_CHARS = "data.csv.no.more.chars";
7476
77 /**
78 * Property specifying the CSV column name for the dataset field.
79 */
80 public static final String PROPERTY_FIELD_COLUMN_NAME = JRPropertiesUtil.PROPERTY_PREFIX + "csv.field.column.name";
81 /**
82 * Property specifying the CSV column index for the dataset field.
83 */
84 public static final String PROPERTY_FIELD_COLUMN_INDEX = JRPropertiesUtil.PROPERTY_PREFIX + "csv.field.column.index";
85 public static final String INDEXED_COLUMN_PREFIX = "COLUMN_";
86 private static final int INDEXED_COLUMN_PREFIX_LENGTH = INDEXED_COLUMN_PREFIX.length();
87
7588 private DateFormat dateFormat;
7689 private NumberFormat numberFormat;
7790 private char fieldDelimiter = ',';
7891 private String recordDelimiter = "\n";
7992 private Map<String, Integer> columnNames = new LinkedHashMap<String, Integer>();
93 private Map<String,Integer> columnIndexMap = new HashMap<String,Integer>();
8094 private boolean useFirstRowAsHeader;
8195
82 private List<String> fields;
96 private List<String> crtRecordColumnValues;
8397 private Reader reader;
8498 private char buffer[] = new char[1024];
8599 private int position;
224238 {
225239 parseRow();
226240 this.columnNames = new LinkedHashMap<String, Integer>();
227 for (int i = 0; i < fields.size(); i++) {
228 String name = fields.get(i);
241 for (int i = 0; i < crtRecordColumnValues.size(); i++) {
242 String name = crtRecordColumnValues.get(i);
229243 this.columnNames.put(name, Integer.valueOf(i));
230244 }
231245 }
241255 @Override
242256 public Object getFieldValue(JRField jrField) throws JRException
243257 {
244 String fieldName = jrField.getName();
245
246 Integer columnIndex = columnNames.get(fieldName);
247 if (columnIndex == null && fieldName.startsWith("COLUMN_"))
248 {
249 columnIndex = Integer.valueOf(fieldName.substring(7));
250 }
251 if (columnIndex == null)
252 {
253 throw
254 new JRException(
255 EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME,
256 new Object[]{fieldName});
257 }
258
259 if (fields.size() > columnIndex.intValue())
260 {
261 String fieldValue = fields.get(columnIndex.intValue());
258 Integer columnIndex = getColumnIndex(jrField);
259
260 if (crtRecordColumnValues.size() > columnIndex)
261 {
262 String fieldValue = crtRecordColumnValues.get(columnIndex);
262263 Class<?> valueClass = jrField.getValueClass();
263264
264265 if (valueClass.equals(String.class))
319320 }
320321
321322
323 /**
324 *
325 */
326 private Integer getColumnIndex(JRField field) throws JRException
327 {
328 String fieldName = field.getName();
329 Integer columnIndex = columnIndexMap.get(fieldName);
330 if (columnIndex == null)
331 {
332 if (field.hasProperties())
333 {
334 String columnName = field.getPropertiesMap().getProperty(PROPERTY_FIELD_COLUMN_NAME);
335 if (columnName != null)
336 {
337 columnIndex = columnNames.get(columnName);
338 if (columnIndex == null)
339 {
340 throw
341 new JRException(
342 EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME,
343 new Object[]{columnName});
344 }
345 }
346 }
347
348 if (columnIndex == null)
349 {
350 if (field.hasProperties())
351 {
352 String index = field.getPropertiesMap().getProperty(PROPERTY_FIELD_COLUMN_INDEX);
353 if (index != null)
354 {
355 columnIndex = Integer.valueOf(index);
356 }
357 }
358 }
359
360 if (columnIndex == null)
361 {
362 columnIndex = columnNames.get(fieldName);
363 }
364
365 if (columnIndex == null && fieldName.startsWith(INDEXED_COLUMN_PREFIX))
366 {
367 columnIndex = Integer.valueOf(fieldName.substring(INDEXED_COLUMN_PREFIX_LENGTH));
368 }
369
370 if (columnIndex == null)
371 {
372 throw
373 new JRException(
374 EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME,
375 new Object[]{fieldName});
376 }
377
378 columnIndexMap.put(fieldName, columnIndex);
379 }
380
381 return columnIndex;
382 }
383
384
322385 /**
323386 * Parses a row of CSV data and extracts the fields it contains
324387 */
333396 boolean startPosition = false;
334397 char c;
335398 int leadingSpaces = 0;
336 fields = new ArrayList<String>();
399 crtRecordColumnValues = new ArrayList<String>();
337400
338401 String row = getRow();
339402 if (row == null)// || row.length() == 0)
472535
473536 isQuoted = false;
474537 insideQuotes = false;
475 fields.add(field);
538 crtRecordColumnValues.add(field);
476539 ++addedFields;
477540
478541 // if many rows were concatenated due to misplacing of starting and ending quotes in a multiline field
544607 field = replaceAll(field, "\"\"", "\"");
545608 }
546609
547 fields.add(field);
610 crtRecordColumnValues.add(field);
548611 ++addedFields;
549612 while(addedFields < columnNames.size())
550613 {
551 fields.add("");
614 crtRecordColumnValues.add("");
552615 ++addedFields;
553616 }
554617
2424
2525 import java.util.HashMap;
2626 import java.util.Map;
27
28 import org.apache.commons.beanutils.PropertyUtils;
29 import org.hibernate.type.Type;
2730
2831 import net.sf.jasperreports.engine.JRDataSource;
2932 import net.sf.jasperreports.engine.JRException;
3033 import net.sf.jasperreports.engine.JRField;
3134 import net.sf.jasperreports.engine.JRRuntimeException;
3235 import net.sf.jasperreports.engine.query.JRHibernateQueryExecuter;
33
34 import org.apache.commons.beanutils.PropertyUtils;
35 import org.hibernate.type.Type;
3636
3737 /**
3838 * Base abstract Hibernate data source.
4747 public static final String EXCEPTION_MESSAGE_KEY_NO_FIELD_READER = "data.hibernate.no.field.reader";
4848 public static final String EXCEPTION_MESSAGE_KEY_UNKNOWN_RETURN_ALIAS = "data.hibernate.unknown.return.alias";
4949
50 private final boolean useFieldDescription;
50 private final JRAbstractBeanDataSource.PropertyNameProvider propertyNameProvider;
5151 private final Map<String, FieldReader> fieldReaders;
5252 protected final JRHibernateQueryExecuter queryExecuter;
5353 private Object currentReturnValue;
6262 */
6363 protected JRHibernateAbstractDataSource(JRHibernateQueryExecuter queryExecuter, boolean useFieldDescription, boolean useIndexOnSingleReturn)
6464 {
65 this.useFieldDescription = useFieldDescription;
65 this.propertyNameProvider = new JRAbstractBeanDataSource.DefaultPropertyNameProvider(useFieldDescription);
6666
6767 this.queryExecuter = queryExecuter;
6868
257257
258258 protected String getFieldMapping(JRField field)
259259 {
260 return (useFieldDescription ?
261 JRAbstractBeanDataSource.FIELD_DESCRIPTION_PROPERTY_NAME_PROVIDER :
262 JRAbstractBeanDataSource.FIELD_NAME_PROPERTY_NAME_PROVIDER)
263 .getPropertyName(field);
260 return propertyNameProvider.getPropertyName(field);
264261 }
265262
266263
231231 @Override
232232 public Object getFieldValue(JRField jrField) throws JRException
233233 {
234 String fieldName = jrField.getName();
235
236 Integer columnIndex = columnNames.get(fieldName);
237 if (columnIndex == null && fieldName.startsWith("COLUMN_")) {
238 columnIndex = Integer.valueOf(fieldName.substring(7));
239 }
240 if (columnIndex == null)
241 {
242 throw
243 new JRException(
244 EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME,
245 new Object[]{fieldName});
246 }
234 Integer columnIndex = getColumnIndex(jrField);
235
247236 Sheet sheet = workbook.getSheet(sheetIndex);
248237 Cell cell = sheet.getCell(columnIndex.intValue(), recordIndex);
249238 String fieldValue = cell.getContents();
3131 import java.io.IOException;
3232 import java.io.InputStream;
3333
34 import org.w3c.dom.Document;
35 import org.w3c.dom.Node;
36 import org.w3c.dom.NodeList;
37 import org.xml.sax.InputSource;
38
3439 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
3540 import net.sf.jasperreports.engine.JRException;
36 import net.sf.jasperreports.engine.JRField;
37 import net.sf.jasperreports.engine.JRRewindableDataSource;
3841 import net.sf.jasperreports.engine.JasperReportsContext;
3942 import net.sf.jasperreports.engine.util.JRXmlUtils;
4043 import net.sf.jasperreports.engine.util.xml.JRXPathExecuter;
4144 import net.sf.jasperreports.engine.util.xml.JRXPathExecuterUtils;
4245 import net.sf.jasperreports.repo.RepositoryUtil;
4346
44 import org.w3c.dom.Document;
45 import org.w3c.dom.Node;
46 import org.w3c.dom.NodeList;
47 import org.xml.sax.InputSource;
48
4947 /**
5048 * XML data source implementation that allows to access the data from a xml
5149 * document using XPath expressions.
5250 * <p>
5351 * The data source is constructed around a node set (record set) selected
54 * by an XPath expression from the xml document.
52 * by an XPath expression from the XML document.
5553 * </p>
5654 * <p>
57 * Each field can provide an additional XPath expresion that will be used to
58 * select its value. This expression must be specified using the "fieldDescription"
59 * element of the field. The expression is evaluated in the context of the current
55 * Each field can provide an additional XPath expression that will be used to
56 * select its value. This expression must be specified using the {@link #PROPERTY_FIELD_EXPRESSION}
57 * custom property at field level. The use of the {@link net.sf.jasperreports.engine.JRField#getDescription() field description} to specify the XPath expression
58 * is still supported, but is now discouraged, the above mentioned custom property taking precedence
59 * over the field description.
60 * The expression is evaluated in the context of the current
6061 * node thus the expression should be relative to the current node.
6162 * </p>
6263 * <p>
118119 * @author Peter Severin (peter_p_s@sourceforge.net, contact@jasperassistant.com)
119120 * @see JRXPathExecuterUtils
120121 */
121 public class JRXmlDataSource extends JRAbstractTextDataSource implements JRRewindableDataSource {
122 public class JRXmlDataSource extends AbstractXmlDataSource<JRXmlDataSource>
123 {
122124
123125 // the xml document
124126 private Document document;
438440 return true;
439441 }
440442
441 /*
442 * (non-Javadoc)
443 *
444 * @see net.sf.jasperreports.engine.JRDataSource#getFieldValue(net.sf.jasperreports.engine.JRField)
445 */
446 @Override
447 public Object getFieldValue(JRField jrField) throws JRException
448 {
449 if(currentNode == null)
450 {
451 return null;
452 }
453 String expression = jrField.getDescription();
454 if (expression == null || expression.length() == 0)
455 {
456 return null;
457 }
458 Object value = null;
459
460 Class<?> valueClass = jrField.getValueClass();
461 Object selectedObject = xPathExecuter.selectObject(currentNode, expression);
462
463 if(Object.class != valueClass)
464 {
465 if (selectedObject != null)
466 {
467 if (selectedObject instanceof Node)
468 {
469 String text = getText((Node) selectedObject);
470 if (text != null)
471 {
472 value = convertStringValue(text, valueClass);
473 }
474 }
475 else if (selectedObject instanceof Boolean && valueClass.equals(Boolean.class))
476 {
477 value = selectedObject;
478 }
479 else if (selectedObject instanceof Number && Number.class.isAssignableFrom(valueClass))
480 {
481 value = convertNumber((Number) selectedObject, valueClass);
482 }
483 else
484 {
485 String text = selectedObject.toString();
486 value = convertStringValue(text, valueClass);
487 }
488 }
489 }
490 else
491 {
492 value = selectedObject;
493 }
494 return value;
443 @Override
444 public Node getCurrentNode()
445 {
446 return currentNode;
447 }
448
449 @Override
450 public Object getSelectObject(Node currentNode, String expression) throws JRException
451 {
452 return xPathExecuter.selectObject(currentNode, expression);
495453 }
496454
497455 /**
504462 * @throws JRException if the sub data source couldn't be created
505463 * @see JRXmlDataSource#JRXmlDataSource(Document, String)
506464 */
465 @Override
507466 public JRXmlDataSource subDataSource(String selectExpr)
508467 throws JRException {
509468 // create a new document from the current node
513472 return subDataSource;
514473 }
515474
516 /**
517 * Creates a sub data source using the current node (record) as the root
518 * of the document. The data source will contain exactly one record consisting
519 * of the document node itself.
520 *
521 * @return the xml sub data source
522 * @throws JRException if the data source cannot be created
523 * @see JRXmlDataSource#subDataSource(String)
524 * @see JRXmlDataSource#JRXmlDataSource(Document)
525 */
526 public JRXmlDataSource subDataSource() throws JRException {
527 return subDataSource(".");
475 @Override
476 public JRXmlDataSource subDataSource() throws JRException // need to override this method here to keep binary compatibility with older releases
477 {
478 return super.subDataSource();
528479 }
529480
530481
534485 * @return a document having the current node as root
535486 * @throws JRException
536487 */
488 @Override
537489 public Document subDocument() throws JRException
538490 {
539491 if(currentNode == null)
559511 * @throws JRException if the sub data source couldn't be created
560512 * @see JRXmlDataSource#JRXmlDataSource(Document, String)
561513 */
514 @Override
562515 public JRXmlDataSource dataSource(String selectExpr)
563516 throws JRException {
564517 JRXmlDataSource subDataSource = new JRXmlDataSource(document, selectExpr);
566519 return subDataSource;
567520 }
568521
569 /**
570 * Creates a sub data source using as root document the document used by "this" data source.
571 * The data source will contain exactly one record consisting of the document node itself.
572 *
573 * @return the xml sub data source
574 * @throws JRException if the data source cannot be created
575 * @see JRXmlDataSource#dataSource(String)
576 * @see JRXmlDataSource#JRXmlDataSource(Document)
577 */
578 public JRXmlDataSource dataSource() throws JRException {
579 return dataSource(".");
580 }
581
582 /**
583 * Return the text that a node contains. This routine:
584 * <ul>
585 * <li>Ignores comments and processing instructions.
586 * <li>Concatenates TEXT nodes, CDATA nodes, and the results of recursively
587 * processing EntityRef nodes.
588 * <li>Ignores any element nodes in the sublist. (Other possible options
589 * are to recurse into element sublists or throw an exception.)
590 * </ul>
591 *
592 * @param node a DOM node
593 * @return a String representing node contents or null
594 */
595 public String getText(Node node) {
596 if (!node.hasChildNodes())
597 {
598 return node.getNodeValue();
599 }
600 StringBuilder result = new StringBuilder();
601
602 NodeList list = node.getChildNodes();
603 for (int i = 0; i < list.getLength(); i++) {
604 Node subnode = list.item(i);
605 if (subnode.getNodeType() == Node.TEXT_NODE)
606 {
607 String value = subnode.getNodeValue();
608 if(value != null)
609 {
610 result.append(value);
611 }
612 }
613 else if (subnode.getNodeType() == Node.CDATA_SECTION_NODE)
614 {
615 String value = subnode.getNodeValue();
616 if(value != null)
617 {
618 result.append(value);
619 }
620 } else if (subnode.getNodeType() == Node.ENTITY_REFERENCE_NODE) {
621 // Recurse into the subtree for text
622 // (and ignore comments)
623 String value = getText(subnode);
624 if(value != null)
625 {
626 result.append(value);
627 }
628 }
629 }
630
631 return result.toString();
632 }
633
522 @Override
523 public JRXmlDataSource dataSource() throws JRException // need to override this method here to keep binary compatibility with older releases
524 {
525 return super.dataSource();
526 }
527
634528 /**
635529 * Closes the reader. Users of this data source should close it after usage.
636530 */
2929 import java.io.UnsupportedEncodingException;
3030 import java.util.ArrayList;
3131 import java.util.Date;
32 import java.util.HashMap;
3233 import java.util.Iterator;
3334 import java.util.List;
35 import java.util.Map;
3436 import java.util.StringTokenizer;
3537
3638 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
3739 import net.sf.jasperreports.engine.JRException;
3840 import net.sf.jasperreports.engine.JRField;
41 import net.sf.jasperreports.engine.JRPropertiesUtil;
3942 import net.sf.jasperreports.engine.JRRuntimeException;
4043 import net.sf.jasperreports.engine.JasperReportsContext;
4144 import net.sf.jasperreports.engine.util.JsonUtil;
5760 public static final String EXCEPTION_MESSAGE_KEY_INVALID_EXPRESSION = "data.json.invalid.expression";
5861 public static final String EXCEPTION_MESSAGE_KEY_NO_DATA = "data.json.no.data";
5962
63 /**
64 * Property specifying the JSON expression for the dataset field.
65 */
66 public static final String PROPERTY_FIELD_EXPRESSION = JRPropertiesUtil.PROPERTY_PREFIX + "json.field.expression";
67
6068 // the JSON select expression that gives the nodes to iterate
6169 private String selectExpression;
70
71 private Map<String, String> fieldExpressions = new HashMap<String, String>();
6272
6373 private Iterator<JsonNode> jsonNodesIterator;
6474
193203 if(currentJsonNode == null) {
194204 return null;
195205 }
196 String expression = jrField.getDescription();
206
207 String expression = null;
208 if (fieldExpressions.containsKey(jrField.getName()))
209 {
210 expression = fieldExpressions.get(jrField.getName());
211 }
212 else
213 {
214 expression = getFieldExpression(jrField);
215 fieldExpressions.put(jrField.getName(), expression);
216 }
197217 if (expression == null || expression.length() == 0)
198218 {
199 expression = jrField.getName();
200 if (expression == null || expression.length() == 0)
201 {
202 return null;
203 }
204 }
219 return null;
220 }
221
205222 Object value = null;
206223
207224 Class<?> valueClass = jrField.getValueClass();
294311 String arrayOperators = currentToken.substring(indexOfLeftSquareBracket);
295312 StringTokenizer arrayOpsTokenizer = new StringTokenizer(arrayOperators,ARRAY_RIGHT);
296313 while(arrayOpsTokenizer.hasMoreTokens()) {
297 if (!tempNode.isMissingNode() && tempNode.isArray()) {
298 String currentArrayOperator = arrayOpsTokenizer.nextToken();
299 tempNode = tempNode.path(Integer.parseInt(currentArrayOperator.substring(1)));
314 if (tempNode == null || tempNode.isMissingNode() || !tempNode.isArray()) {
315 return null;
300316 }
317
318 String currentArrayOperator = arrayOpsTokenizer.nextToken();
319 tempNode = tempNode.path(Integer.parseInt(currentArrayOperator.substring(1)));
301320 }
302321 } else {
303322 tempNode = goDownPathWithAttribute(tempNode, currentToken);
473492 //NOP
474493 }
475494
495
496 protected String getFieldExpression(JRField field)
497 {
498 String fieldExpression = null;
499 if (field.hasProperties())
500 {
501 fieldExpression = field.getPropertiesMap().getProperty(PROPERTY_FIELD_EXPRESSION);
502 }
503 if (fieldExpression == null)
504 {
505 fieldExpression = field.getDescription();
506 if (fieldExpression == null || fieldExpression.length() == 0)
507 {
508 fieldExpression = field.getName();
509 }
510 }
511 return fieldExpression;
512 }
476513 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.data;
24
25 import java.io.File;
26 import java.io.InputStream;
27 import java.math.BigDecimal;
28 import java.math.BigInteger;
29 import java.util.HashMap;
30 import java.util.List;
31 import java.util.Map;
32
33 import net.sf.jasperreports.engine.JRException;
34 import net.sf.jasperreports.engine.JRField;
35 import net.sf.jasperreports.engine.JRPropertiesUtil;
36 import net.sf.jasperreports.engine.JasperReportsContext;
37 import net.sf.jasperreports.engine.json.JRJsonNode;
38 import net.sf.jasperreports.engine.util.JsonUtil;
39 import net.sf.jasperreports.engine.util.json.DefaultJsonQLExecuter;
40 import net.sf.jasperreports.engine.util.json.JsonQLExecuter;
41
42 import org.apache.commons.logging.Log;
43 import org.apache.commons.logging.LogFactory;
44
45 import com.fasterxml.jackson.databind.JsonNode;
46
47 /**
48 * @author Narcis Marcu (narcism@users.sourceforge.net)
49 */
50 public class JsonQLDataSource extends JRAbstractTextDataSource implements JsonData {
51 private static final Log log = LogFactory.getLog(JsonQLDataSource.class);
52
53 public static final String EXCEPTION_MESSAGE_KEY_NO_DATA = "data.json.no.data";
54 public static final String EXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVED = "data.json.field.value.not.retrieved";
55
56 /**
57 * Property specifying the JSONQL expression for the dataset field.
58 */
59 public static final String PROPERTY_FIELD_EXPRESSION = JRPropertiesUtil.PROPERTY_PREFIX + "jsonql.field.expression";
60
61 private JRJsonNode root;
62 private String selectExpression;
63
64 private JRJsonNode currentJsonNode;
65 private List<JRJsonNode> nodes;
66 private int currentNodeIndex = - 1;
67
68 private JsonQLExecuter jsonQLExecuter;
69
70 private Map<String, String> fieldExpressions = new HashMap<>();
71
72
73 public JsonQLDataSource(File file, String selectExpression) throws JRException {
74 this(JsonUtil.parseJson(file), selectExpression);
75 }
76
77 public JsonQLDataSource(File file) throws JRException {
78 this(file, null);
79 }
80
81 public JsonQLDataSource(InputStream jsonInputStream, String selectExpression) throws JRException {
82 this(JsonUtil.parseJson(jsonInputStream), selectExpression);
83 }
84
85 public JsonQLDataSource(InputStream jsonInputStream) throws JRException {
86 this(jsonInputStream, null);
87 }
88
89 public JsonQLDataSource(JasperReportsContext jasperReportsContext, String jsonSource, String selectExpression) throws JRException {
90 this(JsonUtil.parseJson(jasperReportsContext, jsonSource), selectExpression);
91 }
92
93 protected JsonQLDataSource(JsonNode jacksonJsonTree, String selectExpression) throws JRException {
94 this(new JRJsonNode(null, jacksonJsonTree), selectExpression);
95 }
96
97 protected JsonQLDataSource(JRJsonNode root, String selectExpression) throws JRException {
98 this.root = root;
99 this.selectExpression = selectExpression;
100 this.jsonQLExecuter = new DefaultJsonQLExecuter();
101
102 moveFirst();
103 }
104
105 @Override
106 public void moveFirst() throws JRException {
107 if (root.getDataNode() == null || root.getDataNode().isMissingNode()) {
108 throw new JRException(EXCEPTION_MESSAGE_KEY_NO_DATA, (Object[]) null);
109 }
110
111 currentJsonNode = null;
112 nodes = jsonQLExecuter.selectNodes(root, selectExpression);
113 currentNodeIndex = -1;
114 }
115
116 @Override
117 public boolean next() throws JRException {
118 if (nodes != null && currentNodeIndex < nodes.size() - 1) {
119 currentJsonNode = nodes.get(++currentNodeIndex);
120
121 return true;
122 }
123
124 return false;
125 }
126
127 @Override
128 public Object getFieldValue(JRField jrField) throws JRException {
129 if(currentJsonNode == null) {
130 return null;
131 }
132
133 String expression;
134 if (fieldExpressions.containsKey(jrField.getName())) {
135 expression = fieldExpressions.get(jrField.getName());
136 } else {
137 expression = getFieldExpression(jrField);
138 fieldExpressions.put(jrField.getName(), expression);
139 }
140
141 if (expression == null || expression.length() == 0) {
142 return null;
143 }
144
145 JRJsonNode selectedNode = jsonQLExecuter.selectNode(currentJsonNode, root, expression);
146 if (selectedNode != null) {
147 return getConvertedValue(selectedNode, jrField);
148 }
149
150 return null;
151 }
152
153 @Override
154 public JsonQLDataSource subDataSource() throws JRException {
155 return subDataSource(null);
156 }
157
158 @Override
159 public JsonQLDataSource subDataSource(String selectExpression) throws JRException {
160 if(currentJsonNode == null) {
161 throw new JRException(EXCEPTION_MESSAGE_KEY_NO_DATA, (Object[])null);
162 }
163
164 JsonQLDataSource subDataSource = new JsonQLDataSource(currentJsonNode, selectExpression);
165 subDataSource.setTextAttributes(this);
166
167 return subDataSource;
168 }
169
170 protected Object getConvertedValue(JRJsonNode node, JRField jrField) throws JRException {
171 JsonNode dataNode = node.getDataNode();
172 Class<?> valueClass = jrField.getValueClass();
173
174 if (log.isDebugEnabled()) {
175 log.debug("attempting to convert: " + dataNode + " to class: " + valueClass);
176 }
177
178 if (Object.class.equals(valueClass)) {
179 return dataNode;
180 }
181
182 Object result = null;
183
184 if (!dataNode.isNull()) {
185 try {
186 if (Boolean.class.equals(valueClass) && dataNode.isBoolean()) {
187 result = dataNode.booleanValue();
188
189 } else if (BigDecimal.class.equals(valueClass) && dataNode.isBigDecimal()) {
190 result = dataNode.decimalValue();
191
192 } else if (BigInteger.class.equals(valueClass) && dataNode.isBigInteger()) {
193 result = dataNode.bigIntegerValue();
194
195 } else if (Double.class.equals(valueClass) && dataNode.isDouble()) {
196 result = dataNode.doubleValue();
197
198 } else if (Integer.class.equals(valueClass) && dataNode.isInt()) {
199 result = dataNode.intValue();
200
201 } else if (Number.class.isAssignableFrom(valueClass) && dataNode.isNumber()) {
202 result = convertNumber(dataNode.numberValue(), valueClass);
203
204 } else {
205 result = convertStringValue(dataNode.asText(), valueClass);
206 }
207
208 if (result == null) {
209 throw new JRException(EXCEPTION_MESSAGE_KEY_CANNOT_CONVERT_FIELD_TYPE,
210 new Object[]{jrField.getName(), valueClass.getName()});
211 }
212
213 } catch (Exception e) {
214 throw new JRException(EXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVED,
215 new Object[]{jrField.getName(), valueClass.getName()}, e);
216 }
217 }
218
219 return result;
220 }
221
222 protected String getFieldExpression(JRField field) {
223 String fieldExpression = null;
224
225 if (field.hasProperties()) {
226 fieldExpression = field.getPropertiesMap().getProperty(PROPERTY_FIELD_EXPRESSION);
227 }
228
229 if (fieldExpression == null) {
230 fieldExpression = field.getDescription();
231
232 if (fieldExpression == null || fieldExpression.length() == 0) {
233 fieldExpression = field.getName();
234 }
235 }
236
237 return fieldExpression;
238 }
239
240 }
241
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.data;
24
25 import net.sf.jasperreports.data.RewindableDataSourceProvider;
26 import net.sf.jasperreports.engine.JRException;
27 import net.sf.jasperreports.engine.JasperReportsContext;
28
29 /**
30 * @author Narcis Marcu (narcism@users.sourceforge.net)
31 */
32 public class JsonQLDataSourceProvider implements RewindableDataSourceProvider<JsonQLDataSource>
33 {
34
35 private JasperReportsContext jasperReportsContext;
36 private String jsonSource;
37 private String queryString;
38 private TextDataSourceAttributes textAttributes;
39
40 public JsonQLDataSourceProvider(JasperReportsContext jasperReportsContext, String jsonSource, String queryString, TextDataSourceAttributes textAttributes)
41 {
42 this.jasperReportsContext = jasperReportsContext;
43 this.jsonSource = jsonSource;
44 this.queryString = queryString;
45 this.textAttributes = textAttributes;
46 }
47
48 @Override
49 public JsonQLDataSource getDataSource() throws JRException
50 {
51 JsonQLDataSource jsonQLDataSource = new JsonQLDataSource(jasperReportsContext, jsonSource, queryString);
52 jsonQLDataSource.setTextAttributes(textAttributes);
53 return jsonQLDataSource;
54 }
55
56 @Override
57 public void rewind()
58 {
59 // we don't need to do anything here
60 }
61
62 }
173173 * data source is instantiated; each item in the resulting node set will generate a
174174 * record/row in the data source.</li>
175175 * <li>For every field in the report/data set, an XPath expression to select the field value
176 * for each record. The field's XPath expression is provided by the field description
177 * (<code>&lt;fieldDescription&gt;</code> element in JRXML). The field's XPath expression is
176 * for each record is needed. The field's XPath expression is provided by the {@link net.sf.jasperreports.engine.data.AbstractXmlDataSource#PROPERTY_FIELD_EXPRESSION}
177 * custom field property. The use of the {@link net.sf.jasperreports.engine.JRField#getDescription() field description} to specify the XPath expression
178 * is still supported, but is now discouraged, the above mentioned custom property taking precedence
179 * over the field description. The field's XPath expression is
178180 * executed for each record using as a context node the current node from the main
179181 * node set.</li>
180182 * </ul>
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.design;
24
25 import net.sf.jasperreports.engine.DatasetPropertyExpression;
26 import net.sf.jasperreports.engine.JRConstants;
27 import net.sf.jasperreports.engine.JRExpression;
28 import net.sf.jasperreports.engine.base.BaseDatasetPropertyExpression;
29 import net.sf.jasperreports.engine.type.PropertyEvaluationTimeEnum;
30
31 /**
32 * Implementation of {@link DatasetPropertyExpression} to be used at report
33 * design time.
34 *
35 * @author Teodor Danciu (teodord@users.sourceforge.net)
36 */
37 public class DesignDatasetPropertyExpression extends BaseDatasetPropertyExpression
38 {
39
40 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
41
42 /**
43 * Sets the property expression evaluation time.
44 */
45 @Override
46 public void setEvaluationTime(PropertyEvaluationTimeEnum evaluationTime)
47 {
48 super.setEvaluationTime(evaluationTime);
49 }
50
51 /**
52 * Sets the property value expression.
53 *
54 * @param valueExpression the value expression
55 */
56 @Override
57 public void setValueExpression(JRExpression valueExpression)
58 {
59 super.setValueExpression(valueExpression);
60 }
61
62 }
4242 import java.util.UUID;
4343
4444 import net.sf.jasperreports.engine.DatasetFilter;
45 import net.sf.jasperreports.engine.DatasetPropertyExpression;
4546 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
4647 import net.sf.jasperreports.engine.JRAbstractScriptlet;
4748 import net.sf.jasperreports.engine.JRConstants;
111112
112113 public static final String PROPERTY_VARIABLES = "variables";
113114
115 public static final String PROPERTY_PROPERTY_EXPRESSIONS = "propertyExpressions";
116
114117 private transient JasperReportsContext jasperReportsContext;
115118
116119 private boolean ownUUID;
154157 protected Map<String, JRGroup> groupsMap = new HashMap<String, JRGroup>();
155158 protected List<JRGroup> groupsList = new ArrayList<JRGroup>();
156159
160 private List<DatasetPropertyExpression> propertyExpressions = new ArrayList<DatasetPropertyExpression>();
161
162
157163 private class QueryLanguageChangeListener implements PropertyChangeListener, Serializable
158164 {
159165 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
12921298 //TODO event
12931299 getPropertiesMap().setProperty(propName, value);
12941300 }
1295
1296
1301
1302
1303 /**
1304 * Add a dynamic/expression-based property.
1305 *
1306 * @param propertyExpression the property to add
1307 * @see #getPropertyExpressions()
1308 */
1309 public void addPropertyExpression(DatasetPropertyExpression propertyExpression)
1310 {
1311 propertyExpressions.add(propertyExpression);
1312 getEventSupport().fireCollectionElementAddedEvent(PROPERTY_PROPERTY_EXPRESSIONS,
1313 propertyExpression, propertyExpressions.size() - 1);
1314 }
1315
1316 /**
1317 * Remove a property expression.
1318 *
1319 * @param propertyExpression the property expression to remove
1320 * @see #addPropertyExpression(DatasetPropertyExpression)
1321 */
1322 public void removePropertyExpression(DatasetPropertyExpression propertyExpression)
1323 {
1324 int idx = propertyExpressions.indexOf(propertyExpression);
1325 if (idx >= 0)
1326 {
1327 propertyExpressions.remove(idx);
1328
1329 getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_PROPERTY_EXPRESSIONS,
1330 propertyExpression, idx);
1331 }
1332 }
1333
1334 /**
1335 * Remove a property expression.
1336 *
1337 * @param name the name of the property to remove
1338 * @return the removed property expression (if found)
1339 */
1340 public DatasetPropertyExpression removePropertyExpression(String name)
1341 {
1342 DatasetPropertyExpression removed = null;
1343 for (ListIterator<DatasetPropertyExpression> it = propertyExpressions.listIterator(); it.hasNext();)
1344 {
1345 DatasetPropertyExpression prop = it.next();
1346 if (name.equals(prop.getName()))
1347 {
1348 removed = prop;
1349 int idx = it.previousIndex();
1350
1351 it.remove();
1352 getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_PROPERTY_EXPRESSIONS,
1353 removed, idx);
1354 break;
1355 }
1356 }
1357 return removed;
1358 }
1359
1360 /**
1361 * Returns the list of property expressions.
1362 *
1363 * @return the list of property expressions ({@link DatasetPropertyExpression} instances)
1364 * @see #addPropertyExpression(DatasetPropertyExpression)
1365 */
1366 public List<DatasetPropertyExpression> getPropertyExpressionsList()
1367 {
1368 return propertyExpressions;
1369 }
1370
1371 @Override
1372 public DatasetPropertyExpression[] getPropertyExpressions()
1373 {
1374 DatasetPropertyExpression[] props;
1375 if (propertyExpressions.isEmpty())
1376 {
1377 props = null;
1378 }
1379 else
1380 {
1381 props = propertyExpressions.toArray(new DatasetPropertyExpression[propertyExpressions.size()]);
1382 }
1383 return props;
1384 }
1385
1386
12971387 /**
12981388 * Sets the dataset filter expression.
12991389 * <p>
13361426 sortFieldsList = new ArrayList<JRSortField>();
13371427 }
13381428
1429 if (propertyExpressions == null)
1430 {
1431 propertyExpressions = new ArrayList<DatasetPropertyExpression>();
1432 }
1433
13391434 @SuppressWarnings("resource")
13401435 ContextClassLoaderObjectInputStream cclois =
13411436 in instanceof ContextClassLoaderObjectInputStream ? (ContextClassLoaderObjectInputStream)in : null;
14131508 clone.groupsMap.put(group.getName(), group);
14141509 }
14151510 }
1511
1512 clone.propertyExpressions = JRCloneUtils.cloneList(propertyExpressions);
14161513
14171514 return clone;
14181515 }
2222 */
2323 package net.sf.jasperreports.engine.design;
2424
25 import java.io.IOException;
26 import java.io.ObjectInputStream;
27 import java.util.ArrayList;
28 import java.util.List;
29 import java.util.ListIterator;
30
2531 import net.sf.jasperreports.engine.JRConstants;
32 import net.sf.jasperreports.engine.JRPropertyExpression;
2633 import net.sf.jasperreports.engine.base.JRBaseField;
34 import net.sf.jasperreports.engine.util.JRCloneUtils;
2735
2836
2937 /**
4149 public static final String PROPERTY_NAME = "name";
4250
4351 public static final String PROPERTY_VALUE_CLASS_NAME = "valueClassName";
52
53 public static final String PROPERTY_PROPERTY_EXPRESSIONS = "propertyExpressions";
54
55 private List<JRPropertyExpression> propertyExpressions = new ArrayList<JRPropertyExpression>();
4456
4557 /**
4658 *
7284 getEventSupport().firePropertyChange(PROPERTY_VALUE_CLASS_NAME, old, this.valueClassName);
7385 }
7486
87 /**
88 * Add a dynamic/expression-based property.
89 *
90 * @param propertyExpression the property to add
91 * @see #getPropertyExpressions()
92 */
93 public void addPropertyExpression(JRPropertyExpression propertyExpression)
94 {
95 propertyExpressions.add(propertyExpression);
96 getEventSupport().fireCollectionElementAddedEvent(PROPERTY_PROPERTY_EXPRESSIONS,
97 propertyExpression, propertyExpressions.size() - 1);
98 }
99
100 /**
101 * Remove a property expression.
102 *
103 * @param propertyExpression the property expression to remove
104 * @see #addPropertyExpression(JRPropertyExpression)
105 */
106 public void removePropertyExpression(JRPropertyExpression propertyExpression)
107 {
108 int idx = propertyExpressions.indexOf(propertyExpression);
109 if (idx >= 0)
110 {
111 propertyExpressions.remove(idx);
112
113 getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_PROPERTY_EXPRESSIONS,
114 propertyExpression, idx);
115 }
116 }
117
118 /**
119 * Remove a property expression.
120 *
121 * @param name the name of the property to remove
122 * @return the removed property expression (if found)
123 */
124 public JRPropertyExpression removePropertyExpression(String name)
125 {
126 JRPropertyExpression removed = null;
127 for (ListIterator<JRPropertyExpression> it = propertyExpressions.listIterator(); it.hasNext();)
128 {
129 JRPropertyExpression prop = it.next();
130 if (name.equals(prop.getName()))
131 {
132 removed = prop;
133 int idx = it.previousIndex();
134
135 it.remove();
136 getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_PROPERTY_EXPRESSIONS,
137 removed, idx);
138 break;
139 }
140 }
141 return removed;
142 }
143
144 /**
145 * Returns the list of property expressions.
146 *
147 * @return the list of property expressions ({@link JRPropertyExpression} instances)
148 * @see #addPropertyExpression(JRPropertyExpression)
149 */
150 public List<JRPropertyExpression> getPropertyExpressionsList()
151 {
152 return propertyExpressions;
153 }
154
155 @Override
156 public JRPropertyExpression[] getPropertyExpressions()
157 {
158 JRPropertyExpression[] props;
159 if (propertyExpressions.isEmpty())
160 {
161 props = null;
162 }
163 else
164 {
165 props = propertyExpressions.toArray(new JRPropertyExpression[propertyExpressions.size()]);
166 }
167 return props;
168 }
169
170 @Override
171 public Object clone()
172 {
173 JRDesignField clone = (JRDesignField) super.clone();
174 clone.propertyExpressions = JRCloneUtils.cloneList(propertyExpressions);
175 return clone;
176 }
177
178 private void readObject(ObjectInputStream stream)
179 throws IOException, ClassNotFoundException
180 {
181 stream.defaultReadObject();
182
183 if (propertyExpressions == null)
184 {
185 propertyExpressions = new ArrayList<JRPropertyExpression>();
186 }
187 }
75188 }
2525 import net.sf.jasperreports.engine.JRConstants;
2626 import net.sf.jasperreports.engine.JRExpression;
2727 import net.sf.jasperreports.engine.base.JRBaseParameter;
28 import net.sf.jasperreports.engine.type.ParameterEvaluationTimeEnum;
2829
2930
3031 /**
4849 public static final String PROPERTY_VALUE_CLASS_NAME = "valueClassName";
4950
5051 public static final String PROPERTY_NESTED_TYPE_NAME = "nestedType";
52
53 public static final String PROPERTY_EVALUATION_TIME = "evaluationTime";
5154
5255
5356 /**
128131 /**
129132 *
130133 */
134 public void setEvaluationTime(ParameterEvaluationTimeEnum evaluationTime)
135 {
136 ParameterEvaluationTimeEnum old = this.evaluationTime;
137 this.evaluationTime = evaluationTime;
138 getEventSupport().firePropertyChange(PROPERTY_EVALUATION_TIME, old, this.evaluationTime);
139 }
140
141 /**
142 *
143 */
131144 public void setDefaultValueExpression(JRExpression expression)
132145 {
133146 Object old = this.defaultValueExpression;
101101 boolean success;
102102 try //FIXME remove support for pre 3.1 jdt
103103 {
104 Class<?> classAccessRestriction = loadClass("org.eclipse.jdt.internal.compiler.env.AccessRestriction");
104 Class<?> classAccessRestriction = NameEnvironmentAnswer.class.getClassLoader().loadClass("org.eclipse.jdt.internal.compiler.env.AccessRestriction");
105105 constrNameEnvAnsBin2Args = NameEnvironmentAnswer.class.getConstructor(new Class[]{IBinaryType.class, classAccessRestriction});
106106 constrNameEnvAnsCompUnit2Args = NameEnvironmentAnswer.class.getConstructor(new Class[]{ICompilationUnit.class, classAccessRestriction});
107107 is2ArgsConstr = true;
331331 { // with sun.plugin.cache.EmptyInputStream on JRE 1.5 plugin
332332 try // http://sourceforge.net/tracker/index.php?func=detail&aid=1478460&group_id=36382&atid=416703
333333 {
334 isPackage = (is.read() > 0);
334 isPackage = (is.read() < 0);
335335 }
336336 catch(IOException e)
337337 {
989989 {
990990 addBrokenRule(e, field);
991991 }
992
993 verifyProperyExpressions(field.getPropertyExpressions());
992994 }
993995 }
994996 }
10601062 JRVariable[] variables = dataset.getVariables();
10611063 if (variables != null && variables.length > 0)
10621064 {
1063 boolean isMainDataset = dataset.isMainDataset();
10641065 for(int index = 0; index < variables.length; index++)
10651066 {
10661067 JRVariable variable = variables[index];
11161117 {
11171118 addBrokenRule("Increment group \"" + variable.getIncrementGroup().getName() + "\" not found for variable : " + variable.getName(), variable);
11181119 }
1119 }
1120 }
1121
1122 if (!isMainDataset && !variable.isSystemDefined())
1123 {
1124 if (resetType == ResetTypeEnum.COLUMN || resetType == ResetTypeEnum.PAGE)
1125 {
1126 addBrokenRule("Variable " + variable.getName() + " of dataset " + dataset.getName() + " cannot have Column or Page reset type.", variable);
1127 }
1128
1129 if (incrementType == IncrementTypeEnum.COLUMN || incrementType == IncrementTypeEnum.PAGE)
1130 {
1131 addBrokenRule("Variable " + variable.getName() + " of dataset " + dataset.getName() + " cannot have Column or Page increment type.", variable);
11321120 }
11331121 }
11341122 }
22782266 {
22792267 verifyExpressions(dataset);
22802268
2269 verifyProperyExpressions(dataset.getPropertyExpressions());
2270
22812271 verifyParameters(dataset);
22822272
22832273 verifyQuery(dataset);
3333
3434 import net.sf.jasperreports.crosstabs.JRCrosstab;
3535 import net.sf.jasperreports.crosstabs.design.JRDesignCrosstab;
36 import net.sf.jasperreports.engine.DatasetPropertyExpression;
3637 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
3738 import net.sf.jasperreports.engine.JRBand;
3839 import net.sf.jasperreports.engine.JRConstants;
782783
783784
784785 /**
786 *
787 */
788 public void addPropertyExpression(DatasetPropertyExpression propertyExpression)
789 {
790 mainDesignDataset.addPropertyExpression(propertyExpression);
791 }
792
793
794 /**
795 *
796 */
797 public void removePropertyExpression(DatasetPropertyExpression propertyExpression)
798 {
799 mainDesignDataset.removePropertyExpression(propertyExpression);
800 }
801
802
803 /**
804 *
805 */
806 public DatasetPropertyExpression removePropertyExpression(String name)
807 {
808 return mainDesignDataset.removePropertyExpression(name);
809 }
810
811
812 /**
813 *
814 */
815 public List<DatasetPropertyExpression> getPropertyExpressionsList()
816 {
817 return mainDesignDataset.getPropertyExpressionsList();
818 }
819
820
821 /**
785822 * Removes a report scriptlet.
786823 */
787824 public JRScriptlet removeScriptlet(JRScriptlet scriptlet)
1212 <complexType>
1313 <sequence>
1414 <element ref="jr:property" minOccurs="0" maxOccurs="unbounded"/>
15 <element name="propertyExpression" type="jr:datasetPropertyExpressionType" minOccurs="0" maxOccurs="unbounded"/>
1516 <element ref="jr:import" minOccurs="0" maxOccurs="unbounded"/>
1617 <element ref="jr:template" minOccurs="0" maxOccurs="unbounded"/>
1718 <element ref="jr:reportFont" minOccurs="0" maxOccurs="unbounded"/>
118119 </restriction>
119120 </simpleType>
120121 </attribute>
121 <attribute name="whenNoDataType" use="optional" default="NoPages">
122 <attribute name="whenNoDataType" use="optional">
122123 <annotation>
123124 <documentation>Allows users to customize the behavior of the reporting engine when there are now rows in the data source.</documentation>
124125 </annotation>
363364 </complexType>
364365 </element>
365366
366 <element name="propertyExpression">
367 <complexType name="propertyExpressionType" mixed="true">
368 <attribute name="name" type="string" use="required">
369 <annotation>
370 <documentation>Name of the object property.</documentation>
371 </annotation>
372 </attribute>
373 </complexType>
374
375 <element name="propertyExpression" type="jr:propertyExpressionType">
367376 <annotation>
368377 <documentation>Allows the creation of a dynamic name-value pair property for a report element.
369378 The contents of this element is interpreted as a <code>java.lang.String</code> expression,
370379 which will be evaluated at fill time, the result being used as property value.</documentation>
371380 </annotation>
372 <complexType mixed="true">
373 <attribute name="name" type="string" use="required">
374 <annotation>
375 <documentation>Name of the object property.</documentation>
376 </annotation>
377 </attribute>
378 </complexType>
379 </element>
381 </element>
382
383 <complexType name="datasetPropertyExpressionType" mixed="true">
384 <complexContent>
385 <extension base="jr:propertyExpressionType">
386 <attribute name="evaluationTime" use="optional">
387 <annotation>
388 <documentation>Specifies when the default value expression of a parameter is evaluated.</documentation>
389 </annotation>
390 <simpleType>
391 <restriction base="string">
392 <enumeration value="Early">
393 <annotation>
394 <documentation>Evaluate the property expression before parameter contributors.</documentation>
395 </annotation>
396 </enumeration>
397 <enumeration value="Late">
398 <annotation>
399 <documentation>Evaluate the property expression after parameter contributors.</documentation>
400 </annotation>
401 </enumeration>
402 <enumeration value="Report">
403 <annotation>
404 <documentation>Evaluate the property expression at the end of the report.</documentation>
405 </annotation>
406 </enumeration>
407 </restriction>
408 </simpleType>
409 </attribute>
410 </extension>
411 </complexContent>
412 </complexType>
380413
381414 <element name="import">
382415 <annotation>
10491082 <complexType>
10501083 <sequence>
10511084 <element ref="jr:property" minOccurs="0" maxOccurs="unbounded"/>
1085 <element name="propertyExpression" type="jr:datasetPropertyExpressionType" minOccurs="0" maxOccurs="unbounded"/>
10521086 <element ref="jr:scriptlet" minOccurs="0" maxOccurs="unbounded"/>
10531087 <element ref="jr:parameter" minOccurs="0" maxOccurs="unbounded"/>
10541088 <element ref="jr:queryString" minOccurs="0" maxOccurs="1"/>
11621196 </restriction>
11631197 </simpleType>
11641198 </attribute>
1199 <attribute name="evaluationTime" use="optional">
1200 <annotation>
1201 <documentation>Specifies when the default value expression of a parameter is evaluated.</documentation>
1202 </annotation>
1203 <simpleType>
1204 <restriction base="string">
1205 <enumeration value="Early">
1206 <annotation>
1207 <documentation>Evaluate the parameter default value expression before parameter contributors.</documentation>
1208 </annotation>
1209 </enumeration>
1210 <enumeration value="Late">
1211 <annotation>
1212 <documentation>Evaluate the parameter default value expression after parameter contributors.</documentation>
1213 </annotation>
1214 </enumeration>
1215 </restriction>
1216 </simpleType>
1217 </attribute>
11651218 </complexType>
11661219 </element>
11671220
12091262 <complexType>
12101263 <sequence>
12111264 <element ref="jr:property" minOccurs="0" maxOccurs="unbounded"/>
1265 <element ref="jr:propertyExpression" minOccurs="0" maxOccurs="unbounded"/>
12121266 <element ref="jr:fieldDescription" minOccurs="0" maxOccurs="1"/>
12131267 </sequence>
12141268 <attribute name="name" type="string" use="required">
18801934 <restriction base="string">
18811935 <enumeration value="Now">
18821936 <annotation>
1883 <documentation>The part is to be evaluated immediatelly.</documentation>
1937 <documentation>The part is to be evaluated immediately.</documentation>
18841938 </annotation>
18851939 </enumeration>
18861940 <enumeration value="Report">
753753 document.addKeywords(keywords);
754754 }
755755 String creator = configuration.getMetadataCreator();
756 if( creator != null )
757 {
758 document.addCreator(creator);
759 }
760 else
761 {
762 document.addCreator("JasperReports Library version " + Package.getPackage("net.sf.jasperreports.engine").getImplementationVersion());
763 }
756 if( creator == null )
757 {
758 creator = "JasperReports Library version " + Package.getPackage("net.sf.jasperreports.engine").getImplementationVersion();
759 }
760 document.addCreator(creator);
764761
765762 //accessibility check: tab order follows the structure of the document
766763 pdfWriter.setTabs(PdfName.S);
5151
5252 import org.apache.commons.logging.Log;
5353 import org.apache.commons.logging.LogFactory;
54 import org.apache.poi.hpsf.SummaryInformation;
5455 import org.apache.poi.hssf.usermodel.HSSFCell;
5556 import org.apache.poi.hssf.usermodel.HSSFCellStyle;
5657 import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
328329 palette = workbook.getCustomPalette();
329330 customColorIndex = MIN_COLOR_INDEX;
330331 autofitColumns = new HashMap<HSSFSheet,List<Integer>>();
332
333 SummaryInformation summaryInformation = workbook.getSummaryInformation();
334 if (summaryInformation == null)
335 {
336 workbook.createInformationProperties();
337 summaryInformation = workbook.getSummaryInformation();
338 }
339
340 String application = configuration.getMetadataApplication();
341 if( application == null )
342 {
343 application = "JasperReports Library version " + Package.getPackage("net.sf.jasperreports.engine").getImplementationVersion();
344 }
345 summaryInformation.setApplicationName(application);
346
347 String title = configuration.getMetadataTitle();
348 if (title != null)
349 {
350 summaryInformation.setTitle(title);
351 }
352 String subject = configuration.getMetadataSubject();
353 if (subject != null)
354 {
355 summaryInformation.setSubject(subject);
356 }
357 String author = configuration.getMetadataAuthor();
358 if (author != null)
359 {
360 summaryInformation.setAuthor(author);
361 }
362 String keywords = configuration.getMetadataKeywords();
363 if (keywords != null)
364 {
365 summaryInformation.setKeywords(keywords);
366 }
331367 }
332368
333369
179179 */
180180 public static final String XML_EXPORTER_KEY = JRPropertiesUtil.PROPERTY_PREFIX + "xml";
181181
182 private static final String PROPERTY_START_PAGE_INDEX = JRPropertiesUtil.PROPERTY_PREFIX + "export.xml.start.page.index";
183 private static final String PROPERTY_END_PAGE_INDEX = JRPropertiesUtil.PROPERTY_PREFIX + "export.xml.end.page.index";
184 private static final String PROPERTY_PAGE_COUNT = JRPropertiesUtil.PROPERTY_PREFIX + "export.xml.page.count";
182 public static final String PROPERTY_START_PAGE_INDEX = JRPropertiesUtil.PROPERTY_PREFIX + "export.xml.start.page.index";
183 public static final String PROPERTY_END_PAGE_INDEX = JRPropertiesUtil.PROPERTY_PREFIX + "export.xml.end.page.index";
184 public static final String PROPERTY_PAGE_COUNT = JRPropertiesUtil.PROPERTY_PREFIX + "export.xml.page.count";
185185
186186 /**
187187 * Stores the text sequence used to replace invalid XML characters
2727 import net.sf.jasperreports.engine.export.LengthUtil;
2828 import net.sf.jasperreports.engine.type.HorizontalImageAlignEnum;
2929 import net.sf.jasperreports.engine.type.ModeEnum;
30 import net.sf.jasperreports.engine.type.ScaleImageEnum;
3031 import net.sf.jasperreports.engine.type.VerticalImageAlignEnum;
3132 import net.sf.jasperreports.engine.util.JRColorUtil;
3233
3637 */
3738 public class GraphicStyle extends Style
3839 {
40 /**
41 * The ratio of 72 dpi to 96 dpi
42 */
43 public static final Double DPI_RATIO = 72.0/96.0;
44
3945 /**
4046 *
4147 */
4551 private String width;
4652 private String hAlign;
4753 private String vAlign;
48
49
54 private double cropTop;
55 private double cropLeft;
56 private double cropBottom;
57 private double cropRight;
58
59 private String clip;
60
61
62 public GraphicStyle(WriterHelper styleWriter, JRPrintGraphicElement element)
63 {
64 this(styleWriter, element, 0, 0, 0, 0);
65 }
66
5067 /**
5168 *
5269 */
53 public GraphicStyle(WriterHelper styleWriter, JRPrintGraphicElement element)
70 public GraphicStyle(
71 WriterHelper styleWriter,
72 JRPrintGraphicElement element,
73 double cropTop,
74 double cropLeft,
75 double cropBottom,
76 double cropRight
77 )
5478 {
5579 super(styleWriter);
56
80 this.cropTop = cropTop;
81 this.cropLeft = cropLeft;
82 this.cropBottom = cropBottom;
83 this.cropRight = cropRight;
84
5785 if (element.getModeValue() == ModeEnum.OPAQUE)
5886 {
5987 //fill = "solid";
99127 JRPrintImage imageElement = (JRPrintImage)element;
100128 horizontalAlignment = imageElement.getHorizontalImageAlign();
101129 verticalAlignment = imageElement.getVerticalImageAlign();
130 if(imageElement.getScaleImageValue() == ScaleImageEnum.CLIP
131 && (cropTop > 0 || cropLeft > 0 || cropBottom > 0 || cropRight > 0))
132 {
133 clip = " fo:clip=\"rect("
134 + LengthUtil.inchNoRound(cropTop * DPI_RATIO)
135 + "in,"
136 + LengthUtil.inchNoRound(cropRight * DPI_RATIO)
137 + "in,"
138 + LengthUtil.inchNoRound(cropBottom * DPI_RATIO)
139 + "in,"
140 + LengthUtil.inchNoRound(cropLeft * DPI_RATIO)
141 + "in)\"";
142 }
102143 }
103144
104145 switch(horizontalAlignment)
159200 id.append(hAlign);
160201 id.append("|");
161202 id.append(vAlign);
203 id.append("|");
204 id.append(cropTop);
205 id.append("|");
206 id.append(cropLeft);
207 id.append("|");
208 id.append(cropBottom);
209 id.append("|");
210 id.append(cropRight);
162211 return id.toString();
163212 }
164213
171220 styleWriter.write(" draw:fill-color=\"#" + backcolor + "\"");
172221 styleWriter.write(" style:horizontal-pos=\""+hAlign+ "\" style:horizontal-rel=\"paragraph\"");
173222 styleWriter.write(" style:vertical-pos=\""+vAlign+ "\" style:vertical-rel=\"paragraph\"");
223 if(clip != null)
224 {
225 styleWriter.write(clip);
226 }
174227 styleWriter.write(" svg:stroke-color=\"#" + forecolor + "\"");
175228 styleWriter.write(" draw:stroke=\"" + style + "\"");//FIXMENOW dashed borders do not work; only dashed lines and ellipses seem to work
176229 styleWriter.write(" draw:stroke-dash=\"Dashed\"");
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.export.oasis;
24
25 import java.awt.Dimension;
26 import java.awt.geom.Dimension2D;
27
28 import net.sf.jasperreports.engine.JRException;
29 import net.sf.jasperreports.engine.JRPrintImage;
30 import net.sf.jasperreports.engine.JasperReportsContext;
31 import net.sf.jasperreports.engine.export.JRExporterGridCell;
32 import net.sf.jasperreports.engine.type.ModeEnum;
33 import net.sf.jasperreports.renderers.DimensionRenderable;
34 import net.sf.jasperreports.renderers.Renderable;
35 import net.sf.jasperreports.renderers.ResourceRenderer;
36 import net.sf.jasperreports.renderers.util.RendererUtil;
37
38 /**
39 * @author Sanda Zaharia (shertage@users.sourceforge.net)
40 */
41 public class InternalImageProcessor
42 {
43 private final JRPrintImage imageElement;
44 private final JRExporterGridCell cell;
45 private final int availableImageWidth;
46 private final int availableImageHeight;
47 private final DocumentBuilder documentBuilder;
48 private final JasperReportsContext jasperReportsContext;
49
50 public InternalImageProcessor(
51 JRPrintImage imageElement,
52 JRExporterGridCell cell,
53 int availableImageWidth,
54 int availableImageHeight,
55 DocumentBuilder documentBuilder,
56 JasperReportsContext jasperReportsContext
57 )
58 {
59 this.imageElement = imageElement;
60 this.cell = cell;
61 this.availableImageWidth = availableImageWidth;
62 this.availableImageHeight = availableImageHeight;
63 this.documentBuilder = documentBuilder;
64 this.jasperReportsContext = jasperReportsContext;
65 }
66
67 public InternalImageProcessorResult process(Renderable renderer) throws JRException
68 {
69 boolean isLazy = RendererUtil.isLazy(renderer);
70
71 if (!isLazy)
72 {
73 if (renderer instanceof ResourceRenderer)
74 {
75 renderer = documentBuilder.getRenderersCache().getLoadedRenderer((ResourceRenderer)renderer);
76 }
77 }
78
79 // check dimension first, to avoid caching renderers that might not be used eventually, due to their dimension errors
80
81 int width = availableImageWidth;
82 int height = availableImageHeight;
83
84 int xoffset = 0;
85 int yoffset = 0;
86
87 double cropTop = 0;
88 double cropLeft = 0;
89 double cropBottom = 0;
90 double cropRight = 0;
91
92
93 switch (imageElement.getScaleImageValue())
94 {
95 case FILL_FRAME :
96 {
97 width = availableImageWidth;
98 height = availableImageHeight;
99 // xoffset = 0;
100 // yoffset = 0;
101 break;
102 }
103 case CLIP :
104 {
105 double normalWidth = availableImageWidth;
106 double normalHeight = availableImageHeight;
107
108 DimensionRenderable dimensionRenderer = documentBuilder.getRenderersCache().getDimensionRenderable(renderer);
109 Dimension2D dimension = dimensionRenderer == null ? null : dimensionRenderer.getDimension(jasperReportsContext);
110 if (dimension != null)
111 {
112 normalWidth = dimension.getWidth();
113 normalHeight = dimension.getHeight();
114 }
115
116 if (normalWidth > availableImageWidth)
117 {
118 switch (imageElement.getHorizontalImageAlign())
119 {
120 case RIGHT :
121 {
122 cropLeft = normalWidth - availableImageWidth;
123 cropRight = 0;
124 break;
125 }
126 case CENTER :
127 {
128 cropLeft = (normalWidth - availableImageWidth) / 2;
129 cropRight = cropLeft;
130 break;
131 }
132 case LEFT :
133 default :
134 {
135 cropLeft = 0;
136 cropRight = normalWidth - availableImageWidth;
137 break;
138 }
139 }
140 width = (int)normalWidth - (int)cropLeft - (int)cropRight;
141 }
142 else
143 {
144 width = (int)normalWidth;
145 }
146
147 if (normalHeight > availableImageHeight)
148 {
149 switch (imageElement.getVerticalImageAlign())
150 {
151 case TOP :
152 {
153 cropTop = 0;
154 cropBottom = normalHeight - availableImageHeight;
155 break;
156 }
157 case MIDDLE :
158 {
159 cropTop = (normalHeight - availableImageHeight) / 2;
160 cropBottom = cropTop;
161 break;
162 }
163 case BOTTOM :
164 default :
165 {
166 cropTop = normalHeight - availableImageHeight;
167 cropBottom = 0;
168 break;
169 }
170 }
171 height = (int)normalHeight - (int)cropTop - (int)cropBottom;
172 }
173 else
174 {
175 height = (int)normalHeight;
176 }
177
178 // xoffset = (int)(ImageUtil.getXAlignFactor(imageElement) * ((int)normalWidth - availableImageWidth));
179 // yoffset = (int)(ImageUtil.getYAlignFactor(imageElement) * ((int)normalHeight - availableImageHeight));
180
181 break;
182 }
183 case RETAIN_SHAPE :
184 default :
185 {
186 double normalWidth = availableImageWidth;
187 double normalHeight = availableImageHeight;
188
189 if (!isLazy)
190 {
191 DimensionRenderable dimensionRenderer = documentBuilder.getRenderersCache().getDimensionRenderable(renderer);
192 Dimension2D dimension = dimensionRenderer == null ? null : dimensionRenderer.getDimension(jasperReportsContext);
193 if (dimension != null)
194 {
195 normalWidth = dimension.getWidth();
196 normalHeight = dimension.getHeight();
197 }
198 }
199
200 double ratio = normalWidth / normalHeight;
201
202 if( ratio > availableImageWidth / (double)availableImageHeight )
203 {
204 width = availableImageWidth;
205 height = (int)(width/ratio);
206
207 }
208 else
209 {
210 height = availableImageHeight;
211 width = (int)(ratio * height);
212 }
213
214 // xoffset = (int)(ImageUtil.getXAlignFactor(imageElement) * (availableImageWidth - width));
215 // yoffset = (int)(ImageUtil.getYAlignFactor(imageElement) * (availableImageHeight - height));
216 }
217 }
218
219
220 String imagePath =
221 documentBuilder.getImagePath(
222 renderer,
223 new Dimension(availableImageWidth, availableImageHeight),
224 ModeEnum.OPAQUE == imageElement.getModeValue() ? imageElement.getBackcolor() : null,
225 cell,
226 isLazy
227 );
228
229 return
230 new InternalImageProcessorResult(
231 imagePath,
232 width,
233 height,
234 xoffset,
235 yoffset,
236 cropTop,
237 cropLeft,
238 cropBottom,
239 cropRight
240 );
241 }
242 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.export.oasis;
24
25 /**
26 * @author Sanda Zaharia (shertage@users.sourceforge.net)
27 */
28 public class InternalImageProcessorResult
29 {
30 protected final String imagePath;
31 protected int width;
32 protected int height;
33 protected int xoffset;
34 protected int yoffset;
35 protected double cropTop;
36 protected double cropLeft;
37 protected double cropBottom;
38 protected double cropRight;
39
40 protected InternalImageProcessorResult(
41 String imagePath,
42 int width,
43 int height,
44 int xoffset,
45 int yoffset,
46 double cropTop,
47 double cropLeft,
48 double cropBottom,
49 double cropRight
50
51 )
52 {
53 this.imagePath = imagePath;
54 this.width = width;
55 this.height = height;
56 this.xoffset = xoffset;
57 this.yoffset = yoffset;
58 this.cropTop = cropTop;
59 this.cropLeft = cropLeft;
60 this.cropBottom = cropBottom;
61 this.cropRight = cropRight;
62 }
63 }
64
3131 package net.sf.jasperreports.engine.export.oasis;
3232
3333 import java.awt.Color;
34 import java.awt.Dimension;
35 import java.awt.geom.Dimension2D;
3634 import java.io.IOException;
3735 import java.io.OutputStream;
3836 import java.text.AttributedCharacterIterator;
3937 import java.util.HashMap;
4038 import java.util.Locale;
4139 import java.util.Map;
42
43 import org.apache.commons.logging.Log;
44 import org.apache.commons.logging.LogFactory;
4540
4641 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
4742 import net.sf.jasperreports.engine.JRException;
7671 import net.sf.jasperreports.engine.export.zip.ExportZipEntry;
7772 import net.sf.jasperreports.engine.export.zip.FileBufferedZipEntry;
7873 import net.sf.jasperreports.engine.type.LineDirectionEnum;
79 import net.sf.jasperreports.engine.type.ModeEnum;
80 import net.sf.jasperreports.engine.util.ImageUtil;
8174 import net.sf.jasperreports.engine.util.JRStringUtil;
8275 import net.sf.jasperreports.engine.util.JRStyledText;
8376 import net.sf.jasperreports.export.OdsExporterConfiguration;
8477 import net.sf.jasperreports.export.OdsReportConfiguration;
8578 import net.sf.jasperreports.export.XlsReportConfiguration;
86 import net.sf.jasperreports.renderers.DimensionRenderable;
8779 import net.sf.jasperreports.renderers.Renderable;
88 import net.sf.jasperreports.renderers.ResourceRenderer;
89 import net.sf.jasperreports.renderers.util.RendererUtil;
80
81 import org.apache.commons.logging.Log;
82 import org.apache.commons.logging.LogFactory;
9083
9184
9285 /**
403396 image,
404397 gridCell,
405398 availableImageWidth,
406 availableImageHeight
399 availableImageHeight,
400 documentBuilder,
401 jasperReportsContext
407402 );
408403
409404 InternalImageProcessorResult imageProcessorResult = null;
444439 String cellAddress = getCellAddress(rowIndex + gridCell.getRowSpan(), colIndex + gridCell.getColSpan());
445440 cellAddress = cellAddress == null ? "" : "table:end-cell-address=\"" + cellAddress + "\" ";
446441
442 // tempBodyWriter.write(
443 // "<draw:frame text:anchor-type=\"frame\" "
444 // + "draw:style-name=\"" + styleCache.getGraphicStyle(image) + "\" "
445 // + cellAddress
446 //// + "table:end-x=\"" + LengthUtil.inchRound(image.getWidth()) + "in\" "
447 //// + "table:end-y=\"" + LengthUtil.inchRound(image.getHeight()) + "in\" "
448 // + "table:end-x=\"0in\" "
449 // + "table:end-y=\"0in\" "
450 //// + "svg:x=\"" + LengthUtil.inch(image.getX() + leftPadding + imageProcessorResult.xoffset) + "in\" "
451 //// + "svg:y=\"" + LengthUtil.inch(image.getY() + topPadding + imageProcessorResult.yoffset) + "in\" "
452 // + "svg:x=\"0in\" "
453 // + "svg:y=\"0in\" "
454 // + "svg:width=\"" + LengthUtil.inchRound(image.getWidth()) + "in\" "
455 // + "svg:height=\"" + LengthUtil.inchRound(image.getHeight()) + "in\""
456 // + ">"
457 // );
458
459
460
447461 tempBodyWriter.write(
448 "<draw:frame text:anchor-type=\"frame\" "
449 + "draw:style-name=\"" + styleCache.getGraphicStyle(image) + "\" "
450 + cellAddress
451 // + "table:end-x=\"" + LengthUtil.inchRound(image.getWidth()) + "in\" "
452 // + "table:end-y=\"" + LengthUtil.inchRound(image.getHeight()) + "in\" "
453 + "table:end-x=\"0in\" "
454 + "table:end-y=\"0in\" "
455 // + "svg:x=\"" + LengthUtil.inch(image.getX() + leftPadding + imageProcessorResult.xoffset) + "in\" "
456 // + "svg:y=\"" + LengthUtil.inch(image.getY() + topPadding + imageProcessorResult.yoffset) + "in\" "
457 + "svg:x=\"0in\" "
458 + "svg:y=\"0in\" "
459 + "svg:width=\"" + LengthUtil.inchRound(image.getWidth()) + "in\" "
460 + "svg:height=\"" + LengthUtil.inchRound(image.getHeight()) + "in\""
461 + ">"
462 );
462 "<draw:frame text:anchor-type=\"paragraph\" "
463 + "draw:style-name=\"" + styleCache.getGraphicStyle(
464 image,
465 imageProcessorResult.cropTop,
466 imageProcessorResult.cropLeft,
467 imageProcessorResult.cropBottom,
468 imageProcessorResult.cropRight
469 ) + "\" "
470 + "svg:x=\"" + LengthUtil.inch(leftPadding + imageProcessorResult.xoffset/1.33) + "in\" "
471 + "svg:y=\"" + LengthUtil.inch(topPadding + imageProcessorResult.yoffset) + "in\" "
472 + "svg:width=\"" + LengthUtil.inch(imageProcessorResult.width) + "in\" "
473 + "svg:height=\"" + LengthUtil.inch(imageProcessorResult.height) + "in\">"
474 );
475
476
463477 tempBodyWriter.write("<draw:image ");
464478 tempBodyWriter.write(" xlink:href=\"" + JRStringUtil.xmlEncode(imageProcessorResult.imagePath) + "\"");
465479 tempBodyWriter.write(" xlink:type=\"simple\"");
479493 tableBuilder.buildCellFooter();
480494 }
481495
482 private class InternalImageProcessor
483 {
484 private final JRPrintImage imageElement;
485 private final JRExporterGridCell cell;
486 private final int availableImageWidth;
487 private final int availableImageHeight;
488
489 protected InternalImageProcessor(
490 JRPrintImage imageElement,
491 JRExporterGridCell cell,
492 int availableImageWidth,
493 int availableImageHeight
494 )
495 {
496 this.imageElement = imageElement;
497 this.cell = cell;
498 this.availableImageWidth = availableImageWidth;
499 this.availableImageHeight = availableImageHeight;
500 }
501
502 private InternalImageProcessorResult process(Renderable renderer) throws JRException
503 {
504 boolean isLazy = RendererUtil.isLazy(renderer);
505
506 if (!isLazy)
507 {
508 if (renderer instanceof ResourceRenderer)
509 {
510 renderer = documentBuilder.getRenderersCache().getLoadedRenderer((ResourceRenderer)renderer);
511 }
512 }
513
514 // check dimension first, to avoid caching renderers that might not be used eventually, due to their dimension errors
515
516 int width = availableImageWidth;
517 int height = availableImageHeight;
518
519 int xoffset = 0;
520 int yoffset = 0;
521
522 switch (imageElement.getScaleImageValue())
523 {
524 case FILL_FRAME :
525 {
526 width = availableImageWidth;
527 height = availableImageHeight;
528 xoffset = 0;
529 yoffset = 0;
530 break;
531 }
532 case CLIP :
533 case RETAIN_SHAPE :
534 default :
535 {
536 double normalWidth = availableImageWidth;
537 double normalHeight = availableImageHeight;
538
539 if (!isLazy)
540 {
541 DimensionRenderable dimensionRenderer = documentBuilder.getRenderersCache().getDimensionRenderable(renderer);
542 Dimension2D dimension = dimensionRenderer == null ? null : dimensionRenderer.getDimension(jasperReportsContext);
543 if (dimension != null)
544 {
545 normalWidth = dimension.getWidth();
546 normalHeight = dimension.getHeight();
547 }
548 }
549
550 double ratio = normalWidth / normalHeight;
551
552 if( ratio > availableImageWidth / (double)availableImageHeight )
553 {
554 width = availableImageWidth;
555 height = (int)(width/ratio);
556
557 }
558 else
559 {
560 height = availableImageHeight;
561 width = (int)(ratio * height);
562 }
563
564 xoffset = (int)(ImageUtil.getXAlignFactor(imageElement) * (availableImageWidth - width));
565 yoffset = (int)(ImageUtil.getYAlignFactor(imageElement) * (availableImageHeight - height));
566 }
567 }
568
569
570 String imagePath =
571 documentBuilder.getImagePath(
572 renderer,
573 new Dimension(availableImageWidth, availableImageHeight),
574 ModeEnum.OPAQUE == imageElement.getModeValue() ? imageElement.getBackcolor() : null,
575 cell,
576 isLazy
577 );
578
579 return
580 new InternalImageProcessorResult(
581 imagePath,
582 width,
583 height,
584 xoffset,
585 yoffset
586 );
587 }
588 }
589
590 private class InternalImageProcessorResult
591 {
592 protected final String imagePath;
593 protected int width;
594 protected int height;
595 protected int xoffset;
596 protected int yoffset;
597
598 protected InternalImageProcessorResult(
599 String imagePath,
600 int width,
601 int height,
602 int xoffset,
603 int yoffset
604 )
605 {
606 this.imagePath = imagePath;
607 this.width = width;
608 this.height = height;
609 this.xoffset = xoffset;
610 this.yoffset = yoffset;
611 }
612 }
613
614496 protected String getCellAddress(int row, int col)
615497 {
616498 String address = null;
3131 package net.sf.jasperreports.engine.export.oasis;
3232
3333 import java.awt.Color;
34 import java.awt.Dimension;
35 import java.awt.geom.Dimension2D;
3634 import java.io.IOException;
3735 import java.io.OutputStream;
3836 import java.util.HashMap;
4038 import java.util.List;
4139 import java.util.Locale;
4240 import java.util.Map;
43
44 import org.apache.commons.logging.Log;
45 import org.apache.commons.logging.LogFactory;
4641
4742 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
4843 import net.sf.jasperreports.engine.JRAbstractExporter;
7873 import net.sf.jasperreports.engine.export.zip.ExportZipEntry;
7974 import net.sf.jasperreports.engine.export.zip.FileBufferedZipEntry;
8075 import net.sf.jasperreports.engine.type.ModeEnum;
81 import net.sf.jasperreports.engine.util.ImageUtil;
8276 import net.sf.jasperreports.engine.util.JRStringUtil;
8377 import net.sf.jasperreports.engine.util.JRStyledText;
8478 import net.sf.jasperreports.export.ExportInterruptedException;
8781 import net.sf.jasperreports.export.OdtReportConfiguration;
8882 import net.sf.jasperreports.export.OutputStreamExporterOutput;
8983 import net.sf.jasperreports.export.ReportExportConfiguration;
90 import net.sf.jasperreports.renderers.DimensionRenderable;
9184 import net.sf.jasperreports.renderers.Renderable;
92 import net.sf.jasperreports.renderers.ResourceRenderer;
93 import net.sf.jasperreports.renderers.util.RendererUtil;
85
86 import org.apache.commons.logging.Log;
87 import org.apache.commons.logging.LogFactory;
9488
9589
9690 /**
748742 int rightPadding =
749743 Math.max(image.getLineBox().getRightPadding().intValue(), Math.round(image.getLineBox().getRightPen().getLineWidth().floatValue()));
750744
751 int availableImageWidth = image.getWidth() - leftPadding - rightPadding;
752 availableImageWidth = availableImageWidth < 0 ? 0 : availableImageWidth;
753
754 int availableImageHeight = image.getHeight() - topPadding - bottomPadding;
755 availableImageHeight = availableImageHeight < 0 ? 0 : availableImageHeight;
745 int availableImageWidth = Math.max(0,image.getWidth() - leftPadding - rightPadding);
746 int availableImageHeight = Math.max(0,image.getHeight() - topPadding - bottomPadding);
756747
757748 tableBuilder.buildCellHeader(styleCache.getCellStyle(gridCell), gridCell.getColSpan(), gridCell.getRowSpan());
758749
769760 image,
770761 gridCell,
771762 availableImageWidth,
772 availableImageHeight
763 availableImageHeight,
764 documentBuilder,
765 jasperReportsContext
773766 );
774767
775768 InternalImageProcessorResult imageProcessorResult = null;
801794
802795 tempBodyWriter.write(
803796 "<draw:frame text:anchor-type=\"paragraph\" "
804 + "draw:style-name=\"" + styleCache.getGraphicStyle(image) + "\" "
797 + "draw:style-name=\"" + styleCache.getGraphicStyle(
798 image,
799 imageProcessorResult.cropTop,
800 imageProcessorResult.cropLeft,
801 imageProcessorResult.cropBottom,
802 imageProcessorResult.cropRight
803 ) + "\" "
805804 + "svg:x=\"" + LengthUtil.inch(leftPadding + imageProcessorResult.xoffset) + "in\" "
806805 + "svg:y=\"" + LengthUtil.inch(topPadding + imageProcessorResult.yoffset) + "in\" "
807806 + "svg:width=\"" + LengthUtil.inch(imageProcessorResult.width) + "in\" "
827826 }
828827
829828
830 private class InternalImageProcessor
831 {
832 private final JRPrintImage imageElement;
833 private final JRExporterGridCell cell;
834 private final int availableImageWidth;
835 private final int availableImageHeight;
836
837 protected InternalImageProcessor(
838 JRPrintImage imageElement,
839 JRExporterGridCell cell,
840 int availableImageWidth,
841 int availableImageHeight
842 )
843 {
844 this.imageElement = imageElement;
845 this.cell = cell;
846 this.availableImageWidth = availableImageWidth;
847 this.availableImageHeight = availableImageHeight;
848 }
849
850 private InternalImageProcessorResult process(Renderable renderer) throws JRException
851 {
852 boolean isLazy = RendererUtil.isLazy(renderer);
853
854 if (!isLazy)
855 {
856 if (renderer instanceof ResourceRenderer)
857 {
858 renderer = documentBuilder.getRenderersCache().getLoadedRenderer((ResourceRenderer)renderer);
859 }
860 }
861
862 // check dimension first, to avoid caching renderers that might not be used eventually, due to their dimension errors
863
864 int width = availableImageWidth;
865 int height = availableImageHeight;
866
867 int xoffset = 0;
868 int yoffset = 0;
869
870 switch (imageElement.getScaleImageValue())
871 {
872 case FILL_FRAME :
873 {
874 width = availableImageWidth;
875 height = availableImageHeight;
876 xoffset = 0;
877 yoffset = 0;
878 break;
879 }
880 case CLIP :
881 case RETAIN_SHAPE :
882 default :
883 {
884 double normalWidth = availableImageWidth;
885 double normalHeight = availableImageHeight;
886
887 if (!isLazy)
888 {
889 DimensionRenderable dimensionRenderer = documentBuilder.getRenderersCache().getDimensionRenderable(renderer);
890 Dimension2D dimension = dimensionRenderer == null ? null : dimensionRenderer.getDimension(jasperReportsContext);
891 if (dimension != null)
892 {
893 normalWidth = dimension.getWidth();
894 normalHeight = dimension.getHeight();
895 }
896 }
897
898 double ratio = normalWidth / normalHeight;
899
900 if( ratio > availableImageWidth / (double)availableImageHeight )
901 {
902 width = availableImageWidth;
903 height = (int)(width/ratio);
904
905 }
906 else
907 {
908 height = availableImageHeight;
909 width = (int)(ratio * height);
910 }
911
912 xoffset = (int)(ImageUtil.getXAlignFactor(imageElement) * (availableImageWidth - width));
913 yoffset = (int)(ImageUtil.getYAlignFactor(imageElement) * (availableImageHeight - height));
914 }
915 }
916
917
918 String imagePath =
919 documentBuilder.getImagePath(
920 renderer,
921 new Dimension(availableImageWidth, availableImageHeight),
922 ModeEnum.OPAQUE == imageElement.getModeValue() ? imageElement.getBackcolor() : null,
923 cell,
924 isLazy
925 );
926
927 return
928 new InternalImageProcessorResult(
929 imagePath,
930 width,
931 height,
932 xoffset,
933 yoffset
934 );
935 }
936 }
937
938 private class InternalImageProcessorResult
939 {
940 protected final String imagePath;
941 protected int width;
942 protected int height;
943 protected int xoffset;
944 protected int yoffset;
945
946 protected InternalImageProcessorResult(
947 String imagePath,
948 int width,
949 int height,
950 int xoffset,
951 int yoffset
952 )
953 {
954 this.imagePath = imagePath;
955 this.width = width;
956 this.height = height;
957 this.xoffset = xoffset;
958 this.yoffset = yoffset;
959 }
960 }
961
962
963829 /**
964830 *
965831 */
216216 */
217217 public String getGraphicStyle(JRPrintGraphicElement element)
218218 {
219 GraphicStyle graphicStyle = new GraphicStyle(styleWriter, element);
219 return getGraphicStyle(element, 0, 0, 0, 0);
220 }
221
222
223 /**
224 *
225 */
226 public String getGraphicStyle(
227 JRPrintGraphicElement element,
228 double cropTop,
229 double cropLeft,
230 double cropBottom,
231 double cropRight
232 )
233 {
234 GraphicStyle graphicStyle = new GraphicStyle(
235 styleWriter,
236 element,
237 cropTop,
238 cropLeft,
239 cropBottom,
240 cropRight);
220241
221242 String graphicStyleId = graphicStyle.getId();
222243 String graphicStyleName = cellStyles.get(graphicStyleId);
3030 import net.sf.jasperreports.engine.export.CutsInfo;
3131 import net.sf.jasperreports.engine.export.JRGridLayout;
3232 import net.sf.jasperreports.engine.export.LengthUtil;
33 import net.sf.jasperreports.engine.export.ooxml.type.PaperSizeEnum;
3334 import net.sf.jasperreports.engine.type.OrientationEnum;
3435
3536
8283 write(" <w:sectPr>\n");
8384 write(" <w:pgSz w:w=\"" + LengthUtil.twip(pageFormat.getPageWidth()) + "\" w:h=\"" + LengthUtil.twip(pageFormat.getPageHeight()) + "\"");
8485 write(" w:orient=\"" + (pageFormat.getOrientation() == OrientationEnum.LANDSCAPE ? "landscape" : "portrait") + "\"");
86
87 if(OoxmlUtils.getSuitablePaperSize(pageFormat) == PaperSizeEnum.UNDEFINED)
88 {
89 // unique identifier for the paper size
90 write(" w:code=\""+ (1000 + pageFormat.getPageWidth() + pageFormat.getPageHeight()) +"\"");
91 }
8592 write("/>\n");
8693
8794 CutsInfo xCuts = pageGridLayout.getXCuts();
4141 private ExportZipEntry stylesEntry;
4242 private ExportZipEntry settingsEntry;
4343 private ExportZipEntry relsEntry;
44 private ExportZipEntry appEntry;
45 private ExportZipEntry coreEntry;
4446
4547 /**
4648 *
5961 relsEntry = createEntry("word/_rels/document.xml.rels");
6062 addEntry(relsEntry);
6163
64 appEntry = createEntry("docProps/app.xml");
65 addEntry(appEntry);
66
67 coreEntry = createEntry("docProps/core.xml");
68 addEntry(coreEntry);
69
6270 addEntry("_rels/.rels", "net/sf/jasperreports/engine/export/ooxml/docx/_rels/xml.rels");
6371 addEntry("[Content_Types].xml", "net/sf/jasperreports/engine/export/ooxml/docx/Content_Types.xml");
6472 }
95103 return relsEntry;
96104 }
97105
106 /**
107 *
108 */
109 public ExportZipEntry getAppEntry()
110 {
111 return appEntry;
112 }
113
114 /**
115 *
116 */
117 public ExportZipEntry getCoreEntry()
118 {
119 return coreEntry;
120 }
98121 }
199199 protected String pageAnchor;
200200
201201 protected DocxRelsHelper relsHelper;
202 protected PropsAppHelper appHelper;
203 protected PropsCoreHelper coreHelper;
202204
203205 boolean emptyPageState;
204206
353355 relsHelper = new DocxRelsHelper(jasperReportsContext, docxZip.getRelsEntry().getWriter());
354356 relsHelper.exportHeader();
355357
358 appHelper = new PropsAppHelper(jasperReportsContext, docxZip.getAppEntry().getWriter());
359 coreHelper = new PropsCoreHelper(jasperReportsContext, docxZip.getCoreEntry().getWriter());
360
361 appHelper.exportHeader();
362
363 DocxExporterConfiguration configuration = getCurrentConfiguration();
364
365 String application = configuration.getMetadataApplication();
366 if( application == null )
367 {
368 application = "JasperReports Library version " + Package.getPackage("net.sf.jasperreports.engine").getImplementationVersion();
369 }
370 appHelper.exportProperty(PropsAppHelper.PROPERTY_APPLICATION, application);
371
372 coreHelper.exportHeader();
373
374 String title = configuration.getMetadataTitle();
375 if (title != null)
376 {
377 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_TITLE, title);
378 }
379 String subject = configuration.getMetadataSubject();
380 if (subject != null)
381 {
382 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_SUBJECT, subject);
383 }
384 String author = configuration.getMetadataAuthor();
385 if (author != null)
386 {
387 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_CREATOR, author);
388 }
389 String keywords = configuration.getMetadataKeywords();
390 if (keywords != null)
391 {
392 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_KEYWORDS, keywords);
393 }
394
356395 List<ExporterInputItem> items = exporterInput.getItems();
357396
358397 DocxStyleHelper styleHelper =
436475 // }
437476
438477 relsHelper.exportFooter();
439
440478 relsHelper.close();
479
480 appHelper.exportFooter();
481 appHelper.close();
482
483 coreHelper.exportFooter();
484 coreHelper.close();
441485
442486 docxZip.zipEntries(os);
443487
145145 protected PptxPresentationHelper presentationHelper;
146146 protected PptxPresentationRelsHelper presentationRelsHelper;
147147 protected PptxContentTypesHelper ctHelper;
148 protected PropsAppHelper appHelper;
149 protected PropsCoreHelper coreHelper;
148150 protected PptxSlideHelper slideHelper;
149151 protected PptxSlideRelsHelper slideRelsHelper;
150152 protected Writer presentationWriter;
308310
309311 ctHelper = new PptxContentTypesHelper(jasperReportsContext, pptxZip.getContentTypesEntry().getWriter());
310312 ctHelper.exportHeader();
313
314 appHelper = new PropsAppHelper(jasperReportsContext, pptxZip.getAppEntry().getWriter());
315 coreHelper = new PropsCoreHelper(jasperReportsContext, pptxZip.getCoreEntry().getWriter());
316
317 appHelper.exportHeader();
318
319 PptxExporterConfiguration configuration = getCurrentConfiguration();
320
321 String application = configuration.getMetadataApplication();
322 if( application == null )
323 {
324 application = "JasperReports Library version " + Package.getPackage("net.sf.jasperreports.engine").getImplementationVersion();
325 }
326 appHelper.exportProperty(PropsAppHelper.PROPERTY_APPLICATION, application);
327
328 coreHelper.exportHeader();
329
330 String title = configuration.getMetadataTitle();
331 if (title != null)
332 {
333 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_TITLE, title);
334 }
335 String subject = configuration.getMetadataSubject();
336 if (subject != null)
337 {
338 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_SUBJECT, subject);
339 }
340 String author = configuration.getMetadataAuthor();
341 if (author != null)
342 {
343 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_CREATOR, author);
344 }
345 String keywords = configuration.getMetadataKeywords();
346 if (keywords != null)
347 {
348 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_KEYWORDS, keywords);
349 }
311350
312351 // DocxStyleHelper styleHelper =
313352 // new DocxStyleHelper(
369408 // }
370409
371410 presentationRelsHelper.exportFooter();
372
373411 presentationRelsHelper.close();
374412
375413 ctHelper.exportFooter();
376
377414 ctHelper.close();
415
416 appHelper.exportFooter();
417 appHelper.close();
418
419 coreHelper.exportFooter();
420 coreHelper.close();
378421
379422 pptxZip.zipEntries(os);
380423
155155 protected XlsxWorkbookHelper wbHelper;
156156 protected XlsxRelsHelper relsHelper;
157157 protected XlsxContentTypesHelper ctHelper;
158 protected PropsAppHelper appHelper;
159 protected PropsCoreHelper coreHelper;
158160 protected XlsxSheetHelper sheetHelper;
159161 protected XlsxSheetRelsHelper sheetRelsHelper;
160162 protected XlsxDrawingHelper drawingHelper;
657659 // }
658660
659661 relsHelper.exportFooter();
660
661662 relsHelper.close();
662663
663664 ctHelper.exportFooter();
664
665665 ctHelper.close();
666
667 appHelper.exportFooter();
668 appHelper.close();
669
670 coreHelper.exportFooter();
671 coreHelper.close();
666672
667673 xlsxZip.zipEntries(os);
668674
15731579
15741580 relsHelper = new XlsxRelsHelper(jasperReportsContext, xlsxZip.getRelsEntry().getWriter());
15751581 ctHelper = new XlsxContentTypesHelper(jasperReportsContext, xlsxZip.getContentTypesEntry().getWriter());
1582
1583 appHelper = new PropsAppHelper(jasperReportsContext, xlsxZip.getAppEntry().getWriter());
1584 coreHelper = new PropsCoreHelper(jasperReportsContext, xlsxZip.getCoreEntry().getWriter());
15761585
1577 String macro = macroTemplate == null ? getCurrentConfiguration().getMacroTemplate() : macroTemplate;
1586 XlsxExporterConfiguration configuration = getCurrentConfiguration();
1587
1588 String macro = macroTemplate == null ? configuration.getMacroTemplate() : macroTemplate;
15781589 if(macro != null)
15791590 {
15801591 xlsxZip.addMacro(macro);
15831594 }
15841595 relsHelper.exportHeader();
15851596 ctHelper.exportHeader();
1597
1598 appHelper.exportHeader();
15861599
1600 String application = configuration.getMetadataApplication();
1601 if( application == null )
1602 {
1603 application = "JasperReports Library version " + Package.getPackage("net.sf.jasperreports.engine").getImplementationVersion();
1604 }
1605 appHelper.exportProperty(PropsAppHelper.PROPERTY_APPLICATION, application);
1606
1607 coreHelper.exportHeader();
1608
1609 String title = configuration.getMetadataTitle();
1610 if (title != null)
1611 {
1612 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_TITLE, title);
1613 }
1614 String subject = configuration.getMetadataSubject();
1615 if (subject != null)
1616 {
1617 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_SUBJECT, subject);
1618 }
1619 String author = configuration.getMetadataAuthor();
1620 if (author != null)
1621 {
1622 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_CREATOR, author);
1623 }
1624 String keywords = configuration.getMetadataKeywords();
1625 if (keywords != null)
1626 {
1627 coreHelper.exportProperty(PropsCoreHelper.PROPERTY_KEYWORDS, keywords);
1628 }
1629
15871630 styleHelper =
15881631 new XlsxStyleHelper(
15891632 jasperReportsContext,
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.export.ooxml;
24
25 import net.sf.jasperreports.engine.PrintPageFormat;
26 import net.sf.jasperreports.engine.export.ooxml.type.PaperSizeEnum;
27
28 /**
29 * @author Sanda Zaharia (shertage@users.sourceforge.net)
30 */
31 public final class OoxmlUtils {
32
33 public static PaperSizeEnum getSuitablePaperSize(PrintPageFormat pageFormat)
34 {
35 if (pageFormat != null && pageFormat.getPageWidth() != 0 && pageFormat.getPageHeight() != 0)
36 {
37 long mmPageWidth = Math.round(((double)pageFormat.getPageWidth() / 72d) * 25.4);
38 long mmPageHeight = Math.round(((double)pageFormat.getPageHeight() / 72d) * 25.4);
39
40 for (PaperSizeEnum paperSize : PaperSizeEnum.values())
41 {
42 if (
43 ((paperSize.getWidth() == mmPageWidth) && (paperSize.getHeight() == mmPageHeight))
44 || ((paperSize.getHeight() == mmPageWidth) && (paperSize.getWidth() == mmPageHeight))
45 )
46 {
47 return paperSize;
48 }
49 }
50 }
51 return PaperSizeEnum.UNDEFINED;
52 }
53
54 }
5858 write(" <Override PartName=\"/ppt/slideMasters/slideMaster1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml\"/>\n");
5959 write(" <Override PartName=\"/ppt/slideLayouts/slideLayout1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml\"/>\n");
6060 write(" <Override PartName=\"/ppt/presentation.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml\"/>\n");
61 write(" <Override PartName=\"/docProps/app.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\"/>\n");
62 write(" <Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\"/>\n");
6163 }
6264
6365
4141 // private ExportZipEntry stylesEntry;
4242 private ExportZipEntry relsEntry;
4343 private ExportZipEntry contentTypesEntry;
44 private ExportZipEntry appEntry;
45 private ExportZipEntry coreEntry;
4446
4547 /**
4648 *
5961 contentTypesEntry = createEntry("[Content_Types].xml");
6062 addEntry(contentTypesEntry);
6163
64 appEntry = createEntry("docProps/app.xml");
65 addEntry(appEntry);
66
67 coreEntry = createEntry("docProps/core.xml");
68 addEntry(coreEntry);
69
6270 addEntry("_rels/.rels", "net/sf/jasperreports/engine/export/ooxml/pptx/_rels/xml.rels");
6371 addEntry("ppt/slideLayouts/_rels/slideLayout1.xml.rels", "net/sf/jasperreports/engine/export/ooxml/pptx/ppt/slideLayouts/_rels/slideLayout1.xml.rels");
6472 addEntry("ppt/slideLayouts/slideLayout1.xml", "net/sf/jasperreports/engine/export/ooxml/pptx/ppt/slideLayouts/slideLayout1.xml");
99107 return contentTypesEntry;
100108 }
101109
110 /**
111 *
112 */
113 public ExportZipEntry getAppEntry()
114 {
115 return appEntry;
116 }
117
118 /**
119 *
120 */
121 public ExportZipEntry getCoreEntry()
122 {
123 return coreEntry;
124 }
125
102126 /**
103127 *
104128 */
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.export.ooxml;
24
25 import java.io.Writer;
26
27 import net.sf.jasperreports.engine.JasperReportsContext;
28
29
30 /**
31 * @author Teodor Danciu (teodord@users.sourceforge.net)
32 */
33 public class PropsAppHelper extends BaseHelper
34 {
35 public static final String PROPERTY_APPLICATION = "Application";
36
37 /**
38 *
39 */
40 public PropsAppHelper(JasperReportsContext jasperReportsContext, Writer writer)
41 {
42 super(jasperReportsContext, writer);
43 }
44
45 /**
46 *
47 */
48 public void exportHeader()
49 {
50 write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
51 write("<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\">\n");
52 }
53
54
55 /**
56 *
57 */
58 public void exportProperty(String propName, String propValue)
59 {
60 write(" <" + propName + ">" + propValue + "</" + propName + ">\n");
61 }
62
63
64 /**
65 *
66 */
67 public void exportFooter()
68 {
69 write("</Properties>\n");
70 }
71 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.export.ooxml;
24
25 import java.io.Writer;
26
27 import net.sf.jasperreports.engine.JasperReportsContext;
28
29
30 /**
31 * @author Teodor Danciu (teodord@users.sourceforge.net)
32 */
33 public class PropsCoreHelper extends BaseHelper
34 {
35 public static final String PROPERTY_TITLE = "dc:title";
36 public static final String PROPERTY_SUBJECT = "dc:subject";
37 public static final String PROPERTY_CREATOR = "dc:creator";
38 public static final String PROPERTY_KEYWORDS = "cp:keywords";
39
40 /**
41 *
42 */
43 public PropsCoreHelper(JasperReportsContext jasperReportsContext, Writer writer)
44 {
45 super(jasperReportsContext, writer);
46 }
47
48 /**
49 *
50 */
51 public void exportHeader()
52 {
53 write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
54 write("<coreProperties xmlns=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" "
55 + "xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" "
56 + "xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" "
57 + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n");
58 }
59
60
61 /**
62 *
63 */
64 public void exportProperty(String propName, String propValue)
65 {
66 write(" <" + propName + ">" + propValue + "</" + propName + ">\n");
67 }
68
69
70 /**
71 *
72 */
73 public void exportFooter()
74 {
75 write("</coreProperties>\n");
76 }
77 }
6868 write(" <Default Extension=\"tiff\" ContentType=\"image/tiff\"/>\n");
6969 write(" <Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/>\n");
7070 write(" <Default Extension=\"xml\" ContentType=\"application/xml\"/>\n");
71 write(" <Override PartName=\"/docProps/app.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\"/>\n");
72 write(" <Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\"/>\n");
73 write(" <Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/>\n");
7174 if (containsMacro)
7275 {
7376 write(" <Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.ms-excel.sheet.macroEnabled.main+xml\"/>\n");
7780 {
7881 write(" <Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/>\n");
7982 }
80 write(" <Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/>\n");
8183 }
8284
8385
8484 */
8585 public void exportProps(Map<Attribute,Object> parentAttrs, Map<Attribute,Object> attrs, Locale locale)
8686 {
87 write(" <rPr>\n");
88
89 Object value = attrs.get(TextAttribute.FAMILY);
90 Object oldValue = parentAttrs.get(TextAttribute.FAMILY);
91 boolean isOwnFont = false;
92
93 if (value != null && !value.equals(oldValue))//FIXMEXLSX the text locale might be different from the report locale, resulting in different export font
87
88 boolean isOpen = false;
89
90 // tracker #8326: text run properties do not inherit font settings from the cell style in XLSX; we need to set it manually
91 Object value = attrs.get(TextAttribute.FAMILY) == null
92 ? parentAttrs.get(TextAttribute.FAMILY)
93 : attrs.get(TextAttribute.FAMILY);
94
95 if (value != null) //FIXMEXLSX the text locale might be different from the report locale, resulting in different export font
9496 {
9597 String fontFamilyAttr = (String)value;
9698 String fontFamily = fontUtil.getExportFontFamily(fontFamilyAttr, locale, exporterKey);
99 write(" <rPr>\n");
97100 write(" <rFont val=\"" + fontFamily + "\"/>\n");
98 isOwnFont = true;
99 }
100
101 value = attrs.get(TextAttribute.FOREGROUND);
102 oldValue = parentAttrs.get(TextAttribute.FOREGROUND);
103
104 if (value != null && (isOwnFont ||!value.equals(oldValue)))
105 {
106 write(" <color rgb=\"" + JRColorUtil.getColorHexa((Color)value) + "\" />\n");
107 }
108
109
110 // highlighted text run is not allowed in Excel Spreadsheet ML
111
112 // value = attrs.get(TextAttribute.BACKGROUND);
113 // oldValue = parentAttrs.get(TextAttribute.BACKGROUND);
114 //
115 //
116 // if (value != null && (isOwnFont ||!value.equals(oldValue)))
117 // {
118 // String backcolor = ColorEnum.getByColor((Color)value) == null ? COLOR_NONE : ColorEnum.getByColor((Color)value).getName();
119 // if(backcolor != null){
120 // write(" <highlight val=\"" + backcolor + "\" />\n");
121 // }
122 // }
123
124 value = attrs.get(TextAttribute.SIZE);
125 oldValue = parentAttrs.get(TextAttribute.SIZE);
126
127 if (value != null && (isOwnFont ||!value.equals(oldValue)))
128 {
129 write(" <sz val=\"" + value + "\" />\n");
130
131 }
132
133 value = attrs.get(TextAttribute.WEIGHT);
134 oldValue = parentAttrs.get(TextAttribute.WEIGHT);
135
136 if (value != null && (isOwnFont ||!value.equals(oldValue)))
137 {
138 write(" <b val=\"" + value.equals(TextAttribute.WEIGHT_BOLD) + "\"/>\n");
139 }
140
141 value = attrs.get(TextAttribute.POSTURE);
142 oldValue = parentAttrs.get(TextAttribute.POSTURE);
143
144 if (value != null && (isOwnFont ||!value.equals(oldValue)))
145 {
146 write(" <i val=\"" + value.equals(TextAttribute.POSTURE_OBLIQUE) + "\"/>\n");
147 }
148
149
150 value = attrs.get(TextAttribute.UNDERLINE);
151 oldValue = parentAttrs.get(TextAttribute.UNDERLINE);
152
153 if (
154 (value == null && oldValue != null)
155 || (value != null && (isOwnFont ||!value.equals(oldValue)))
156 )
157 {
158 write(" <u val=\"" + (value == null ? "none" : "single") + "\"/>\n");
159 }
160
161 value = attrs.get(TextAttribute.STRIKETHROUGH);
162 oldValue = parentAttrs.get(TextAttribute.STRIKETHROUGH);
163
164 if (
165 (value == null && oldValue != null)
166 || (value != null && (isOwnFont ||!value.equals(oldValue)))
167 )
168 {
169 write(" <strike val=\"" + (value != null) + "\"/>\n");
170 }
171
101 isOpen = true;
102 }
103
104 if(isOpen)
105 {
106 value = attrs.get(TextAttribute.FOREGROUND) == null
107 ? parentAttrs.get(TextAttribute.FOREGROUND)
108 : attrs.get(TextAttribute.FOREGROUND);
109
110 if (value != null)
111 {
112 write(" <color rgb=\"" + JRColorUtil.getColorHexa((Color)value) + "\" />\n");
113 }
114
115
116 // highlighted text run is not allowed in Excel Spreadsheet ML
117
118 // value = attrs.get(TextAttribute.BACKGROUND);
119 // oldValue = parentAttrs.get(TextAttribute.BACKGROUND);
120 //
121 //
122 // if (value != null && (isOwnFont ||!value.equals(oldValue)))
123 // {
124 // String backcolor = ColorEnum.getByColor((Color)value) == null ? COLOR_NONE : ColorEnum.getByColor((Color)value).getName();
125 // if(backcolor != null){
126 // write(" <highlight val=\"" + backcolor + "\" />\n");
127 // }
128 // }
129
130 value = attrs.get(TextAttribute.SIZE) == null
131 ? parentAttrs.get(TextAttribute.SIZE)
132 : attrs.get(TextAttribute.SIZE);
133
134 if (value != null)
135 {
136 write(" <sz val=\"" + value + "\" />\n");
137 }
138
139 value = attrs.get(TextAttribute.WEIGHT) == null
140 ? parentAttrs.get(TextAttribute.WEIGHT)
141 : attrs.get(TextAttribute.WEIGHT);
142
143 if (value != null)
144 {
145 write(" <b val=\"" + value.equals(TextAttribute.WEIGHT_BOLD) + "\"/>\n");
146 }
147
148 value = attrs.get(TextAttribute.POSTURE) == null
149 ? parentAttrs.get(TextAttribute.POSTURE)
150 : attrs.get(TextAttribute.POSTURE);
151
152 if (value != null)
153 {
154 write(" <i val=\"" + value.equals(TextAttribute.POSTURE_OBLIQUE) + "\"/>\n");
155 }
156
157 value = attrs.get(TextAttribute.UNDERLINE) == null
158 ? parentAttrs.get(TextAttribute.UNDERLINE)
159 : attrs.get(TextAttribute.UNDERLINE);
160
161 if (value != null)
162 {
163 write(" <u val=\"" + (value == null ? "none" : "single") + "\"/>\n");
164 }
165
166 value = attrs.get(TextAttribute.STRIKETHROUGH) == null
167 ? parentAttrs.get(TextAttribute.STRIKETHROUGH)
168 : attrs.get(TextAttribute.STRIKETHROUGH);
169
170 if (value != null)
171 {
172 write(" <strike val=\"" + (value != null) + "\"/>\n");
173 }
174 }
175
172176 value = attrs.get(TextAttribute.SUPERSCRIPT);
173177
174178 if (TextAttribute.SUPERSCRIPT_SUPER.equals(value))
175179 {
180 if(!isOpen)
181 {
182 write(" <rPr>\n");
183 isOpen = true;
184 }
176185 write(" <vertAlign val=\"superscript\" />\n");
177186 }
178187 else if (TextAttribute.SUPERSCRIPT_SUB.equals(value))
179188 {
189 if(!isOpen)
190 {
191 write(" <rPr>\n");
192 isOpen = true;
193 }
180194 write(" <vertAlign val=\"subscript\" />\n");
181195 }
182
183 write(" </rPr>\n");
196
197 if(isOpen)
198 {
199 write(" </rPr>\n");
200 }
184201 }
185202
186203
240240 }
241241 }
242242
243 PaperSizeEnum pSize = getSuitablePaperSize(jasperPrint);
243 PaperSizeEnum pSize = OoxmlUtils.getSuitablePaperSize(jasperPrint);
244244 String paperSize = pSize == PaperSizeEnum.UNDEFINED ? "" : " paperSize=\"" + pSize.getOoxmlValue() + "\"";
245245 write(paperSize);
246246
374374 {
375375 rowBreaks.add(rowIndex);
376376 }
377
378 private final PaperSizeEnum getSuitablePaperSize(PrintPageFormat jasP)
379 {
380 if (jasP != null && jasP.getPageWidth() != 0 && jasP.getPageHeight() != 0)
381 {
382 long mmPageWidth = Math.round(((double)jasP.getPageWidth() / 72.0d) * 25.4d);
383 long mmPageHeight = Math.round(((double)jasP.getPageHeight() / 72.0d) * 25.4d);
384
385 for (PaperSizeEnum paperSize : PaperSizeEnum.values())
386 {
387 if (
388 ((paperSize.getWidth() == mmPageWidth) && (paperSize.getHeight() == mmPageHeight))
389 || ((paperSize.getHeight() == mmPageWidth) && (paperSize.getWidth() == mmPageHeight))
390 )
391 {
392 return paperSize;
393 }
394 }
395 }
396
397 return PaperSizeEnum.UNDEFINED;
398 }
399377
400378 }
5454 private ExportZipEntry stylesEntry;
5555 private ExportZipEntry relsEntry;
5656 private ExportZipEntry contentTypesEntry;
57 private ExportZipEntry appEntry;
58 private ExportZipEntry coreEntry;
5759
5860 /**
5961 *
8486 contentTypesEntry = createEntry("[Content_Types].xml");
8587 addEntry(contentTypesEntry);
8688
89 appEntry = createEntry("docProps/app.xml");
90 addEntry(appEntry);
91
92 coreEntry = createEntry("docProps/core.xml");
93 addEntry(coreEntry);
94
8795 addEntry("_rels/.rels", "net/sf/jasperreports/engine/export/ooxml/xlsx/_rels/xml.rels");
8896 }
8997
117125 public ExportZipEntry getContentTypesEntry()
118126 {
119127 return contentTypesEntry;
128 }
129
130 /**
131 *
132 */
133 public ExportZipEntry getAppEntry()
134 {
135 return appEntry;
136 }
137
138 /**
139 *
140 */
141 public ExportZipEntry getCoreEntry()
142 {
143 return coreEntry;
120144 }
121145
122146 /**
99 <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
1010 <Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
1111 <Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/>
12 <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
13 <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
1214 </Types>
00 <?xml version="1.0" encoding="UTF-8"?>
11 <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
22 <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
3 <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
4 <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
35 </Relationships>
00 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
11 <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
22 <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>
3 <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
4 <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
35 </Relationships>
5555 EXECUTIVE((byte)7, "Executive", 190, 254),
5656
5757 /**
58 * Specifies the A2 paper size.
59 * ISO 216 - "A2" (420 x 594 mm)
60 */
61 A2((byte)66, "A2", 420, 594),
62
63 /**
5864 * Specifies the A3 paper size.
5965 * ISO 216 - "A3" (297 x 420 mm)
6066 */
7278 */
7379 A5((byte)11, "A5", 148, 210),
7480
75 // /**
76 // * Specifies the A5 paper size.
77 // * ANSI X3.151-1987 - "Ledger/Tabloid" (279 x 432 mm)
78 // */
79 // LEDGER_TABLOID((byte)xx, "Ledger/Tabloid", 279, 432),
81 /**
82 * Specifies the Tabloid paper size.
83 * ANSI X3.151-1987 - "Ledger/Tabloid" (279 x 432 mm)
84 */
85 TABLOID((byte)3, "Tabloid", 279, 432),
86
87 /**
88 * Specifies the Ledger paper size.
89 * ANSI X3.151-1987 - "Ledger/Tabloid" (432 x 279 mm)
90 */
91 LEDGER((byte)4, "Ledger", 432, 279),
8092
8193 /**
8294 * Specifies the DL Envelope paper size.
8395 * ISO 269 - "Envelope DL" (110 x 220 mm)
8496 */
85 ENVELOPE_DL((byte)27, "Envelope_DL", 110, 220);
97 ENVELOPE_DL((byte)27, "Envelope_DL", 110, 220),
98
99 /**
100 * Specifies the B4 paper size.
101 * ISO 216 - "B4" (250 x 353 mm)
102 */
103 B4((byte)12, "B4", 250, 353),
104
105 /**
106 * Specifies the B5 paper size.
107 * ISO 216 - "B5" (176 x 250 mm)
108 */
109 B5((byte)13, "B5", 176, 250),
110
111 /**
112 * Specifies the C3 paper size.
113 * ISO 216 - "C3" (324 x 458 mm)
114 */
115 C3((byte)29, "C3", 324, 458),
116
117 /**
118 * Specifies the C4 paper size.
119 * ISO 216 - "C4" (229 x 324 mm)
120 */
121 C4((byte)30, "C4", 229, 324),
122
123 /**
124 * Specifies the C5 paper size.
125 * ISO 216 - "C5" (162 x 229 mm)
126 */
127 C5((byte)28, "C5", 162, 229),
128
129 /**
130 * Specifies the C6 paper size.
131 * ISO 216 - "C6" (114 x 162 mm)
132 */
133 C6((byte)31, "C6", 114, 162);
86134
87135 /**
88136 *
00 <?xml version="1.0" encoding="UTF-8"?>
11 <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
22 <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
3 <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
4 <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
35 </Relationships>
241241 }
242242 */
243243 }
244
245 @Override
246 public void abort()
247 {
248 if (subreportFiller.fillingThread != null)
249 {
250 if (log.isDebugEnabled())
251 {
252 log.debug("Interrupting subfiller thread " + subreportFiller.fillingThread);
253 }
254
255 subreportFiller.fillingThread.interrupt();
256 }
257 }
244258 }
3636 void registerSubfiller(JRBaseFiller filler);
3737
3838 void unregisterSubfiller(JRBaseFiller filler);
39
40 void abortSubfiller(JRBaseFiller filler);
3941
4042 boolean isRunToBottom();
4143
433433 }
434434
435435 mainDataset.setParameterValues(parameterValues);
436 mainDataset.evaluateFieldProperties();
436437 mainDataset.initDatasource();
437438
438439 this.scriptlet = mainDataset.delegateScriptlet;
716717
717718
718719 /**
719 * Cancells the fill process.
720 * Cancels the fill process.
720721 *
721722 * @throws JRException
722723 */
7373 public void unregisterSubfiller(JRBaseFiller filler)
7474 {
7575 parentFiller.unregisterSubfiller(filler);
76 }
77
78 @Override
79 public void abortSubfiller(JRBaseFiller filler)
80 {
81 if (subreportRunner != null)
82 {
83 subreportRunner.abort();
84 }
7685 }
7786
7887 @Override
00 /*
11 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2005 - 2016 Works, Inc. All rights reserved.
2 * Copyright (C) 2005 Works, Inc. All rights reserved.
33 * http://www.works.com
4 * Copyright (C) 2005 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
46 *
57 * Unless you have purchased a commercial license agreement from Jaspersoft,
68 * the following license terms apply:
5757 import net.sf.jasperreports.engine.JRParameter;
5858 import net.sf.jasperreports.engine.JRPrintElement;
5959 import net.sf.jasperreports.engine.JRPrintPage;
60 import net.sf.jasperreports.engine.JRReport;
6061 import net.sf.jasperreports.engine.JRReportTemplate;
6162 import net.sf.jasperreports.engine.JRRuntimeException;
6263 import net.sf.jasperreports.engine.JRStyle;
7475 import net.sf.jasperreports.engine.type.FooterPositionEnum;
7576 import net.sf.jasperreports.engine.type.OrientationEnum;
7677 import net.sf.jasperreports.engine.type.PrintOrderEnum;
78 import net.sf.jasperreports.engine.type.PropertyEvaluationTimeEnum;
7779 import net.sf.jasperreports.engine.type.RunDirectionEnum;
7880 import net.sf.jasperreports.engine.type.SectionTypeEnum;
7981 import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum;
123125
124126 protected OrientationEnum orientation;
125127
126 protected WhenNoDataTypeEnum whenNoDataType;
128 private WhenNoDataTypeEnum whenNoDataType;
127129
128130 protected int columnWidth;
129131
577579
578580 /* */
579581 fillReport();
582
583 mainDataset.evaluateProperties(PropertyEvaluationTimeEnum.REPORT);
584
585 propertiesUtil.transferProperties(
586 mainDataset,
587 jasperPrint,
588 JasperPrint.PROPERTIES_PRINT_TRANSFER_PREFIX
589 );
580590
581591 // add consolidates styles as normal styles in the print object
582592 // for (Iterator it = consolidatedStyles.values().iterator(); it.hasNext();)
613623 fillingThread = null;
614624
615625 //kill the subreport filler threads
616 killSubfillerThreads();
626 abortSubfillers();
617627
618628 if (parent == null)
619629 {
893903 }
894904
895905
896 private void killSubfillerThreads()
906 private void abortSubfillers()
897907 {
898908 if (subfillers != null && !subfillers.isEmpty())
899909 {
900910 for (JRBaseFiller subfiller : subfillers.values())
901911 {
902 if (subfiller.fillingThread != null)
912 if (subfiller.bandReportParent != null)
903913 {
904914 if (log.isDebugEnabled())
905915 {
906 log.debug("Fill " + fillerId + ": Interrupting subfiller thread " + subfiller.fillingThread);
916 log.debug("Fill " + fillerId + ": Aborting subfiller " + subfiller.fillerId);
907917 }
908
909 subfiller.fillingThread.interrupt();
918
919 subfiller.bandReportParent.abortSubfiller(subfiller);
910920 }
911921 }
912922 }
957967 /**
958968 *
959969 */
970 protected WhenNoDataTypeEnum getWhenNoDataType()
971 {
972 WhenNoDataTypeEnum result = whenNoDataType;
973
974 if (result == null)
975 {
976 result =
977 WhenNoDataTypeEnum.getByName(
978 propertiesUtil.getProperty(mainDataset, JRReport.CONFIG_PROPERTY_WHEN_NO_DATA_TYPE)
979 );
980 }
981
982 return result;
983 }
984
985
986 /**
987 *
988 */
960989 public Format getDateFormat(String pattern)
961990 {
962991 return getDateFormat(pattern, null);
11391168 protected void resolveBandBoundElements(JRFillBand band, byte evaluation) throws JRException
11401169 {
11411170 resolveBoundElements(JREvaluationTime.getBandEvaluationTime(band), evaluation);
1142 }
1143
1144
1145 /**
1146 * Cancells the fill process.
1147 *
1148 * @throws JRException
1149 */
1150 @Override
1151 public void cancelFill() throws JRException
1152 {
1153 if (log.isDebugEnabled())
1154 {
1155 log.debug("Fill " + fillerId + ": cancelling");
1156 }
1157
1158 fillContext.markCanceled();
1159
1160 if (fillContext.cancelRunningQuery())
1161 {
1162 if (log.isDebugEnabled())
1163 {
1164 log.debug("Fill " + fillerId + ": query cancelled");
1165 }
1166 }
1167 else
1168 {
1169 Thread t = fillingThread;
1170 if (t != null)
1171 {
1172 if (log.isDebugEnabled())
1173 {
1174 log.debug("Fill " + fillerId + ": Interrupting thread " + t);
1175 }
1176
1177 t.interrupt();
1178 }
1179 }
11801171 }
11811172
11821173
7777 {
7878 Continuation.suspend();
7979 }
80
81 @Override
82 public void abort()
83 {
84 //NOP
85 }
8086 }
00 /*
11 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2005 - 2016 Works, Inc. All rights reserved.
2 * Copyright (C) 2005 Works, Inc. All rights reserved.
33 * http://www.works.com
4 * Copyright (C) 2005 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
46 *
57 * Unless you have purchased a commercial license agreement from Jaspersoft,
68 * the following license terms apply:
2424
2525 import java.awt.Color;
2626 import java.awt.geom.Rectangle2D;
27 import java.util.ArrayList;
2728 import java.util.Iterator;
29 import java.util.List;
2830 import java.util.Locale;
2931 import java.util.SortedSet;
3032 import java.util.TimeZone;
105107 import net.sf.jasperreports.engine.JRPrintElement;
106108 import net.sf.jasperreports.engine.JRPrintHyperlinkParameters;
107109 import net.sf.jasperreports.engine.JRPrintImage;
110 import net.sf.jasperreports.engine.JRPropertiesUtil;
108111 import net.sf.jasperreports.engine.JRRuntimeException;
109112 import net.sf.jasperreports.engine.JRVisitor;
110113 import net.sf.jasperreports.engine.JasperReportsContext;
114 import net.sf.jasperreports.engine.NamedChartCustomizer;
111115 import net.sf.jasperreports.engine.base.JRBaseChart;
112116 import net.sf.jasperreports.engine.type.EvaluationTimeEnum;
113117 import net.sf.jasperreports.engine.type.HyperlinkTypeEnum;
161165 private String hyperlinkTooltip;
162166 private JRPrintHyperlinkParameters hyperlinkParameters;
163167
164 protected String customizerClass;
165 protected JRChartCustomizer chartCustomizer;
168 protected List<JRChartCustomizer> chartCustomizers;
166169
167170 protected String renderType;
168171 protected String themeName;
297300
298301 evaluationGroup = factory.getGroup(chart.getEvaluationGroup());
299302
300 customizerClass = chart.getCustomizerClass();
301 if (customizerClass != null && customizerClass.length() > 0) {
302 try {
303 Class<?> myClass = JRClassLoader.loadClassForName(customizerClass);
304 chartCustomizer = (JRChartCustomizer) myClass.newInstance();
305 } catch (Exception e) {
303 chartCustomizers = new ArrayList<JRChartCustomizer>();
304 JRChartCustomizer chartCustomizer = createAndInitCustomizer(chart.getCustomizerClass(), null);
305 if (chartCustomizer != null)
306 {
307 chartCustomizers.add(chartCustomizer);
308 }
309
310 List<JRPropertiesUtil.PropertySuffix> properties =
311 JRPropertiesUtil.getProperties(
312 chart.getPropertiesMap(),
313 NamedChartCustomizer.CUSTOMIZER_CLASS_PROPERTY_PREFIX
314 );
315 for (JRPropertiesUtil.PropertySuffix prop : properties)
316 {
317 chartCustomizer = createAndInitCustomizer(prop.getValue(), prop.getSuffix());
318 if (chartCustomizer != null)
319 {
320 chartCustomizers.add(chartCustomizer);
321 }
322 }
323
324 renderType = chart.getRenderType();
325 if(renderType == null)
326 {
327 renderType = filler.getPropertiesUtil().getProperty(getParentProperties(), JRChart.PROPERTY_CHART_RENDER_TYPE);
328 }
329
330 themeName = chart.getTheme();
331 if(themeName == null)
332 {
333 themeName = filler.getPropertiesUtil().getProperty(getParentProperties(), JRChart.PROPERTY_CHART_THEME);
334 }
335 }
336
337 /**
338 *
339 */
340 protected JRChartCustomizer createAndInitCustomizer(
341 String customizerClassName,
342 String customizerName
343 )
344 {
345 JRChartCustomizer customizer = null;
346
347 if (customizerClassName != null && customizerClassName.length() > 0)
348 {
349 try
350 {
351 Class<?> customizerClass = JRClassLoader.loadClassForName(customizerClassName);
352 customizer = (JRChartCustomizer) customizerClass.newInstance();
353 }
354 catch (Exception e)
355 {
306356 throw
307357 new JRRuntimeException(
308358 EXCEPTION_MESSAGE_KEY_CUSTOMIZER_INSTANCE_ERROR,
310360 e);
311361 }
312362
313 if (chartCustomizer instanceof JRAbstractChartCustomizer)
314 {
315 ((JRAbstractChartCustomizer) chartCustomizer).init(filler, this);
363 if (customizer instanceof JRAbstractChartCustomizer)
364 {
365 ((JRAbstractChartCustomizer) customizer).init(this);
366 }
367
368 if (customizer instanceof NamedChartCustomizer)
369 {
370 ((NamedChartCustomizer) customizer).setName(customizerName);
316371 }
317372 }
318373
319 renderType = chart.getRenderType();
320 if(renderType == null)
321 {
322 renderType = filler.getPropertiesUtil().getProperty(getParentProperties(), JRChart.PROPERTY_CHART_RENDER_TYPE);
323 }
324
325 themeName = chart.getTheme();
326 if(themeName == null)
327 {
328 themeName = filler.getPropertiesUtil().getProperty(getParentProperties(), JRChart.PROPERTY_CHART_THEME);
329 }
374 return customizer;
330375 }
331376
332377 @Override
790835 chartHyperlinkProvider = createChartHyperlinkProvider();
791836 }
792837
793 if (chartCustomizer != null)
838 for (JRChartCustomizer chartCustomizer : chartCustomizers)
794839 {
795840 chartCustomizer.customize(jfreeChart, this);
796841 }
940985 {
941986 printImage.setRenderer(getRenderable());
942987 printImage.setAnchorName(getAnchorName());
943 if (getHyperlinkWhenExpression() == null || hyperlinkWhen == Boolean.TRUE)
988 if (getHyperlinkWhenExpression() == null || Boolean.TRUE.equals(hyperlinkWhen))
944989 {
945990 printImage.setHyperlinkReference(getHyperlinkReference());
946991 printImage.setHyperlinkAnchor(getHyperlinkAnchor());
13621407 @Override
13631408 public String getCustomizerClass()
13641409 {
1365 return customizerClass;
1410 return ((JRChart)parent).getCustomizerClass();
13661411 }
13671412
13681413
20042004 textElement.addDynamicProperty(CrosstabInteractiveJsonHandler.PROPERTY_COLUMN_INDEX,
20052005 builtinExpressions.createConstantExpression(Integer.toString(bucketIdx)));
20062006 textElement.addDynamicProperty(HtmlExporter.PROPERTY_HTML_CLASS,
2007 builtinExpressions.createConstantExpression("jrxtrowheader jrxtinteractive " + HTML_CLASS_CROSS_FLOATING));
2007 builtinExpressions.createConstantExpression("jrxtrowheader jrxtinteractive " + HTML_CLASS_ROW_FLOATING));
20082008 }
20092009 }
20102010 else
20252025 {
20262026 iconLabelElement.getPropertiesMap().setProperty(CrosstabInteractiveJsonHandler.PROPERTY_COLUMN_INDEX,
20272027 Integer.toString(bucketIdx));
2028 iconLabelElement.getPropertiesMap().setProperty(HtmlExporter.PROPERTY_HTML_CLASS, "jrxtrowheader jrxtinteractive " + HTML_CLASS_CROSS_FLOATING);
2028 iconLabelElement.getPropertiesMap().setProperty(HtmlExporter.PROPERTY_HTML_CLASS, "jrxtrowheader jrxtinteractive " + HTML_CLASS_ROW_FLOATING);
20292029 }
20302030
20312031 iconLabelElements.put(textElementIndex, iconLabelElement);
2424
2525 import java.sql.Connection;
2626 import java.util.ArrayList;
27 import java.util.Arrays;
2728 import java.util.HashMap;
2829 import java.util.HashSet;
2930 import java.util.Iterator;
3536 import java.util.TimeZone;
3637 import java.util.UUID;
3738
39 import org.apache.commons.logging.Log;
40 import org.apache.commons.logging.LogFactory;
41
3842 import net.sf.jasperreports.data.cache.CachedDataset;
3943 import net.sf.jasperreports.data.cache.DataCacheHandler;
4044 import net.sf.jasperreports.data.cache.DataRecorder;
4246 import net.sf.jasperreports.data.cache.DataSnapshotException;
4347 import net.sf.jasperreports.data.cache.DatasetRecorder;
4448 import net.sf.jasperreports.engine.DatasetFilter;
49 import net.sf.jasperreports.engine.DatasetPropertyExpression;
4550 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
4651 import net.sf.jasperreports.engine.EvaluationType;
4752 import net.sf.jasperreports.engine.JRAbstractScriptlet;
7580 import net.sf.jasperreports.engine.scriptlets.ScriptletFactoryContext;
7681 import net.sf.jasperreports.engine.type.CalculationEnum;
7782 import net.sf.jasperreports.engine.type.IncrementTypeEnum;
83 import net.sf.jasperreports.engine.type.ParameterEvaluationTimeEnum;
84 import net.sf.jasperreports.engine.type.PropertyEvaluationTimeEnum;
7885 import net.sf.jasperreports.engine.type.ResetTypeEnum;
7986 import net.sf.jasperreports.engine.type.WhenResourceMissingTypeEnum;
8087 import net.sf.jasperreports.engine.util.DigestUtils;
8390 import net.sf.jasperreports.engine.util.JRResourcesUtil;
8491 import net.sf.jasperreports.engine.util.MD5Digest;
8592
86 import org.apache.commons.logging.Log;
87 import org.apache.commons.logging.LogFactory;
88
8993 /**
9094 * @author Lucian Chirita (lucianc@users.sourceforge.net)
9195 */
231235 */
232236 protected List<JRAbstractScriptlet> scriptlets;
233237
238 protected List<DatasetPropertyExpression> propertyExpressions;
239 protected JRPropertiesMap staticProperties;
240 protected JRPropertiesMap mergedProperties;
241
234242 /**
235243 *
236244 */
288296 setVariables(dataset, factory);
289297
290298 setGroups(dataset, factory);
299
300 staticProperties = dataset.hasProperties() ? dataset.getPropertiesMap().cloneProperties() : null;
301 mergedProperties = staticProperties;
302
303 DatasetPropertyExpression[] datasetPropertyExpressions = dataset.getPropertyExpressions();
304 propertyExpressions =
305 datasetPropertyExpressions == null
306 ? new ArrayList<DatasetPropertyExpression>(0)
307 : new ArrayList<DatasetPropertyExpression>(Arrays.asList(datasetPropertyExpressions));
291308 }
292309
293310
630647 scriptlets = createScriptlets(parameterValues);
631648 delegateScriptlet.setData(parametersMap, fieldsMap, variablesMap, groups);//FIXMESCRIPTLET use some context
632649
633 contributeParameters(parameterValues);
634
635 filter = (DatasetFilter) parameterValues.get(JRParameter.FILTER);
636
637650 // initializing cache because we need the cached parameter values
638651 cacheInit();
639652
653 setFillParameterValuesFromMap(parameterValues, true);
654 setFillParameterValuesFromCache(parameterValues);
655 evaluateParameterValues(ParameterEvaluationTimeEnum.EARLY, parameterValues);
656
657 mergedProperties = staticProperties;
658 evaluateProperties(PropertyEvaluationTimeEnum.EARLY);
659
640660 //FIXME do not call on default parameter value evaluation and when a data snapshot is used?
641 setFillParameterValues(parameterValues);
642
661 contributeParameters(parameterValues);
662
663 setFillParameterValuesFromMap(parameterValues, false);
664 evaluateParameterValues(ParameterEvaluationTimeEnum.LATE, parameterValues);
665
666 evaluateProperties(PropertyEvaluationTimeEnum.LATE);
667
668 filter = (DatasetFilter) parameterValues.get(JRParameter.FILTER);
669
643670 // after we have the parameter values, init cache recording
644671 cacheInitRecording();
645672
878905 return JRPropertiesUtil.asBoolean(includedProp);
879906 }
880907
908 protected ParameterEvaluationTimeEnum getDefaultParameterEvaluationTime()
909 {
910 String evalTimeProp =
911 propertiesUtil.getProperty(
912 ParameterEvaluationTimeEnum.PROPERTY_EVALUATION_TIME,
913 this
914 );
915 return ParameterEvaluationTimeEnum.byName(evalTimeProp);
916 }
917
918 protected PropertyEvaluationTimeEnum getDefaultPropertyEvaluationTime()
919 {
920 String evalTimeProp =
921 propertiesUtil.getProperty(
922 PropertyEvaluationTimeEnum.PROPERTY_EVALUATION_TIME,
923 this
924 );
925 return PropertyEvaluationTimeEnum.byName(evalTimeProp);
926 }
927
881928 protected void cacheRecord()
882929 {
883930 if (dataRecorder != null && !dataRecorder.hasEnded())
9631010 }
9641011 }
9651012
1013
9661014 /**
9671015 * Sets the parameter values from the values map.
9681016 *
9691017 * @param parameterValues the values map
9701018 * @throws JRException
9711019 */
972 private void setFillParameterValues(Map<String,Object> parameterValues) throws JRException
1020 private void evaluateParameterValues(ParameterEvaluationTimeEnum evaluationTime, Map<String,Object> parameterValues) throws JRException
1021 {
1022 if (parameters != null && parameters.length > 0)
1023 {
1024 ParameterEvaluationTimeEnum defaultEvaluationTime = getDefaultParameterEvaluationTime();
1025 for (int i = 0; i < parameters.length; i++)
1026 {
1027 JRFillParameter parameter = parameters[i];
1028 String paramName = parameter.getName();
1029 ParameterEvaluationTimeEnum paramEvalTime = parameter.getEvaluationTime() == null ? defaultEvaluationTime : parameter.getEvaluationTime();
1030
1031 if (
1032 !parameterValues.containsKey(paramName) //cheaper to test this first
1033 && !parameter.isSystemDefined() //cheaper to test this first
1034 && evaluationTime == paramEvalTime
1035 && (!isIncludedInDataCache(parameter) || cachedDataset == null)
1036 )
1037 {
1038 Object value = calculator.evaluate(parameter.getDefaultValueExpression(), JRExpression.EVALUATION_DEFAULT);
1039 if (value != null)
1040 {
1041 parameterValues.put(paramName, value);
1042 }
1043 setParameter(parameter, value);
1044 }
1045 }
1046 }
1047 }
1048
1049
1050 /**
1051 *
1052 */
1053 private void setFillParameterValuesFromMap(Map<String,Object> parameterValues, boolean reset) throws JRException
9731054 {
9741055 if (parameters != null && parameters.length > 0)
9751056 {
9821063 if (parameterValues.containsKey(paramName))
9831064 {
9841065 value = parameterValues.get(paramName);
1066 setParameter(parameter, value);
9851067 }
986 else if (!parameter.isSystemDefined())
1068 else if (reset)
1069 {
1070 setParameter(parameter, null);
1071 }
1072 }
1073 }
1074 }
1075
1076
1077 /**
1078 * Sets the parameter values from the values map.
1079 *
1080 * @param parameterValues the values map
1081 * @throws JRException
1082 */
1083 private void setFillParameterValuesFromCache(Map<String,Object> parameterValues) throws JRException
1084 {
1085 if (parameters != null && parameters.length > 0)
1086 {
1087 for (int i = 0; i < parameters.length; i++)
1088 {
1089 JRFillParameter parameter = parameters[i];
1090 String paramName = parameter.getName();
1091
1092 if (
1093 !parameterValues.containsKey(paramName)
1094 && !parameter.isSystemDefined()
1095 )
9871096 {
9881097 if (isIncludedInDataCache(parameter) && cachedDataset != null)
9891098 {
10031112 log.debug("loading parameter " + paramName + " value from data snapshot");
10041113 }
10051114
1006 value = cachedDataset.getParameterValue(paramName);
1007 }
1008 else
1009 {
1010 value = calculator.evaluate(parameter.getDefaultValueExpression(), JRExpression.EVALUATION_DEFAULT);
1011 if (value != null)
1012 {
1013 parameterValues.put(paramName, value);
1014 }
1115 Object value = cachedDataset.getParameterValue(paramName);
1116 setParameter(parameter, value);
10151117 }
10161118 }
1017 setParameter(parameter, value);
1119 }
1120 }
1121 }
1122
1123
1124 /**
1125 *
1126 */
1127 public void evaluateFieldProperties() throws JRException
1128 {
1129 if (fields != null && fields.length > 0)
1130 {
1131 for (JRFillField field : fields)
1132 {
1133 field.evaluateProperties();
10181134 }
10191135 }
10201136 }
16631779
16641780 private void checkVariableCalculationReq(JRFillVariable variable, List<JRFillVariable> variableList, JRFillObjectFactory factory)
16651781 {
1782 JRVariable parentVariable = variable.getParent();
1783
16661784 if (hasVariableCalculationReq(variable, CalculationEnum.AVERAGE) || hasVariableCalculationReq(variable, CalculationEnum.VARIANCE))
16671785 {
16681786 if (variable.getHelperVariable(JRCalculable.HELPER_COUNT) == null)
16691787 {
1670 JRVariable countVar = createHelperVariable(variable, "_COUNT", CalculationEnum.COUNT);
1788 JRVariable countVar = createHelperVariable(parentVariable, "_COUNT", CalculationEnum.COUNT);
16711789 JRFillVariable fillCountVar = factory.getVariable(countVar);
16721790 checkVariableCalculationReq(fillCountVar, variableList, factory);
16731791 variable.setHelperVariable(fillCountVar, JRCalculable.HELPER_COUNT);
16751793
16761794 if (variable.getHelperVariable(JRCalculable.HELPER_SUM) == null)
16771795 {
1678 JRVariable sumVar = createHelperVariable(variable, "_SUM", CalculationEnum.SUM);
1796 JRVariable sumVar = createHelperVariable(parentVariable, "_SUM", CalculationEnum.SUM);
16791797 JRFillVariable fillSumVar = factory.getVariable(sumVar);
16801798 checkVariableCalculationReq(fillSumVar, variableList, factory);
16811799 variable.setHelperVariable(fillSumVar, JRCalculable.HELPER_SUM);
16861804 {
16871805 if (variable.getHelperVariable(JRCalculable.HELPER_VARIANCE) == null)
16881806 {
1689 JRVariable varianceVar = createHelperVariable(variable, "_VARIANCE", CalculationEnum.VARIANCE);
1807 JRVariable varianceVar = createHelperVariable(parentVariable, "_VARIANCE", CalculationEnum.VARIANCE);
16901808 JRFillVariable fillVarianceVar = factory.getVariable(varianceVar);
16911809 checkVariableCalculationReq(fillVarianceVar, variableList, factory);
16921810 variable.setHelperVariable(fillVarianceVar, JRCalculable.HELPER_VARIANCE);
16971815 {
16981816 if (variable.getHelperVariable(JRCalculable.HELPER_COUNT) == null)
16991817 {
1700 JRVariable countVar = createDistinctCountHelperVariable(variable);
1818 JRVariable countVar = createDistinctCountHelperVariable(parentVariable);
17011819 JRFillVariable fillCountVar = factory.getVariable(countVar);
17021820 checkVariableCalculationReq(fillCountVar, variableList, factory);
17031821 variable.setHelperVariable(fillCountVar, JRCalculable.HELPER_COUNT);
18081926 @Override
18091927 public boolean hasProperties()
18101928 {
1811 return parent.hasProperties();
1929 return mergedProperties != null && mergedProperties.hasProperties();
18121930 }
18131931
18141932
18151933 @Override
18161934 public JRPropertiesMap getPropertiesMap()
18171935 {
1818 return parent.getPropertiesMap();
1936 return mergedProperties;
18191937 }
18201938
18211939
18241942 {
18251943 // report properties propagate to subdatasets
18261944 return isMain ? null : filler.getJasperReport();
1945 }
1946
1947
1948 @Override
1949 public DatasetPropertyExpression[] getPropertyExpressions()
1950 {
1951 return propertyExpressions.toArray(new DatasetPropertyExpression[propertyExpressions.size()]);
1952 }
1953
1954
1955 /**
1956 *
1957 */
1958 protected void evaluateProperties(PropertyEvaluationTimeEnum evaluationTime) throws JRException
1959 {
1960 if (!propertyExpressions.isEmpty())
1961 {
1962 JRPropertiesMap dynamicProperties = new JRPropertiesMap();
1963
1964 PropertyEvaluationTimeEnum defaultEvaluationTime = getDefaultPropertyEvaluationTime();
1965 for (DatasetPropertyExpression prop : propertyExpressions)
1966 {
1967 PropertyEvaluationTimeEnum propEvalTime = prop.getEvaluationTime() == null ? defaultEvaluationTime : prop.getEvaluationTime();
1968 if (evaluationTime == propEvalTime)
1969 {
1970 String value = (String) evaluateExpression(prop.getValueExpression(), JRExpression.EVALUATION_DEFAULT);
1971 //if (value != null) //is the null value significant for some field properties?
1972 {
1973 dynamicProperties.setProperty(prop.getName(), value);
1974 }
1975 }
1976 }
1977
1978 JRPropertiesMap newMergedProperties = dynamicProperties.cloneProperties();
1979 newMergedProperties.setBaseProperties(mergedProperties);
1980 mergedProperties = newMergedProperties;
1981 }
18271982 }
18281983
18291984
2727 import java.util.Map;
2828 import java.util.UUID;
2929
30 import org.apache.commons.logging.Log;
31 import org.apache.commons.logging.LogFactory;
32
3033 import net.sf.jasperreports.data.cache.DataCacheHandler;
3134 import net.sf.jasperreports.engine.CommonReturnValue;
3235 import net.sf.jasperreports.engine.JRDataSource;
4750 import net.sf.jasperreports.engine.type.IncrementTypeEnum;
4851 import net.sf.jasperreports.engine.type.ResetTypeEnum;
4952
50 import org.apache.commons.logging.Log;
51 import org.apache.commons.logging.LogFactory;
52
5353 /**
5454 * Class used to instantiate sub datasets.
5555 *
245245 dataset.filterElementDatasets(elementDataset);
246246 dataset.initCalculator();
247247 dataset.setParameterValues(parameterValues);
248 dataset.evaluateFieldProperties();
248249 dataset.initDatasource();
249250
250251 iterate();
8484 datasetRun = factory.getDatasetRun(dataset.getDatasetRun());
8585 }
8686
87 protected JRFillElementDataset(JRFillElementDataset dataset, JRFillCloneFactory factory)
88 {
89 parent = dataset.parent;
90 filler = dataset.filler;
91
92 resetGroup = dataset.resetGroup;
93 incrementGroup = dataset.incrementGroup;
94
95 datasetRun = new JRFillDatasetRun(dataset.datasetRun, factory);
96 }
97
98
8799 protected void setBand(JRFillBand band)
88100 {
89101 if (datasetRun != null)
2222 */
2323 package net.sf.jasperreports.engine.fill;
2424
25 import java.util.ArrayList;
26 import java.util.Arrays;
27 import java.util.List;
28
29 import net.sf.jasperreports.engine.JRException;
2530 import net.sf.jasperreports.engine.JRExpression;
2631 import net.sf.jasperreports.engine.JRField;
2732 import net.sf.jasperreports.engine.JRPropertiesHolder;
2833 import net.sf.jasperreports.engine.JRPropertiesMap;
34 import net.sf.jasperreports.engine.JRPropertyExpression;
2935
3036
3137 /**
3945 *
4046 */
4147 protected JRField parent;
48 protected JRFillExpressionEvaluator expressionEvaluator;
49 protected List<JRPropertyExpression> propertyExpressions;
50 protected JRPropertiesMap staticProperties;
51 protected JRPropertiesMap mergedProperties;
4252
4353 /**
4454 *
6070 factory.put(field, this);
6171
6272 parent = field;
73
74 expressionEvaluator = factory.getExpressionEvaluator();
75
76 staticProperties = field.hasProperties() ? field.getPropertiesMap().cloneProperties() : null;
77 mergedProperties = staticProperties;
78
79 JRPropertyExpression[] fieldPropertyExpressions = field.getPropertyExpressions();
80 propertyExpressions =
81 fieldPropertyExpressions == null
82 ? new ArrayList<JRPropertyExpression>(0)
83 : new ArrayList<JRPropertyExpression>(Arrays.asList(fieldPropertyExpressions));
6384 }
6485
6586
186207 @Override
187208 public boolean hasProperties()
188209 {
189 return parent.hasProperties();
210 return mergedProperties != null && mergedProperties.hasProperties();
190211 }
191212
192213
193214 @Override
194215 public JRPropertiesMap getPropertiesMap()
195216 {
196 return parent.getPropertiesMap();
217 return mergedProperties;
197218 }
198219
199220
202223 {
203224 return null;
204225 }
205
226
227
228 @Override
229 public JRPropertyExpression[] getPropertyExpressions()
230 {
231 return propertyExpressions.toArray(new JRPropertyExpression[propertyExpressions.size()]);
232 }
233
234
235 /**
236 *
237 */
238 protected void evaluateProperties() throws JRException
239 {
240 if (propertyExpressions.isEmpty())
241 {
242 mergedProperties = staticProperties;
243 }
244 else
245 {
246 JRPropertiesMap dynamicProperties = new JRPropertiesMap();
247
248 for (JRPropertyExpression prop : propertyExpressions)
249 {
250 String value = (String) evaluateExpression(prop.getValueExpression());
251 //if (value != null) //is the null value significant for some field properties?
252 {
253 dynamicProperties.setProperty(prop.getName(), value);
254 }
255 }
256
257 mergedProperties = dynamicProperties.cloneProperties();
258 mergedProperties.setBaseProperties(staticProperties);
259 }
260 }
261
262 /**
263 *
264 */
265 protected final Object evaluateExpression(JRExpression expression) throws JRException
266 {
267 return expressionEvaluator.evaluate(expression, JRExpression.EVALUATION_DEFAULT);
268 }
269
206270 @Override
207271 public Object clone()
208272 {
108108 }
109109
110110 Boolean hyperlinkWhen = (Boolean) expressionEvaluator.evaluate(hyperlink.getHyperlinkWhenExpression(), evaluationType);
111 if (hyperlink.getHyperlinkWhenExpression() != null && hyperlinkWhen != Boolean.TRUE)
111 if (hyperlink.getHyperlinkWhenExpression() != null && Boolean.TRUE.equals(hyperlinkWhen))
112112 {
113113 return null;
114114 }
2828 import java.io.InputStream;
2929 import java.net.URL;
3030
31 import org.apache.commons.logging.Log;
32 import org.apache.commons.logging.LogFactory;
33
3134 import net.sf.jasperreports.engine.JRException;
3235 import net.sf.jasperreports.engine.JRExpression;
3336 import net.sf.jasperreports.engine.JRExpressionCollector;
5962 */
6063 public class JRFillImage extends JRFillGraphicElement implements JRImage
6164 {
65 private static final Log log = LogFactory.getLog(JRFillImage.class);
6266
6367 public static final String EXCEPTION_MESSAGE_KEY_UNKNOWN_SOURCE_CLASS = "fill.image.unknown.source.class";
6468
866870 }
867871 }
868872
873 if (log.isDebugEnabled())
874 {
875 log.debug("Fitted image of dimension " + imageSize + " on " + availableHeight
876 + ", overflow allowed " + overflowAllowed + ": " + fitted);
877 }
878
869879 return fitted;
870880 }
871881
927937
928938 printImage.setRenderer(getRenderable());
929939 printImage.setAnchorName(getAnchorName());
930 if (getHyperlinkWhenExpression() == null || hyperlinkWhen == Boolean.TRUE)
940 if (getHyperlinkWhenExpression() == null || Boolean.TRUE.equals(hyperlinkWhen))
931941 {
932942 printImage.setHyperlinkReference(getHyperlinkReference());
933943 printImage.setHyperlinkAnchor(getHyperlinkAnchor());
2727 import net.sf.jasperreports.engine.JRPropertiesHolder;
2828 import net.sf.jasperreports.engine.JRPropertiesMap;
2929 import net.sf.jasperreports.engine.JRValueParameter;
30 import net.sf.jasperreports.engine.type.ParameterEvaluationTimeEnum;
3031
3132
3233 /**
115116 }
116117
117118 @Override
119 public ParameterEvaluationTimeEnum getEvaluationTime()
120 {
121 return parent.getEvaluationTime();
122 }
123
124 @Override
118125 public JRExpression getDefaultValueExpression()
119126 {
120127 return parent.getDefaultValueExpression();
197197 text.setWidth(getWidth());
198198 // if (getRotation() == ROTATION_NONE)
199199 // {
200 text.setHeight(getPrintElementHeight());
200 //text.setHeight(getPrintElementHeight());
201 text.setHeight(getStretchHeight());
201202 // }
202203 // else
203204 // {
8181 private float leadingOffset;
8282 private float textWidth;
8383 private float textHeight;
84 private int elementStretchHeightDelta;
84 //private int elementStretchHeightDelta;
8585 private int textStart;
8686 private int textEnd;
8787 private short[] lineBreakOffsets;
119119 initParagraph = textElement.getParagraph().clone(this);
120120
121121 // not supporting property expressions for this
122 this.consumeSpaceOnOverflow = JRPropertiesUtil.getInstance(filler.getJasperReportsContext()).getBooleanProperty(
123 textElement, PROPERTY_CONSUME_SPACE_ON_OVERFLOW, true);
122 this.consumeSpaceOnOverflow = filler.getPropertiesUtil().getBooleanProperty(
123 PROPERTY_CONSUME_SPACE_ON_OVERFLOW, true,
124 // manually falling back to report properties as getParentProperties() is null for textElement
125 textElement, filler.getJasperReport()
126 );
124127
125128 this.defaultKeepFullText = filler.getPropertiesUtil().getBooleanProperty(
126129 JRTextElement.PROPERTY_PRINT_KEEP_FULL_TEXT, false,
549552 textEnd = 0;
550553 textTruncateSuffix = null;
551554 lineBreakOffsets = null;
552 elementStretchHeightDelta = 0;
555 //elementStretchHeightDelta = 0;
553556 }
554557
555558 /**
580583 lineSpacingFactor = 0;
581584 leadingOffset = 0;
582585 textHeight = 0;
583 elementStretchHeightDelta = 0;
586 //elementStretchHeightDelta = 0;
584587 }
585588
586589
678681 setTextWidth(measuredText.getTextWidth());
679682 setTextHeight(measuredText.getTextHeight());
680683
681 elementStretchHeightDelta = 0;
684 //elementStretchHeightDelta = 0;
682685 if (getRotationValue().equals(RotationEnum.NONE))
683686 {
684687 //FIXME truncating to int here seems wrong as the text measurer compares
692695 else
693696 {
694697 // occupy all remaining space so that no other element renders there
695 // but do not change the print element height
696698 setPrepareHeight(getHeight() + availableStretchHeight);
697699
698700 // store the difference between the consumed stretch height and the text stretch height.
699701 // this will be used in fill() to set the print element height,
700 // which doesn't take into account the consumed empty space
701 int textStretchHeight = elementTextHeight > getHeight() ? elementTextHeight : getHeight();
702 elementStretchHeightDelta = getStretchHeight() - textStretchHeight;
702 // which doesn't take into account the consumed empty space;
703
704 // gave up on storing this delta because it was not consistent with other elements stretching to container height
705 //int textStretchHeight = elementTextHeight > getHeight() ? elementTextHeight : getHeight();
706 //elementStretchHeightDelta = getStretchHeight() - textStretchHeight;
703707 }
704708 }
705709 else
715719 setLeadingOffset(measuredText.getLeadingOffset());
716720 }
717721
718 public int getPrintElementHeight()
719 {
720 return getStretchHeight() - elementStretchHeightDelta;
721 }
722 // public int getPrintElementHeight()
723 // {
724 // return getStretchHeight() - elementStretchHeightDelta;
725 // }
722726
723727 protected abstract boolean canOverflow();
724728
865865 text.setWidth(getWidth());
866866 // if (getRotation() == ROTATION_NONE)
867867 // {
868 text.setHeight(getPrintElementHeight());
868 //text.setHeight(getPrintElementHeight());
869 text.setHeight(getStretchHeight());
869870 // }
870871 // else
871872 // {
907908 setPrintText(text);
908909
909910 text.setAnchorName(getAnchorName());
910 if (getHyperlinkWhenExpression() == null || hyperlinkWhen == Boolean.TRUE)
911 if (getHyperlinkWhenExpression() == null || Boolean.TRUE.equals(hyperlinkWhen))
911912 {
912913 text.setHyperlinkReference(getHyperlinkReference());
913914 text.setHyperlinkAnchor(getHyperlinkAnchor());
8585 helperVariables = new JRFillVariable[JRCalculable.HELPER_SIZE];
8686 }
8787
88 protected JRVariable getParent()
89 {
90 return parent;
91 }
8892
8993 protected void reset()
9094 {
00 /*
11 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2005 - 2016 Works, Inc. All rights reserved.
2 * Copyright (C) 2006 Works, Inc. All rights reserved.
33 * http://www.works.com
4 * Copyright (C) 2006 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
46 *
57 * Unless you have purchased a commercial license agreement from Jaspersoft,
68 * the following license terms apply:
133133 log.debug("Fill " + fillerId + ": no data");
134134 }
135135
136 switch (whenNoDataType)
136 switch (getWhenNoDataType())
137137 {
138138 case ALL_SECTIONS_NO_DETAIL :
139139 {
9292 * @throws JRException
9393 */
9494 void suspend() throws JRException;
95
96 /**
97 * Aborts the current fill.
98 */
99 void abort();
95100 }
2222 */
2323 package net.sf.jasperreports.engine.fill;
2424
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
2528 import net.sf.jasperreports.engine.JRException;
2629 import net.sf.jasperreports.engine.JRExpression;
2730 import net.sf.jasperreports.engine.JRGroup;
3336 import net.sf.jasperreports.engine.type.ResetTypeEnum;
3437 import net.sf.jasperreports.engine.type.RunDirectionEnum;
3538
36 import org.apache.commons.logging.Log;
37 import org.apache.commons.logging.LogFactory;
38
3939
4040 /**
4141 * @author Teodor Danciu (teodord@users.sourceforge.net)
127127 log.debug("Fill " + fillerId + ": no data");
128128 }
129129
130 switch (whenNoDataType)
130 switch (getWhenNoDataType())
131131 {
132132 case ALL_SECTIONS_NO_DETAIL :
133133 {
934934 }
935935
936936 float newTextHeight = measuredState.textHeight + lineHeight;
937
938 //this test is somewhat inconsistent with JRFillTextElement.chopTextElement which truncates the text height to int.
939 //thus it can happen that a text which would normally be measures to textHeight=18.6 and element height=18
940 //overflows when there are exactly 18 pixels left on the page.
937941 boolean fits = newTextHeight + maxDescent <= maxHeight;
938942 if (fits)
939943 {
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json;
24
25 import com.fasterxml.jackson.databind.JsonNode;
26
27 /**
28 * @author Narcis Marcu (narcism@users.sourceforge.net)
29 */
30 public class JRJsonNode {
31 private JRJsonNode parent;
32 private JsonNode dataNode;
33
34 public JRJsonNode(JRJsonNode parent, JsonNode dataNode) {
35 this.parent = parent;
36 this.dataNode = dataNode;
37 }
38
39 public JRJsonNode getParent() {
40 return parent;
41 }
42
43 public JsonNode getDataNode() {
44 return dataNode;
45 }
46
47 public JRJsonNode createChild(JsonNode childDataNode) {
48 return new JRJsonNode(this, childDataNode);
49 }
50
51 @Override
52 public String toString() {
53 return dataNode.toString();
54 }
55 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import com.fasterxml.jackson.databind.JsonNode;
29
30 /**
31 * @author Narcis Marcu (narcism@users.sourceforge.net)
32 */
33 public class JsonNodeContainer {
34 private List<JRJsonNode> nodes;
35
36 public JsonNodeContainer() {
37 nodes = new ArrayList<>();
38 }
39
40 public JsonNodeContainer(JRJsonNode node) {
41 this();
42 nodes.add(node);
43 }
44
45 public void add(JRJsonNode node) {
46 nodes.add(node);
47 }
48
49 public void addNodes(List<JRJsonNode> nodes) {
50 this.nodes.addAll(nodes);
51 }
52
53 public List<JRJsonNode> getNodes() {
54 return nodes;
55 }
56
57 public List<JRJsonNode> getContainerNodes() {
58 if (nodes.size() == 1 && nodes.get(0).getDataNode().isArray()) {
59 List<JRJsonNode> result = new ArrayList<>();
60
61 JRJsonNode parentNode = nodes.get(0);
62 JsonNode arrayNode = parentNode.getDataNode();
63
64 for (JsonNode deeper: arrayNode) {
65 result.add(parentNode.createChild(deeper));
66 }
67
68 return result;
69
70 }
71 return nodes;
72 }
73
74 public JRJsonNode getFirst() {
75 return nodes.get(0);
76 }
77
78 public int getSize() {
79 return nodes.size();
80 }
81
82 public int getContainerSize() {
83 if (nodes.size() == 1 && nodes.get(0).getDataNode().isArray()) {
84 return nodes.get(0).getDataNode().size();
85 }
86
87 return nodes.size();
88 }
89
90 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression;
24
25 import net.sf.jasperreports.engine.json.expression.filter.evaluation.FilterExpressionEvaluatorVisitor;
26 import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
27
28 import com.fasterxml.jackson.databind.ObjectMapper;
29
30 /**
31 * @author Narcis Marcu (narcism@users.sourceforge.net)
32 */
33 public interface EvaluationContext {
34
35 FilterExpressionEvaluatorVisitor getFilterExpressionEvaluatorVisitor();
36
37 MemberExpressionEvaluatorVisitor getMemberExpressionEvaluatorVisitor();
38
39 MemberExpressionEvaluatorVisitor getMemberExpressionEvaluatorVisitorForFilter();
40
41 ObjectMapper getObjectMapper();
42 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
29
30 /**
31 * @author Narcis Marcu (narcism@users.sourceforge.net)
32 */
33 public class JsonQLExpression {
34 private List<MemberExpression> memberExpressionList = new ArrayList<>();
35 private boolean isAbsolute;
36
37 public void addMemberExpression(MemberExpression memberExpression) {
38 memberExpressionList.add(memberExpression);
39 }
40
41 public List<MemberExpression> getMemberExpressionList() {
42 return memberExpressionList;
43 }
44
45 public boolean isAbsolute() {
46 return isAbsolute;
47 }
48
49 public void setIsAbsolute(boolean isAbsolute) {
50 this.isAbsolute = isAbsolute;
51 }
52
53 @Override
54 public String toString() {
55 String result = (isAbsolute ? "" : "NON ") + "absolute pathExpression: \n";
56
57 for(MemberExpression me: memberExpressionList) {
58 result += me + "\n";
59 }
60
61 return result;
62 }
63 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression;
24
25 import java.util.List;
26
27 import net.sf.jasperreports.engine.json.JRJsonNode;
28 import net.sf.jasperreports.engine.json.JsonNodeContainer;
29 import net.sf.jasperreports.engine.json.expression.filter.evaluation.DefaultFilterExpressionEvaluatorVisitor;
30 import net.sf.jasperreports.engine.json.expression.filter.evaluation.FilterExpressionEvaluatorVisitor;
31 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
32 import net.sf.jasperreports.engine.json.expression.member.evaluation.DefaultMemberExpressionEvaluatorVisitor;
33 import net.sf.jasperreports.engine.json.expression.member.evaluation.DefaultMemberExpressionEvaluatorVisitorForFilter;
34 import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
35 import net.sf.jasperreports.engine.util.JsonUtil;
36
37 import com.fasterxml.jackson.databind.ObjectMapper;
38
39 /**
40 * @author Narcis Marcu (narcism@users.sourceforge.net)
41 */
42 public class JsonQLExpressionEvaluator {
43
44 private EvaluationContext evaluationContext;
45
46
47 public JsonQLExpressionEvaluator() {
48 evaluationContext = new EvaluationContext() {
49 @Override
50 public FilterExpressionEvaluatorVisitor getFilterExpressionEvaluatorVisitor() {
51 return new DefaultFilterExpressionEvaluatorVisitor(this);
52 }
53
54 @Override
55 public MemberExpressionEvaluatorVisitor getMemberExpressionEvaluatorVisitor() {
56 return new DefaultMemberExpressionEvaluatorVisitor(this);
57 }
58
59 @Override
60 public MemberExpressionEvaluatorVisitor getMemberExpressionEvaluatorVisitorForFilter() {
61 return new DefaultMemberExpressionEvaluatorVisitorForFilter(this);
62 }
63
64 @Override
65 public ObjectMapper getObjectMapper() {
66 return JsonUtil.createObjectMapper();
67 }
68 };
69 }
70
71 public JsonNodeContainer evaluate(JsonQLExpression expression, JRJsonNode contextNode) {
72
73 List<MemberExpression> memberExpressionList = expression.getMemberExpressionList();
74 JsonNodeContainer result = new JsonNodeContainer(contextNode);
75
76 if (memberExpressionList != null) {
77 for (MemberExpression me: memberExpressionList) {
78 result = me.evaluate(result, evaluationContext.getMemberExpressionEvaluatorVisitor());
79
80 if (result == null) {
81 return null;
82 }
83 }
84 }
85
86 return result;
87
88 }
89
90 public EvaluationContext getEvaluationContext() {
91 return evaluationContext;
92 }
93 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import net.sf.jasperreports.engine.json.JRJsonNode;
29 import net.sf.jasperreports.engine.json.expression.filter.evaluation.FilterExpressionEvaluatorVisitor;
30 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
31 import net.sf.jasperreports.engine.type.JsonOperatorEnum;
32
33 /**
34 * @author Narcis Marcu (narcism@users.sourceforge.net)
35 */
36 public class BasicFilterExpression implements FilterExpression {
37 private List<MemberExpression> memberExpressionList = new ArrayList<>();
38 private JsonOperatorEnum operator;
39 private ValueDescriptor valueDescriptor;
40 private boolean isSizeFunction;
41 private boolean isNullFunction;
42 private boolean isNotNullFunction;
43 private boolean isArrayFunction;
44 private boolean isObjectFunction;
45 private boolean isValueFunction;
46
47
48 public BasicFilterExpression() {
49 }
50
51 @Override
52 public boolean evaluate(JRJsonNode jsonNode, FilterExpressionEvaluatorVisitor evaluator) {
53 return evaluator.evaluateBasicFilter(this, jsonNode);
54 }
55
56 public List<MemberExpression> getMemberExpressionList() {
57 return memberExpressionList;
58 }
59
60 public void addMemberExpression(MemberExpression memberExpression) {
61 memberExpressionList.add(memberExpression);
62 }
63
64 public JsonOperatorEnum getOperator() {
65 return operator;
66 }
67
68 public void setOperator(JsonOperatorEnum operator) {
69 this.operator = operator;
70 }
71
72 public ValueDescriptor getValueDescriptor() {
73 return valueDescriptor;
74 }
75
76 public void setValueDescriptor(ValueDescriptor valueDescriptor) {
77 this.valueDescriptor = valueDescriptor;
78 }
79
80 public boolean isSizeFunction() {
81 return isSizeFunction;
82 }
83
84 public void setIsSizeFunction(boolean isSizeFunction) {
85 this.isSizeFunction = isSizeFunction;
86 }
87
88 public boolean isNullFunction() {
89 return isNullFunction;
90 }
91
92 public void setIsNullFunction(boolean isNullFunction) {
93 this.isNullFunction = isNullFunction;
94 }
95
96 public boolean isNotNullFunction() {
97 return isNotNullFunction;
98 }
99
100 public void setIsNotNullFunction(boolean isNotNullFunction) {
101 this.isNotNullFunction = isNotNullFunction;
102 }
103
104 public boolean isArrayFunction() {
105 return isArrayFunction;
106 }
107
108 public void setIsArrayFunction(boolean isArrayFunction) {
109 this.isArrayFunction = isArrayFunction;
110 }
111
112 public boolean isObjectFunction() {
113 return isObjectFunction;
114 }
115
116 public void setIsObjectFunction(boolean isObjectFunction) {
117 this.isObjectFunction = isObjectFunction;
118 }
119
120 public boolean isValueFunction() {
121 return isValueFunction;
122 }
123
124 public void setIsValueFunction(boolean isValueFunction) {
125 this.isValueFunction = isValueFunction;
126 }
127
128 @Override
129 public String toString() {
130 String result = "";
131
132 for(MemberExpression me: memberExpressionList) {
133 result += me.toString() + " ";
134 }
135
136 if (isSizeFunction) {
137 result += "isSizeFn";
138 } else if (isValueFunction) {
139 result += "isValueFn";
140 } else if (isArrayFunction) {
141 result += "isArrayFn";
142 } else if (isNotNullFunction) {
143 result += "isNotNullFn";
144 } else if (isObjectFunction) {
145 result += "isObjectFn";
146 }
147
148 return result + " " + operator + " " + valueDescriptor;
149 }
150 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter;
24
25 import net.sf.jasperreports.engine.json.JRJsonNode;
26 import net.sf.jasperreports.engine.json.expression.filter.evaluation.FilterExpressionEvaluatorVisitor;
27
28 /**
29 * @author Narcis Marcu (narcism@users.sourceforge.net)
30 */
31 public class CompoundFilterExpression implements FilterExpression {
32 private FilterExpression f1;
33 private FilterExpression f2;
34 private LOGICAL_OPERATOR logicalOperator;
35
36
37 public CompoundFilterExpression(FilterExpression f1, FilterExpression f2, LOGICAL_OPERATOR logicalOperator) {
38 this.f1 = f1;
39 this.f2 = f2;
40 this.logicalOperator = logicalOperator;
41 }
42
43 @Override
44 public boolean evaluate(JRJsonNode jsonNode, FilterExpressionEvaluatorVisitor evaluator) {
45 return evaluator.evaluateCompoundFilter(this, jsonNode);
46 }
47
48 public FilterExpression getLeft() {
49 return f1;
50 }
51
52 public FilterExpression getRight() {
53 return f2;
54 }
55
56 public LOGICAL_OPERATOR getLogicalOperator() {
57 return logicalOperator;
58 }
59
60 @Override
61 public String toString() {
62 return "(" + f1 + " " + logicalOperator + " " + f2 + ")";
63 }
64 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter;
24
25 import net.sf.jasperreports.engine.json.JRJsonNode;
26 import net.sf.jasperreports.engine.json.expression.filter.evaluation.FilterExpressionEvaluatorVisitor;
27
28 /**
29 * @author Narcis Marcu (narcism@users.sourceforge.net)
30 */
31 public interface FilterExpression {
32
33 enum LOGICAL_OPERATOR {
34 AND,
35 OR
36 }
37
38 enum VALUE_TYPE {
39 NULL,
40 BOOLEAN,
41 INTEGER,
42 DOUBLE,
43 STRING
44 }
45
46 boolean evaluate(JRJsonNode jsonNode, FilterExpressionEvaluatorVisitor evaluator);
47
48 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter;
24
25 import net.sf.jasperreports.engine.json.JRJsonNode;
26 import net.sf.jasperreports.engine.json.expression.filter.evaluation.FilterExpressionEvaluatorVisitor;
27
28 /**
29 * @author Narcis Marcu (narcism@users.sourceforge.net)
30 */
31 public class NotFilterExpression implements FilterExpression {
32 private FilterExpression filterExpression;
33
34 public NotFilterExpression(FilterExpression filterExpression) {
35 this.filterExpression = filterExpression;
36 }
37
38 @Override
39 public boolean evaluate(JRJsonNode jsonNode, FilterExpressionEvaluatorVisitor evaluator) {
40 return evaluator.evaluateNotFilter(this, jsonNode);
41 }
42
43 public FilterExpression getFilterExpression() {
44 return filterExpression;
45 }
46
47 @Override
48 public String toString() {
49 return "not( " + filterExpression + " )";
50 }
51 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter;
24
25 /**
26 * @author Narcis Marcu (narcism@users.sourceforge.net)
27 */
28 public class ValueDescriptor {
29 private String value;
30 private FilterExpression.VALUE_TYPE type;
31
32 public ValueDescriptor(FilterExpression.VALUE_TYPE type, String value) {
33 this.value = value;
34 this.type = type;
35 }
36
37 public String getValue() {
38 return value;
39 }
40
41 public FilterExpression.VALUE_TYPE getType() {
42 return type;
43 }
44
45 @Override
46 public String toString() {
47 return type + "{" + value + "}";
48 }
49 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter.evaluation;
24
25 import java.math.BigDecimal;
26
27 import net.sf.jasperreports.engine.json.JRJsonNode;
28 import net.sf.jasperreports.engine.json.JsonNodeContainer;
29 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
30 import net.sf.jasperreports.engine.json.expression.filter.BasicFilterExpression;
31 import net.sf.jasperreports.engine.json.expression.filter.FilterExpression;
32 import net.sf.jasperreports.engine.json.expression.filter.ValueDescriptor;
33 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
34 import net.sf.jasperreports.engine.type.JsonOperatorEnum;
35
36 import org.apache.commons.logging.Log;
37 import org.apache.commons.logging.LogFactory;
38
39 import com.fasterxml.jackson.databind.JsonNode;
40
41 /**
42 * @author Narcis Marcu (narcism@users.sourceforge.net)
43 */
44 public class BasicFilterExpressionEvaluator implements FilterExpressionEvaluator {
45 private static final Log log = LogFactory.getLog(BasicFilterExpressionEvaluator.class);
46
47 private EvaluationContext evaluationContext;
48 private BasicFilterExpression expression;
49
50
51 public BasicFilterExpressionEvaluator(EvaluationContext evaluationContext, BasicFilterExpression expression) {
52 this.evaluationContext = evaluationContext;
53 this.expression = expression;
54 }
55
56 @Override
57 public boolean evaluate(JRJsonNode jsonNode) {
58 JsonNodeContainer memberEval = new JsonNodeContainer(jsonNode);
59 boolean result = false;
60
61 if (log.isDebugEnabled()) {
62 log.debug("filtering (" + this.expression + ") to: " + jsonNode);
63 }
64
65 // traverse the members
66 outer: for (MemberExpression me: expression.getMemberExpressionList()) {
67 memberEval = me.evaluate(memberEval, evaluationContext.getMemberExpressionEvaluatorVisitorForFilter());
68
69 // exit on first null
70 if (memberEval == null) {
71 if (log.isDebugEnabled()) {
72 log.debug("result is null");
73 }
74 return false;
75 }
76
77 // break when hitting a missing node; this will allow filtering for missing keys
78 if (memberEval.getSize() == 1 && memberEval.getFirst().getDataNode().isMissingNode()) {
79 if (log.isDebugEnabled()) {
80 log.debug("hit missing node");
81 }
82 break outer;
83 }
84 }
85
86 if (log.isDebugEnabled()) {
87 log.debug("done filter members' eval => node with (size: " + memberEval.getSize() +
88 ", cSize: " + memberEval.getContainerSize() + ")");
89 }
90
91 // check for null first
92 if (expression.isNullFunction()) {
93 if (log.isDebugEnabled()) {
94 log.debug("expression isNullFunction");
95 }
96
97 if (memberEval.getSize() == 1 &&
98 (memberEval.getFirst().getDataNode().isNull() ||
99 memberEval.getFirst().getDataNode().isMissingNode())) {
100 result = true;
101 }
102 }
103 // check for not null on everything except null and missing nodes
104 else if (expression.isNotNullFunction()) {
105 if (log.isDebugEnabled()) {
106 log.debug("expression isNotNullFunction");
107 }
108
109 if (memberEval.getSize() > 1 ||
110 memberEval.getSize() == 1 &&
111 !(memberEval.getFirst().getDataNode().isNull() ||
112 memberEval.getFirst().getDataNode().isMissingNode())) {
113 result = true;
114 }
115 }
116 else if (expression.isArrayFunction()) {
117 if (log.isDebugEnabled()) {
118 log.debug("expression isArrayFunction");
119 }
120
121 if (memberEval.getSize() > 1 ||
122 memberEval.getSize() == 1 && memberEval.getFirst().getDataNode().isArray()) {
123 return true;
124 }
125 }
126 else if (expression.isObjectFunction()) {
127 if (log.isDebugEnabled()) {
128 log.debug("expression isObjectFunction");
129 }
130
131 if (memberEval.getSize() == 1 && memberEval.getFirst().getDataNode().isObject()) {
132 return true;
133 }
134 }
135 else if (expression.isValueFunction()) {
136 if (log.isDebugEnabled()) {
137 log.debug("expression isValueFunction");
138 }
139
140 if (memberEval.getSize() == 1 && memberEval.getFirst().getDataNode().isValueNode()) {
141 return true;
142 }
143 }
144 // the size is only checked on an array object
145 else if (expression.isSizeFunction()) {
146 if (log.isDebugEnabled()) {
147 log.debug("expression isSizeFunction");
148 }
149
150 if (memberEval.getSize() > 1 ||
151 memberEval.getSize() == 1 && memberEval.getFirst().getDataNode().isArray()) {
152 result = applySizeOperator(memberEval.getContainerSize());
153 }
154 }
155 // else perform the filtering only for value/missing nodes
156 else if (memberEval.getSize() == 1 &&
157 (memberEval.getFirst().getDataNode().isValueNode() || memberEval.getFirst().getDataNode().isMissingNode())) {
158
159 result = applyOperator(memberEval.getFirst().getDataNode());
160 }
161
162 if (log.isDebugEnabled()) {
163 log.debug("filter result is: " + result);
164 }
165
166 return result;
167 }
168
169 protected boolean applySizeOperator(int size) {
170 if (expression.getValueDescriptor().getType() == FilterExpression.VALUE_TYPE.INTEGER) {
171 int operand = Integer.parseInt(expression.getValueDescriptor().getValue());
172
173 switch(expression.getOperator()) {
174 case EQ:
175 return size == operand;
176 case NE:
177 return size != operand;
178 case GT:
179 return size > operand;
180 case GE:
181 return size >= operand;
182 case LT:
183 return size < operand;
184 case LE:
185 return size <= operand;
186 }
187 }
188
189 return false;
190 }
191
192 protected boolean applyOperator(JsonNode valueNode) {
193 ValueDescriptor valueDescriptor = expression.getValueDescriptor();
194 JsonOperatorEnum operator = expression.getOperator();
195 FilterExpression.VALUE_TYPE type = valueDescriptor.getType();
196
197 // do null comparison first
198 if (FilterExpression.VALUE_TYPE.NULL.equals(type)) {
199 switch (operator) {
200 case EQ:
201 return valueNode.isNull() || valueNode.isMissingNode();
202 case NE:
203 return !(valueNode.isNull() || valueNode.isMissingNode());
204 }
205 } else {
206 // compare numbers with numbers
207 if (valueNode.isNumber() &&
208 (FilterExpression.VALUE_TYPE.INTEGER.equals(type) || FilterExpression.VALUE_TYPE.DOUBLE.equals(type))) {
209
210 BigDecimal opRight = new BigDecimal(valueDescriptor.getValue());
211 BigDecimal opLeft;
212
213 if (valueNode.isBigDecimal()) {
214 opLeft = valueNode.decimalValue();
215 } else {
216 opLeft = new BigDecimal(valueNode.asText());
217 }
218
219 switch (operator) {
220 case EQ:
221 return opLeft.compareTo(opRight) == 0;
222 case NE:
223 return opLeft.compareTo(opRight) != 0;
224 case GT:
225 return opLeft.compareTo(opRight) > 0;
226 case GE:
227 return opLeft.compareTo(opRight) >= 0;
228 case LT:
229 return opLeft.compareTo(opRight) < 0;
230 case LE:
231 return opLeft.compareTo(opRight) <= 0;
232 }
233 }
234 // compare strings with strings
235 else if (valueNode.isTextual() && FilterExpression.VALUE_TYPE.STRING.equals(type)) {
236 switch (operator) {
237 case EQ:
238 return valueNode.textValue().equals(valueDescriptor.getValue());
239 case NE:
240 return !valueNode.textValue().equals(valueDescriptor.getValue());
241 case CONTAINS:
242 return valueNode.textValue().contains(valueDescriptor.getValue());
243 }
244 }
245 // compare booleans with booleans
246 else if (valueNode.isBoolean() && FilterExpression.VALUE_TYPE.BOOLEAN.equals(type)) {
247 switch (operator) {
248 case EQ:
249 return valueNode.booleanValue() == Boolean.parseBoolean(valueDescriptor.getValue());
250 case NE:
251 return valueNode.booleanValue() != Boolean.parseBoolean(valueDescriptor.getValue());
252 }
253 }
254 }
255
256 return false;
257 }
258 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter.evaluation;
24
25 import net.sf.jasperreports.engine.json.JRJsonNode;
26 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
27 import net.sf.jasperreports.engine.json.expression.filter.CompoundFilterExpression;
28
29 /**
30 * @author Narcis Marcu (narcism@users.sourceforge.net)
31 */
32 public class CompoundFilterExpressionEvaluator implements FilterExpressionEvaluator {
33 private EvaluationContext evaluationContext;
34 private CompoundFilterExpression expression;
35
36
37 public CompoundFilterExpressionEvaluator(EvaluationContext evaluationContext, CompoundFilterExpression expression) {
38 this.evaluationContext = evaluationContext;
39 this.expression = expression;
40 }
41
42 @Override
43 public boolean evaluate(JRJsonNode contextNode) {
44 FilterExpressionEvaluatorVisitor evaluatorVisitor = evaluationContext.getFilterExpressionEvaluatorVisitor();
45
46 switch (expression.getLogicalOperator()) {
47 case AND:
48 return expression.getLeft().evaluate(contextNode, evaluatorVisitor)
49 && expression.getRight().evaluate(contextNode, evaluatorVisitor);
50 case OR:
51 return expression.getLeft().evaluate(contextNode, evaluatorVisitor)
52 || expression.getRight().evaluate(contextNode, evaluatorVisitor);
53 }
54
55 return false;
56 }
57 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter.evaluation;
24
25 import net.sf.jasperreports.engine.json.JRJsonNode;
26 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
27 import net.sf.jasperreports.engine.json.expression.filter.BasicFilterExpression;
28 import net.sf.jasperreports.engine.json.expression.filter.CompoundFilterExpression;
29 import net.sf.jasperreports.engine.json.expression.filter.NotFilterExpression;
30
31 /**
32 * @author Narcis Marcu (narcism@users.sourceforge.net)
33 */
34 public class DefaultFilterExpressionEvaluatorVisitor implements FilterExpressionEvaluatorVisitor {
35 private EvaluationContext evaluationContext;
36
37
38 public DefaultFilterExpressionEvaluatorVisitor(EvaluationContext evaluationContext) {
39 this.evaluationContext = evaluationContext;
40 }
41
42 @Override
43 public boolean evaluateBasicFilter(BasicFilterExpression expression, JRJsonNode contextNode) {
44 FilterExpressionEvaluator evaluator = new BasicFilterExpressionEvaluator(evaluationContext, expression);
45 return evaluator.evaluate(contextNode);
46 }
47
48 @Override
49 public boolean evaluateCompoundFilter(CompoundFilterExpression expression, JRJsonNode contextNode) {
50 FilterExpressionEvaluator evaluator = new CompoundFilterExpressionEvaluator(evaluationContext, expression);
51 return evaluator.evaluate(contextNode);
52 }
53
54 @Override
55 public boolean evaluateNotFilter(NotFilterExpression expression, JRJsonNode contextNode) {
56 FilterExpressionEvaluator evaluator = new NotFilterExpressionEvaluator(evaluationContext, expression);
57 return evaluator.evaluate(contextNode);
58 }
59 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter.evaluation;
24
25 import net.sf.jasperreports.engine.json.JRJsonNode;
26
27 /**
28 * @author Narcis Marcu (narcism@users.sourceforge.net)
29 */
30 public interface FilterExpressionEvaluator {
31
32 boolean evaluate(JRJsonNode contextNode);
33
34 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter.evaluation;
24
25 import net.sf.jasperreports.engine.json.JRJsonNode;
26 import net.sf.jasperreports.engine.json.expression.filter.BasicFilterExpression;
27 import net.sf.jasperreports.engine.json.expression.filter.CompoundFilterExpression;
28 import net.sf.jasperreports.engine.json.expression.filter.NotFilterExpression;
29
30 /**
31 * @author Narcis Marcu (narcism@users.sourceforge.net)
32 */
33 public interface FilterExpressionEvaluatorVisitor {
34
35 boolean evaluateBasicFilter(BasicFilterExpression expression, JRJsonNode contextNode);
36
37 boolean evaluateCompoundFilter(CompoundFilterExpression expression, JRJsonNode contextNode);
38
39 boolean evaluateNotFilter(NotFilterExpression expression, JRJsonNode contextNode);
40 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.filter.evaluation;
24
25 import net.sf.jasperreports.engine.json.JRJsonNode;
26 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
27 import net.sf.jasperreports.engine.json.expression.filter.NotFilterExpression;
28
29 /**
30 * @author Narcis Marcu (narcism@users.sourceforge.net)
31 */
32 public class NotFilterExpressionEvaluator implements FilterExpressionEvaluator {
33 private EvaluationContext evaluationContext;
34 private NotFilterExpression expression;
35
36
37 public NotFilterExpressionEvaluator(EvaluationContext evaluationContext, NotFilterExpression expression) {
38 this.evaluationContext = evaluationContext;
39 this.expression = expression;
40 }
41
42 @Override
43 public boolean evaluate(JRJsonNode contextNode) {
44 return !expression.getFilterExpression().evaluate(contextNode, evaluationContext.getFilterExpressionEvaluatorVisitor());
45 }
46 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member;
24
25 import net.sf.jasperreports.engine.json.expression.filter.FilterExpression;
26
27 /**
28 * @author Narcis Marcu (narcism@users.sourceforge.net)
29 */
30 public abstract class AbstractMemberExpression implements MemberExpression {
31 private DIRECTION direction;
32 private FilterExpression filterExpression;
33
34
35 @Override
36 public FilterExpression getFilterExpression() {
37 return filterExpression;
38 }
39
40 @Override
41 public void setFilterExpression(FilterExpression filterExpression) {
42 this.filterExpression = filterExpression;
43 }
44
45 public DIRECTION getDirection() {
46 return direction;
47 }
48
49 public void setDirection(DIRECTION direction) {
50 this.direction = direction;
51 }
52
53 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import net.sf.jasperreports.engine.json.JsonNodeContainer;
29 import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
30
31 /**
32 * @author Narcis Marcu (narcism@users.sourceforge.net)
33 */
34 public class ArrayConstructionExpression extends AbstractMemberExpression {
35 private List<Integer> indexes;
36
37
38 public ArrayConstructionExpression() {
39 indexes = new ArrayList<>();
40 }
41
42 @Override
43 public JsonNodeContainer evaluate(JsonNodeContainer nodeContainer, MemberExpressionEvaluatorVisitor evaluator) {
44 return evaluator.evaluateArrayConstruction(this, nodeContainer);
45 }
46
47 public void addIndex(int index) {
48 indexes.add(index);
49 }
50
51 public List<Integer> getIndexes() {
52 return indexes;
53 }
54
55 @Override
56 public String toString() {
57 String result = getDirection() + " " + indexes;
58 if (getFilterExpression() != null) {
59 result += "(" + getFilterExpression() + ")";
60 }
61 return result;
62 }
63 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member;
24
25 import net.sf.jasperreports.engine.json.JsonNodeContainer;
26 import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
27
28 /**
29 * @author Narcis Marcu (narcism@users.sourceforge.net)
30 */
31 public class ArrayIndexExpression extends AbstractMemberExpression {
32 private int index;
33
34
35 public ArrayIndexExpression(DIRECTION direction, int index) {
36 this.index = index;
37 setDirection(direction);
38 }
39
40 @Override
41 public JsonNodeContainer evaluate(JsonNodeContainer nodeContainer, MemberExpressionEvaluatorVisitor evaluator) {
42 return evaluator.evaluateArrayIndex(this, nodeContainer);
43 }
44
45 public int getIndex() {
46 return index;
47 }
48
49 @Override
50 public String toString() {
51 String result = getDirection() + " " + index;
52 if (getFilterExpression() != null) {
53 result += "(" + getFilterExpression() + ")";
54 }
55 return result;
56 }
57 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member;
24
25 import net.sf.jasperreports.engine.json.JsonNodeContainer;
26 import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
27
28 /**
29 * @author Narcis Marcu (narcism@users.sourceforge.net)
30 */
31 public class ArraySliceExpression extends AbstractMemberExpression {
32 private Integer start, end;
33
34
35 public ArraySliceExpression(DIRECTION direction, Integer start, Integer end) {
36 this.start = start;
37 this.end = end;
38 setDirection(direction);
39 }
40
41 @Override
42 public JsonNodeContainer evaluate(JsonNodeContainer nodeContainer, MemberExpressionEvaluatorVisitor evaluator) {
43 return evaluator.evaluateArraySlice(this, nodeContainer);
44 }
45
46 public Integer getStart() {
47 return start;
48 }
49
50 public Integer getEnd() {
51 return end;
52 }
53
54 @Override
55 public String toString() {
56 String result = getDirection() + " [" + (start != null ? start : "START") + ":" + (end != null ? end : "END") + "]";
57 if (getFilterExpression() != null) {
58 result += "(" + getFilterExpression() + ")";
59 }
60 return result;
61 }
62 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member;
24
25 import net.sf.jasperreports.engine.json.JsonNodeContainer;
26 import net.sf.jasperreports.engine.json.expression.filter.FilterExpression;
27 import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
28
29 /**
30 * @author Narcis Marcu (narcism@users.sourceforge.net)
31 */
32 public interface MemberExpression {
33
34 enum DIRECTION {
35 DOWN,
36 ANYWHERE_DOWN
37 }
38
39 JsonNodeContainer evaluate(JsonNodeContainer nodeContainer, MemberExpressionEvaluatorVisitor evaluator);
40
41 FilterExpression getFilterExpression();
42
43 void setFilterExpression(FilterExpression filterExpression);
44
45 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member;
24
25 import net.sf.jasperreports.engine.json.JsonNodeContainer;
26 import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
27
28 /**
29 * @author Narcis Marcu (narcism@users.sourceforge.net)
30 */
31 public class MultiLevelUpExpression extends AbstractMemberExpression {
32 private int level;
33
34
35 public MultiLevelUpExpression(int level) {
36 this.level = level;
37 }
38
39 @Override
40 public JsonNodeContainer evaluate(JsonNodeContainer contextNode, MemberExpressionEvaluatorVisitor evaluator) {
41 return evaluator.evaluateMultiLevelUp(this, contextNode);
42 }
43
44 public int getLevel() {
45 return level;
46 }
47
48 @Override
49 public String toString() {
50 String result = "Up by " + level + " level(s)";
51 if (getFilterExpression() != null) {
52 result += "(" + getFilterExpression() + ")";
53 }
54 return result;
55 }
56 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import net.sf.jasperreports.engine.json.JsonNodeContainer;
29 import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
30
31 /**
32 * @author Narcis Marcu (narcism@users.sourceforge.net)
33 */
34 public class ObjectConstructionExpression extends AbstractMemberExpression {
35 private List<String> objectKeys;
36
37
38 public ObjectConstructionExpression() {
39 objectKeys = new ArrayList<>();
40 }
41
42 @Override
43 public JsonNodeContainer evaluate(JsonNodeContainer nodeContainer, MemberExpressionEvaluatorVisitor evaluator) {
44 return evaluator.evaluateObjectConstruction(this, nodeContainer);
45 }
46
47 public void addKey(String key) {
48 objectKeys.add(key);
49 }
50
51 public List<String> getObjectKeys() {
52 return objectKeys;
53 }
54
55 @Override
56 public String toString() {
57 String result = getDirection() + " " + objectKeys;
58 if (getFilterExpression() != null) {
59 result += "(" + getFilterExpression() + ")";
60 }
61 return result;
62 }
63
64 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member;
24
25 import net.sf.jasperreports.engine.json.JsonNodeContainer;
26 import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
27
28 /**
29 * @author Narcis Marcu (narcism@users.sourceforge.net)
30 */
31 public class ObjectKeyExpression extends AbstractMemberExpression {
32 private String objectKey;
33 private boolean isWildcard;
34
35
36 public ObjectKeyExpression(DIRECTION direction) {
37 this.isWildcard = true;
38 setDirection(direction);
39 }
40
41 public ObjectKeyExpression(DIRECTION direction, String objectKey) {
42 this.objectKey = objectKey;
43 this.isWildcard = false;
44 setDirection(direction);
45 }
46
47
48 public boolean isWildcard() {
49 return isWildcard;
50 }
51
52 public String getObjectKey() {
53 return objectKey;
54 }
55
56 @Override
57 public JsonNodeContainer evaluate(JsonNodeContainer nodeContainer, MemberExpressionEvaluatorVisitor evaluator) {
58 return evaluator.evaluateObjectKey(this, nodeContainer);
59 }
60
61 @Override
62 public String toString() {
63 String result = getDirection() + " " + (objectKey != null ? objectKey : "wildcard");
64 if (getFilterExpression() != null) {
65 result += "(" + getFilterExpression() + ")";
66 }
67 return result;
68 }
69
70 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import java.util.ArrayList;
26 import java.util.Deque;
27 import java.util.Iterator;
28 import java.util.List;
29 import java.util.Map;
30
31 import net.sf.jasperreports.engine.json.JRJsonNode;
32 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
33 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
34
35 import org.apache.commons.logging.Log;
36 import org.apache.commons.logging.LogFactory;
37
38 import com.fasterxml.jackson.databind.JsonNode;
39 import com.fasterxml.jackson.databind.node.ArrayNode;
40
41 /**
42 * @author Narcis Marcu (narcism@users.sourceforge.net)
43 */
44 public abstract class AbstractMemberExpressionEvaluator implements MemberExpressionEvaluator {
45 private static final Log log = LogFactory.getLog(AbstractMemberExpressionEvaluator.class);
46
47 private EvaluationContext evaluationContext;
48
49
50 public AbstractMemberExpressionEvaluator(EvaluationContext evaluationContext) {
51 this.evaluationContext = evaluationContext;
52 }
53
54 public abstract MemberExpression getMemberExpression();
55
56 public EvaluationContext getEvaluationContext() {
57 return evaluationContext;
58 }
59
60 protected boolean applyFilter(JRJsonNode node) {
61 if (log.isDebugEnabled()) {
62 log.debug("apply filter - " + getMemberExpression().getFilterExpression() + " - to: " + node);
63 }
64
65 if (getMemberExpression().getFilterExpression() != null) {
66 boolean evalResult = getMemberExpression().getFilterExpression().evaluate(node, evaluationContext.getFilterExpressionEvaluatorVisitor());
67
68 if (log.isDebugEnabled()) {
69 log.debug("filter returns " + evalResult);
70 }
71
72 return evalResult;
73 }
74
75 if (log.isDebugEnabled()) {
76 log.debug("no filter expression, returns true");
77 }
78
79 return true;
80 }
81
82 protected List<JRJsonNode> filterArrayNode(JRJsonNode parent, ArrayNode childArray) {
83 return filterArrayNode(parent, childArray, null);
84 }
85
86 protected List<JRJsonNode> filterArrayNode(JRJsonNode parent, ArrayNode childArray, String deeperKey) {
87 return filterArrayNode(parent, childArray, deeperKey, false);
88 }
89
90 protected List<JRJsonNode> filterArrayNode(JRJsonNode parent, ArrayNode childArray, String deeperKey, boolean keepArrayContainment) {
91 if (log.isDebugEnabled()) {
92 log.debug("filtering array: " + childArray + "; deeperKey: " + deeperKey + "; keepArrayContainment: " + keepArrayContainment);
93 }
94
95 List<JRJsonNode> result = new ArrayList<>();
96 ArrayNode container = null;
97
98 if (keepArrayContainment) {
99 container = evaluationContext.getObjectMapper().createArrayNode();
100 }
101
102 for (JsonNode current : childArray) {
103 if (deeperKey != null) {
104 JsonNode deeperNode = current.get(deeperKey);
105
106 if (deeperNode != null) {
107 JRJsonNode currentParent = parent.createChild(current);
108 JRJsonNode currentChild = currentParent.createChild(deeperNode);
109
110 if (applyFilter(currentChild)) {
111 if (keepArrayContainment) {
112 container.add(deeperNode);
113 } else {
114 result.add(currentChild);
115 }
116 }
117 }
118 } else {
119 JRJsonNode currentChild = parent.createChild(current);
120
121 if (applyFilter(currentChild)) {
122 if (keepArrayContainment) {
123 container.add(current);
124 } else {
125 result.add(currentChild);
126 }
127 }
128 }
129 }
130
131 if (keepArrayContainment && container.size() > 0) {
132 result.add(parent.createChild(container));
133 }
134
135 return result;
136 }
137
138 protected void addChildrenToStack(JRJsonNode stackNode, Deque<JRJsonNode> stack) {
139 JsonNode stackDataNode = stackNode.getDataNode();
140
141 if (stackDataNode.isObject()) {
142 Iterator<Map.Entry<String, JsonNode>> it = stackDataNode.fields();
143
144 while (it.hasNext()) {
145 JsonNode current = it.next().getValue();
146 stack.addLast(stackNode.createChild(current));
147 }
148 }
149 // if array => push all children
150 else if (stackDataNode.isArray()) {
151 for (JsonNode deeper: stackDataNode) {
152 stack.addLast(stackNode.createChild(deeper));
153 }
154 }
155 }
156
157 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import java.util.ArrayDeque;
26 import java.util.ArrayList;
27 import java.util.Deque;
28 import java.util.List;
29
30 import net.sf.jasperreports.engine.json.JRJsonNode;
31 import net.sf.jasperreports.engine.json.JsonNodeContainer;
32 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
33 import net.sf.jasperreports.engine.json.expression.member.ArrayConstructionExpression;
34 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
35
36 import org.apache.commons.logging.Log;
37 import org.apache.commons.logging.LogFactory;
38
39 import com.fasterxml.jackson.databind.JsonNode;
40 import com.fasterxml.jackson.databind.node.ArrayNode;
41
42 /**
43 * @author Narcis Marcu (narcism@users.sourceforge.net)
44 */
45 public class ArrayConstructionExpressionEvaluator extends AbstractMemberExpressionEvaluator {
46 private static final Log log = LogFactory.getLog(ArrayConstructionExpressionEvaluator.class);
47
48 private ArrayConstructionExpression expression;
49
50 public ArrayConstructionExpressionEvaluator(EvaluationContext evaluationContext, ArrayConstructionExpression expression) {
51 super(evaluationContext);
52 this.expression = expression;
53 }
54
55 @Override
56 public JsonNodeContainer evaluate(JsonNodeContainer contextNode) {
57 if (log.isDebugEnabled()) {
58 log.debug("---> evaluating arrayIndex expression [" + expression +
59 "] on a node with (size: " + contextNode.getSize() +
60 ", cSize: " + contextNode.getContainerSize() + ")");
61 }
62
63 JsonNodeContainer result = new JsonNodeContainer();
64
65 switch(expression.getDirection()) {
66 case DOWN:
67 List<JRJsonNode> containerNodes = contextNode.getContainerNodes();
68 int containerSize = contextNode.getContainerSize();
69
70 for (Integer idx: expression.getIndexes()) {
71 if (idx >= 0 && idx < containerSize) {
72 JRJsonNode nodeAtIndex = containerNodes.get(idx);
73
74 if (applyFilter(nodeAtIndex)) {
75 result.add(nodeAtIndex);
76 }
77 }
78 }
79
80 break;
81 case ANYWHERE_DOWN:
82 List<JRJsonNode> nodes = contextNode.getContainerNodes();
83
84 for (JRJsonNode node: nodes) {
85 result.addNodes(goAnywhereDown(node));
86 }
87
88 break;
89 }
90
91 if (result.getSize() > 0) {
92 return result;
93 }
94
95 return null;
96 }
97
98 @Override
99 public MemberExpression getMemberExpression() {
100 return expression;
101 }
102
103 private List<JRJsonNode> goAnywhereDown(JRJsonNode jrJsonNode) {
104 List<JRJsonNode> result = new ArrayList<>();
105 Deque<JRJsonNode> stack = new ArrayDeque<>();
106 JsonNode initialDataNode = jrJsonNode.getDataNode();
107
108 if (log.isDebugEnabled()) {
109 log.debug("initial stack population with: " + initialDataNode);
110 }
111
112 // populate the stack initially
113 stack.push(jrJsonNode);
114
115 while (!stack.isEmpty()) {
116 JRJsonNode stackNode = stack.pop();
117 JsonNode stackDataNode = stackNode.getDataNode();
118
119 addChildrenToStack(stackNode, stack);
120
121 // process the current stack item
122 if (stackDataNode.isArray()) {
123 if (log.isDebugEnabled()) {
124 log.debug("processing stack element: " + stackDataNode);
125 }
126
127 ArrayNode newNode = getEvaluationContext().getObjectMapper().createArrayNode();
128
129 for (Integer idx: expression.getIndexes()) {
130 if (idx >= 0 && idx < stackDataNode.size()) {
131 JRJsonNode nodeAtIndex = stackNode.createChild(stackDataNode.get(idx));
132
133 if (applyFilter(nodeAtIndex)) {
134 newNode.add(nodeAtIndex.getDataNode());
135 }
136 }
137 }
138
139 if (newNode.size() > 0) {
140 result.add(stackNode.createChild(newNode));
141 }
142 }
143 }
144
145 return result;
146 }
147
148 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import java.util.ArrayDeque;
26 import java.util.ArrayList;
27 import java.util.Deque;
28 import java.util.List;
29
30 import net.sf.jasperreports.engine.json.JRJsonNode;
31 import net.sf.jasperreports.engine.json.JsonNodeContainer;
32 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
33 import net.sf.jasperreports.engine.json.expression.member.ArrayIndexExpression;
34 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
35
36 import org.apache.commons.logging.Log;
37 import org.apache.commons.logging.LogFactory;
38
39 import com.fasterxml.jackson.databind.JsonNode;
40
41 /**
42 * @author Narcis Marcu (narcism@users.sourceforge.net)
43 */
44 public class ArrayIndexExpressionEvaluator extends AbstractMemberExpressionEvaluator {
45 private static final Log log = LogFactory.getLog(ArrayIndexExpressionEvaluator.class);
46
47 private ArrayIndexExpression expression;
48
49 public ArrayIndexExpressionEvaluator(EvaluationContext evaluationContext, ArrayIndexExpression expression) {
50 super(evaluationContext);
51 this.expression = expression;
52 }
53
54 @Override
55 public JsonNodeContainer evaluate(JsonNodeContainer contextNode) {
56 if (log.isDebugEnabled()) {
57 log.debug("---> evaluating arrayIndex expression [" + expression +
58 "] on a node with (size: " + contextNode.getSize() +
59 ", cSize: " + contextNode.getContainerSize() + ")");
60 }
61
62 JsonNodeContainer result = new JsonNodeContainer();
63
64 switch(expression.getDirection()) {
65 case DOWN:
66 // this only make sense for containers with appropriate size
67 if (expression.getIndex() >= 0 && expression.getIndex() < contextNode.getContainerSize()) {
68 List<JRJsonNode> containerNodes = contextNode.getContainerNodes();
69 JRJsonNode nodeAtIndex = containerNodes.get(expression.getIndex());
70
71 if (applyFilter(nodeAtIndex)) {
72 result.add(nodeAtIndex);
73 }
74 }
75 break;
76 case ANYWHERE_DOWN:
77 List<JRJsonNode> nodes = contextNode.getContainerNodes();
78
79 for (JRJsonNode node: nodes) {
80 result.addNodes(goAnywhereDown(node));
81 }
82
83 break;
84 }
85
86 if (result.getSize() > 0) {
87 return result;
88 }
89
90 return null;
91
92 }
93
94 @Override
95 public MemberExpression getMemberExpression() {
96 return expression;
97 }
98
99 private List<JRJsonNode> goAnywhereDown(JRJsonNode jrJsonNode) {
100 List<JRJsonNode> result = new ArrayList<>();
101 Deque<JRJsonNode> stack = new ArrayDeque<>();
102 JsonNode initialDataNode = jrJsonNode.getDataNode();
103
104 if (log.isDebugEnabled()) {
105 log.debug("initial stack population with: " + initialDataNode);
106 }
107
108 // populate the stack initially
109 stack.push(jrJsonNode);
110
111 while (!stack.isEmpty()) {
112 JRJsonNode stackNode = stack.pop();
113 JsonNode stackDataNode = stackNode.getDataNode();
114
115 addChildrenToStack(stackNode, stack);
116
117 // process the current stack item
118 if (stackDataNode.isArray()) {
119 if (log.isDebugEnabled()) {
120 log.debug("processing stack element: " + stackDataNode);
121 }
122
123 if (expression.getIndex() >= 0 && expression.getIndex() < stackDataNode.size()) {
124 JsonNode nodeAtIndex = stackDataNode.get(expression.getIndex());
125 JRJsonNode child = stackNode.createChild(nodeAtIndex);
126
127 if (applyFilter(child)) {
128 result.add(child);
129 }
130 }
131 }
132 }
133
134 return result;
135 }
136
137 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import java.util.ArrayDeque;
26 import java.util.ArrayList;
27 import java.util.Deque;
28 import java.util.List;
29
30 import net.sf.jasperreports.engine.json.JRJsonNode;
31 import net.sf.jasperreports.engine.json.JsonNodeContainer;
32 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
33 import net.sf.jasperreports.engine.json.expression.member.ArraySliceExpression;
34 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
35
36 import org.apache.commons.logging.Log;
37 import org.apache.commons.logging.LogFactory;
38
39 import com.fasterxml.jackson.databind.JsonNode;
40 import com.fasterxml.jackson.databind.node.ArrayNode;
41
42 /**
43 * @author Narcis Marcu (narcism@users.sourceforge.net)
44 */
45 public class ArraySliceExpressionEvaluator extends AbstractMemberExpressionEvaluator {
46 private static final Log log = LogFactory.getLog(ArraySliceExpressionEvaluator.class);
47
48 private ArraySliceExpression expression;
49
50 public ArraySliceExpressionEvaluator(EvaluationContext evaluationContext, ArraySliceExpression expression) {
51 super(evaluationContext);
52 this.expression = expression;
53 }
54
55 @Override
56 public JsonNodeContainer evaluate(JsonNodeContainer contextNode) {
57 if (log.isDebugEnabled()) {
58 log.debug("---> evaluating expression [" + expression +
59 "] on a node with (size: " + contextNode.getSize() +
60 ", cSize: " + contextNode.getContainerSize() + ")");
61 }
62
63 JsonNodeContainer result = new JsonNodeContainer();
64
65 switch(expression.getDirection()) {
66 case DOWN:
67 Integer start = getSliceStart(contextNode.getContainerSize());
68 if (start >= contextNode.getContainerSize()) {
69 return null;
70 }
71
72 Integer end = getSliceEnd(contextNode.getContainerSize());
73 if (end < 0) {
74 return null;
75 }
76
77 if (log.isDebugEnabled()) {
78 log.debug("start: " + start + ", end: " + end);
79 }
80
81 List<JRJsonNode> containerNodes = contextNode.getContainerNodes();
82
83 for (int i = start; i < end; i++) {
84 JRJsonNode nodeAtIndex = containerNodes.get(i);
85
86 if (applyFilter(nodeAtIndex)) {
87 result.add(nodeAtIndex);
88 }
89 }
90
91 break;
92 case ANYWHERE_DOWN:
93 for (JRJsonNode node: contextNode.getContainerNodes()) {
94 result.addNodes(goAnywhereDown(node));
95 }
96
97 break;
98 }
99
100 if (result.getSize() > 0) {
101 return result;
102 }
103
104 return null;
105
106 }
107
108 private Integer getSliceStart(int containerSize) {
109 Integer start = expression.getStart();
110
111 if (start == null) {
112 start = 0;
113 } else if (start < 0) {
114 start = containerSize + start;
115
116 if (start < 0 ) {
117 start = 0;
118 }
119 }
120
121 return start;
122 }
123
124 private Integer getSliceEnd(int containerSize) {
125 Integer end = expression.getEnd();
126
127 if (end == null) {
128 end = containerSize;
129 } else if (end < 0) {
130 end = containerSize + end;
131 } else if (end > containerSize) {
132 end = containerSize;
133 }
134
135 return end;
136 }
137
138 private List<JRJsonNode> goAnywhereDown(JRJsonNode jrJsonNode) {
139 List<JRJsonNode> result = new ArrayList<>();
140 Deque<JRJsonNode> stack = new ArrayDeque<>();
141
142 if (log.isDebugEnabled()) {
143 log.debug("initial stack population with: " + jrJsonNode.getDataNode());
144 }
145
146 // populate the stack initially
147 stack.push(jrJsonNode);
148
149 while (!stack.isEmpty()) {
150 JRJsonNode stackNode = stack.pop();
151 JsonNode stackDataNode = stackNode.getDataNode();
152
153 addChildrenToStack(stackNode, stack);
154
155 // process the current stack item
156 if (stackDataNode.isArray()) {
157 if (log.isDebugEnabled()) {
158 log.debug("processing stack element: " + stackDataNode);
159 }
160
161 ArrayNode newNode = getEvaluationContext().getObjectMapper().createArrayNode();
162
163 Integer start = getSliceStart(stackDataNode.size());
164 if (start >= stackDataNode.size()) {
165 continue;
166 }
167
168 Integer end = getSliceEnd(stackDataNode.size());
169 if (end < 0) {
170 continue;
171 }
172
173 for (int i = start; i < end; i++) {
174 JRJsonNode nodeAtIndex = stackNode.createChild(stackDataNode.get(i));
175
176 if (applyFilter(nodeAtIndex)) {
177 newNode.add(nodeAtIndex.getDataNode());
178 }
179 }
180
181 if (newNode.size() > 0) {
182 result.add(stackNode.createChild(newNode));
183 }
184 }
185 }
186
187 return result;
188 }
189
190 @Override
191 public MemberExpression getMemberExpression() {
192 return expression;
193 }
194
195 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import net.sf.jasperreports.engine.json.JsonNodeContainer;
26 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
27 import net.sf.jasperreports.engine.json.expression.member.ArrayConstructionExpression;
28 import net.sf.jasperreports.engine.json.expression.member.ArrayIndexExpression;
29 import net.sf.jasperreports.engine.json.expression.member.ArraySliceExpression;
30 import net.sf.jasperreports.engine.json.expression.member.MultiLevelUpExpression;
31 import net.sf.jasperreports.engine.json.expression.member.ObjectConstructionExpression;
32 import net.sf.jasperreports.engine.json.expression.member.ObjectKeyExpression;
33
34 /**
35 * @author Narcis Marcu (narcism@users.sourceforge.net)
36 */
37 public class DefaultMemberExpressionEvaluatorVisitor implements MemberExpressionEvaluatorVisitor {
38 private EvaluationContext evaluationContext;
39
40
41 public DefaultMemberExpressionEvaluatorVisitor(EvaluationContext evaluationContext) {
42 this.evaluationContext = evaluationContext;
43 }
44
45 @Override
46 public JsonNodeContainer evaluateObjectKey(ObjectKeyExpression expression, JsonNodeContainer contextNode) {
47 MemberExpressionEvaluator evaluator = new ObjectKeyExpressionEvaluator(evaluationContext, expression);
48 return evaluator.evaluate(contextNode);
49 }
50
51 @Override
52 public JsonNodeContainer evaluateMultiLevelUp(MultiLevelUpExpression expression, JsonNodeContainer contextNode) {
53 MemberExpressionEvaluator evaluator = new MultiLevelUpExpressionEvaluator(evaluationContext, expression);
54 return evaluator.evaluate(contextNode);
55 }
56
57 @Override
58 public JsonNodeContainer evaluateArrayIndex(ArrayIndexExpression expression, JsonNodeContainer contextNode) {
59 MemberExpressionEvaluator evaluator = new ArrayIndexExpressionEvaluator(evaluationContext, expression);
60 return evaluator.evaluate(contextNode);
61 }
62
63 @Override
64 public JsonNodeContainer evaluateArraySlice(ArraySliceExpression expression, JsonNodeContainer contextNode) {
65 MemberExpressionEvaluator evaluator = new ArraySliceExpressionEvaluator(evaluationContext, expression);
66 return evaluator.evaluate(contextNode);
67 }
68
69 @Override
70 public JsonNodeContainer evaluateObjectConstruction(ObjectConstructionExpression expression, JsonNodeContainer contextNode) {
71 MemberExpressionEvaluator evaluator = new ObjectConstructionExpressionEvaluator(evaluationContext, expression);
72 return evaluator.evaluate(contextNode);
73 }
74
75 @Override
76 public JsonNodeContainer evaluateArrayConstruction(ArrayConstructionExpression expression, JsonNodeContainer contextNode) {
77 MemberExpressionEvaluator evaluator = new ArrayConstructionExpressionEvaluator(evaluationContext, expression);
78 return evaluator.evaluate(contextNode);
79 }
80
81 public EvaluationContext getEvaluationContext() {
82 return evaluationContext;
83 }
84 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import net.sf.jasperreports.engine.json.JsonNodeContainer;
26 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
27 import net.sf.jasperreports.engine.json.expression.member.ObjectKeyExpression;
28
29 /**
30 * @author Narcis Marcu (narcism@users.sourceforge.net)
31 */
32 public class DefaultMemberExpressionEvaluatorVisitorForFilter extends DefaultMemberExpressionEvaluatorVisitor {
33
34 public DefaultMemberExpressionEvaluatorVisitorForFilter(EvaluationContext evaluationContext) {
35 super(evaluationContext);
36 }
37
38 /**
39 * Filters need to keep missing nodes for null checks and keep the array containment when traversing arrays
40 */
41 @Override
42 public JsonNodeContainer evaluateObjectKey(ObjectKeyExpression expression, JsonNodeContainer contextNode) {
43 ObjectKeyExpressionEvaluator evaluator = new ObjectKeyExpressionEvaluator(getEvaluationContext(), expression, true);
44 return evaluator.evaluate(contextNode);
45 }
46
47 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import net.sf.jasperreports.engine.json.JsonNodeContainer;
26
27 /**
28 * @author Narcis Marcu (narcism@users.sourceforge.net)
29 */
30 public interface MemberExpressionEvaluator {
31
32 JsonNodeContainer evaluate(JsonNodeContainer contextNode);
33
34 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import net.sf.jasperreports.engine.json.JsonNodeContainer;
26 import net.sf.jasperreports.engine.json.expression.member.ArrayConstructionExpression;
27 import net.sf.jasperreports.engine.json.expression.member.ArrayIndexExpression;
28 import net.sf.jasperreports.engine.json.expression.member.ArraySliceExpression;
29 import net.sf.jasperreports.engine.json.expression.member.MultiLevelUpExpression;
30 import net.sf.jasperreports.engine.json.expression.member.ObjectConstructionExpression;
31 import net.sf.jasperreports.engine.json.expression.member.ObjectKeyExpression;
32
33 /**
34 * @author Narcis Marcu (narcism@users.sourceforge.net)
35 */
36 public interface MemberExpressionEvaluatorVisitor {
37
38 JsonNodeContainer evaluateObjectKey(ObjectKeyExpression expression, JsonNodeContainer contextNode);
39
40 JsonNodeContainer evaluateMultiLevelUp(MultiLevelUpExpression expression, JsonNodeContainer contextNode);
41
42 JsonNodeContainer evaluateArrayIndex(ArrayIndexExpression expression, JsonNodeContainer contextNode);
43
44 JsonNodeContainer evaluateArraySlice(ArraySliceExpression expression, JsonNodeContainer contextNode);
45
46 JsonNodeContainer evaluateObjectConstruction(ObjectConstructionExpression expression, JsonNodeContainer contextNode);
47
48 JsonNodeContainer evaluateArrayConstruction(ArrayConstructionExpression expression, JsonNodeContainer contextNode);
49 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import net.sf.jasperreports.engine.json.JRJsonNode;
29 import net.sf.jasperreports.engine.json.JsonNodeContainer;
30 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
31 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
32 import net.sf.jasperreports.engine.json.expression.member.MultiLevelUpExpression;
33
34 import org.apache.commons.logging.Log;
35 import org.apache.commons.logging.LogFactory;
36
37 /**
38 * @author Narcis Marcu (narcism@users.sourceforge.net)
39 */
40 public class MultiLevelUpExpressionEvaluator extends AbstractMemberExpressionEvaluator {
41 private static final Log log = LogFactory.getLog(MultiLevelUpExpressionEvaluator.class);
42
43 private MultiLevelUpExpression expression;
44
45
46 public MultiLevelUpExpressionEvaluator(EvaluationContext evaluationContext, MultiLevelUpExpression expression) {
47 super(evaluationContext);
48 this.expression = expression;
49 }
50
51 @Override
52 public JsonNodeContainer evaluate(JsonNodeContainer contextNode) {
53 List<JRJsonNode> nodes = contextNode.getNodes();
54
55 if (log.isDebugEnabled()) {
56 log.debug("---> evaluating expression [" + expression +
57 "] on a node with (size: " + contextNode.getSize() +
58 ", cSize: " + contextNode.getContainerSize() + ")");
59 }
60
61 JsonNodeContainer result = new JsonNodeContainer();
62 List<JRJsonNode> uniqueParents = new ArrayList<>();
63
64 for (JRJsonNode node: nodes) {
65 JRJsonNode parent = getParent(node);
66
67 if (parent != null && !uniqueParents.contains(parent)) {
68 uniqueParents.add(parent);
69
70 if (applyFilter(parent)) {
71 result.add(parent);
72 }
73 }
74 }
75
76 if (result.getSize() > 0) {
77 return result;
78 }
79
80 return null;
81 }
82
83 @Override
84 public MemberExpression getMemberExpression() {
85 return expression;
86 }
87
88 private JRJsonNode getParent(JRJsonNode jrJsonNode) {
89 JRJsonNode result = jrJsonNode;
90 int level = expression.getLevel();
91
92 for(int i=0; i < level; i++) {
93 result = result.getParent();
94
95 if (result == null) {
96 return null;
97 }
98 }
99
100 return result;
101 }
102
103 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import java.util.ArrayDeque;
26 import java.util.ArrayList;
27 import java.util.Deque;
28 import java.util.List;
29
30 import net.sf.jasperreports.engine.json.JRJsonNode;
31 import net.sf.jasperreports.engine.json.JsonNodeContainer;
32 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
33 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
34 import net.sf.jasperreports.engine.json.expression.member.ObjectConstructionExpression;
35
36 import org.apache.commons.logging.Log;
37 import org.apache.commons.logging.LogFactory;
38
39 import com.fasterxml.jackson.databind.JsonNode;
40 import com.fasterxml.jackson.databind.node.ObjectNode;
41
42 /**
43 * @author Narcis Marcu (narcism@users.sourceforge.net)
44 */
45 public class ObjectConstructionExpressionEvaluator extends AbstractMemberExpressionEvaluator {
46 private static final Log log = LogFactory.getLog(ObjectConstructionExpressionEvaluator.class);
47
48 private ObjectConstructionExpression expression;
49
50 public ObjectConstructionExpressionEvaluator(EvaluationContext evaluationContext, ObjectConstructionExpression expression) {
51 super(evaluationContext);
52 this.expression = expression;
53 }
54
55 @Override
56 public JsonNodeContainer evaluate(JsonNodeContainer contextNode) {
57 if (log.isDebugEnabled()) {
58 log.debug("---> evaluating expression [" + expression +
59 "] on a node with (size: " + contextNode.getSize() +
60 ", cSize: " + contextNode.getContainerSize() + ")");
61 }
62
63 JsonNodeContainer result = new JsonNodeContainer();
64
65 switch(expression.getDirection()) {
66 case DOWN:
67 for (JRJsonNode node: contextNode.getNodes()) {
68 result.addNodes(goDown(node));
69 }
70
71 break;
72 case ANYWHERE_DOWN:
73 for (JRJsonNode node: contextNode.getNodes()) {
74 result.addNodes(goAnywhereDown(node));
75 }
76
77 break;
78 }
79
80 if (result.getSize() > 0) {
81 return result;
82 }
83
84 return null;
85 }
86
87 @Override
88 public MemberExpression getMemberExpression() {
89 return expression;
90 }
91
92 private List<JRJsonNode> goDown(JRJsonNode jrJsonNode) {
93 List<JRJsonNode> result = new ArrayList<>();
94 JsonNode dataNode = jrJsonNode.getDataNode();
95
96 // advance into object
97 if (dataNode.isObject()) {
98 JRJsonNode deeperNode = constructNewObjectNodeWithKeys(jrJsonNode);
99 if (deeperNode != null) {
100 result.add(deeperNode);
101 }
102 }
103 // advance into array
104 else if (dataNode.isArray()) {
105 for (JsonNode node : dataNode) {
106 JRJsonNode childWithKeys = constructNewObjectNodeWithKeys(jrJsonNode.createChild(node));
107
108 if (childWithKeys != null) {
109 result.add(childWithKeys);
110 }
111 }
112 }
113
114 return result;
115 }
116
117 private JRJsonNode constructNewObjectNodeWithKeys(JRJsonNode from) {
118 ObjectNode newNode = getEvaluationContext().getObjectMapper().createObjectNode();
119
120 for (String objectKey: expression.getObjectKeys()) {
121 JsonNode deeperNode = from.getDataNode().get(objectKey);
122
123 if (deeperNode != null && (deeperNode.isObject() || deeperNode.isValueNode() || deeperNode.isArray())) {
124 JRJsonNode deeperChild = from.createChild(deeperNode);
125
126 if (applyFilter(deeperChild)) {
127 newNode.put(objectKey, deeperNode);
128 }
129 }
130 }
131
132 if (newNode.size() > 0) {
133 return from.createChild(newNode);
134 }
135
136 return null;
137 }
138
139 private List<JRJsonNode> goAnywhereDown(JRJsonNode jrJsonNode) {
140 List<JRJsonNode> result = new ArrayList<>();
141 Deque<JRJsonNode> stack = new ArrayDeque<>();
142
143 if (log.isDebugEnabled()) {
144 log.debug("initial stack population with: " + jrJsonNode.getDataNode());
145 }
146
147 // populate the stack initially
148 stack.push(jrJsonNode);
149
150 while (!stack.isEmpty()) {
151 JRJsonNode stackNode = stack.pop();
152 JsonNode stackDataNode = stackNode.getDataNode();
153
154 addChildrenToStack(stackNode, stack);
155
156 if (log.isDebugEnabled()) {
157 log.debug("processing stack element: " + stackDataNode);
158 }
159
160 // process the current stack item
161 if (stackDataNode.isObject()) {
162 JRJsonNode childWithKeys = constructNewObjectNodeWithKeys(stackNode);
163
164 if (childWithKeys != null) {
165 result.add(childWithKeys);
166 }
167 }
168 }
169
170 return result;
171 }
172
173 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.json.expression.member.evaluation;
24
25 import java.util.ArrayDeque;
26 import java.util.ArrayList;
27 import java.util.Deque;
28 import java.util.Iterator;
29 import java.util.List;
30 import java.util.Map;
31
32 import net.sf.jasperreports.engine.json.JRJsonNode;
33 import net.sf.jasperreports.engine.json.JsonNodeContainer;
34 import net.sf.jasperreports.engine.json.expression.EvaluationContext;
35 import net.sf.jasperreports.engine.json.expression.member.MemberExpression;
36 import net.sf.jasperreports.engine.json.expression.member.ObjectKeyExpression;
37
38 import org.apache.commons.logging.Log;
39 import org.apache.commons.logging.LogFactory;
40
41 import com.fasterxml.jackson.databind.JsonNode;
42 import com.fasterxml.jackson.databind.node.ArrayNode;
43 import com.fasterxml.jackson.databind.node.ObjectNode;
44
45 /**
46 * @author Narcis Marcu (narcism@users.sourceforge.net)
47 */
48 public class ObjectKeyExpressionEvaluator extends AbstractMemberExpressionEvaluator {
49 private static final Log log = LogFactory.getLog(ObjectKeyExpressionEvaluator.class);
50
51 private ObjectKeyExpression expression;
52 private boolean isCalledFromFilter;
53
54
55 public ObjectKeyExpressionEvaluator(EvaluationContext evaluationContext, ObjectKeyExpression expression) {
56 this(evaluationContext, expression, false);
57 }
58
59 public ObjectKeyExpressionEvaluator(EvaluationContext evaluationContext,
60 ObjectKeyExpression expression, boolean isCalledFromFilter) {
61 super(evaluationContext);
62
63 this.expression = expression;
64 this.isCalledFromFilter = isCalledFromFilter;
65 }
66
67 @Override
68 public JsonNodeContainer evaluate(JsonNodeContainer contextNode) {
69 List<JRJsonNode> nodes = contextNode.getNodes();
70
71 if (log.isDebugEnabled()) {
72 log.debug("---> evaluating expression [" + expression +
73 "] on a node with (size: " + contextNode.getSize() +
74 ", cSize: " + contextNode.getContainerSize() + ")");
75 }
76
77 JsonNodeContainer result = new JsonNodeContainer();
78
79 for (JRJsonNode node: nodes) {
80 List<JRJsonNode> evaluatedNodes = singleEval(node);
81
82 if (evaluatedNodes.size() > 0) {
83 result.addNodes(evaluatedNodes);
84 }
85 }
86
87 if (result.getSize() > 0) {
88 return result;
89 }
90
91 return null;
92 }
93
94 @Override
95 public MemberExpression getMemberExpression() {
96 return expression;
97 }
98
99 private List<JRJsonNode> singleEval(JRJsonNode jrJsonNode) {
100 switch (expression.getDirection()) {
101 case DOWN:
102 return goDown(jrJsonNode);
103 case ANYWHERE_DOWN:
104 return goAnywhereDown(jrJsonNode);
105 }
106
107 return null;
108 }
109
110 private List<JRJsonNode> goDown(JRJsonNode jrJsonNode) {
111 if (log.isDebugEnabled()) {
112 log.debug("going " + MemberExpression.DIRECTION.DOWN + " by " +
113 (expression.isWildcard() ?
114 "wildcard" :
115 "key: [" + expression.getObjectKey() + "]") + " on " + jrJsonNode.getDataNode());
116 }
117
118 List<JRJsonNode> result = new ArrayList<>();
119 JsonNode dataNode = jrJsonNode.getDataNode();
120
121 // advance into object
122 if (dataNode.isObject()) {
123 // if wildcard => filter and add all its children(the values for each key) to an arrayNode
124 if (expression.isWildcard()) {
125 ArrayNode container = getEvaluationContext().getObjectMapper().createArrayNode();
126 Iterator<Map.Entry<String, JsonNode>> it = dataNode.fields();
127
128 while (it.hasNext()) {
129 JsonNode current = it.next().getValue();
130
131 if (applyFilter(jrJsonNode.createChild(current))) {
132 container.add(current);
133 }
134 }
135
136 if (container.size() > 0) {
137 result.add(jrJsonNode.createChild(container));
138 }
139 }
140 // else go down and filter
141 else {
142 JRJsonNode deeperNode = goDeeperIntoObjectNode(jrJsonNode, isCalledFromFilter);
143 if (deeperNode != null) {
144 result.add(deeperNode);
145 }
146 }
147 }
148 // advance into array
149 // when called from filter => keep the array containment
150 else if (dataNode.isArray()) {
151 if (expression.isWildcard()) {
152 result = filterArrayNode(jrJsonNode, (ArrayNode) dataNode, null, isCalledFromFilter);
153 } else {
154 result = filterArrayNode(jrJsonNode, (ArrayNode) dataNode, expression.getObjectKey(), isCalledFromFilter);
155 }
156 }
157
158 return result;
159 }
160
161 private List<JRJsonNode> goAnywhereDown(JRJsonNode jrJsonNode) {
162 if (log.isDebugEnabled()) {
163 log.debug("going " + MemberExpression.DIRECTION.ANYWHERE_DOWN + " by " +
164 (expression.isWildcard() ?
165 "wildcard" :
166 "key: [" + expression.getObjectKey() + "]") + " on " + jrJsonNode.getDataNode());
167 }
168
169 List<JRJsonNode> result = new ArrayList<>();
170 Deque<JRJsonNode> stack = new ArrayDeque<>();
171 JsonNode initialDataNode = jrJsonNode.getDataNode();
172
173 if (log.isDebugEnabled()) {
174 log.debug("initial stack population with: " + initialDataNode);
175 }
176
177 // populate the stack initially
178 if (initialDataNode.isArray()) {
179 for (JsonNode deeper: initialDataNode) {
180 stack.addLast(jrJsonNode.createChild(deeper));
181 }
182 } else {
183 stack.push(jrJsonNode);
184 }
185
186 while (!stack.isEmpty()) {
187 JRJsonNode stackNode = stack.pop();
188 JsonNode stackDataNode = stackNode.getDataNode();
189
190 addChildrenToStack(stackNode, stack);
191
192 if (log.isDebugEnabled()) {
193 log.debug("processing stack element: " + stackDataNode);
194 }
195
196 // process the current stack item
197 if (stackDataNode.isObject()) {
198 if (log.isDebugEnabled()) {
199 log.debug("stack element is object; wildcard: " + expression.isWildcard());
200 }
201
202 // if wildcard => only filter the parent; we already added the object keys to the stack
203 if (expression.isWildcard()) {
204 if (applyFilter(stackNode)) {
205 result.add(stackNode);
206 }
207 }
208 // else go down and filter
209 else {
210 JRJsonNode deeperNode = goDeeperIntoObjectNode(stackNode, false);
211 if (deeperNode != null) {
212 result.add(deeperNode);
213 }
214 }
215 }
216 else if (stackDataNode.isValueNode() || stackDataNode.isArray()) {
217 if (log.isDebugEnabled()) {
218 log.debug("stack element is " + (stackDataNode.isValueNode() ? "value node" : "array") + "; wildcard: " + expression.isWildcard());
219 }
220
221 if (expression.isWildcard()) {
222 if (applyFilter(stackNode)) {
223 result.add(stackNode);
224 }
225 }
226 }
227 }
228
229 return result;
230 }
231
232 private JRJsonNode goDeeperIntoObjectNode(JRJsonNode jrJsonNode, boolean keepMissingNode) {
233 ObjectNode dataNode = (ObjectNode) jrJsonNode.getDataNode();
234
235 // allow missing nodes to be returned
236 JsonNode deeperNode = dataNode.path(expression.getObjectKey());
237
238 // if the deeper node is object/value => filter and add it
239 if (!deeperNode.isMissingNode() &&
240 (deeperNode.isObject() || deeperNode.isValueNode() || deeperNode.isArray())) {
241
242 JRJsonNode child = jrJsonNode.createChild(deeperNode);
243 if (applyFilter(child)) {
244 return child;
245 }
246 }
247 // Filtering expressions need the missing node to check for null
248 else if (keepMissingNode && deeperNode.isMissingNode()) {
249 return jrJsonNode.createChild(deeperNode);
250 }
251
252 return null;
253 }
254
255 }
0 // $ANTLR 2.7.5 (20050128): "json_grammar.g" -> "JsonQueryLexer.java"$
1
2 /*
3 * JasperReports - Free Java Reporting Library.
4 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
6 *
7 * Unless you have purchased a commercial license agreement from Jaspersoft,
8 * the following license terms apply:
9 *
10 * This program is part of JasperReports.
11 *
12 * JasperReports is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * JasperReports is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
24 */
25 package net.sf.jasperreports.engine.json.parser;
26
27 import java.io.InputStream;
28 import antlr.TokenStreamException;
29 import antlr.TokenStreamIOException;
30 import antlr.TokenStreamRecognitionException;
31 import antlr.CharStreamException;
32 import antlr.CharStreamIOException;
33 import antlr.ANTLRException;
34 import java.io.Reader;
35 import java.util.Hashtable;
36 import antlr.CharScanner;
37 import antlr.InputBuffer;
38 import antlr.ByteBuffer;
39 import antlr.CharBuffer;
40 import antlr.Token;
41 import antlr.CommonToken;
42 import antlr.RecognitionException;
43 import antlr.NoViableAltForCharException;
44 import antlr.MismatchedCharException;
45 import antlr.TokenStream;
46 import antlr.ANTLRHashString;
47 import antlr.LexerSharedInputState;
48 import antlr.collections.impl.BitSet;
49 import antlr.SemanticException;
50
51 /**
52 * @author Narcis Marcu (narcism@users.sourceforge.net)
53 */
54 public class JsonQueryLexer extends antlr.CharScanner implements JsonQueryParserTokenTypes, TokenStream
55 {
56
57 @Override
58 public void reportError(RecognitionException re) {
59 throw new RuntimeException(re);
60 }
61
62 public JsonQueryLexer(InputStream in) {
63 this(new ByteBuffer(in));
64 }
65 public JsonQueryLexer(Reader in) {
66 this(new CharBuffer(in));
67 }
68 public JsonQueryLexer(InputBuffer ib) {
69 this(new LexerSharedInputState(ib));
70 }
71 public JsonQueryLexer(LexerSharedInputState state) {
72 super(state);
73 caseSensitiveLiterals = true;
74 setCaseSensitive(true);
75 literals = new Hashtable();
76 literals.put(new ANTLRHashString("null", this), new Integer(48));
77 literals.put(new ANTLRHashString("true", this), new Integer(49));
78 literals.put(new ANTLRHashString("false", this), new Integer(50));
79 }
80
81 public Token nextToken() throws TokenStreamException {
82 Token theRetToken=null;
83 tryAgain:
84 for (;;) {
85 Token _token = null;
86 int _ttype = Token.INVALID_TYPE;
87 setCommitToPath(false);
88 int _m;
89 _m = mark();
90 resetText();
91 try { // for char stream error handling
92 try { // for lexical error handling
93 switch ( LA(1)) {
94 case ':':
95 {
96 mSEMI(true);
97 theRetToken=_returnToken;
98 break;
99 }
100 case ',':
101 {
102 mCOMMA(true);
103 theRetToken=_returnToken;
104 break;
105 }
106 case '^':
107 {
108 mCARET(true);
109 theRetToken=_returnToken;
110 break;
111 }
112 case '{':
113 {
114 mLCURLY(true);
115 theRetToken=_returnToken;
116 break;
117 }
118 case '}':
119 {
120 mRCURLY(true);
121 theRetToken=_returnToken;
122 break;
123 }
124 case '[':
125 {
126 mLBRACKET(true);
127 theRetToken=_returnToken;
128 break;
129 }
130 case ']':
131 {
132 mRBRACKET(true);
133 theRetToken=_returnToken;
134 break;
135 }
136 case '(':
137 {
138 mLPAREN(true);
139 theRetToken=_returnToken;
140 break;
141 }
142 case ')':
143 {
144 mRPAREN(true);
145 theRetToken=_returnToken;
146 break;
147 }
148 case '&':
149 {
150 mAND(true);
151 theRetToken=_returnToken;
152 break;
153 }
154 case '|':
155 {
156 mOR(true);
157 theRetToken=_returnToken;
158 break;
159 }
160 case '=':
161 {
162 mEQ(true);
163 theRetToken=_returnToken;
164 break;
165 }
166 case '"':
167 {
168 mSTRING(true);
169 theRetToken=_returnToken;
170 break;
171 }
172 case '$': case 'A': case 'B': case 'C':
173 case 'D': case 'E': case 'F': case 'G':
174 case 'H': case 'I': case 'J': case 'K':
175 case 'L': case 'M': case 'N': case 'O':
176 case 'P': case 'Q': case 'R': case 'S':
177 case 'T': case 'U': case 'V': case 'W':
178 case 'X': case 'Y': case 'Z': case '_':
179 case 'a': case 'b': case 'c': case 'd':
180 case 'e': case 'f': case 'g': case 'h':
181 case 'i': case 'j': case 'k': case 'l':
182 case 'm': case 'n': case 'o': case 'p':
183 case 'q': case 'r': case 's': case 't':
184 case 'u': case 'v': case 'w': case 'x':
185 case 'y': case 'z':
186 {
187 mID_OR_ABSOLUTE(true);
188 theRetToken=_returnToken;
189 break;
190 }
191 case '-': case '.': case '0': case '1':
192 case '2': case '3': case '4': case '5':
193 case '6': case '7': case '8': case '9':
194 {
195 mINT_OR_REAL_OR_DOTS(true);
196 theRetToken=_returnToken;
197 break;
198 }
199 case '\n': case '\r':
200 {
201 mNEWLINE(true);
202 theRetToken=_returnToken;
203 break;
204 }
205 default:
206 if ((LA(1)=='!') && (LA(2)=='=')) {
207 mNE(true);
208 theRetToken=_returnToken;
209 }
210 else if ((LA(1)=='*') && (LA(2)=='=')) {
211 mCONTAINS(true);
212 theRetToken=_returnToken;
213 }
214 else if ((LA(1)=='<') && (LA(2)=='=')) {
215 mLE(true);
216 theRetToken=_returnToken;
217 }
218 else if ((LA(1)=='>') && (LA(2)=='=')) {
219 mGE(true);
220 theRetToken=_returnToken;
221 }
222 else if ((LA(1)=='@') && (LA(2)=='s')) {
223 mAT_SIZE(true);
224 theRetToken=_returnToken;
225 }
226 else if ((LA(1)=='@') && (LA(2)=='v')) {
227 mAT_VALUE(true);
228 theRetToken=_returnToken;
229 }
230 else if ((LA(1)=='@') && (LA(2)=='i')) {
231 mTYPE_CHECK(true);
232 theRetToken=_returnToken;
233 }
234 else if ((LA(1)=='/') && (LA(2)=='/')) {
235 mSINGLE_LINE_COMMENT(true);
236 theRetToken=_returnToken;
237 }
238 else if ((LA(1)=='/') && (LA(2)=='*')) {
239 mMULTI_LINE_COMMENT(true);
240 theRetToken=_returnToken;
241 }
242 else if ((LA(1)=='*') && (true)) {
243 mWILDCARD(true);
244 theRetToken=_returnToken;
245 }
246 else if ((LA(1)=='!') && (true)) {
247 mNOT(true);
248 theRetToken=_returnToken;
249 }
250 else if ((LA(1)=='<') && (true)) {
251 mLT(true);
252 theRetToken=_returnToken;
253 }
254 else if ((LA(1)=='>') && (true)) {
255 mGT(true);
256 theRetToken=_returnToken;
257 }
258 else {
259 if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
260 else {
261 commit();
262 try {mWS(false);}
263 catch(RecognitionException e) {
264 // catastrophic failure
265 reportError(e);
266 consume();
267 }
268 continue tryAgain;
269 }
270 }
271 }
272 commit();
273 if ( _returnToken==null ) continue tryAgain; // found SKIP token
274 _ttype = _returnToken.getType();
275 _ttype = testLiteralsTable(_ttype);
276 _returnToken.setType(_ttype);
277 return _returnToken;
278 }
279 catch (RecognitionException e) {
280 if ( !getCommitToPath() ) {
281 rewind(_m);
282 resetText();
283 try {mWS(false);}
284 catch(RecognitionException ee) {
285 // horrendous failure: error in filter rule
286 reportError(ee);
287 consume();
288 }
289 continue tryAgain;
290 }
291 throw new TokenStreamRecognitionException(e);
292 }
293 }
294 catch (CharStreamException cse) {
295 if ( cse instanceof CharStreamIOException ) {
296 throw new TokenStreamIOException(((CharStreamIOException)cse).io);
297 }
298 else {
299 throw new TokenStreamException(cse.getMessage());
300 }
301 }
302 }
303 }
304
305 public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
306 int _ttype; Token _token=null; int _begin=text.length();
307 _ttype = SEMI;
308 int _saveIndex;
309
310 match(':');
311 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
312 _token = makeToken(_ttype);
313 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
314 }
315 _returnToken = _token;
316 }
317
318 public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
319 int _ttype; Token _token=null; int _begin=text.length();
320 _ttype = COMMA;
321 int _saveIndex;
322
323 match(',');
324 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
325 _token = makeToken(_ttype);
326 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
327 }
328 _returnToken = _token;
329 }
330
331 public final void mWILDCARD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
332 int _ttype; Token _token=null; int _begin=text.length();
333 _ttype = WILDCARD;
334 int _saveIndex;
335
336 match('*');
337 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
338 _token = makeToken(_ttype);
339 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
340 }
341 _returnToken = _token;
342 }
343
344 public final void mCARET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
345 int _ttype; Token _token=null; int _begin=text.length();
346 _ttype = CARET;
347 int _saveIndex;
348
349 match('^');
350 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
351 _token = makeToken(_ttype);
352 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
353 }
354 _returnToken = _token;
355 }
356
357 public final void mLCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
358 int _ttype; Token _token=null; int _begin=text.length();
359 _ttype = LCURLY;
360 int _saveIndex;
361
362 match('{');
363 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
364 _token = makeToken(_ttype);
365 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
366 }
367 _returnToken = _token;
368 }
369
370 public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
371 int _ttype; Token _token=null; int _begin=text.length();
372 _ttype = RCURLY;
373 int _saveIndex;
374
375 match('}');
376 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
377 _token = makeToken(_ttype);
378 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
379 }
380 _returnToken = _token;
381 }
382
383 public final void mLBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
384 int _ttype; Token _token=null; int _begin=text.length();
385 _ttype = LBRACKET;
386 int _saveIndex;
387
388 match('[');
389 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
390 _token = makeToken(_ttype);
391 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
392 }
393 _returnToken = _token;
394 }
395
396 public final void mRBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
397 int _ttype; Token _token=null; int _begin=text.length();
398 _ttype = RBRACKET;
399 int _saveIndex;
400
401 match(']');
402 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
403 _token = makeToken(_ttype);
404 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
405 }
406 _returnToken = _token;
407 }
408
409 public final void mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
410 int _ttype; Token _token=null; int _begin=text.length();
411 _ttype = LPAREN;
412 int _saveIndex;
413
414 match('(');
415 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
416 _token = makeToken(_ttype);
417 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
418 }
419 _returnToken = _token;
420 }
421
422 public final void mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
423 int _ttype; Token _token=null; int _begin=text.length();
424 _ttype = RPAREN;
425 int _saveIndex;
426
427 match(')');
428 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
429 _token = makeToken(_ttype);
430 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
431 }
432 _returnToken = _token;
433 }
434
435 public final void mAND(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
436 int _ttype; Token _token=null; int _begin=text.length();
437 _ttype = AND;
438 int _saveIndex;
439
440 match("&&");
441 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
442 _token = makeToken(_ttype);
443 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
444 }
445 _returnToken = _token;
446 }
447
448 public final void mOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
449 int _ttype; Token _token=null; int _begin=text.length();
450 _ttype = OR;
451 int _saveIndex;
452
453 match("||");
454 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
455 _token = makeToken(_ttype);
456 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
457 }
458 _returnToken = _token;
459 }
460
461 public final void mNOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
462 int _ttype; Token _token=null; int _begin=text.length();
463 _ttype = NOT;
464 int _saveIndex;
465
466 match('!');
467 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
468 _token = makeToken(_ttype);
469 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
470 }
471 _returnToken = _token;
472 }
473
474 public final void mEQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
475 int _ttype; Token _token=null; int _begin=text.length();
476 _ttype = EQ;
477 int _saveIndex;
478
479 match("==");
480 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
481 _token = makeToken(_ttype);
482 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
483 }
484 _returnToken = _token;
485 }
486
487 public final void mNE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
488 int _ttype; Token _token=null; int _begin=text.length();
489 _ttype = NE;
490 int _saveIndex;
491
492 match("!=");
493 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
494 _token = makeToken(_ttype);
495 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
496 }
497 _returnToken = _token;
498 }
499
500 public final void mCONTAINS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
501 int _ttype; Token _token=null; int _begin=text.length();
502 _ttype = CONTAINS;
503 int _saveIndex;
504
505 match("*=");
506 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
507 _token = makeToken(_ttype);
508 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
509 }
510 _returnToken = _token;
511 }
512
513 public final void mLT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
514 int _ttype; Token _token=null; int _begin=text.length();
515 _ttype = LT;
516 int _saveIndex;
517
518 match("<");
519 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
520 _token = makeToken(_ttype);
521 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
522 }
523 _returnToken = _token;
524 }
525
526 public final void mLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
527 int _ttype; Token _token=null; int _begin=text.length();
528 _ttype = LE;
529 int _saveIndex;
530
531 match("<=");
532 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
533 _token = makeToken(_ttype);
534 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
535 }
536 _returnToken = _token;
537 }
538
539 public final void mGT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
540 int _ttype; Token _token=null; int _begin=text.length();
541 _ttype = GT;
542 int _saveIndex;
543
544 match(">");
545 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
546 _token = makeToken(_ttype);
547 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
548 }
549 _returnToken = _token;
550 }
551
552 public final void mGE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
553 int _ttype; Token _token=null; int _begin=text.length();
554 _ttype = GE;
555 int _saveIndex;
556
557 match(">=");
558 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
559 _token = makeToken(_ttype);
560 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
561 }
562 _returnToken = _token;
563 }
564
565 public final void mAT_SIZE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
566 int _ttype; Token _token=null; int _begin=text.length();
567 _ttype = AT_SIZE;
568 int _saveIndex;
569
570 match("@size");
571 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
572 _token = makeToken(_ttype);
573 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
574 }
575 _returnToken = _token;
576 }
577
578 public final void mAT_VALUE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
579 int _ttype; Token _token=null; int _begin=text.length();
580 _ttype = AT_VALUE;
581 int _saveIndex;
582
583 match("@val");
584 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
585 _token = makeToken(_ttype);
586 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
587 }
588 _returnToken = _token;
589 }
590
591 public final void mTYPE_CHECK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
592 int _ttype; Token _token=null; int _begin=text.length();
593 _ttype = TYPE_CHECK;
594 int _saveIndex;
595
596 boolean synPredMatched150 = false;
597 if (((LA(1)=='@') && (LA(2)=='i'))) {
598 int _m150 = mark();
599 synPredMatched150 = true;
600 inputState.guessing++;
601 try {
602 {
603 match("@isNotNull");
604 }
605 }
606 catch (RecognitionException pe) {
607 synPredMatched150 = false;
608 }
609 rewind(_m150);
610 inputState.guessing--;
611 }
612 if ( synPredMatched150 ) {
613 mAT_IS_NOT_NULL(false);
614 if ( inputState.guessing==0 ) {
615 _ttype = AT_IS_NOT_NULL;
616 }
617 }
618 else {
619 boolean synPredMatched152 = false;
620 if (((LA(1)=='@') && (LA(2)=='i'))) {
621 int _m152 = mark();
622 synPredMatched152 = true;
623 inputState.guessing++;
624 try {
625 {
626 match("@isNull");
627 }
628 }
629 catch (RecognitionException pe) {
630 synPredMatched152 = false;
631 }
632 rewind(_m152);
633 inputState.guessing--;
634 }
635 if ( synPredMatched152 ) {
636 mAT_IS_NULL(false);
637 if ( inputState.guessing==0 ) {
638 _ttype = AT_IS_NULL;
639 }
640 }
641 else {
642 boolean synPredMatched154 = false;
643 if (((LA(1)=='@') && (LA(2)=='i'))) {
644 int _m154 = mark();
645 synPredMatched154 = true;
646 inputState.guessing++;
647 try {
648 {
649 match("@isArray");
650 }
651 }
652 catch (RecognitionException pe) {
653 synPredMatched154 = false;
654 }
655 rewind(_m154);
656 inputState.guessing--;
657 }
658 if ( synPredMatched154 ) {
659 mAT_IS_ARRAY(false);
660 if ( inputState.guessing==0 ) {
661 _ttype = AT_IS_ARRAY;
662 }
663 }
664 else {
665 boolean synPredMatched156 = false;
666 if (((LA(1)=='@') && (LA(2)=='i'))) {
667 int _m156 = mark();
668 synPredMatched156 = true;
669 inputState.guessing++;
670 try {
671 {
672 match("@isObject");
673 }
674 }
675 catch (RecognitionException pe) {
676 synPredMatched156 = false;
677 }
678 rewind(_m156);
679 inputState.guessing--;
680 }
681 if ( synPredMatched156 ) {
682 mAT_IS_OBJECT(false);
683 if ( inputState.guessing==0 ) {
684 _ttype = AT_IS_OBJECT;
685 }
686 }
687 else {
688 boolean synPredMatched158 = false;
689 if (((LA(1)=='@') && (LA(2)=='i'))) {
690 int _m158 = mark();
691 synPredMatched158 = true;
692 inputState.guessing++;
693 try {
694 {
695 match("@isValue");
696 }
697 }
698 catch (RecognitionException pe) {
699 synPredMatched158 = false;
700 }
701 rewind(_m158);
702 inputState.guessing--;
703 }
704 if ( synPredMatched158 ) {
705 mAT_IS_VALUE(false);
706 if ( inputState.guessing==0 ) {
707 _ttype = AT_IS_VALUE;
708 }
709 }
710 else {
711 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
712 }
713 }}}}
714 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
715 _token = makeToken(_ttype);
716 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
717 }
718 _returnToken = _token;
719 }
720
721 protected final void mAT_IS_NOT_NULL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
722 int _ttype; Token _token=null; int _begin=text.length();
723 _ttype = AT_IS_NOT_NULL;
724 int _saveIndex;
725
726 match("@isNotNull");
727 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
728 _token = makeToken(_ttype);
729 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
730 }
731 _returnToken = _token;
732 }
733
734 protected final void mAT_IS_NULL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
735 int _ttype; Token _token=null; int _begin=text.length();
736 _ttype = AT_IS_NULL;
737 int _saveIndex;
738
739 match("@isNull");
740 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
741 _token = makeToken(_ttype);
742 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
743 }
744 _returnToken = _token;
745 }
746
747 protected final void mAT_IS_ARRAY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
748 int _ttype; Token _token=null; int _begin=text.length();
749 _ttype = AT_IS_ARRAY;
750 int _saveIndex;
751
752 match("@isArray");
753 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
754 _token = makeToken(_ttype);
755 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
756 }
757 _returnToken = _token;
758 }
759
760 protected final void mAT_IS_OBJECT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
761 int _ttype; Token _token=null; int _begin=text.length();
762 _ttype = AT_IS_OBJECT;
763 int _saveIndex;
764
765 match("@isObject");
766 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
767 _token = makeToken(_ttype);
768 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
769 }
770 _returnToken = _token;
771 }
772
773 protected final void mAT_IS_VALUE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
774 int _ttype; Token _token=null; int _begin=text.length();
775 _ttype = AT_IS_VALUE;
776 int _saveIndex;
777
778 match("@isValue");
779 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
780 _token = makeToken(_ttype);
781 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
782 }
783 _returnToken = _token;
784 }
785
786 public final void mSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
787 int _ttype; Token _token=null; int _begin=text.length();
788 _ttype = STRING;
789 int _saveIndex;
790
791 _saveIndex=text.length();
792 match('"');
793 text.setLength(_saveIndex);
794 {
795 _loop162:
796 do {
797 if ((LA(1)=='\\')) {
798 mESC(false);
799 }
800 else if ((_tokenSet_0.member(LA(1)))) {
801 {
802 match(_tokenSet_0);
803 }
804 }
805 else {
806 break _loop162;
807 }
808
809 } while (true);
810 }
811 _saveIndex=text.length();
812 match('"');
813 text.setLength(_saveIndex);
814 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
815 _token = makeToken(_ttype);
816 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
817 }
818 _returnToken = _token;
819 }
820
821 protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
822 int _ttype; Token _token=null; int _begin=text.length();
823 _ttype = ESC;
824 int _saveIndex;
825
826 match('\\');
827 {
828 switch ( LA(1)) {
829 case 'n':
830 {
831 match('n');
832 if ( inputState.guessing==0 ) {
833 text.setLength(_begin); text.append("\n");
834 }
835 break;
836 }
837 case 'r':
838 {
839 match('r');
840 if ( inputState.guessing==0 ) {
841 text.setLength(_begin); text.append("\r");
842 }
843 break;
844 }
845 case 't':
846 {
847 match('t');
848 if ( inputState.guessing==0 ) {
849 text.setLength(_begin); text.append("\t");
850 }
851 break;
852 }
853 case '"':
854 {
855 match('"');
856 if ( inputState.guessing==0 ) {
857 text.setLength(_begin); text.append("\"");
858 }
859 break;
860 }
861 default:
862 {
863 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
864 }
865 }
866 }
867 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
868 _token = makeToken(_ttype);
869 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
870 }
871 _returnToken = _token;
872 }
873
874 public final void mID_OR_ABSOLUTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
875 int _ttype; Token _token=null; int _begin=text.length();
876 _ttype = ID_OR_ABSOLUTE;
877 int _saveIndex;
878
879 boolean synPredMatched165 = false;
880 if ((((_tokenSet_1.member(LA(1))) && (true))&&( getColumn() == 1 ))) {
881 int _m165 = mark();
882 synPredMatched165 = true;
883 inputState.guessing++;
884 try {
885 {
886 match('$');
887 mID_LETTER(false);
888 }
889 }
890 catch (RecognitionException pe) {
891 synPredMatched165 = false;
892 }
893 rewind(_m165);
894 inputState.guessing--;
895 }
896 if ( synPredMatched165 ) {
897 mID(false);
898 if ( inputState.guessing==0 ) {
899 _ttype = ID;
900 }
901 }
902 else if (((LA(1)=='$') && (true))&&( getColumn() == 1 && getLine() == 1 )) {
903 match('$');
904 if ( inputState.guessing==0 ) {
905 _ttype = ABSOLUTE;
906 }
907 }
908 else {
909 boolean synPredMatched169 = false;
910 if ((((_tokenSet_1.member(LA(1))) && (true))&&( getColumn() == 1 ))) {
911 int _m169 = mark();
912 synPredMatched169 = true;
913 inputState.guessing++;
914 try {
915 {
916 {
917 switch ( LA(1)) {
918 case 'a': case 'b': case 'c': case 'd':
919 case 'e': case 'f': case 'g': case 'h':
920 case 'i': case 'j': case 'k': case 'l':
921 case 'm': case 'n': case 'o': case 'p':
922 case 'q': case 'r': case 's': case 't':
923 case 'u': case 'v': case 'w': case 'x':
924 case 'y': case 'z':
925 {
926 matchRange('a','z');
927 break;
928 }
929 case 'A': case 'B': case 'C': case 'D':
930 case 'E': case 'F': case 'G': case 'H':
931 case 'I': case 'J': case 'K': case 'L':
932 case 'M': case 'N': case 'O': case 'P':
933 case 'Q': case 'R': case 'S': case 'T':
934 case 'U': case 'V': case 'W': case 'X':
935 case 'Y': case 'Z':
936 {
937 matchRange('A','Z');
938 break;
939 }
940 case '_':
941 {
942 match('_');
943 break;
944 }
945 default:
946 {
947 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
948 }
949 }
950 }
951 {
952 if ((_tokenSet_2.member(LA(1)))) {
953 mID_LETTER(false);
954 }
955 else {
956 }
957
958 }
959 }
960 }
961 catch (RecognitionException pe) {
962 synPredMatched169 = false;
963 }
964 rewind(_m169);
965 inputState.guessing--;
966 }
967 if ( synPredMatched169 ) {
968 mID(false);
969 if ( inputState.guessing==0 ) {
970 _ttype = ID;
971 }
972 }
973 else if (((_tokenSet_1.member(LA(1))) && (true))&&( getColumn() == 1 && getLine() > 1 || getColumn() > 1 )) {
974 mID(false);
975 if ( inputState.guessing==0 ) {
976 _ttype = ID;
977 }
978 }
979 else {
980 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
981 }
982 }
983 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
984 _token = makeToken(_ttype);
985 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
986 }
987 _returnToken = _token;
988 }
989
990 protected final void mID_LETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
991 int _ttype; Token _token=null; int _begin=text.length();
992 _ttype = ID_LETTER;
993 int _saveIndex;
994
995 switch ( LA(1)) {
996 case '$': case 'A': case 'B': case 'C':
997 case 'D': case 'E': case 'F': case 'G':
998 case 'H': case 'I': case 'J': case 'K':
999 case 'L': case 'M': case 'N': case 'O':
1000 case 'P': case 'Q': case 'R': case 'S':
1001 case 'T': case 'U': case 'V': case 'W':
1002 case 'X': case 'Y': case 'Z': case '_':
1003 case 'a': case 'b': case 'c': case 'd':
1004 case 'e': case 'f': case 'g': case 'h':
1005 case 'i': case 'j': case 'k': case 'l':
1006 case 'm': case 'n': case 'o': case 'p':
1007 case 'q': case 'r': case 's': case 't':
1008 case 'u': case 'v': case 'w': case 'x':
1009 case 'y': case 'z':
1010 {
1011 mID_START_LETTER(false);
1012 break;
1013 }
1014 case '0': case '1': case '2': case '3':
1015 case '4': case '5': case '6': case '7':
1016 case '8': case '9':
1017 {
1018 mDIGIT(false);
1019 break;
1020 }
1021 default:
1022 {
1023 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1024 }
1025 }
1026 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1027 _token = makeToken(_ttype);
1028 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1029 }
1030 _returnToken = _token;
1031 }
1032
1033 protected final void mID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1034 int _ttype; Token _token=null; int _begin=text.length();
1035 _ttype = ID;
1036 int _saveIndex;
1037
1038 mID_START_LETTER(false);
1039 {
1040 _loop191:
1041 do {
1042 if ((_tokenSet_2.member(LA(1)))) {
1043 mID_LETTER(false);
1044 }
1045 else {
1046 break _loop191;
1047 }
1048
1049 } while (true);
1050 }
1051 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1052 _token = makeToken(_ttype);
1053 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1054 }
1055 _returnToken = _token;
1056 }
1057
1058 public final void mINT_OR_REAL_OR_DOTS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1059 int _ttype; Token _token=null; int _begin=text.length();
1060 _ttype = INT_OR_REAL_OR_DOTS;
1061 int _saveIndex;
1062
1063 boolean synPredMatched175 = false;
1064 if (((_tokenSet_3.member(LA(1))) && (_tokenSet_4.member(LA(2))))) {
1065 int _m175 = mark();
1066 synPredMatched175 = true;
1067 inputState.guessing++;
1068 try {
1069 {
1070 {
1071 switch ( LA(1)) {
1072 case '-':
1073 {
1074 match('-');
1075 break;
1076 }
1077 case '.': case '0': case '1': case '2':
1078 case '3': case '4': case '5': case '6':
1079 case '7': case '8': case '9':
1080 {
1081 break;
1082 }
1083 default:
1084 {
1085 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1086 }
1087 }
1088 }
1089 {
1090 _loop174:
1091 do {
1092 if (((LA(1) >= '0' && LA(1) <= '9'))) {
1093 mDIGIT(false);
1094 }
1095 else {
1096 break _loop174;
1097 }
1098
1099 } while (true);
1100 }
1101 mFRAC(false);
1102 }
1103 }
1104 catch (RecognitionException pe) {
1105 synPredMatched175 = false;
1106 }
1107 rewind(_m175);
1108 inputState.guessing--;
1109 }
1110 if ( synPredMatched175 ) {
1111 mREAL(false);
1112 if ( inputState.guessing==0 ) {
1113 _ttype = REAL;
1114 }
1115 }
1116 else {
1117 boolean synPredMatched177 = false;
1118 if (((LA(1)=='.') && (LA(2)=='.'))) {
1119 int _m177 = mark();
1120 synPredMatched177 = true;
1121 inputState.guessing++;
1122 try {
1123 {
1124 match("..");
1125 }
1126 }
1127 catch (RecognitionException pe) {
1128 synPredMatched177 = false;
1129 }
1130 rewind(_m177);
1131 inputState.guessing--;
1132 }
1133 if ( synPredMatched177 ) {
1134 mDOTDOT(false);
1135 if ( inputState.guessing==0 ) {
1136 _ttype = DOTDOT;
1137 }
1138 }
1139 else if ((_tokenSet_5.member(LA(1))) && (true)) {
1140 mINT(false);
1141 if ( inputState.guessing==0 ) {
1142 _ttype = INT;
1143 }
1144 }
1145 else if ((LA(1)=='.') && (true)) {
1146 mDOT(false);
1147 if ( inputState.guessing==0 ) {
1148 _ttype = DOT;
1149 }
1150 }
1151 else {
1152 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1153 }
1154 }
1155 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1156 _token = makeToken(_ttype);
1157 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1158 }
1159 _returnToken = _token;
1160 }
1161
1162 protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1163 int _ttype; Token _token=null; int _begin=text.length();
1164 _ttype = DIGIT;
1165 int _saveIndex;
1166
1167 matchRange('0','9');
1168 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1169 _token = makeToken(_ttype);
1170 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1171 }
1172 _returnToken = _token;
1173 }
1174
1175 protected final void mFRAC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1176 int _ttype; Token _token=null; int _begin=text.length();
1177 _ttype = FRAC;
1178 int _saveIndex;
1179
1180 match('.');
1181 {
1182 int _cnt207=0;
1183 _loop207:
1184 do {
1185 if (((LA(1) >= '0' && LA(1) <= '9'))) {
1186 mDIGIT(false);
1187 }
1188 else {
1189 if ( _cnt207>=1 ) { break _loop207; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1190 }
1191
1192 _cnt207++;
1193 } while (true);
1194 }
1195 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1196 _token = makeToken(_ttype);
1197 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1198 }
1199 _returnToken = _token;
1200 }
1201
1202 protected final void mREAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1203 int _ttype; Token _token=null; int _begin=text.length();
1204 _ttype = REAL;
1205 int _saveIndex;
1206
1207 {
1208 switch ( LA(1)) {
1209 case '-':
1210 {
1211 match('-');
1212 break;
1213 }
1214 case '.': case '0': case '1': case '2':
1215 case '3': case '4': case '5': case '6':
1216 case '7': case '8': case '9':
1217 {
1218 break;
1219 }
1220 default:
1221 {
1222 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1223 }
1224 }
1225 }
1226 {
1227 _loop199:
1228 do {
1229 if (((LA(1) >= '0' && LA(1) <= '9'))) {
1230 mDIGIT(false);
1231 }
1232 else {
1233 break _loop199;
1234 }
1235
1236 } while (true);
1237 }
1238 mFRAC(false);
1239 {
1240 if ((LA(1)=='E'||LA(1)=='e')) {
1241 mEXP(false);
1242 }
1243 else {
1244 }
1245
1246 }
1247 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1248 _token = makeToken(_ttype);
1249 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1250 }
1251 _returnToken = _token;
1252 }
1253
1254 protected final void mDOTDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1255 int _ttype; Token _token=null; int _begin=text.length();
1256 _ttype = DOTDOT;
1257 int _saveIndex;
1258
1259 match("..");
1260 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1261 _token = makeToken(_ttype);
1262 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1263 }
1264 _returnToken = _token;
1265 }
1266
1267 protected final void mINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1268 int _ttype; Token _token=null; int _begin=text.length();
1269 _ttype = INT;
1270 int _saveIndex;
1271
1272 {
1273 switch ( LA(1)) {
1274 case '-':
1275 {
1276 match('-');
1277 break;
1278 }
1279 case '0': case '1': case '2': case '3':
1280 case '4': case '5': case '6': case '7':
1281 case '8': case '9':
1282 {
1283 break;
1284 }
1285 default:
1286 {
1287 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1288 }
1289 }
1290 }
1291 {
1292 int _cnt195=0;
1293 _loop195:
1294 do {
1295 if (((LA(1) >= '0' && LA(1) <= '9'))) {
1296 mDIGIT(false);
1297 }
1298 else {
1299 if ( _cnt195>=1 ) { break _loop195; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1300 }
1301
1302 _cnt195++;
1303 } while (true);
1304 }
1305 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1306 _token = makeToken(_ttype);
1307 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1308 }
1309 _returnToken = _token;
1310 }
1311
1312 protected final void mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1313 int _ttype; Token _token=null; int _begin=text.length();
1314 _ttype = DOT;
1315 int _saveIndex;
1316
1317 match('.');
1318 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1319 _token = makeToken(_ttype);
1320 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1321 }
1322 _returnToken = _token;
1323 }
1324
1325 public final void mNEWLINE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1326 int _ttype; Token _token=null; int _begin=text.length();
1327 _ttype = NEWLINE;
1328 int _saveIndex;
1329
1330 {
1331 if ((LA(1)=='\r') && (LA(2)=='\n')) {
1332 match("\r\n");
1333 }
1334 else if ((LA(1)=='\r') && (true)) {
1335 match('\r');
1336 }
1337 else if ((LA(1)=='\n')) {
1338 match('\n');
1339 }
1340 else {
1341 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1342 }
1343
1344 }
1345 if ( inputState.guessing==0 ) {
1346
1347 newline();
1348 _ttype = Token.SKIP;
1349
1350 }
1351 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1352 _token = makeToken(_ttype);
1353 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1354 }
1355 _returnToken = _token;
1356 }
1357
1358 public final void mSINGLE_LINE_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1359 int _ttype; Token _token=null; int _begin=text.length();
1360 _ttype = SINGLE_LINE_COMMENT;
1361 int _saveIndex;
1362
1363 match("//");
1364 {
1365 _loop183:
1366 do {
1367 if ((_tokenSet_6.member(LA(1)))) {
1368 {
1369 match(_tokenSet_6);
1370 }
1371 }
1372 else {
1373 break _loop183;
1374 }
1375
1376 } while (true);
1377 }
1378 {
1379 if ((LA(1)=='\r') && (LA(2)=='\n')) {
1380 match("\r\n");
1381 }
1382 else if ((LA(1)=='\r') && (true)) {
1383 match('\r');
1384 }
1385 else if ((LA(1)=='\n')) {
1386 match('\n');
1387 }
1388 else {
1389 }
1390
1391 }
1392 if ( inputState.guessing==0 ) {
1393
1394 newline();
1395 _ttype = Token.SKIP;
1396
1397 }
1398 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1399 _token = makeToken(_ttype);
1400 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1401 }
1402 _returnToken = _token;
1403 }
1404
1405 public final void mMULTI_LINE_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1406 int _ttype; Token _token=null; int _begin=text.length();
1407 _ttype = MULTI_LINE_COMMENT;
1408 int _saveIndex;
1409
1410 match("/*");
1411 {
1412 _loop187:
1413 do {
1414 // nongreedy exit test
1415 if ((LA(1)=='*') && (LA(2)=='/')) break _loop187;
1416 if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe')) && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
1417 matchNot(EOF_CHAR);
1418 }
1419 else {
1420 break _loop187;
1421 }
1422
1423 } while (true);
1424 }
1425 match("*/");
1426 if ( inputState.guessing==0 ) {
1427 _ttype = Token.SKIP;
1428 }
1429 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1430 _token = makeToken(_ttype);
1431 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1432 }
1433 _returnToken = _token;
1434 }
1435
1436 protected final void mABSOLUTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1437 int _ttype; Token _token=null; int _begin=text.length();
1438 _ttype = ABSOLUTE;
1439 int _saveIndex;
1440
1441 match('$');
1442 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1443 _token = makeToken(_ttype);
1444 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1445 }
1446 _returnToken = _token;
1447 }
1448
1449 protected final void mID_START_LETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1450 int _ttype; Token _token=null; int _begin=text.length();
1451 _ttype = ID_START_LETTER;
1452 int _saveIndex;
1453
1454 switch ( LA(1)) {
1455 case 'a': case 'b': case 'c': case 'd':
1456 case 'e': case 'f': case 'g': case 'h':
1457 case 'i': case 'j': case 'k': case 'l':
1458 case 'm': case 'n': case 'o': case 'p':
1459 case 'q': case 'r': case 's': case 't':
1460 case 'u': case 'v': case 'w': case 'x':
1461 case 'y': case 'z':
1462 {
1463 matchRange('a','z');
1464 break;
1465 }
1466 case 'A': case 'B': case 'C': case 'D':
1467 case 'E': case 'F': case 'G': case 'H':
1468 case 'I': case 'J': case 'K': case 'L':
1469 case 'M': case 'N': case 'O': case 'P':
1470 case 'Q': case 'R': case 'S': case 'T':
1471 case 'U': case 'V': case 'W': case 'X':
1472 case 'Y': case 'Z':
1473 {
1474 matchRange('A','Z');
1475 break;
1476 }
1477 case '$':
1478 {
1479 match('$');
1480 break;
1481 }
1482 case '_':
1483 {
1484 match('_');
1485 break;
1486 }
1487 default:
1488 {
1489 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1490 }
1491 }
1492 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1493 _token = makeToken(_ttype);
1494 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1495 }
1496 _returnToken = _token;
1497 }
1498
1499 protected final void mEXP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1500 int _ttype; Token _token=null; int _begin=text.length();
1501 _ttype = EXP;
1502 int _saveIndex;
1503
1504 {
1505 switch ( LA(1)) {
1506 case 'e':
1507 {
1508 match('e');
1509 break;
1510 }
1511 case 'E':
1512 {
1513 match('E');
1514 break;
1515 }
1516 default:
1517 {
1518 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1519 }
1520 }
1521 }
1522 {
1523 switch ( LA(1)) {
1524 case '+':
1525 {
1526 match('+');
1527 break;
1528 }
1529 case '-':
1530 {
1531 match('-');
1532 break;
1533 }
1534 case '0': case '1': case '2': case '3':
1535 case '4': case '5': case '6': case '7':
1536 case '8': case '9':
1537 {
1538 break;
1539 }
1540 default:
1541 {
1542 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1543 }
1544 }
1545 }
1546 {
1547 int _cnt212=0;
1548 _loop212:
1549 do {
1550 if (((LA(1) >= '0' && LA(1) <= '9'))) {
1551 mDIGIT(false);
1552 }
1553 else {
1554 if ( _cnt212>=1 ) { break _loop212; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1555 }
1556
1557 _cnt212++;
1558 } while (true);
1559 }
1560 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1561 _token = makeToken(_ttype);
1562 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1563 }
1564 _returnToken = _token;
1565 }
1566
1567 protected final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1568 int _ttype; Token _token=null; int _begin=text.length();
1569 _ttype = WS;
1570 int _saveIndex;
1571
1572 match(' ');
1573 if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1574 _token = makeToken(_ttype);
1575 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1576 }
1577 _returnToken = _token;
1578 }
1579
1580
1581 private static final long[] mk_tokenSet_0() {
1582 long[] data = new long[2048];
1583 data[0]=-17179869185L;
1584 data[1]=-268435457L;
1585 for (int i = 2; i<=1022; i++) { data[i]=-1L; }
1586 data[1023]=9223372036854775807L;
1587 return data;
1588 }
1589 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1590 private static final long[] mk_tokenSet_1() {
1591 long[] data = new long[1025];
1592 data[0]=68719476736L;
1593 data[1]=576460745995190270L;
1594 return data;
1595 }
1596 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1597 private static final long[] mk_tokenSet_2() {
1598 long[] data = new long[1025];
1599 data[0]=287948969894477824L;
1600 data[1]=576460745995190270L;
1601 return data;
1602 }
1603 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1604 private static final long[] mk_tokenSet_3() {
1605 long[] data = new long[1025];
1606 data[0]=288054454291267584L;
1607 return data;
1608 }
1609 public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
1610 private static final long[] mk_tokenSet_4() {
1611 long[] data = new long[1025];
1612 data[0]=288019269919178752L;
1613 return data;
1614 }
1615 public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
1616 private static final long[] mk_tokenSet_5() {
1617 long[] data = new long[1025];
1618 data[0]=287984085547089920L;
1619 return data;
1620 }
1621 public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
1622 private static final long[] mk_tokenSet_6() {
1623 long[] data = new long[2048];
1624 data[0]=-9217L;
1625 for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1626 data[1023]=9223372036854775807L;
1627 return data;
1628 }
1629 public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
1630
1631 }
0 // $ANTLR 2.7.5 (20050128): "json_grammar.g" -> "JsonQueryParser.java"$
1
2 /*
3 * JasperReports - Free Java Reporting Library.
4 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
6 *
7 * Unless you have purchased a commercial license agreement from Jaspersoft,
8 * the following license terms apply:
9 *
10 * This program is part of JasperReports.
11 *
12 * JasperReports is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * JasperReports is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
24 */
25 package net.sf.jasperreports.engine.json.parser;
26
27 import antlr.TokenBuffer;
28 import antlr.TokenStreamException;
29 import antlr.TokenStreamIOException;
30 import antlr.ANTLRException;
31 import antlr.LLkParser;
32 import antlr.Token;
33 import antlr.TokenStream;
34 import antlr.RecognitionException;
35 import antlr.NoViableAltException;
36 import antlr.MismatchedTokenException;
37 import antlr.SemanticException;
38 import antlr.ParserSharedInputState;
39 import antlr.collections.impl.BitSet;
40 import antlr.collections.AST;
41 import java.util.Hashtable;
42 import antlr.ASTFactory;
43 import antlr.ASTPair;
44 import antlr.collections.impl.ASTArray;
45
46 /**
47 * @author Narcis Marcu (narcism@users.sourceforge.net)
48 */
49 public class JsonQueryParser extends antlr.LLkParser implements JsonQueryParserTokenTypes
50 {
51
52 protected JsonQueryParser(TokenBuffer tokenBuf, int k) {
53 super(tokenBuf,k);
54 tokenNames = _tokenNames;
55 buildTokenTypeASTClassMap();
56 astFactory = new ASTFactory(getTokenTypeToASTClassMap());
57 }
58
59 public JsonQueryParser(TokenBuffer tokenBuf) {
60 this(tokenBuf,2);
61 }
62
63 protected JsonQueryParser(TokenStream lexer, int k) {
64 super(lexer,k);
65 tokenNames = _tokenNames;
66 buildTokenTypeASTClassMap();
67 astFactory = new ASTFactory(getTokenTypeToASTClassMap());
68 }
69
70 public JsonQueryParser(TokenStream lexer) {
71 this(lexer,2);
72 }
73
74 public JsonQueryParser(ParserSharedInputState state) {
75 super(state,2);
76 tokenNames = _tokenNames;
77 buildTokenTypeASTClassMap();
78 astFactory = new ASTFactory(getTokenTypeToASTClassMap());
79 }
80
81 public final void pathExpr() throws RecognitionException, TokenStreamException {
82
83 returnAST = null;
84 ASTPair currentAST = new ASTPair();
85 AST pathExpr_AST = null;
86
87 {
88 switch ( LA(1)) {
89 case ABSOLUTE:
90 {
91 AST tmp35_AST = null;
92 tmp35_AST = astFactory.create(LT(1));
93 astFactory.addASTChild(currentAST, tmp35_AST);
94 match(ABSOLUTE);
95 break;
96 }
97 case EOF:
98 case DOT:
99 case DOTDOT:
100 case ID:
101 case WILDCARD:
102 case LBRACKET:
103 case CARET:
104 {
105 break;
106 }
107 default:
108 {
109 throw new NoViableAltException(LT(1), getFilename());
110 }
111 }
112 }
113 {
114 _loop4:
115 do {
116 if ((_tokenSet_0.member(LA(1)))) {
117 memberExpr();
118 astFactory.addASTChild(currentAST, returnAST);
119 }
120 else {
121 break _loop4;
122 }
123
124 } while (true);
125 }
126 match(Token.EOF_TYPE);
127 if ( inputState.guessing==0 ) {
128 pathExpr_AST = (AST)currentAST.root;
129 pathExpr_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(PATH,"Path Expr:")).add(pathExpr_AST));
130 currentAST.root = pathExpr_AST;
131 currentAST.child = pathExpr_AST!=null &&pathExpr_AST.getFirstChild()!=null ?
132 pathExpr_AST.getFirstChild() : pathExpr_AST;
133 currentAST.advanceChildToEnd();
134 }
135 pathExpr_AST = (AST)currentAST.root;
136 returnAST = pathExpr_AST;
137 }
138
139 public final void memberExpr() throws RecognitionException, TokenStreamException {
140
141 returnAST = null;
142 ASTPair currentAST = new ASTPair();
143 AST memberExpr_AST = null;
144
145 pathNaviExpr();
146 astFactory.addASTChild(currentAST, returnAST);
147 {
148 switch ( LA(1)) {
149 case LPAREN:
150 {
151 filterExprMain();
152 astFactory.addASTChild(currentAST, returnAST);
153 break;
154 }
155 case EOF:
156 case DOT:
157 case DOTDOT:
158 case ID:
159 case WILDCARD:
160 case LBRACKET:
161 case CARET:
162 {
163 break;
164 }
165 default:
166 {
167 throw new NoViableAltException(LT(1), getFilename());
168 }
169 }
170 }
171 if ( inputState.guessing==0 ) {
172 memberExpr_AST = (AST)currentAST.root;
173 memberExpr_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(MEMBER,"Member expression:")).add(memberExpr_AST));
174 currentAST.root = memberExpr_AST;
175 currentAST.child = memberExpr_AST!=null &&memberExpr_AST.getFirstChild()!=null ?
176 memberExpr_AST.getFirstChild() : memberExpr_AST;
177 currentAST.advanceChildToEnd();
178 }
179 memberExpr_AST = (AST)currentAST.root;
180 returnAST = memberExpr_AST;
181 }
182
183 public final void pathNaviExpr() throws RecognitionException, TokenStreamException {
184
185 returnAST = null;
186 ASTPair currentAST = new ASTPair();
187 AST pathNaviExpr_AST = null;
188
189 boolean synPredMatched11 = false;
190 if ((((LA(1) >= DOT && LA(1) <= WILDCARD)) && (_tokenSet_1.member(LA(2))))) {
191 int _m11 = mark();
192 synPredMatched11 = true;
193 inputState.guessing++;
194 try {
195 {
196 {
197 switch ( LA(1)) {
198 case DOT:
199 {
200 match(DOT);
201 break;
202 }
203 case DOTDOT:
204 {
205 match(DOTDOT);
206 break;
207 }
208 case ID:
209 case WILDCARD:
210 {
211 break;
212 }
213 default:
214 {
215 throw new NoViableAltException(LT(1), getFilename());
216 }
217 }
218 }
219 {
220 switch ( LA(1)) {
221 case ID:
222 {
223 match(ID);
224 break;
225 }
226 case WILDCARD:
227 {
228 match(WILDCARD);
229 break;
230 }
231 default:
232 {
233 throw new NoViableAltException(LT(1), getFilename());
234 }
235 }
236 }
237 }
238 }
239 catch (RecognitionException pe) {
240 synPredMatched11 = false;
241 }
242 rewind(_m11);
243 inputState.guessing--;
244 }
245 if ( synPredMatched11 ) {
246 simpleKeyExpr();
247 astFactory.addASTChild(currentAST, returnAST);
248 pathNaviExpr_AST = (AST)currentAST.root;
249 }
250 else {
251 boolean synPredMatched14 = false;
252 if (((LA(1)==DOTDOT||LA(1)==LBRACKET) && (LA(2)==LBRACKET||LA(2)==STRING))) {
253 int _m14 = mark();
254 synPredMatched14 = true;
255 inputState.guessing++;
256 try {
257 {
258 {
259 switch ( LA(1)) {
260 case DOTDOT:
261 {
262 match(DOTDOT);
263 break;
264 }
265 case LBRACKET:
266 {
267 break;
268 }
269 default:
270 {
271 throw new NoViableAltException(LT(1), getFilename());
272 }
273 }
274 }
275 match(LBRACKET);
276 match(STRING);
277 match(RBRACKET);
278 }
279 }
280 catch (RecognitionException pe) {
281 synPredMatched14 = false;
282 }
283 rewind(_m14);
284 inputState.guessing--;
285 }
286 if ( synPredMatched14 ) {
287 complexKeyExpr();
288 astFactory.addASTChild(currentAST, returnAST);
289 pathNaviExpr_AST = (AST)currentAST.root;
290 }
291 else {
292 boolean synPredMatched19 = false;
293 if (((LA(1)==DOTDOT||LA(1)==LBRACKET) && (LA(2)==ID||LA(2)==LBRACKET||LA(2)==STRING))) {
294 int _m19 = mark();
295 synPredMatched19 = true;
296 inputState.guessing++;
297 try {
298 {
299 {
300 switch ( LA(1)) {
301 case DOTDOT:
302 {
303 match(DOTDOT);
304 break;
305 }
306 case LBRACKET:
307 {
308 break;
309 }
310 default:
311 {
312 throw new NoViableAltException(LT(1), getFilename());
313 }
314 }
315 }
316 match(LBRACKET);
317 {
318 switch ( LA(1)) {
319 case STRING:
320 {
321 match(STRING);
322 break;
323 }
324 case ID:
325 {
326 match(ID);
327 break;
328 }
329 default:
330 {
331 throw new NoViableAltException(LT(1), getFilename());
332 }
333 }
334 }
335 match(COMMA);
336 {
337 switch ( LA(1)) {
338 case STRING:
339 {
340 match(STRING);
341 break;
342 }
343 case ID:
344 {
345 match(ID);
346 break;
347 }
348 default:
349 {
350 throw new NoViableAltException(LT(1), getFilename());
351 }
352 }
353 }
354 }
355 }
356 catch (RecognitionException pe) {
357 synPredMatched19 = false;
358 }
359 rewind(_m19);
360 inputState.guessing--;
361 }
362 if ( synPredMatched19 ) {
363 objectConstructionExpr();
364 astFactory.addASTChild(currentAST, returnAST);
365 pathNaviExpr_AST = (AST)currentAST.root;
366 }
367 else {
368 boolean synPredMatched22 = false;
369 if (((LA(1)==DOTDOT||LA(1)==LBRACKET) && (LA(2)==LBRACKET||LA(2)==INT))) {
370 int _m22 = mark();
371 synPredMatched22 = true;
372 inputState.guessing++;
373 try {
374 {
375 {
376 switch ( LA(1)) {
377 case DOTDOT:
378 {
379 match(DOTDOT);
380 break;
381 }
382 case LBRACKET:
383 {
384 break;
385 }
386 default:
387 {
388 throw new NoViableAltException(LT(1), getFilename());
389 }
390 }
391 }
392 match(LBRACKET);
393 match(INT);
394 match(RBRACKET);
395 }
396 }
397 catch (RecognitionException pe) {
398 synPredMatched22 = false;
399 }
400 rewind(_m22);
401 inputState.guessing--;
402 }
403 if ( synPredMatched22 ) {
404 arrayExpr();
405 astFactory.addASTChild(currentAST, returnAST);
406 pathNaviExpr_AST = (AST)currentAST.root;
407 }
408 else {
409 boolean synPredMatched25 = false;
410 if (((LA(1)==DOTDOT||LA(1)==LBRACKET) && (LA(2)==LBRACKET||LA(2)==INT))) {
411 int _m25 = mark();
412 synPredMatched25 = true;
413 inputState.guessing++;
414 try {
415 {
416 {
417 switch ( LA(1)) {
418 case DOTDOT:
419 {
420 match(DOTDOT);
421 break;
422 }
423 case LBRACKET:
424 {
425 break;
426 }
427 default:
428 {
429 throw new NoViableAltException(LT(1), getFilename());
430 }
431 }
432 }
433 match(LBRACKET);
434 match(INT);
435 match(COMMA);
436 match(INT);
437 }
438 }
439 catch (RecognitionException pe) {
440 synPredMatched25 = false;
441 }
442 rewind(_m25);
443 inputState.guessing--;
444 }
445 if ( synPredMatched25 ) {
446 arrayConstructionExpr();
447 astFactory.addASTChild(currentAST, returnAST);
448 pathNaviExpr_AST = (AST)currentAST.root;
449 }
450 else if ((LA(1)==DOTDOT||LA(1)==LBRACKET) && (LA(2)==LBRACKET||LA(2)==INT||LA(2)==SEMI)) {
451 arraySliceExpr();
452 astFactory.addASTChild(currentAST, returnAST);
453 pathNaviExpr_AST = (AST)currentAST.root;
454 }
455 else if ((LA(1)==CARET)) {
456 multiLevelUpExpr();
457 astFactory.addASTChild(currentAST, returnAST);
458 pathNaviExpr_AST = (AST)currentAST.root;
459 }
460 else {
461 throw new NoViableAltException(LT(1), getFilename());
462 }
463 }}}}
464 returnAST = pathNaviExpr_AST;
465 }
466
467 public final void filterExprMain() throws RecognitionException, TokenStreamException {
468
469 returnAST = null;
470 ASTPair currentAST = new ASTPair();
471 AST filterExprMain_AST = null;
472
473 match(LPAREN);
474 filterExpr();
475 astFactory.addASTChild(currentAST, returnAST);
476 match(RPAREN);
477 if ( inputState.guessing==0 ) {
478 filterExprMain_AST = (AST)currentAST.root;
479 filterExprMain_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(FILTER,"Filter expression main:")).add(filterExprMain_AST));
480 currentAST.root = filterExprMain_AST;
481 currentAST.child = filterExprMain_AST!=null &&filterExprMain_AST.getFirstChild()!=null ?
482 filterExprMain_AST.getFirstChild() : filterExprMain_AST;
483 currentAST.advanceChildToEnd();
484 }
485 filterExprMain_AST = (AST)currentAST.root;
486 returnAST = filterExprMain_AST;
487 }
488
489 public final void simpleKeyExpr() throws RecognitionException, TokenStreamException {
490
491 returnAST = null;
492 ASTPair currentAST = new ASTPair();
493 AST simpleKeyExpr_AST = null;
494
495 {
496 switch ( LA(1)) {
497 case DOT:
498 {
499 AST tmp39_AST = null;
500 tmp39_AST = astFactory.create(LT(1));
501 astFactory.addASTChild(currentAST, tmp39_AST);
502 match(DOT);
503 break;
504 }
505 case DOTDOT:
506 {
507 AST tmp40_AST = null;
508 tmp40_AST = astFactory.create(LT(1));
509 astFactory.addASTChild(currentAST, tmp40_AST);
510 match(DOTDOT);
511 break;
512 }
513 case ID:
514 case WILDCARD:
515 {
516 break;
517 }
518 default:
519 {
520 throw new NoViableAltException(LT(1), getFilename());
521 }
522 }
523 }
524 {
525 switch ( LA(1)) {
526 case ID:
527 {
528 AST tmp41_AST = null;
529 tmp41_AST = astFactory.create(LT(1));
530 astFactory.addASTChild(currentAST, tmp41_AST);
531 match(ID);
532 break;
533 }
534 case WILDCARD:
535 {
536 AST tmp42_AST = null;
537 tmp42_AST = astFactory.create(LT(1));
538 astFactory.addASTChild(currentAST, tmp42_AST);
539 match(WILDCARD);
540 break;
541 }
542 default:
543 {
544 throw new NoViableAltException(LT(1), getFilename());
545 }
546 }
547 }
548 if ( inputState.guessing==0 ) {
549 simpleKeyExpr_AST = (AST)currentAST.root;
550 simpleKeyExpr_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(SIMPLE_KEY,"Simple expression:")).add(simpleKeyExpr_AST));
551 currentAST.root = simpleKeyExpr_AST;
552 currentAST.child = simpleKeyExpr_AST!=null &&simpleKeyExpr_AST.getFirstChild()!=null ?
553 simpleKeyExpr_AST.getFirstChild() : simpleKeyExpr_AST;
554 currentAST.advanceChildToEnd();
555 }
556 simpleKeyExpr_AST = (AST)currentAST.root;
557 returnAST = simpleKeyExpr_AST;
558 }
559
560 public final void complexKeyExpr() throws RecognitionException, TokenStreamException {
561
562 returnAST = null;
563 ASTPair currentAST = new ASTPair();
564 AST complexKeyExpr_AST = null;
565
566 {
567 switch ( LA(1)) {
568 case DOTDOT:
569 {
570 AST tmp43_AST = null;
571 tmp43_AST = astFactory.create(LT(1));
572 astFactory.addASTChild(currentAST, tmp43_AST);
573 match(DOTDOT);
574 break;
575 }
576 case LBRACKET:
577 {
578 break;
579 }
580 default:
581 {
582 throw new NoViableAltException(LT(1), getFilename());
583 }
584 }
585 }
586 match(LBRACKET);
587 AST tmp45_AST = null;
588 tmp45_AST = astFactory.create(LT(1));
589 astFactory.addASTChild(currentAST, tmp45_AST);
590 match(STRING);
591 match(RBRACKET);
592 if ( inputState.guessing==0 ) {
593 complexKeyExpr_AST = (AST)currentAST.root;
594 complexKeyExpr_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(COMPLEX_KEY,"Complex expression:")).add(complexKeyExpr_AST));
595 currentAST.root = complexKeyExpr_AST;
596 currentAST.child = complexKeyExpr_AST!=null &&complexKeyExpr_AST.getFirstChild()!=null ?
597 complexKeyExpr_AST.getFirstChild() : complexKeyExpr_AST;
598 currentAST.advanceChildToEnd();
599 }
600 complexKeyExpr_AST = (AST)currentAST.root;
601 returnAST = complexKeyExpr_AST;
602 }
603
604 public final void objectConstructionExpr() throws RecognitionException, TokenStreamException {
605
606 returnAST = null;
607 ASTPair currentAST = new ASTPair();
608 AST objectConstructionExpr_AST = null;
609
610 {
611 switch ( LA(1)) {
612 case DOTDOT:
613 {
614 AST tmp47_AST = null;
615 tmp47_AST = astFactory.create(LT(1));
616 astFactory.addASTChild(currentAST, tmp47_AST);
617 match(DOTDOT);
618 break;
619 }
620 case LBRACKET:
621 {
622 break;
623 }
624 default:
625 {
626 throw new NoViableAltException(LT(1), getFilename());
627 }
628 }
629 }
630 match(LBRACKET);
631 {
632 switch ( LA(1)) {
633 case STRING:
634 {
635 AST tmp49_AST = null;
636 tmp49_AST = astFactory.create(LT(1));
637 astFactory.addASTChild(currentAST, tmp49_AST);
638 match(STRING);
639 break;
640 }
641 case ID:
642 {
643 AST tmp50_AST = null;
644 tmp50_AST = astFactory.create(LT(1));
645 astFactory.addASTChild(currentAST, tmp50_AST);
646 match(ID);
647 break;
648 }
649 default:
650 {
651 throw new NoViableAltException(LT(1), getFilename());
652 }
653 }
654 }
655 {
656 int _cnt36=0;
657 _loop36:
658 do {
659 if ((LA(1)==COMMA)) {
660 match(COMMA);
661 {
662 switch ( LA(1)) {
663 case STRING:
664 {
665 AST tmp52_AST = null;
666 tmp52_AST = astFactory.create(LT(1));
667 astFactory.addASTChild(currentAST, tmp52_AST);
668 match(STRING);
669 break;
670 }
671 case ID:
672 {
673 AST tmp53_AST = null;
674 tmp53_AST = astFactory.create(LT(1));
675 astFactory.addASTChild(currentAST, tmp53_AST);
676 match(ID);
677 break;
678 }
679 default:
680 {
681 throw new NoViableAltException(LT(1), getFilename());
682 }
683 }
684 }
685 }
686 else {
687 if ( _cnt36>=1 ) { break _loop36; } else {throw new NoViableAltException(LT(1), getFilename());}
688 }
689
690 _cnt36++;
691 } while (true);
692 }
693 match(RBRACKET);
694 if ( inputState.guessing==0 ) {
695 objectConstructionExpr_AST = (AST)currentAST.root;
696 objectConstructionExpr_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(OBJECT_CONSTRUCTION,"Object construction expression:")).add(objectConstructionExpr_AST));
697 currentAST.root = objectConstructionExpr_AST;
698 currentAST.child = objectConstructionExpr_AST!=null &&objectConstructionExpr_AST.getFirstChild()!=null ?
699 objectConstructionExpr_AST.getFirstChild() : objectConstructionExpr_AST;
700 currentAST.advanceChildToEnd();
701 }
702 objectConstructionExpr_AST = (AST)currentAST.root;
703 returnAST = objectConstructionExpr_AST;
704 }
705
706 public final void arrayExpr() throws RecognitionException, TokenStreamException {
707
708 returnAST = null;
709 ASTPair currentAST = new ASTPair();
710 AST arrayExpr_AST = null;
711
712 {
713 switch ( LA(1)) {
714 case DOTDOT:
715 {
716 AST tmp55_AST = null;
717 tmp55_AST = astFactory.create(LT(1));
718 astFactory.addASTChild(currentAST, tmp55_AST);
719 match(DOTDOT);
720 break;
721 }
722 case LBRACKET:
723 {
724 break;
725 }
726 default:
727 {
728 throw new NoViableAltException(LT(1), getFilename());
729 }
730 }
731 }
732 match(LBRACKET);
733 AST tmp57_AST = null;
734 tmp57_AST = astFactory.create(LT(1));
735 astFactory.addASTChild(currentAST, tmp57_AST);
736 match(INT);
737 match(RBRACKET);
738 if ( inputState.guessing==0 ) {
739 arrayExpr_AST = (AST)currentAST.root;
740 arrayExpr_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(ARRAY_INDEX,"Array expression:")).add(arrayExpr_AST));
741 currentAST.root = arrayExpr_AST;
742 currentAST.child = arrayExpr_AST!=null &&arrayExpr_AST.getFirstChild()!=null ?
743 arrayExpr_AST.getFirstChild() : arrayExpr_AST;
744 currentAST.advanceChildToEnd();
745 }
746 arrayExpr_AST = (AST)currentAST.root;
747 returnAST = arrayExpr_AST;
748 }
749
750 public final void arrayConstructionExpr() throws RecognitionException, TokenStreamException {
751
752 returnAST = null;
753 ASTPair currentAST = new ASTPair();
754 AST arrayConstructionExpr_AST = null;
755
756 {
757 switch ( LA(1)) {
758 case DOTDOT:
759 {
760 AST tmp59_AST = null;
761 tmp59_AST = astFactory.create(LT(1));
762 astFactory.addASTChild(currentAST, tmp59_AST);
763 match(DOTDOT);
764 break;
765 }
766 case LBRACKET:
767 {
768 break;
769 }
770 default:
771 {
772 throw new NoViableAltException(LT(1), getFilename());
773 }
774 }
775 }
776 match(LBRACKET);
777 AST tmp61_AST = null;
778 tmp61_AST = astFactory.create(LT(1));
779 astFactory.addASTChild(currentAST, tmp61_AST);
780 match(INT);
781 {
782 int _cnt42=0;
783 _loop42:
784 do {
785 if ((LA(1)==COMMA)) {
786 match(COMMA);
787 AST tmp63_AST = null;
788 tmp63_AST = astFactory.create(LT(1));
789 astFactory.addASTChild(currentAST, tmp63_AST);
790 match(INT);
791 }
792 else {
793 if ( _cnt42>=1 ) { break _loop42; } else {throw new NoViableAltException(LT(1), getFilename());}
794 }
795
796 _cnt42++;
797 } while (true);
798 }
799 match(RBRACKET);
800 if ( inputState.guessing==0 ) {
801 arrayConstructionExpr_AST = (AST)currentAST.root;
802 arrayConstructionExpr_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(ARRAY_CONSTRUCTION,"Array construction expression:")).add(arrayConstructionExpr_AST));
803 currentAST.root = arrayConstructionExpr_AST;
804 currentAST.child = arrayConstructionExpr_AST!=null &&arrayConstructionExpr_AST.getFirstChild()!=null ?
805 arrayConstructionExpr_AST.getFirstChild() : arrayConstructionExpr_AST;
806 currentAST.advanceChildToEnd();
807 }
808 arrayConstructionExpr_AST = (AST)currentAST.root;
809 returnAST = arrayConstructionExpr_AST;
810 }
811
812 public final void arraySliceExpr() throws RecognitionException, TokenStreamException {
813
814 returnAST = null;
815 ASTPair currentAST = new ASTPair();
816 AST arraySliceExpr_AST = null;
817
818 {
819 switch ( LA(1)) {
820 case DOTDOT:
821 {
822 AST tmp65_AST = null;
823 tmp65_AST = astFactory.create(LT(1));
824 astFactory.addASTChild(currentAST, tmp65_AST);
825 match(DOTDOT);
826 break;
827 }
828 case LBRACKET:
829 {
830 break;
831 }
832 default:
833 {
834 throw new NoViableAltException(LT(1), getFilename());
835 }
836 }
837 }
838 match(LBRACKET);
839 {
840 switch ( LA(1)) {
841 case INT:
842 {
843 {
844 AST tmp67_AST = null;
845 tmp67_AST = astFactory.create(LT(1));
846 astFactory.addASTChild(currentAST, tmp67_AST);
847 match(INT);
848 AST tmp68_AST = null;
849 tmp68_AST = astFactory.create(LT(1));
850 astFactory.addASTChild(currentAST, tmp68_AST);
851 match(SEMI);
852 {
853 switch ( LA(1)) {
854 case INT:
855 {
856 AST tmp69_AST = null;
857 tmp69_AST = astFactory.create(LT(1));
858 astFactory.addASTChild(currentAST, tmp69_AST);
859 match(INT);
860 break;
861 }
862 case RBRACKET:
863 {
864 break;
865 }
866 default:
867 {
868 throw new NoViableAltException(LT(1), getFilename());
869 }
870 }
871 }
872 }
873 break;
874 }
875 case SEMI:
876 {
877 {
878 AST tmp70_AST = null;
879 tmp70_AST = astFactory.create(LT(1));
880 astFactory.addASTChild(currentAST, tmp70_AST);
881 match(SEMI);
882 AST tmp71_AST = null;
883 tmp71_AST = astFactory.create(LT(1));
884 astFactory.addASTChild(currentAST, tmp71_AST);
885 match(INT);
886 }
887 break;
888 }
889 default:
890 {
891 throw new NoViableAltException(LT(1), getFilename());
892 }
893 }
894 }
895 match(RBRACKET);
896 if ( inputState.guessing==0 ) {
897 arraySliceExpr_AST = (AST)currentAST.root;
898 arraySliceExpr_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(ARRAY_SLICE,"Array slice expression:")).add(arraySliceExpr_AST));
899 currentAST.root = arraySliceExpr_AST;
900 currentAST.child = arraySliceExpr_AST!=null &&arraySliceExpr_AST.getFirstChild()!=null ?
901 arraySliceExpr_AST.getFirstChild() : arraySliceExpr_AST;
902 currentAST.advanceChildToEnd();
903 }
904 arraySliceExpr_AST = (AST)currentAST.root;
905 returnAST = arraySliceExpr_AST;
906 }
907
908 public final void multiLevelUpExpr() throws RecognitionException, TokenStreamException {
909
910 returnAST = null;
911 ASTPair currentAST = new ASTPair();
912 AST multiLevelUpExpr_AST = null;
913
914 AST tmp73_AST = null;
915 tmp73_AST = astFactory.create(LT(1));
916 astFactory.addASTChild(currentAST, tmp73_AST);
917 match(CARET);
918 {
919 switch ( LA(1)) {
920 case LCURLY:
921 {
922 match(LCURLY);
923 AST tmp75_AST = null;
924 tmp75_AST = astFactory.create(LT(1));
925 astFactory.addASTChild(currentAST, tmp75_AST);
926 match(INT);
927 match(RCURLY);
928 break;
929 }
930 case EOF:
931 case DOT:
932 case DOTDOT:
933 case ID:
934 case WILDCARD:
935 case LBRACKET:
936 case CARET:
937 case LPAREN:
938 case AT_IS_NULL:
939 case AT_IS_NOT_NULL:
940 case AT_IS_ARRAY:
941 case AT_IS_OBJECT:
942 case AT_IS_VALUE:
943 case AT_SIZE:
944 case EQ:
945 case NE:
946 case LT:
947 case LE:
948 case GT:
949 case GE:
950 case CONTAINS:
951 {
952 break;
953 }
954 default:
955 {
956 throw new NoViableAltException(LT(1), getFilename());
957 }
958 }
959 }
960 if ( inputState.guessing==0 ) {
961 multiLevelUpExpr_AST = (AST)currentAST.root;
962 multiLevelUpExpr_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(MULTI_LEVEL_UP,"Multi level up:")).add(multiLevelUpExpr_AST));
963 currentAST.root = multiLevelUpExpr_AST;
964 currentAST.child = multiLevelUpExpr_AST!=null &&multiLevelUpExpr_AST.getFirstChild()!=null ?
965 multiLevelUpExpr_AST.getFirstChild() : multiLevelUpExpr_AST;
966 currentAST.advanceChildToEnd();
967 }
968 multiLevelUpExpr_AST = (AST)currentAST.root;
969 returnAST = multiLevelUpExpr_AST;
970 }
971
972 public final void filterExpr() throws RecognitionException, TokenStreamException {
973
974 returnAST = null;
975 ASTPair currentAST = new ASTPair();
976 AST filterExpr_AST = null;
977
978 andExpr();
979 astFactory.addASTChild(currentAST, returnAST);
980 {
981 _loop54:
982 do {
983 if ((LA(1)==OR)) {
984 AST tmp77_AST = null;
985 tmp77_AST = astFactory.create(LT(1));
986 astFactory.makeASTRoot(currentAST, tmp77_AST);
987 match(OR);
988 andExpr();
989 astFactory.addASTChild(currentAST, returnAST);
990 }
991 else {
992 break _loop54;
993 }
994
995 } while (true);
996 }
997 filterExpr_AST = (AST)currentAST.root;
998 returnAST = filterExpr_AST;
999 }
1000
1001 public final void andExpr() throws RecognitionException, TokenStreamException {
1002
1003 returnAST = null;
1004 ASTPair currentAST = new ASTPair();
1005 AST andExpr_AST = null;
1006
1007 notExpr();
1008 astFactory.addASTChild(currentAST, returnAST);
1009 {
1010 _loop57:
1011 do {
1012 if ((LA(1)==AND)) {
1013 AST tmp78_AST = null;
1014 tmp78_AST = astFactory.create(LT(1));
1015 astFactory.makeASTRoot(currentAST, tmp78_AST);
1016 match(AND);
1017 notExpr();
1018 astFactory.addASTChild(currentAST, returnAST);
1019 }
1020 else {
1021 break _loop57;
1022 }
1023
1024 } while (true);
1025 }
1026 andExpr_AST = (AST)currentAST.root;
1027 returnAST = andExpr_AST;
1028 }
1029
1030 public final void notExpr() throws RecognitionException, TokenStreamException {
1031
1032 returnAST = null;
1033 ASTPair currentAST = new ASTPair();
1034 AST notExpr_AST = null;
1035
1036 {
1037 switch ( LA(1)) {
1038 case NOT:
1039 {
1040 AST tmp79_AST = null;
1041 tmp79_AST = astFactory.create(LT(1));
1042 astFactory.makeASTRoot(currentAST, tmp79_AST);
1043 match(NOT);
1044 break;
1045 }
1046 case DOT:
1047 case DOTDOT:
1048 case ID:
1049 case WILDCARD:
1050 case LBRACKET:
1051 case CARET:
1052 case LPAREN:
1053 case AT_IS_NULL:
1054 case AT_IS_NOT_NULL:
1055 case AT_IS_ARRAY:
1056 case AT_IS_OBJECT:
1057 case AT_IS_VALUE:
1058 case AT_SIZE:
1059 case AT_VALUE:
1060 {
1061 break;
1062 }
1063 default:
1064 {
1065 throw new NoViableAltException(LT(1), getFilename());
1066 }
1067 }
1068 }
1069 basicExpr();
1070 astFactory.addASTChild(currentAST, returnAST);
1071 notExpr_AST = (AST)currentAST.root;
1072 returnAST = notExpr_AST;
1073 }
1074
1075 public final void basicExpr() throws RecognitionException, TokenStreamException {
1076
1077 returnAST = null;
1078 ASTPair currentAST = new ASTPair();
1079 AST basicExpr_AST = null;
1080
1081 switch ( LA(1)) {
1082 case DOT:
1083 case DOTDOT:
1084 case ID:
1085 case WILDCARD:
1086 case LBRACKET:
1087 case CARET:
1088 case AT_IS_NULL:
1089 case AT_IS_NOT_NULL:
1090 case AT_IS_ARRAY:
1091 case AT_IS_OBJECT:
1092 case AT_IS_VALUE:
1093 case AT_SIZE:
1094 case AT_VALUE:
1095 {
1096 filterNaviExpr();
1097 astFactory.addASTChild(currentAST, returnAST);
1098 basicExpr_AST = (AST)currentAST.root;
1099 break;
1100 }
1101 case LPAREN:
1102 {
1103 match(LPAREN);
1104 filterExpr();
1105 astFactory.addASTChild(currentAST, returnAST);
1106 match(RPAREN);
1107 basicExpr_AST = (AST)currentAST.root;
1108 break;
1109 }
1110 default:
1111 {
1112 throw new NoViableAltException(LT(1), getFilename());
1113 }
1114 }
1115 returnAST = basicExpr_AST;
1116 }
1117
1118 public final void filterNaviExpr() throws RecognitionException, TokenStreamException {
1119
1120 returnAST = null;
1121 ASTPair currentAST = new ASTPair();
1122 AST filterNaviExpr_AST = null;
1123
1124 switch ( LA(1)) {
1125 case AT_IS_NULL:
1126 case AT_IS_NOT_NULL:
1127 case AT_IS_ARRAY:
1128 case AT_IS_OBJECT:
1129 case AT_IS_VALUE:
1130 {
1131 pathTypeCheckExpr();
1132 astFactory.addASTChild(currentAST, returnAST);
1133 filterNaviExpr_AST = (AST)currentAST.root;
1134 break;
1135 }
1136 case AT_SIZE:
1137 {
1138 sizeFnExpr();
1139 astFactory.addASTChild(currentAST, returnAST);
1140 filterNaviExpr_AST = (AST)currentAST.root;
1141 break;
1142 }
1143 case AT_VALUE:
1144 {
1145 valueFnExpr();
1146 astFactory.addASTChild(currentAST, returnAST);
1147 filterNaviExpr_AST = (AST)currentAST.root;
1148 break;
1149 }
1150 case DOT:
1151 case DOTDOT:
1152 case ID:
1153 case WILDCARD:
1154 case LBRACKET:
1155 case CARET:
1156 {
1157 {
1158 int _cnt63=0;
1159 _loop63:
1160 do {
1161 if ((_tokenSet_0.member(LA(1)))) {
1162 pathNaviExpr();
1163 astFactory.addASTChild(currentAST, returnAST);
1164 }
1165 else {
1166 if ( _cnt63>=1 ) { break _loop63; } else {throw new NoViableAltException(LT(1), getFilename());}
1167 }
1168
1169 _cnt63++;
1170 } while (true);
1171 }
1172 {
1173 switch ( LA(1)) {
1174 case AT_IS_NULL:
1175 case AT_IS_NOT_NULL:
1176 case AT_IS_ARRAY:
1177 case AT_IS_OBJECT:
1178 case AT_IS_VALUE:
1179 {
1180 pathTypeCheckExpr();
1181 astFactory.addASTChild(currentAST, returnAST);
1182 break;
1183 }
1184 case AT_SIZE:
1185 {
1186 sizeFnExpr();
1187 astFactory.addASTChild(currentAST, returnAST);
1188 break;
1189 }
1190 case EQ:
1191 case NE:
1192 case LT:
1193 case LE:
1194 case GT:
1195 case GE:
1196 case CONTAINS:
1197 {
1198 operator_to_value();
1199 astFactory.addASTChild(currentAST, returnAST);
1200 break;
1201 }
1202 default:
1203 {
1204 throw new NoViableAltException(LT(1), getFilename());
1205 }
1206 }
1207 }
1208 filterNaviExpr_AST = (AST)currentAST.root;
1209 break;
1210 }
1211 default:
1212 {
1213 throw new NoViableAltException(LT(1), getFilename());
1214 }
1215 }
1216 returnAST = filterNaviExpr_AST;
1217 }
1218
1219 public final void pathTypeCheckExpr() throws RecognitionException, TokenStreamException {
1220
1221 returnAST = null;
1222 ASTPair currentAST = new ASTPair();
1223 AST pathTypeCheckExpr_AST = null;
1224
1225 switch ( LA(1)) {
1226 case AT_IS_NULL:
1227 {
1228 AST tmp82_AST = null;
1229 tmp82_AST = astFactory.create(LT(1));
1230 astFactory.addASTChild(currentAST, tmp82_AST);
1231 match(AT_IS_NULL);
1232 pathTypeCheckExpr_AST = (AST)currentAST.root;
1233 break;
1234 }
1235 case AT_IS_NOT_NULL:
1236 {
1237 AST tmp83_AST = null;
1238 tmp83_AST = astFactory.create(LT(1));
1239 astFactory.addASTChild(currentAST, tmp83_AST);
1240 match(AT_IS_NOT_NULL);
1241 pathTypeCheckExpr_AST = (AST)currentAST.root;
1242 break;
1243 }
1244 case AT_IS_ARRAY:
1245 {
1246 AST tmp84_AST = null;
1247 tmp84_AST = astFactory.create(LT(1));
1248 astFactory.addASTChild(currentAST, tmp84_AST);
1249 match(AT_IS_ARRAY);
1250 pathTypeCheckExpr_AST = (AST)currentAST.root;
1251 break;
1252 }
1253 case AT_IS_OBJECT:
1254 {
1255 AST tmp85_AST = null;
1256 tmp85_AST = astFactory.create(LT(1));
1257 astFactory.addASTChild(currentAST, tmp85_AST);
1258 match(AT_IS_OBJECT);
1259 pathTypeCheckExpr_AST = (AST)currentAST.root;
1260 break;
1261 }
1262 case AT_IS_VALUE:
1263 {
1264 AST tmp86_AST = null;
1265 tmp86_AST = astFactory.create(LT(1));
1266 astFactory.addASTChild(currentAST, tmp86_AST);
1267 match(AT_IS_VALUE);
1268 pathTypeCheckExpr_AST = (AST)currentAST.root;
1269 break;
1270 }
1271 default:
1272 {
1273 throw new NoViableAltException(LT(1), getFilename());
1274 }
1275 }
1276 returnAST = pathTypeCheckExpr_AST;
1277 }
1278
1279 public final void sizeFnExpr() throws RecognitionException, TokenStreamException {
1280
1281 returnAST = null;
1282 ASTPair currentAST = new ASTPair();
1283 AST sizeFnExpr_AST = null;
1284
1285 AST tmp87_AST = null;
1286 tmp87_AST = astFactory.create(LT(1));
1287 astFactory.addASTChild(currentAST, tmp87_AST);
1288 match(AT_SIZE);
1289 {
1290 switch ( LA(1)) {
1291 case EQ:
1292 {
1293 AST tmp88_AST = null;
1294 tmp88_AST = astFactory.create(LT(1));
1295 astFactory.addASTChild(currentAST, tmp88_AST);
1296 match(EQ);
1297 break;
1298 }
1299 case NE:
1300 {
1301 AST tmp89_AST = null;
1302 tmp89_AST = astFactory.create(LT(1));
1303 astFactory.addASTChild(currentAST, tmp89_AST);
1304 match(NE);
1305 break;
1306 }
1307 case LT:
1308 {
1309 AST tmp90_AST = null;
1310 tmp90_AST = astFactory.create(LT(1));
1311 astFactory.addASTChild(currentAST, tmp90_AST);
1312 match(LT);
1313 break;
1314 }
1315 case LE:
1316 {
1317 AST tmp91_AST = null;
1318 tmp91_AST = astFactory.create(LT(1));
1319 astFactory.addASTChild(currentAST, tmp91_AST);
1320 match(LE);
1321 break;
1322 }
1323 case GT:
1324 {
1325 AST tmp92_AST = null;
1326 tmp92_AST = astFactory.create(LT(1));
1327 astFactory.addASTChild(currentAST, tmp92_AST);
1328 match(GT);
1329 break;
1330 }
1331 case GE:
1332 {
1333 AST tmp93_AST = null;
1334 tmp93_AST = astFactory.create(LT(1));
1335 astFactory.addASTChild(currentAST, tmp93_AST);
1336 match(GE);
1337 break;
1338 }
1339 default:
1340 {
1341 throw new NoViableAltException(LT(1), getFilename());
1342 }
1343 }
1344 }
1345 AST tmp94_AST = null;
1346 tmp94_AST = astFactory.create(LT(1));
1347 astFactory.addASTChild(currentAST, tmp94_AST);
1348 match(INT);
1349 sizeFnExpr_AST = (AST)currentAST.root;
1350 returnAST = sizeFnExpr_AST;
1351 }
1352
1353 public final void valueFnExpr() throws RecognitionException, TokenStreamException {
1354
1355 returnAST = null;
1356 ASTPair currentAST = new ASTPair();
1357 AST valueFnExpr_AST = null;
1358
1359 AST tmp95_AST = null;
1360 tmp95_AST = astFactory.create(LT(1));
1361 astFactory.addASTChild(currentAST, tmp95_AST);
1362 match(AT_VALUE);
1363 operator_to_value();
1364 astFactory.addASTChild(currentAST, returnAST);
1365 valueFnExpr_AST = (AST)currentAST.root;
1366 returnAST = valueFnExpr_AST;
1367 }
1368
1369 public final void operator_to_value() throws RecognitionException, TokenStreamException {
1370
1371 returnAST = null;
1372 ASTPair currentAST = new ASTPair();
1373 AST operator_to_value_AST = null;
1374
1375 if ((LA(1)==EQ||LA(1)==NE||LA(1)==CONTAINS) && (LA(2)==STRING)) {
1376 {
1377 switch ( LA(1)) {
1378 case EQ:
1379 {
1380 AST tmp96_AST = null;
1381 tmp96_AST = astFactory.create(LT(1));
1382 astFactory.addASTChild(currentAST, tmp96_AST);
1383 match(EQ);
1384 break;
1385 }
1386 case NE:
1387 {
1388 AST tmp97_AST = null;
1389 tmp97_AST = astFactory.create(LT(1));
1390 astFactory.addASTChild(currentAST, tmp97_AST);
1391 match(NE);
1392 break;
1393 }
1394 case CONTAINS:
1395 {
1396 AST tmp98_AST = null;
1397 tmp98_AST = astFactory.create(LT(1));
1398 astFactory.addASTChild(currentAST, tmp98_AST);
1399 match(CONTAINS);
1400 break;
1401 }
1402 default:
1403 {
1404 throw new NoViableAltException(LT(1), getFilename());
1405 }
1406 }
1407 }
1408 AST tmp99_AST = null;
1409 tmp99_AST = astFactory.create(LT(1));
1410 astFactory.addASTChild(currentAST, tmp99_AST);
1411 match(STRING);
1412 operator_to_value_AST = (AST)currentAST.root;
1413 }
1414 else if ((LA(1)==EQ||LA(1)==NE) && (_tokenSet_2.member(LA(2)))) {
1415 {
1416 switch ( LA(1)) {
1417 case EQ:
1418 {
1419 AST tmp100_AST = null;
1420 tmp100_AST = astFactory.create(LT(1));
1421 astFactory.addASTChild(currentAST, tmp100_AST);
1422 match(EQ);
1423 break;
1424 }
1425 case NE:
1426 {
1427 AST tmp101_AST = null;
1428 tmp101_AST = astFactory.create(LT(1));
1429 astFactory.addASTChild(currentAST, tmp101_AST);
1430 match(NE);
1431 break;
1432 }
1433 default:
1434 {
1435 throw new NoViableAltException(LT(1), getFilename());
1436 }
1437 }
1438 }
1439 non_string_value();
1440 astFactory.addASTChild(currentAST, returnAST);
1441 operator_to_value_AST = (AST)currentAST.root;
1442 }
1443 else if (((LA(1) >= LT && LA(1) <= GE))) {
1444 {
1445 switch ( LA(1)) {
1446 case LT:
1447 {
1448 AST tmp102_AST = null;
1449 tmp102_AST = astFactory.create(LT(1));
1450 astFactory.addASTChild(currentAST, tmp102_AST);
1451 match(LT);
1452 break;
1453 }
1454 case LE:
1455 {
1456 AST tmp103_AST = null;
1457 tmp103_AST = astFactory.create(LT(1));
1458 astFactory.addASTChild(currentAST, tmp103_AST);
1459 match(LE);
1460 break;
1461 }
1462 case GT:
1463 {
1464 AST tmp104_AST = null;
1465 tmp104_AST = astFactory.create(LT(1));
1466 astFactory.addASTChild(currentAST, tmp104_AST);
1467 match(GT);
1468 break;
1469 }
1470 case GE:
1471 {
1472 AST tmp105_AST = null;
1473 tmp105_AST = astFactory.create(LT(1));
1474 astFactory.addASTChild(currentAST, tmp105_AST);
1475 match(GE);
1476 break;
1477 }
1478 default:
1479 {
1480 throw new NoViableAltException(LT(1), getFilename());
1481 }
1482 }
1483 }
1484 {
1485 switch ( LA(1)) {
1486 case INT:
1487 {
1488 AST tmp106_AST = null;
1489 tmp106_AST = astFactory.create(LT(1));
1490 astFactory.addASTChild(currentAST, tmp106_AST);
1491 match(INT);
1492 break;
1493 }
1494 case REAL:
1495 {
1496 AST tmp107_AST = null;
1497 tmp107_AST = astFactory.create(LT(1));
1498 astFactory.addASTChild(currentAST, tmp107_AST);
1499 match(REAL);
1500 break;
1501 }
1502 default:
1503 {
1504 throw new NoViableAltException(LT(1), getFilename());
1505 }
1506 }
1507 }
1508 operator_to_value_AST = (AST)currentAST.root;
1509 }
1510 else {
1511 throw new NoViableAltException(LT(1), getFilename());
1512 }
1513
1514 returnAST = operator_to_value_AST;
1515 }
1516
1517 public final void non_string_value() throws RecognitionException, TokenStreamException {
1518
1519 returnAST = null;
1520 ASTPair currentAST = new ASTPair();
1521 AST non_string_value_AST = null;
1522
1523 switch ( LA(1)) {
1524 case LITERAL_null:
1525 {
1526 AST tmp108_AST = null;
1527 tmp108_AST = astFactory.create(LT(1));
1528 astFactory.addASTChild(currentAST, tmp108_AST);
1529 match(LITERAL_null);
1530 non_string_value_AST = (AST)currentAST.root;
1531 break;
1532 }
1533 case LITERAL_true:
1534 {
1535 AST tmp109_AST = null;
1536 tmp109_AST = astFactory.create(LT(1));
1537 astFactory.addASTChild(currentAST, tmp109_AST);
1538 match(LITERAL_true);
1539 non_string_value_AST = (AST)currentAST.root;
1540 break;
1541 }
1542 case LITERAL_false:
1543 {
1544 AST tmp110_AST = null;
1545 tmp110_AST = astFactory.create(LT(1));
1546 astFactory.addASTChild(currentAST, tmp110_AST);
1547 match(LITERAL_false);
1548 non_string_value_AST = (AST)currentAST.root;
1549 break;
1550 }
1551 case INT:
1552 {
1553 AST tmp111_AST = null;
1554 tmp111_AST = astFactory.create(LT(1));
1555 astFactory.addASTChild(currentAST, tmp111_AST);
1556 match(INT);
1557 non_string_value_AST = (AST)currentAST.root;
1558 break;
1559 }
1560 case REAL:
1561 {
1562 AST tmp112_AST = null;
1563 tmp112_AST = astFactory.create(LT(1));
1564 astFactory.addASTChild(currentAST, tmp112_AST);
1565 match(REAL);
1566 non_string_value_AST = (AST)currentAST.root;
1567 break;
1568 }
1569 default:
1570 {
1571 throw new NoViableAltException(LT(1), getFilename());
1572 }
1573 }
1574 returnAST = non_string_value_AST;
1575 }
1576
1577
1578 public static final String[] _tokenNames = {
1579 "<0>",
1580 "EOF",
1581 "<2>",
1582 "NULL_TREE_LOOKAHEAD",
1583 "PATH",
1584 "MEMBER",
1585 "SIMPLE_KEY",
1586 "COMPLEX_KEY",
1587 "OBJECT_CONSTRUCTION",
1588 "ARRAY_INDEX",
1589 "ARRAY_CONSTRUCTION",
1590 "ARRAY_SLICE",
1591 "MULTI_LEVEL_UP",
1592 "FILTER",
1593 "ABSOLUTE",
1594 "DOT",
1595 "DOTDOT",
1596 "ID",
1597 "WILDCARD",
1598 "LBRACKET",
1599 "STRING",
1600 "RBRACKET",
1601 "COMMA",
1602 "INT",
1603 "SEMI",
1604 "CARET",
1605 "LCURLY",
1606 "RCURLY",
1607 "LPAREN",
1608 "RPAREN",
1609 "OR",
1610 "AND",
1611 "NOT",
1612 "AT_IS_NULL",
1613 "AT_IS_NOT_NULL",
1614 "AT_IS_ARRAY",
1615 "AT_IS_OBJECT",
1616 "AT_IS_VALUE",
1617 "AT_SIZE",
1618 "EQ",
1619 "NE",
1620 "LT",
1621 "LE",
1622 "GT",
1623 "GE",
1624 "AT_VALUE",
1625 "CONTAINS",
1626 "REAL",
1627 "\"null\"",
1628 "\"true\"",
1629 "\"false\"",
1630 "TYPE_CHECK",
1631 "ID_OR_ABSOLUTE",
1632 "INT_OR_REAL_OR_DOTS",
1633 "NEWLINE",
1634 "SINGLE_LINE_COMMENT",
1635 "MULTI_LINE_COMMENT",
1636 "WS",
1637 "DIGIT",
1638 "FRAC",
1639 "EXP",
1640 "ESC",
1641 "ID_START_LETTER",
1642 "ID_LETTER"
1643 };
1644
1645 protected void buildTokenTypeASTClassMap() {
1646 tokenTypeToASTClassMap=null;
1647 };
1648
1649 private static final long[] mk_tokenSet_0() {
1650 long[] data = { 34570240L, 0L};
1651 return data;
1652 }
1653 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1654 private static final long[] mk_tokenSet_1() {
1655 long[] data = { 105544829337602L, 0L};
1656 return data;
1657 }
1658 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1659 private static final long[] mk_tokenSet_2() {
1660 long[] data = { 2111062333718528L, 0L};
1661 return data;
1662 }
1663 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1664
1665 }
0 // $ANTLR 2.7.5 (20050128): "json_grammar.g" -> "JsonQueryParser.java"$
1
2 /*
3 * JasperReports - Free Java Reporting Library.
4 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
6 *
7 * Unless you have purchased a commercial license agreement from Jaspersoft,
8 * the following license terms apply:
9 *
10 * This program is part of JasperReports.
11 *
12 * JasperReports is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * JasperReports is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
24 */
25 package net.sf.jasperreports.engine.json.parser;
26
27 public interface JsonQueryParserTokenTypes {
28 int EOF = 1;
29 int NULL_TREE_LOOKAHEAD = 3;
30 int PATH = 4;
31 int MEMBER = 5;
32 int SIMPLE_KEY = 6;
33 int COMPLEX_KEY = 7;
34 int OBJECT_CONSTRUCTION = 8;
35 int ARRAY_INDEX = 9;
36 int ARRAY_CONSTRUCTION = 10;
37 int ARRAY_SLICE = 11;
38 int MULTI_LEVEL_UP = 12;
39 int FILTER = 13;
40 int ABSOLUTE = 14;
41 int DOT = 15;
42 int DOTDOT = 16;
43 int ID = 17;
44 int WILDCARD = 18;
45 int LBRACKET = 19;
46 int STRING = 20;
47 int RBRACKET = 21;
48 int COMMA = 22;
49 int INT = 23;
50 int SEMI = 24;
51 int CARET = 25;
52 int LCURLY = 26;
53 int RCURLY = 27;
54 int LPAREN = 28;
55 int RPAREN = 29;
56 int OR = 30;
57 int AND = 31;
58 int NOT = 32;
59 int AT_IS_NULL = 33;
60 int AT_IS_NOT_NULL = 34;
61 int AT_IS_ARRAY = 35;
62 int AT_IS_OBJECT = 36;
63 int AT_IS_VALUE = 37;
64 int AT_SIZE = 38;
65 int EQ = 39;
66 int NE = 40;
67 int LT = 41;
68 int LE = 42;
69 int GT = 43;
70 int GE = 44;
71 int AT_VALUE = 45;
72 int CONTAINS = 46;
73 int REAL = 47;
74 int LITERAL_null = 48;
75 int LITERAL_true = 49;
76 int LITERAL_false = 50;
77 int TYPE_CHECK = 51;
78 int ID_OR_ABSOLUTE = 52;
79 int INT_OR_REAL_OR_DOTS = 53;
80 int NEWLINE = 54;
81 int SINGLE_LINE_COMMENT = 55;
82 int MULTI_LINE_COMMENT = 56;
83 int WS = 57;
84 int DIGIT = 58;
85 int FRAC = 59;
86 int EXP = 60;
87 int ESC = 61;
88 int ID_START_LETTER = 62;
89 int ID_LETTER = 63;
90 }
0 // $ANTLR 2.7.5 (20050128): json_grammar.g -> JsonQueryParserTokenTypes.txt$
1 JsonQueryParser // output token vocab name
2 PATH=4
3 MEMBER=5
4 SIMPLE_KEY=6
5 COMPLEX_KEY=7
6 OBJECT_CONSTRUCTION=8
7 ARRAY_INDEX=9
8 ARRAY_CONSTRUCTION=10
9 ARRAY_SLICE=11
10 MULTI_LEVEL_UP=12
11 FILTER=13
12 ABSOLUTE=14
13 DOT=15
14 DOTDOT=16
15 ID=17
16 WILDCARD=18
17 LBRACKET=19
18 STRING=20
19 RBRACKET=21
20 COMMA=22
21 INT=23
22 SEMI=24
23 CARET=25
24 LCURLY=26
25 RCURLY=27
26 LPAREN=28
27 RPAREN=29
28 OR=30
29 AND=31
30 NOT=32
31 AT_IS_NULL=33
32 AT_IS_NOT_NULL=34
33 AT_IS_ARRAY=35
34 AT_IS_OBJECT=36
35 AT_IS_VALUE=37
36 AT_SIZE=38
37 EQ=39
38 NE=40
39 LT=41
40 LE=42
41 GT=43
42 GE=44
43 AT_VALUE=45
44 CONTAINS=46
45 REAL=47
46 LITERAL_null="null"=48
47 LITERAL_true="true"=49
48 LITERAL_false="false"=50
49 TYPE_CHECK=51
50 ID_OR_ABSOLUTE=52
51 INT_OR_REAL_OR_DOTS=53
52 NEWLINE=54
53 SINGLE_LINE_COMMENT=55
54 MULTI_LINE_COMMENT=56
55 WS=57
56 DIGIT=58
57 FRAC=59
58 EXP=60
59 ESC=61
60 ID_START_LETTER=62
61 ID_LETTER=63
0 // $ANTLR 2.7.5 (20050128): "json_grammar.g" -> "JsonQueryWalker.java"$
1
2 /*
3 * JasperReports - Free Java Reporting Library.
4 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
5 * http://www.jaspersoft.com
6 *
7 * Unless you have purchased a commercial license agreement from Jaspersoft,
8 * the following license terms apply:
9 *
10 * This program is part of JasperReports.
11 *
12 * JasperReports is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * JasperReports is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
24 */
25 package net.sf.jasperreports.engine.json.parser;
26
27 import antlr.TreeParser;
28 import antlr.Token;
29 import antlr.collections.AST;
30 import antlr.RecognitionException;
31 import antlr.ANTLRException;
32 import antlr.NoViableAltException;
33 import antlr.MismatchedTokenException;
34 import antlr.SemanticException;
35 import antlr.collections.impl.BitSet;
36 import antlr.ASTPair;
37 import antlr.collections.impl.ASTArray;
38
39 import net.sf.jasperreports.engine.json.expression.JsonQLExpression;
40 import net.sf.jasperreports.engine.json.expression.filter.FilterExpression.LOGICAL_OPERATOR;
41 import net.sf.jasperreports.engine.json.expression.filter.FilterExpression.VALUE_TYPE;
42 import net.sf.jasperreports.engine.json.expression.filter.*;
43 import net.sf.jasperreports.engine.json.expression.member.MemberExpression.DIRECTION;
44 import net.sf.jasperreports.engine.json.expression.member.*;
45
46 import net.sf.jasperreports.engine.type.JsonOperatorEnum;
47
48
49 /**
50 * @author Narcis Marcu (narcism@users.sourceforge.net)
51 */
52 public class JsonQueryWalker extends antlr.TreeParser implements JsonQueryParserTokenTypes
53 {
54 public JsonQueryWalker() {
55 tokenNames = _tokenNames;
56 }
57
58 public final JsonQLExpression jsonQLExpression(AST _t) throws RecognitionException {
59 JsonQLExpression jsonQLExpression = new JsonQLExpression();
60
61 AST jsonQLExpression_AST_in = (_t == ASTNULL) ? null : (AST)_t;
62 AST abs = null;
63
64 try { // for error handling
65 AST __t76 = _t;
66 AST tmp1_AST_in = (AST)_t;
67 match(_t,PATH);
68 _t = _t.getFirstChild();
69 {
70 if (_t==null) _t=ASTNULL;
71 switch ( _t.getType()) {
72 case ABSOLUTE:
73 {
74 abs = (AST)_t;
75 match(_t,ABSOLUTE);
76 _t = _t.getNextSibling();
77 break;
78 }
79 case 3:
80 case MEMBER:
81 {
82 break;
83 }
84 default:
85 {
86 throw new NoViableAltException(_t);
87 }
88 }
89 }
90 {
91 _loop79:
92 do {
93 if (_t==null) _t=ASTNULL;
94 if ((_t.getType()==MEMBER)) {
95 memberExpr(_t,jsonQLExpression);
96 _t = _retTree;
97 }
98 else {
99 break _loop79;
100 }
101
102 } while (true);
103 }
104 _t = __t76;
105 _t = _t.getNextSibling();
106
107 if (abs != null) {
108 jsonQLExpression.setIsAbsolute(true);
109 }
110
111 }
112 catch (RecognitionException ex) {
113 reportError(ex);
114 if (_t!=null) {_t = _t.getNextSibling();}
115 }
116 _retTree = _t;
117 return jsonQLExpression;
118 }
119
120 public final void memberExpr(AST _t,
121 JsonQLExpression jsonQLExpression
122 ) throws RecognitionException {
123
124 AST memberExpr_AST_in = (_t == ASTNULL) ? null : (AST)_t;
125
126 MemberExpression memberExpr = null;
127 FilterExpression filterExpression = null;
128
129
130 try { // for error handling
131 AST __t81 = _t;
132 AST tmp2_AST_in = (AST)_t;
133 match(_t,MEMBER);
134 _t = _t.getFirstChild();
135 memberExpr=pathNaviExpr(_t);
136 _t = _retTree;
137 {
138 if (_t==null) _t=ASTNULL;
139 switch ( _t.getType()) {
140 case FILTER:
141 {
142 filterExpression=filterExprMain(_t);
143 _t = _retTree;
144 break;
145 }
146 case 3:
147 {
148 break;
149 }
150 default:
151 {
152 throw new NoViableAltException(_t);
153 }
154 }
155 }
156 _t = __t81;
157 _t = _t.getNextSibling();
158
159 memberExpr.setFilterExpression(filterExpression);
160 jsonQLExpression.addMemberExpression(memberExpr);
161
162 }
163 catch (RecognitionException ex) {
164 reportError(ex);
165 if (_t!=null) {_t = _t.getNextSibling();}
166 }
167 _retTree = _t;
168 }
169
170 public final MemberExpression pathNaviExpr(AST _t) throws RecognitionException {
171 MemberExpression memberExpr = null;
172
173 AST pathNaviExpr_AST_in = (_t == ASTNULL) ? null : (AST)_t;
174 AST id = null;
175 AST s = null;
176 AST n = null;
177 AST sliceStart = null;
178 AST sliceEnd = null;
179 AST levelUp = null;
180
181 DIRECTION dir = DIRECTION.DOWN;
182
183
184 try { // for error handling
185 if (_t==null) _t=ASTNULL;
186 switch ( _t.getType()) {
187 case SIMPLE_KEY:
188 {
189 AST __t84 = _t;
190 AST tmp3_AST_in = (AST)_t;
191 match(_t,SIMPLE_KEY);
192 _t = _t.getFirstChild();
193 {
194 if (_t==null) _t=ASTNULL;
195 switch ( _t.getType()) {
196 case DOT:
197 case DOTDOT:
198 {
199 dir=direction(_t);
200 _t = _retTree;
201 break;
202 }
203 case ID:
204 case WILDCARD:
205 {
206 break;
207 }
208 default:
209 {
210 throw new NoViableAltException(_t);
211 }
212 }
213 }
214 {
215 if (_t==null) _t=ASTNULL;
216 switch ( _t.getType()) {
217 case ID:
218 {
219 id = (AST)_t;
220 match(_t,ID);
221 _t = _t.getNextSibling();
222 break;
223 }
224 case WILDCARD:
225 {
226 AST tmp4_AST_in = (AST)_t;
227 match(_t,WILDCARD);
228 _t = _t.getNextSibling();
229 break;
230 }
231 default:
232 {
233 throw new NoViableAltException(_t);
234 }
235 }
236 }
237 _t = __t84;
238 _t = _t.getNextSibling();
239
240 if (id != null) {
241 // object key
242 memberExpr = new ObjectKeyExpression(dir, id.getText());
243 } else {
244 // wildcard
245 memberExpr = new ObjectKeyExpression(dir);
246 }
247
248 break;
249 }
250 case COMPLEX_KEY:
251 {
252 AST __t87 = _t;
253 AST tmp5_AST_in = (AST)_t;
254 match(_t,COMPLEX_KEY);
255 _t = _t.getFirstChild();
256 {
257 if (_t==null) _t=ASTNULL;
258 switch ( _t.getType()) {
259 case DOT:
260 case DOTDOT:
261 {
262 dir=direction(_t);
263 _t = _retTree;
264 break;
265 }
266 case STRING:
267 {
268 break;
269 }
270 default:
271 {
272 throw new NoViableAltException(_t);
273 }
274 }
275 }
276 s = (AST)_t;
277 match(_t,STRING);
278 _t = _t.getNextSibling();
279 _t = __t87;
280 _t = _t.getNextSibling();
281
282 memberExpr = new ObjectKeyExpression(dir, s.getText());
283
284 break;
285 }
286 case OBJECT_CONSTRUCTION:
287 {
288
289 memberExpr = new ObjectConstructionExpression();
290
291 AST __t89 = _t;
292 AST tmp6_AST_in = (AST)_t;
293 match(_t,OBJECT_CONSTRUCTION);
294 _t = _t.getFirstChild();
295 {
296 if (_t==null) _t=ASTNULL;
297 switch ( _t.getType()) {
298 case DOT:
299 case DOTDOT:
300 {
301 dir=direction(_t);
302 _t = _retTree;
303 break;
304 }
305 case ID:
306 case STRING:
307 {
308 break;
309 }
310 default:
311 {
312 throw new NoViableAltException(_t);
313 }
314 }
315 }
316 {
317 int _cnt92=0;
318 _loop92:
319 do {
320 if (_t==null) _t=ASTNULL;
321 if ((_t.getType()==ID||_t.getType()==STRING)) {
322 addObjectKey(_t,(ObjectConstructionExpression)memberExpr);
323 _t = _retTree;
324 }
325 else {
326 if ( _cnt92>=1 ) { break _loop92; } else {throw new NoViableAltException(_t);}
327 }
328
329 _cnt92++;
330 } while (true);
331 }
332 _t = __t89;
333 _t = _t.getNextSibling();
334
335 ((ObjectConstructionExpression)memberExpr).setDirection(dir);
336
337 break;
338 }
339 case ARRAY_INDEX:
340 {
341 AST __t93 = _t;
342 AST tmp7_AST_in = (AST)_t;
343 match(_t,ARRAY_INDEX);
344 _t = _t.getFirstChild();
345 {
346 if (_t==null) _t=ASTNULL;
347 switch ( _t.getType()) {
348 case DOT:
349 case DOTDOT:
350 {
351 dir=direction(_t);
352 _t = _retTree;
353 break;
354 }
355 case INT:
356 {
357 break;
358 }
359 default:
360 {
361 throw new NoViableAltException(_t);
362 }
363 }
364 }
365 n = (AST)_t;
366 match(_t,INT);
367 _t = _t.getNextSibling();
368 _t = __t93;
369 _t = _t.getNextSibling();
370
371 memberExpr = new ArrayIndexExpression(dir, Integer.parseInt(n.getText()));
372
373 break;
374 }
375 case ARRAY_CONSTRUCTION:
376 {
377
378 memberExpr = new ArrayConstructionExpression();
379
380 AST __t95 = _t;
381 AST tmp8_AST_in = (AST)_t;
382 match(_t,ARRAY_CONSTRUCTION);
383 _t = _t.getFirstChild();
384 {
385 if (_t==null) _t=ASTNULL;
386 switch ( _t.getType()) {
387 case DOT:
388 case DOTDOT:
389 {
390 dir=direction(_t);
391 _t = _retTree;
392 break;
393 }
394 case INT:
395 {
396 break;
397 }
398 default:
399 {
400 throw new NoViableAltException(_t);
401 }
402 }
403 }
404 {
405 int _cnt98=0;
406 _loop98:
407 do {
408 if (_t==null) _t=ASTNULL;
409 if ((_t.getType()==INT)) {
410 addArrayIndex(_t,(ArrayConstructionExpression)memberExpr);
411 _t = _retTree;
412 }
413 else {
414 if ( _cnt98>=1 ) { break _loop98; } else {throw new NoViableAltException(_t);}
415 }
416
417 _cnt98++;
418 } while (true);
419 }
420 _t = __t95;
421 _t = _t.getNextSibling();
422
423 ((ArrayConstructionExpression)memberExpr).setDirection(dir);
424
425 break;
426 }
427 case ARRAY_SLICE:
428 {
429 AST __t99 = _t;
430 AST tmp9_AST_in = (AST)_t;
431 match(_t,ARRAY_SLICE);
432 _t = _t.getFirstChild();
433 {
434 if (_t==null) _t=ASTNULL;
435 switch ( _t.getType()) {
436 case DOT:
437 case DOTDOT:
438 {
439 dir=direction(_t);
440 _t = _retTree;
441 break;
442 }
443 case INT:
444 case SEMI:
445 {
446 break;
447 }
448 default:
449 {
450 throw new NoViableAltException(_t);
451 }
452 }
453 }
454 {
455 if (_t==null) _t=ASTNULL;
456 switch ( _t.getType()) {
457 case INT:
458 {
459 sliceStart = (AST)_t;
460 match(_t,INT);
461 _t = _t.getNextSibling();
462 break;
463 }
464 case SEMI:
465 {
466 break;
467 }
468 default:
469 {
470 throw new NoViableAltException(_t);
471 }
472 }
473 }
474 AST tmp10_AST_in = (AST)_t;
475 match(_t,SEMI);
476 _t = _t.getNextSibling();
477 {
478 if (_t==null) _t=ASTNULL;
479 switch ( _t.getType()) {
480 case INT:
481 {
482 sliceEnd = (AST)_t;
483 match(_t,INT);
484 _t = _t.getNextSibling();
485 break;
486 }
487 case 3:
488 {
489 break;
490 }
491 default:
492 {
493 throw new NoViableAltException(_t);
494 }
495 }
496 }
497 _t = __t99;
498 _t = _t.getNextSibling();
499
500 Integer start = null, end = null;
501
502 if (sliceStart != null) {
503 start = Integer.valueOf(sliceStart.getText());
504 }
505 if (sliceEnd != null) {
506 end = Integer.valueOf(sliceEnd.getText());
507 }
508
509 memberExpr = new ArraySliceExpression(dir, start, end);
510
511 break;
512 }
513 case MULTI_LEVEL_UP:
514 {
515 AST __t103 = _t;
516 AST tmp11_AST_in = (AST)_t;
517 match(_t,MULTI_LEVEL_UP);
518 _t = _t.getFirstChild();
519 AST tmp12_AST_in = (AST)_t;
520 match(_t,CARET);
521 _t = _t.getNextSibling();
522 {
523 if (_t==null) _t=ASTNULL;
524 switch ( _t.getType()) {
525 case INT:
526 {
527 levelUp = (AST)_t;
528 match(_t,INT);
529 _t = _t.getNextSibling();
530 break;
531 }
532 case 3:
533 {
534 break;
535 }
536 default:
537 {
538 throw new NoViableAltException(_t);
539 }
540 }
541 }
542 _t = __t103;
543 _t = _t.getNextSibling();
544
545 int level = 1;
546 if (levelUp != null) {
547 level = Integer.parseInt(levelUp.getText());
548 }
549 memberExpr = new MultiLevelUpExpression(level);
550
551 break;
552 }
553 default:
554 {
555 throw new NoViableAltException(_t);
556 }
557 }
558 }
559 catch (RecognitionException ex) {
560 reportError(ex);
561 if (_t!=null) {_t = _t.getNextSibling();}
562 }
563 _retTree = _t;
564 return memberExpr;
565 }
566
567 public final FilterExpression filterExprMain(AST _t) throws RecognitionException {
568 FilterExpression filterExpression = null;
569
570 AST filterExprMain_AST_in = (_t == ASTNULL) ? null : (AST)_t;
571
572 try { // for error handling
573 AST __t109 = _t;
574 AST tmp13_AST_in = (AST)_t;
575 match(_t,FILTER);
576 _t = _t.getFirstChild();
577 filterExpression=filterExpr(_t);
578 _t = _retTree;
579 _t = __t109;
580 _t = _t.getNextSibling();
581 }
582 catch (RecognitionException ex) {
583 reportError(ex);
584 if (_t!=null) {_t = _t.getNextSibling();}
585 }
586 _retTree = _t;
587 return filterExpression;
588 }
589
590 public final DIRECTION direction(AST _t) throws RecognitionException {
591 DIRECTION dir = DIRECTION.DOWN;
592
593 AST direction_AST_in = (_t == ASTNULL) ? null : (AST)_t;
594
595 try { // for error handling
596 if (_t==null) _t=ASTNULL;
597 switch ( _t.getType()) {
598 case DOT:
599 {
600 AST tmp14_AST_in = (AST)_t;
601 match(_t,DOT);
602 _t = _t.getNextSibling();
603 break;
604 }
605 case DOTDOT:
606 {
607 AST tmp15_AST_in = (AST)_t;
608 match(_t,DOTDOT);
609 _t = _t.getNextSibling();
610 dir = DIRECTION.ANYWHERE_DOWN;
611 break;
612 }
613 default:
614 {
615 throw new NoViableAltException(_t);
616 }
617 }
618 }
619 catch (RecognitionException ex) {
620 reportError(ex);
621 if (_t!=null) {_t = _t.getNextSibling();}
622 }
623 _retTree = _t;
624 return dir;
625 }
626
627 public final void addObjectKey(AST _t,
628 ObjectConstructionExpression objConstrExpr
629 ) throws RecognitionException {
630
631 AST addObjectKey_AST_in = (_t == ASTNULL) ? null : (AST)_t;
632 AST str = null;
633 AST id = null;
634
635 try { // for error handling
636 {
637 if (_t==null) _t=ASTNULL;
638 switch ( _t.getType()) {
639 case STRING:
640 {
641 str = (AST)_t;
642 match(_t,STRING);
643 _t = _t.getNextSibling();
644 break;
645 }
646 case ID:
647 {
648 id = (AST)_t;
649 match(_t,ID);
650 _t = _t.getNextSibling();
651 break;
652 }
653 default:
654 {
655 throw new NoViableAltException(_t);
656 }
657 }
658 }
659
660 String key = null;
661 if (str != null) {
662 key = str.getText();
663 } else {
664 key = id.getText();
665 }
666 objConstrExpr.addKey(key);
667
668 }
669 catch (RecognitionException ex) {
670 reportError(ex);
671 if (_t!=null) {_t = _t.getNextSibling();}
672 }
673 _retTree = _t;
674 }
675
676 public final void addArrayIndex(AST _t,
677 ArrayConstructionExpression arrayConstrExpr
678 ) throws RecognitionException {
679
680 AST addArrayIndex_AST_in = (_t == ASTNULL) ? null : (AST)_t;
681 AST idx = null;
682
683 try { // for error handling
684 idx = (AST)_t;
685 match(_t,INT);
686 _t = _t.getNextSibling();
687
688 arrayConstrExpr.addIndex(Integer.parseInt(idx.getText()));
689
690 }
691 catch (RecognitionException ex) {
692 reportError(ex);
693 if (_t!=null) {_t = _t.getNextSibling();}
694 }
695 _retTree = _t;
696 }
697
698 public final FilterExpression filterExpr(AST _t) throws RecognitionException {
699 FilterExpression result = null;
700
701 AST filterExpr_AST_in = (_t == ASTNULL) ? null : (AST)_t;
702
703 FilterExpression fe1, fe2;
704
705
706 try { // for error handling
707 if (_t==null) _t=ASTNULL;
708 switch ( _t.getType()) {
709 case AND:
710 {
711 AST __t111 = _t;
712 AST tmp16_AST_in = (AST)_t;
713 match(_t,AND);
714 _t = _t.getFirstChild();
715 fe1=filterExpr(_t);
716 _t = _retTree;
717 fe2=filterExpr(_t);
718 _t = _retTree;
719 _t = __t111;
720 _t = _t.getNextSibling();
721
722 result = new CompoundFilterExpression(fe1, fe2, LOGICAL_OPERATOR.AND);
723
724 break;
725 }
726 case OR:
727 {
728 AST __t112 = _t;
729 AST tmp17_AST_in = (AST)_t;
730 match(_t,OR);
731 _t = _t.getFirstChild();
732 fe1=filterExpr(_t);
733 _t = _retTree;
734 fe2=filterExpr(_t);
735 _t = _retTree;
736 _t = __t112;
737 _t = _t.getNextSibling();
738
739 result = new CompoundFilterExpression(fe1, fe2, LOGICAL_OPERATOR.OR);
740
741 break;
742 }
743 case NOT:
744 {
745 AST __t113 = _t;
746 AST tmp18_AST_in = (AST)_t;
747 match(_t,NOT);
748 _t = _t.getFirstChild();
749 fe1=filterExpr(_t);
750 _t = _retTree;
751 _t = __t113;
752 _t = _t.getNextSibling();
753
754 result = new NotFilterExpression(fe1);
755
756 break;
757 }
758 case SIMPLE_KEY:
759 case COMPLEX_KEY:
760 case OBJECT_CONSTRUCTION:
761 case ARRAY_INDEX:
762 case ARRAY_CONSTRUCTION:
763 case ARRAY_SLICE:
764 case MULTI_LEVEL_UP:
765 case AT_IS_NULL:
766 case AT_IS_NOT_NULL:
767 case AT_IS_ARRAY:
768 case AT_IS_OBJECT:
769 case AT_IS_VALUE:
770 case AT_SIZE:
771 case AT_VALUE:
772 {
773 result=filterExprMinimal(_t);
774 _t = _retTree;
775 break;
776 }
777 default:
778 {
779 throw new NoViableAltException(_t);
780 }
781 }
782 }
783 catch (RecognitionException ex) {
784 reportError(ex);
785 if (_t!=null) {_t = _t.getNextSibling();}
786 }
787 _retTree = _t;
788 return result;
789 }
790
791 public final BasicFilterExpression filterExprMinimal(AST _t) throws RecognitionException {
792 BasicFilterExpression filterExpression = new BasicFilterExpression();
793
794 AST filterExprMinimal_AST_in = (_t == ASTNULL) ? null : (AST)_t;
795 AST sizeFn = null;
796 AST szFn = null;
797
798 ValueDescriptor val = null;
799 JsonOperatorEnum op = null;
800
801
802 try { // for error handling
803 if (_t==null) _t=ASTNULL;
804 switch ( _t.getType()) {
805 case AT_SIZE:
806 case AT_VALUE:
807 {
808 {
809 if (_t==null) _t=ASTNULL;
810 switch ( _t.getType()) {
811 case AT_SIZE:
812 {
813 sizeFn = (AST)_t;
814 match(_t,AT_SIZE);
815 _t = _t.getNextSibling();
816 break;
817 }
818 case AT_VALUE:
819 {
820 AST tmp19_AST_in = (AST)_t;
821 match(_t,AT_VALUE);
822 _t = _t.getNextSibling();
823 break;
824 }
825 default:
826 {
827 throw new NoViableAltException(_t);
828 }
829 }
830 }
831 op=operator(_t);
832 _t = _retTree;
833 val=value(_t);
834 _t = _retTree;
835
836 if (sizeFn != null) {
837 filterExpression.setIsSizeFunction(true);
838 }
839 filterExpression.setOperator(op);
840 filterExpression.setValueDescriptor(val);
841
842 break;
843 }
844 case AT_IS_NULL:
845 case AT_IS_NOT_NULL:
846 case AT_IS_ARRAY:
847 case AT_IS_OBJECT:
848 case AT_IS_VALUE:
849 {
850 pathTypeCheckExpr(_t,filterExpression);
851 _t = _retTree;
852 break;
853 }
854 case SIMPLE_KEY:
855 case COMPLEX_KEY:
856 case OBJECT_CONSTRUCTION:
857 case ARRAY_INDEX:
858 case ARRAY_CONSTRUCTION:
859 case ARRAY_SLICE:
860 case MULTI_LEVEL_UP:
861 {
862 {
863 int _cnt117=0;
864 _loop117:
865 do {
866 if (_t==null) _t=ASTNULL;
867 if (((_t.getType() >= SIMPLE_KEY && _t.getType() <= MULTI_LEVEL_UP))) {
868 filterMemberExpr(_t,filterExpression);
869 _t = _retTree;
870 }
871 else {
872 if ( _cnt117>=1 ) { break _loop117; } else {throw new NoViableAltException(_t);}
873 }
874
875 _cnt117++;
876 } while (true);
877 }
878 {
879 if (_t==null) _t=ASTNULL;
880 switch ( _t.getType()) {
881 case AT_IS_NULL:
882 case AT_IS_NOT_NULL:
883 case AT_IS_ARRAY:
884 case AT_IS_OBJECT:
885 case AT_IS_VALUE:
886 {
887 pathTypeCheckExpr(_t,filterExpression);
888 _t = _retTree;
889 break;
890 }
891 case AT_SIZE:
892 case EQ:
893 case NE:
894 case LT:
895 case LE:
896 case GT:
897 case GE:
898 case CONTAINS:
899 {
900 {
901 {
902 if (_t==null) _t=ASTNULL;
903 switch ( _t.getType()) {
904 case AT_SIZE:
905 {
906 szFn = (AST)_t;
907 match(_t,AT_SIZE);
908 _t = _t.getNextSibling();
909 break;
910 }
911 case EQ:
912 case NE:
913 case LT:
914 case LE:
915 case GT:
916 case GE:
917 case CONTAINS:
918 {
919 break;
920 }
921 default:
922 {
923 throw new NoViableAltException(_t);
924 }
925 }
926 }
927 op=operator(_t);
928 _t = _retTree;
929 val=value(_t);
930 _t = _retTree;
931 }
932 break;
933 }
934 default:
935 {
936 throw new NoViableAltException(_t);
937 }
938 }
939 }
940
941 if (szFn != null) {
942 filterExpression.setIsSizeFunction(true);
943 }
944 filterExpression.setOperator(op);
945 filterExpression.setValueDescriptor(val);
946
947 break;
948 }
949 default:
950 {
951 throw new NoViableAltException(_t);
952 }
953 }
954 }
955 catch (RecognitionException ex) {
956 reportError(ex);
957 if (_t!=null) {_t = _t.getNextSibling();}
958 }
959 _retTree = _t;
960 return filterExpression;
961 }
962
963 public final JsonOperatorEnum operator(AST _t) throws RecognitionException {
964 JsonOperatorEnum operator = null;
965
966 AST operator_AST_in = (_t == ASTNULL) ? null : (AST)_t;
967
968 try { // for error handling
969 if (_t==null) _t=ASTNULL;
970 switch ( _t.getType()) {
971 case EQ:
972 {
973 AST tmp20_AST_in = (AST)_t;
974 match(_t,EQ);
975 _t = _t.getNextSibling();
976 operator = JsonOperatorEnum.EQ;
977 break;
978 }
979 case NE:
980 {
981 AST tmp21_AST_in = (AST)_t;
982 match(_t,NE);
983 _t = _t.getNextSibling();
984 operator = JsonOperatorEnum.NE;
985 break;
986 }
987 case LT:
988 {
989 AST tmp22_AST_in = (AST)_t;
990 match(_t,LT);
991 _t = _t.getNextSibling();
992 operator = JsonOperatorEnum.LT;
993 break;
994 }
995 case LE:
996 {
997 AST tmp23_AST_in = (AST)_t;
998 match(_t,LE);
999 _t = _t.getNextSibling();
1000 operator = JsonOperatorEnum.LE;
1001 break;
1002 }
1003 case GT:
1004 {
1005 AST tmp24_AST_in = (AST)_t;
1006 match(_t,GT);
1007 _t = _t.getNextSibling();
1008 operator = JsonOperatorEnum.GT;
1009 break;
1010 }
1011 case GE:
1012 {
1013 AST tmp25_AST_in = (AST)_t;
1014 match(_t,GE);
1015 _t = _t.getNextSibling();
1016 operator = JsonOperatorEnum.GE;
1017 break;
1018 }
1019 case CONTAINS:
1020 {
1021 AST tmp26_AST_in = (AST)_t;
1022 match(_t,CONTAINS);
1023 _t = _t.getNextSibling();
1024 operator = JsonOperatorEnum.CONTAINS;
1025 break;
1026 }
1027 default:
1028 {
1029 throw new NoViableAltException(_t);
1030 }
1031 }
1032 }
1033 catch (RecognitionException ex) {
1034 reportError(ex);
1035 if (_t!=null) {_t = _t.getNextSibling();}
1036 }
1037 _retTree = _t;
1038 return operator;
1039 }
1040
1041 public final ValueDescriptor value(AST _t) throws RecognitionException {
1042 ValueDescriptor valueDescriptor = null;
1043
1044 AST value_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1045 AST integer = null;
1046 AST real = null;
1047 AST string = null;
1048
1049 try { // for error handling
1050 if (_t==null) _t=ASTNULL;
1051 switch ( _t.getType()) {
1052 case LITERAL_null:
1053 {
1054 AST tmp27_AST_in = (AST)_t;
1055 match(_t,LITERAL_null);
1056 _t = _t.getNextSibling();
1057 valueDescriptor = new ValueDescriptor(VALUE_TYPE.NULL, "null");
1058 break;
1059 }
1060 case LITERAL_true:
1061 {
1062 AST tmp28_AST_in = (AST)_t;
1063 match(_t,LITERAL_true);
1064 _t = _t.getNextSibling();
1065 valueDescriptor = new ValueDescriptor(VALUE_TYPE.BOOLEAN, "true");
1066 break;
1067 }
1068 case LITERAL_false:
1069 {
1070 AST tmp29_AST_in = (AST)_t;
1071 match(_t,LITERAL_false);
1072 _t = _t.getNextSibling();
1073 valueDescriptor = new ValueDescriptor(VALUE_TYPE.BOOLEAN, "false");
1074 break;
1075 }
1076 case INT:
1077 {
1078 integer = (AST)_t;
1079 match(_t,INT);
1080 _t = _t.getNextSibling();
1081 valueDescriptor = new ValueDescriptor(VALUE_TYPE.INTEGER, integer.getText());
1082 break;
1083 }
1084 case REAL:
1085 {
1086 real = (AST)_t;
1087 match(_t,REAL);
1088 _t = _t.getNextSibling();
1089 valueDescriptor = new ValueDescriptor(VALUE_TYPE.DOUBLE, real.getText());
1090 break;
1091 }
1092 case STRING:
1093 {
1094 string = (AST)_t;
1095 match(_t,STRING);
1096 _t = _t.getNextSibling();
1097 valueDescriptor = new ValueDescriptor(VALUE_TYPE.STRING, string.getText());
1098 break;
1099 }
1100 default:
1101 {
1102 throw new NoViableAltException(_t);
1103 }
1104 }
1105 }
1106 catch (RecognitionException ex) {
1107 reportError(ex);
1108 if (_t!=null) {_t = _t.getNextSibling();}
1109 }
1110 _retTree = _t;
1111 return valueDescriptor;
1112 }
1113
1114 public final void pathTypeCheckExpr(AST _t,
1115 BasicFilterExpression filterExpression
1116 ) throws RecognitionException {
1117
1118 AST pathTypeCheckExpr_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1119
1120 try { // for error handling
1121 if (_t==null) _t=ASTNULL;
1122 switch ( _t.getType()) {
1123 case AT_IS_NULL:
1124 {
1125 AST tmp30_AST_in = (AST)_t;
1126 match(_t,AT_IS_NULL);
1127 _t = _t.getNextSibling();
1128
1129 filterExpression.setIsNullFunction(true);
1130
1131 break;
1132 }
1133 case AT_IS_NOT_NULL:
1134 {
1135 AST tmp31_AST_in = (AST)_t;
1136 match(_t,AT_IS_NOT_NULL);
1137 _t = _t.getNextSibling();
1138
1139 filterExpression.setIsNotNullFunction(true);
1140
1141 break;
1142 }
1143 case AT_IS_ARRAY:
1144 {
1145 AST tmp32_AST_in = (AST)_t;
1146 match(_t,AT_IS_ARRAY);
1147 _t = _t.getNextSibling();
1148
1149 filterExpression.setIsArrayFunction(true);
1150
1151 break;
1152 }
1153 case AT_IS_OBJECT:
1154 {
1155 AST tmp33_AST_in = (AST)_t;
1156 match(_t,AT_IS_OBJECT);
1157 _t = _t.getNextSibling();
1158
1159 filterExpression.setIsObjectFunction(true);
1160
1161 break;
1162 }
1163 case AT_IS_VALUE:
1164 {
1165 AST tmp34_AST_in = (AST)_t;
1166 match(_t,AT_IS_VALUE);
1167 _t = _t.getNextSibling();
1168
1169 filterExpression.setIsValueFunction(true);
1170
1171 break;
1172 }
1173 default:
1174 {
1175 throw new NoViableAltException(_t);
1176 }
1177 }
1178 }
1179 catch (RecognitionException ex) {
1180 reportError(ex);
1181 if (_t!=null) {_t = _t.getNextSibling();}
1182 }
1183 _retTree = _t;
1184 }
1185
1186 public final void filterMemberExpr(AST _t,
1187 BasicFilterExpression filterExpression
1188 ) throws RecognitionException {
1189
1190 AST filterMemberExpr_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1191
1192 MemberExpression memberExpr = null;
1193
1194
1195 try { // for error handling
1196 memberExpr=pathNaviExpr(_t);
1197 _t = _retTree;
1198
1199 filterExpression.addMemberExpression(memberExpr);
1200
1201 }
1202 catch (RecognitionException ex) {
1203 reportError(ex);
1204 if (_t!=null) {_t = _t.getNextSibling();}
1205 }
1206 _retTree = _t;
1207 }
1208
1209
1210 public static final String[] _tokenNames = {
1211 "<0>",
1212 "EOF",
1213 "<2>",
1214 "NULL_TREE_LOOKAHEAD",
1215 "PATH",
1216 "MEMBER",
1217 "SIMPLE_KEY",
1218 "COMPLEX_KEY",
1219 "OBJECT_CONSTRUCTION",
1220 "ARRAY_INDEX",
1221 "ARRAY_CONSTRUCTION",
1222 "ARRAY_SLICE",
1223 "MULTI_LEVEL_UP",
1224 "FILTER",
1225 "ABSOLUTE",
1226 "DOT",
1227 "DOTDOT",
1228 "ID",
1229 "WILDCARD",
1230 "LBRACKET",
1231 "STRING",
1232 "RBRACKET",
1233 "COMMA",
1234 "INT",
1235 "SEMI",
1236 "CARET",
1237 "LCURLY",
1238 "RCURLY",
1239 "LPAREN",
1240 "RPAREN",
1241 "OR",
1242 "AND",
1243 "NOT",
1244 "AT_IS_NULL",
1245 "AT_IS_NOT_NULL",
1246 "AT_IS_ARRAY",
1247 "AT_IS_OBJECT",
1248 "AT_IS_VALUE",
1249 "AT_SIZE",
1250 "EQ",
1251 "NE",
1252 "LT",
1253 "LE",
1254 "GT",
1255 "GE",
1256 "AT_VALUE",
1257 "CONTAINS",
1258 "REAL",
1259 "\"null\"",
1260 "\"true\"",
1261 "\"false\"",
1262 "TYPE_CHECK",
1263 "ID_OR_ABSOLUTE",
1264 "INT_OR_REAL_OR_DOTS",
1265 "NEWLINE",
1266 "SINGLE_LINE_COMMENT",
1267 "MULTI_LINE_COMMENT",
1268 "WS",
1269 "DIGIT",
1270 "FRAC",
1271 "EXP",
1272 "ESC",
1273 "ID_START_LETTER",
1274 "ID_LETTER"
1275 };
1276
1277 }
1278
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24
25 header
26 {
27 /*
28 * JasperReports - Free Java Reporting Library.
29 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
30 * http://www.jaspersoft.com
31 *
32 * Unless you have purchased a commercial license agreement from Jaspersoft,
33 * the following license terms apply:
34 *
35 * This program is part of JasperReports.
36 *
37 * JasperReports is free software: you can redistribute it and/or modify
38 * it under the terms of the GNU Lesser General Public License as published by
39 * the Free Software Foundation, either version 3 of the License, or
40 * (at your option) any later version.
41 *
42 * JasperReports is distributed in the hope that it will be useful,
43 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 * GNU Lesser General Public License for more details.
46 *
47 * You should have received a copy of the GNU Lesser General Public License
48 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
49 */
50 package net.sf.jasperreports.engine.json.parser;
51 }
52
53
54 /**
55 * @author Narcis Marcu (narcism@users.sourceforge.net)
56 */
57 class JsonQueryParser extends Parser;
58
59 options {
60 buildAST=true;
61 k=2;
62 defaultErrorHandler=false;
63 }
64
65 tokens {
66 PATH;
67 MEMBER;
68
69 SIMPLE_KEY;
70 COMPLEX_KEY;
71 OBJECT_CONSTRUCTION;
72 ARRAY_INDEX;
73 ARRAY_CONSTRUCTION;
74 ARRAY_SLICE;
75 MULTI_LEVEL_UP;
76
77 FILTER;
78 }
79
80 pathExpr
81 : (ABSOLUTE)? (memberExpr)* EOF!
82 { #pathExpr = #([PATH, "Path Expr:"], #pathExpr); }
83 ;
84
85 memberExpr
86 : pathNaviExpr (filterExprMain)?
87 { #memberExpr = #([MEMBER, "Member expression:"], #memberExpr); }
88 ;
89
90 pathNaviExpr
91 : ( (DOT | DOTDOT)? (ID | WILDCARD ) ) => simpleKeyExpr
92 | ( (DOTDOT)? LBRACKET STRING RBRACKET) => complexKeyExpr
93 | ( (DOTDOT)? LBRACKET (STRING | ID) COMMA (STRING | ID) ) => objectConstructionExpr
94 | ( (DOTDOT)? LBRACKET INT RBRACKET ) => arrayExpr
95 | ( (DOTDOT)? LBRACKET INT COMMA INT ) => arrayConstructionExpr
96 | arraySliceExpr
97 | multiLevelUpExpr
98 ;
99
100 simpleKeyExpr
101 : (DOT | DOTDOT)? (ID | WILDCARD )
102 { #simpleKeyExpr = #([SIMPLE_KEY, "Simple expression:"], #simpleKeyExpr); }
103 ;
104
105 complexKeyExpr
106 : (DOTDOT)? LBRACKET! STRING RBRACKET!
107 { #complexKeyExpr = #([COMPLEX_KEY, "Complex expression:"], #complexKeyExpr); }
108 ;
109
110 objectConstructionExpr
111 : (DOTDOT)? LBRACKET! (STRING | ID) (COMMA! (STRING | ID))+ RBRACKET!
112 { #objectConstructionExpr = #([OBJECT_CONSTRUCTION, "Object construction expression:"], #objectConstructionExpr); }
113 ;
114
115 arrayExpr
116 : (DOTDOT)? LBRACKET! INT RBRACKET!
117 { #arrayExpr = #([ARRAY_INDEX, "Array expression:"], #arrayExpr); }
118 ;
119
120 arrayConstructionExpr
121 : (DOTDOT)? LBRACKET! INT (COMMA! INT)+ RBRACKET!
122 { #arrayConstructionExpr = #([ARRAY_CONSTRUCTION, "Array construction expression:"], #arrayConstructionExpr); }
123 ;
124
125 arraySliceExpr
126 : (DOTDOT)? LBRACKET! ( (INT SEMI (INT)?) | (SEMI INT) ) RBRACKET!
127 { #arraySliceExpr = #([ARRAY_SLICE, "Array slice expression:"], #arraySliceExpr); }
128 ;
129
130 multiLevelUpExpr
131 : CARET (LCURLY! INT RCURLY!)?
132 { #multiLevelUpExpr = #([MULTI_LEVEL_UP, "Multi level up:"], #multiLevelUpExpr); }
133 ;
134
135
136 filterExprMain
137 : LPAREN! filterExpr RPAREN!
138 { #filterExprMain = #([FILTER, "Filter expression main:"], #filterExprMain); }
139 ;
140
141 filterExpr
142 : andExpr (OR^ andExpr)*
143 ;
144
145 andExpr
146 : notExpr (AND^ notExpr)*
147 ;
148
149 notExpr
150 : (NOT^)? basicExpr
151 ;
152
153 basicExpr
154 : filterNaviExpr
155 | LPAREN! filterExpr RPAREN!
156 ;
157
158 filterNaviExpr
159 : pathTypeCheckExpr
160 | sizeFnExpr
161 | valueFnExpr
162 | (pathNaviExpr)+ (pathTypeCheckExpr | sizeFnExpr | operator_to_value)
163 ;
164
165 pathTypeCheckExpr
166 : AT_IS_NULL
167 | AT_IS_NOT_NULL
168 | AT_IS_ARRAY
169 | AT_IS_OBJECT
170 | AT_IS_VALUE
171 ;
172
173 sizeFnExpr
174 : AT_SIZE (EQ | NE | LT | LE | GT | GE) INT
175 ;
176
177 valueFnExpr
178 : AT_VALUE operator_to_value
179 ;
180
181 operator_to_value
182 : (EQ | NE | CONTAINS) STRING
183 | (EQ | NE ) non_string_value
184 | (LT | LE | GT | GE) (INT | REAL)
185 ;
186
187 non_string_value
188 : "null"
189 | "true"
190 | "false"
191 | INT
192 | REAL
193 ;
194
195
196 {
197 import net.sf.jasperreports.engine.json.expression.JsonQLExpression;
198 import net.sf.jasperreports.engine.json.expression.filter.FilterExpression.LOGICAL_OPERATOR;
199 import net.sf.jasperreports.engine.json.expression.filter.FilterExpression.VALUE_TYPE;
200 import net.sf.jasperreports.engine.json.expression.filter.*;
201 import net.sf.jasperreports.engine.json.expression.member.MemberExpression.DIRECTION;
202 import net.sf.jasperreports.engine.json.expression.member.*;
203
204 import net.sf.jasperreports.engine.type.JsonOperatorEnum;
205 }
206
207 /**
208 * @author Narcis Marcu (narcism@users.sourceforge.net)
209 */
210 class JsonQueryWalker extends TreeParser;
211
212 jsonQLExpression returns [JsonQLExpression jsonQLExpression = new JsonQLExpression()]
213 : #(PATH (abs:ABSOLUTE)? (memberExpr[jsonQLExpression])*)
214 {
215 if (abs != null) {
216 jsonQLExpression.setIsAbsolute(true);
217 }
218 }
219 ;
220
221 memberExpr [JsonQLExpression jsonQLExpression]
222 {
223 MemberExpression memberExpr = null;
224 FilterExpression filterExpression = null;
225 }
226 : #(MEMBER
227 memberExpr=pathNaviExpr (filterExpression = filterExprMain)?
228 )
229 {
230 memberExpr.setFilterExpression(filterExpression);
231 jsonQLExpression.addMemberExpression(memberExpr);
232 }
233 ;
234
235 pathNaviExpr returns [MemberExpression memberExpr = null]
236 {
237 DIRECTION dir = DIRECTION.DOWN;
238 }
239 : #(SIMPLE_KEY (dir=direction)? (id:ID | WILDCARD ))
240 {
241 if (id != null) {
242 // object key
243 memberExpr = new ObjectKeyExpression(dir, id.getText());
244 } else {
245 // wildcard
246 memberExpr = new ObjectKeyExpression(dir);
247 }
248 }
249 | #(COMPLEX_KEY (dir=direction)? s:STRING)
250 {
251 memberExpr = new ObjectKeyExpression(dir, s.getText());
252 }
253 | {
254 memberExpr = new ObjectConstructionExpression();
255 }
256 #(OBJECT_CONSTRUCTION (dir=direction)? (addObjectKey[(ObjectConstructionExpression)memberExpr])+)
257 {
258 ((ObjectConstructionExpression)memberExpr).setDirection(dir);
259 }
260 | #(ARRAY_INDEX (dir=direction)? n:INT)
261 {
262 memberExpr = new ArrayIndexExpression(dir, Integer.parseInt(n.getText()));
263 }
264 | {
265 memberExpr = new ArrayConstructionExpression();
266 }
267 #(ARRAY_CONSTRUCTION (dir=direction)? (addArrayIndex[(ArrayConstructionExpression)memberExpr])+)
268 {
269 ((ArrayConstructionExpression)memberExpr).setDirection(dir);
270 }
271 | #(ARRAY_SLICE (dir=direction)? (sliceStart:INT)? SEMI (sliceEnd:INT)?)
272 {
273 Integer start = null, end = null;
274
275 if (sliceStart != null) {
276 start = Integer.valueOf(sliceStart.getText());
277 }
278 if (sliceEnd != null) {
279 end = Integer.valueOf(sliceEnd.getText());
280 }
281
282 memberExpr = new ArraySliceExpression(dir, start, end);
283 }
284 | #(MULTI_LEVEL_UP CARET (levelUp:INT)?)
285 {
286 int level = 1;
287 if (levelUp != null) {
288 level = Integer.parseInt(levelUp.getText());
289 }
290 memberExpr = new MultiLevelUpExpression(level);
291 }
292 ;
293
294 addObjectKey [ObjectConstructionExpression objConstrExpr]
295 : (str:STRING | id:ID)
296 {
297 String key = null;
298 if (str != null) {
299 key = str.getText();
300 } else {
301 key = id.getText();
302 }
303 objConstrExpr.addKey(key);
304 }
305 ;
306
307 addArrayIndex [ArrayConstructionExpression arrayConstrExpr]
308 : idx:INT
309 {
310 arrayConstrExpr.addIndex(Integer.parseInt(idx.getText()));
311 }
312 ;
313
314 filterExprMain returns [FilterExpression filterExpression = null]
315 : #(FILTER filterExpression=filterExpr)
316 ;
317
318 filterExpr returns [FilterExpression result = null]
319 {
320 FilterExpression fe1, fe2;
321 }
322 : #(AND fe1=filterExpr fe2=filterExpr)
323 {
324 result = new CompoundFilterExpression(fe1, fe2, LOGICAL_OPERATOR.AND);
325 }
326 | #(OR fe1=filterExpr fe2=filterExpr)
327 {
328 result = new CompoundFilterExpression(fe1, fe2, LOGICAL_OPERATOR.OR);
329 }
330 | #(NOT fe1=filterExpr)
331 {
332 result = new NotFilterExpression(fe1);
333 }
334 | result=filterExprMinimal
335 ;
336
337 filterExprMinimal returns [BasicFilterExpression filterExpression = new BasicFilterExpression()]
338 {
339 ValueDescriptor val = null;
340 JsonOperatorEnum op = null;
341 }
342 : (sizeFn:AT_SIZE | AT_VALUE) op=operator val=value
343 {
344 if (sizeFn != null) {
345 filterExpression.setIsSizeFunction(true);
346 }
347 filterExpression.setOperator(op);
348 filterExpression.setValueDescriptor(val);
349 }
350 | pathTypeCheckExpr[filterExpression]
351 | (filterMemberExpr[filterExpression])+ (pathTypeCheckExpr[filterExpression] | ((szFn:AT_SIZE)? op=operator val=value))
352 {
353 if (szFn != null) {
354 filterExpression.setIsSizeFunction(true);
355 }
356 filterExpression.setOperator(op);
357 filterExpression.setValueDescriptor(val);
358 }
359 ;
360
361 pathTypeCheckExpr [BasicFilterExpression filterExpression]
362 : AT_IS_NULL
363 {
364 filterExpression.setIsNullFunction(true);
365 }
366 | AT_IS_NOT_NULL
367 {
368 filterExpression.setIsNotNullFunction(true);
369 }
370 | AT_IS_ARRAY
371 {
372 filterExpression.setIsArrayFunction(true);
373 }
374 | AT_IS_OBJECT
375 {
376 filterExpression.setIsObjectFunction(true);
377 }
378 | AT_IS_VALUE
379 {
380 filterExpression.setIsValueFunction(true);
381 }
382 ;
383
384 filterMemberExpr [BasicFilterExpression filterExpression]
385 {
386 MemberExpression memberExpr = null;
387 }
388 : memberExpr=pathNaviExpr
389 {
390 filterExpression.addMemberExpression(memberExpr);
391 }
392 ;
393
394 direction returns [DIRECTION dir = DIRECTION.DOWN]
395 : DOT
396 | DOTDOT
397 { dir = DIRECTION.ANYWHERE_DOWN; }
398 ;
399
400 operator returns [JsonOperatorEnum operator = null]
401 : EQ
402 { operator = JsonOperatorEnum.EQ; }
403 | NE
404 { operator = JsonOperatorEnum.NE; }
405 | LT
406 { operator = JsonOperatorEnum.LT; }
407 | LE
408 { operator = JsonOperatorEnum.LE; }
409 | GT
410 { operator = JsonOperatorEnum.GT; }
411 | GE
412 { operator = JsonOperatorEnum.GE; }
413 | CONTAINS
414 { operator = JsonOperatorEnum.CONTAINS; }
415 ;
416
417 value returns [ValueDescriptor valueDescriptor = null]
418 : "null"
419 { valueDescriptor = new ValueDescriptor(VALUE_TYPE.NULL, "null"); }
420 | "true"
421 { valueDescriptor = new ValueDescriptor(VALUE_TYPE.BOOLEAN, "true"); }
422 | "false"
423 { valueDescriptor = new ValueDescriptor(VALUE_TYPE.BOOLEAN, "false"); }
424 | integer: INT
425 { valueDescriptor = new ValueDescriptor(VALUE_TYPE.INTEGER, integer.getText()); }
426 | real: REAL
427 { valueDescriptor = new ValueDescriptor(VALUE_TYPE.DOUBLE, real.getText()); }
428 | string: STRING
429 { valueDescriptor = new ValueDescriptor(VALUE_TYPE.STRING, string.getText()); }
430 ;
431
432
433 /**
434 * @author Narcis Marcu (narcism@users.sourceforge.net)
435 */
436 class JsonQueryLexer extends Lexer;
437
438 options {
439 defaultErrorHandler=false;
440 k=2;
441 charVocabulary='\u0000'..'\uFFFE';
442 filter=WS;
443 }
444
445 {
446 @Override
447 public void reportError(RecognitionException re) {
448 throw new RuntimeException(re);
449 }
450
451 }
452
453 SEMI
454 : ':'
455 ;
456 COMMA
457 : ','
458 ;
459 WILDCARD
460 : '*'
461 ;
462 CARET
463 : '^'
464 ;
465 LCURLY
466 : '{'
467 ;
468 RCURLY
469 : '}'
470 ;
471 LBRACKET
472 : '['
473 ;
474 RBRACKET
475 : ']'
476 ;
477 LPAREN
478 : '('
479 ;
480 RPAREN
481 : ')'
482 ;
483 AND
484 : "&&"
485 ;
486 OR
487 : "||"
488 ;
489 NOT
490 : '!'
491 ;
492 EQ
493 : "=="
494 ;
495 NE
496 : "!="
497 ;
498 CONTAINS
499 : "*="
500 ;
501 LT
502 : "<"
503 ;
504 LE
505 : "<="
506 ;
507 GT
508 : ">"
509 ;
510 GE
511 : ">="
512 ;
513 AT_SIZE
514 : "@size"
515 ;
516 AT_VALUE
517 : "@val"
518 ;
519 TYPE_CHECK
520 : ("@isNotNull") => AT_IS_NOT_NULL { $setType(AT_IS_NOT_NULL); }
521 | ("@isNull") => AT_IS_NULL { $setType(AT_IS_NULL); }
522 | ("@isArray") => AT_IS_ARRAY { $setType(AT_IS_ARRAY); }
523 | ("@isObject") => AT_IS_OBJECT { $setType(AT_IS_OBJECT); }
524 | ("@isValue") => AT_IS_VALUE { $setType(AT_IS_VALUE); }
525 ;
526 STRING
527 : '"'! (ESC | ~('"' | '\\'))* '"'!
528 ;
529 ID_OR_ABSOLUTE
530 : { getColumn() == 1 }? ( '$' ID_LETTER ) => ID { $setType(ID); }
531 | { getColumn() == 1 && getLine() == 1 }? '$' { $setType(ABSOLUTE); }
532 | { getColumn() == 1 }? ( ('a'..'z' | 'A'..'Z' | '_') (ID_LETTER)? ) => ID { $setType(ID); }
533 | { getColumn() == 1 && getLine() > 1 || getColumn() > 1 }? ID { $setType(ID); }
534 ;
535 INT_OR_REAL_OR_DOTS
536 : ( ('-')? (DIGIT)* FRAC ) => REAL { $setType(REAL); }
537 | ( "..") => DOTDOT { $setType(DOTDOT); }
538 | INT { $setType(INT); }
539 | DOT { $setType(DOT); }
540 ;
541 NEWLINE
542 : ("\r\n" // DOS
543 | '\r' // MAC
544 | '\n' // Unix
545 )
546 {
547 newline();
548 $setType(Token.SKIP);
549 }
550 ;
551 SINGLE_LINE_COMMENT
552 : "//" (~('\r'|'\n'))* ("\r\n"|'\r'|'\n')?
553 {
554 newline();
555 $setType(Token.SKIP);
556 }
557 ;
558 MULTI_LINE_COMMENT
559 : "/*" (options {greedy=false;} :.)* "*/"
560 { $setType(Token.SKIP); }
561 ;
562 protected ABSOLUTE
563 : '$'
564 ;
565 protected ID
566 : ID_START_LETTER (ID_LETTER)*
567 ;
568 protected INT
569 : ('-')? (DIGIT)+
570 ;
571 protected REAL
572 : ('-')? (DIGIT)* FRAC (EXP)?
573 ;
574 protected DOT
575 : '.'
576 ;
577 protected DOTDOT
578 : ".."
579 ;
580 protected WS
581 : ' '
582 ;
583 protected DIGIT
584 : '0'..'9'
585 ;
586 protected FRAC
587 : '.' (DIGIT)+
588 ;
589 protected EXP
590 : ('e'|'E') ('+'|'-')? (DIGIT)+
591 ;
592 protected ESC
593 : '\\'(
594 'n' { $setText("\n"); }
595 | 'r' { $setText("\r"); }
596 | 't' { $setText("\t"); }
597 | '"' { $setText("\""); }
598 )
599 ;
600 protected ID_START_LETTER
601 : 'a'..'z'
602 | 'A'..'Z'
603 | '$'
604 | '_'
605 ;
606 protected ID_LETTER
607 : ID_START_LETTER
608 | DIGIT
609 ;
610 protected AT_IS_NULL
611 : "@isNull"
612 ;
613 protected AT_IS_NOT_NULL
614 : "@isNotNull"
615 ;
616 protected AT_IS_ARRAY
617 : "@isArray"
618 ;
619 protected AT_IS_OBJECT
620 : "@isObject"
621 ;
622 protected AT_IS_VALUE
623 : "@isValue"
624 ;
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.query;
24
25 import java.io.InputStream;
26 import java.util.ArrayList;
27 import java.util.List;
28 import java.util.Locale;
29 import java.util.Map;
30 import java.util.TimeZone;
31
32 import net.sf.jasperreports.data.RewindableDataSourceProvider;
33 import net.sf.jasperreports.engine.JRDataSource;
34 import net.sf.jasperreports.engine.JRDataset;
35 import net.sf.jasperreports.engine.JRException;
36 import net.sf.jasperreports.engine.JRValueParameter;
37 import net.sf.jasperreports.engine.JasperReportsContext;
38 import net.sf.jasperreports.engine.data.JRAbstractTextDataSource;
39 import net.sf.jasperreports.engine.data.JsonData;
40 import net.sf.jasperreports.engine.data.JsonDataCollection;
41 import net.sf.jasperreports.engine.data.TextDataSourceAttributes;
42
43 import org.apache.commons.logging.Log;
44 import org.apache.commons.logging.LogFactory;
45
46 /**
47 * @author Narcis Marcu (narcism@users.sourceforge.net)
48 */
49 public abstract class AbstractJsonQueryExecuter<T extends JRAbstractTextDataSource & JsonData> extends JRAbstractQueryExecuter
50 {
51 private static final Log log = LogFactory.getLog(AbstractJsonQueryExecuter.class);
52
53 private JsonData datasource;
54
55
56 /**
57 *
58 */
59 public AbstractJsonQueryExecuter(
60 JasperReportsContext jasperReportsContext,
61 JRDataset dataset,
62 Map<String, ? extends JRValueParameter> parametersMap
63 )
64 {
65 super(jasperReportsContext, dataset, parametersMap);
66 parseQuery();
67 }
68
69 @Override
70 public JRDataSource createDatasource() throws JRException
71 {
72 TextDataSourceAttributes textAttributes = getTextAttributes();
73
74 InputStream jsonInputStream = (InputStream) getParameterValue(JsonQueryExecuterFactory.JSON_INPUT_STREAM);
75 if (jsonInputStream != null) {
76 T jsonDatasource = getJsonDataInstance(jsonInputStream);
77 jsonDatasource.setTextAttributes(textAttributes);
78 datasource = jsonDatasource;
79 } else {
80 String jsonSource = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_SOURCE);
81 if (jsonSource != null) {
82 T jsonDatasource = getJsonDataInstance(jsonSource);
83 jsonDatasource.setTextAttributes(textAttributes);
84 datasource = jsonDatasource;
85 } else {
86 List<String> jsonSources = (List<String>) getParameterValue(JsonQueryExecuterFactory.JSON_SOURCES, true);
87 if (jsonSources != null) {
88 List<RewindableDataSourceProvider<T>> jsonProviders = new ArrayList<>(jsonSources.size());
89
90 for (String source : jsonSources) {
91 RewindableDataSourceProvider<T> jsonProvider = getJsonDataProviderInstance(source, textAttributes);
92 jsonProviders.add(jsonProvider);
93 }
94 datasource = new JsonDataCollection(jsonProviders);
95 } else {
96 if (log.isWarnEnabled()) {
97 log.warn("No JSON source was provided.");
98 }
99 }
100 }
101 }
102
103 return datasource;
104 }
105
106 protected abstract T getJsonDataInstance(InputStream jsonInputStream) throws JRException;
107
108 protected abstract T getJsonDataInstance(String jsonSource) throws JRException;
109
110 protected abstract RewindableDataSourceProvider<T> getJsonDataProviderInstance(
111 String source, TextDataSourceAttributes textAttributes);
112
113 protected TextDataSourceAttributes getTextAttributes()
114 {
115 TextDataSourceAttributes attributes = new TextDataSourceAttributes();
116 String dateFormatPattern = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_DATE_PATTERN);
117 if(dateFormatPattern != null){
118 attributes.setDatePattern(dateFormatPattern);
119 }
120
121 String numberFormatPattern = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_NUMBER_PATTERN);
122 if(numberFormatPattern != null){
123 attributes.setNumberPattern(numberFormatPattern);
124 }
125
126 Locale jsonLocale = (Locale) getParameterValue(JsonQueryExecuterFactory.JSON_LOCALE, true);
127 if (jsonLocale != null) {
128 attributes.setLocale(jsonLocale);
129 } else {
130 String jsonLocaleCode = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_LOCALE_CODE);
131 if (jsonLocaleCode != null) {
132 attributes.setLocale(jsonLocaleCode);
133 }
134 }
135
136 TimeZone jsonTimezone = (TimeZone) getParameterValue(JsonQueryExecuterFactory.JSON_TIME_ZONE, true);
137 if (jsonTimezone != null) {
138 attributes.setTimeZone(jsonTimezone);
139 } else {
140 String jsonTimezoneId = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_TIMEZONE_ID);
141 if (jsonTimezoneId != null) {
142 attributes.setTimeZone(jsonTimezoneId);
143 }
144 }
145
146 return attributes;
147 }
148
149 @Override
150 public void close()
151 {
152 //NOP
153 }
154
155 @Override
156 public boolean cancelQuery() throws JRException
157 {
158 //nothing to cancel
159 return false;
160 }
161
162 }
6565 public static final String EXCEPTION_MESSAGE_KEY_UNKNOWN_QUERY_RUN_TYPE = "query.hibernate.unknown.query.run.type";
6666 public static final String EXCEPTION_MESSAGE_KEY_UNRESOLVED_TYPE_CONSTANT = "query.hibernate.unresolved.type.constant";
6767
68 protected static final String CANONICAL_LANGUAGE = "HQL";
68 public static final String CANONICAL_LANGUAGE = "HQL";
6969
7070 private static final Map<Class<?>,Type> hibernateTypeMap;
7171
9393 */
9494 public static final String PROPERTY_TIME_ZONE = JRPropertiesUtil.PROPERTY_PREFIX + "jdbc.time.zone";
9595
96 //FIXME to be documented soon
9697 public static final String PROPERTY_PARAMETERS_TIME_ZONE = JRPropertiesUtil.PROPERTY_PREFIX + "jdbc.parameters.time.zone";
9798
9899 public static final String PROPERTY_FIELDS_TIME_ZONE = JRPropertiesUtil.PROPERTY_PREFIX + "jdbc.fields.time.zone";
108108
109109 private static final Log log = LogFactory.getLog(JRJpaQueryExecuter.class);
110110
111 protected static final String CANONICAL_LANGUAGE = "EJBQL";
111 public static final String CANONICAL_LANGUAGE = "EJBQL";
112112
113113 private final Integer reportMaxCount;
114114
5555 {
5656 private static final Log log = LogFactory.getLog(JRXPathQueryExecuter.class);
5757
58 protected static final String CANONICAL_LANGUAGE = "XPath";
58 public static final String CANONICAL_LANGUAGE = "XPath";
5959
6060 private JRXmlDataSource datasource;
6161
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.query;
24
25 import java.io.InputStream;
26 import java.util.Map;
27
28 import net.sf.jasperreports.data.RewindableDataSourceProvider;
29 import net.sf.jasperreports.engine.JRDataset;
30 import net.sf.jasperreports.engine.JRException;
31 import net.sf.jasperreports.engine.JRValueParameter;
32 import net.sf.jasperreports.engine.JasperReportsContext;
33 import net.sf.jasperreports.engine.data.JsonQLDataSource;
34 import net.sf.jasperreports.engine.data.JsonQLDataSourceProvider;
35 import net.sf.jasperreports.engine.data.TextDataSourceAttributes;
36 import net.sf.jasperreports.engine.util.JRStringUtil;
37
38 /**
39 * Simple JSON query executer implementation.
40 *
41 * @author Narcis Marcu (narcism@users.sourceforge.net)
42 */
43 public class JsonQLQueryExecuter extends AbstractJsonQueryExecuter<JsonQLDataSource>
44 {
45 public static final String CANONICAL_LANGUAGE = "JSONQL";
46
47 /**
48 *
49 */
50 public JsonQLQueryExecuter(
51 JasperReportsContext jasperReportsContext,
52 JRDataset dataset,
53 Map<String, ? extends JRValueParameter> parametersMap
54 )
55 {
56 super(jasperReportsContext, dataset, parametersMap);
57 }
58
59 @Override
60 protected String getCanonicalQueryLanguage()
61 {
62 return CANONICAL_LANGUAGE;
63 }
64
65 @Override
66 protected String getParameterReplacement(String parameterName)
67 {
68 Object parameterValue = getParameterValue(parameterName);
69
70 if (parameterValue == null) {
71 return null;
72 }
73
74 Class<?> valueClass= parameterValue.getClass();
75
76 if(!(Number.class.equals(valueClass) || Boolean.class.equals(valueClass))) {
77 StringBuilder sb = new StringBuilder("\"");
78
79 sb.append(JRStringUtil.escapeJavaStringLiteral((String) parameterValue));
80 sb.append("\"");
81
82 return sb.toString();
83 }
84
85 return String.valueOf(parameterValue);
86 }
87
88 @Override
89 protected JsonQLDataSource getJsonDataInstance(InputStream jsonInputStream) throws JRException {
90 return new JsonQLDataSource(jsonInputStream, getQueryString());
91 }
92
93 @Override
94 protected JsonQLDataSource getJsonDataInstance(String jsonSource) throws JRException {
95 return new JsonQLDataSource(getJasperReportsContext(), jsonSource, getQueryString());
96 }
97
98 @Override
99 protected RewindableDataSourceProvider<JsonQLDataSource> getJsonDataProviderInstance(String source, TextDataSourceAttributes textAttributes) {
100 return new JsonQLDataSourceProvider(getJasperReportsContext(), source, getQueryString(), textAttributes);
101 }
102 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.query;
24
25 import java.util.Map;
26
27 import net.sf.jasperreports.engine.JRDataset;
28 import net.sf.jasperreports.engine.JRException;
29 import net.sf.jasperreports.engine.JRValueParameter;
30 import net.sf.jasperreports.engine.JasperReportsContext;
31
32 /**
33 * JSON QL query executer factory.
34 * <p/>
35 * The factory creates {@link JsonQLQueryExecuter JsonQLQueryExecuter}
36 * query executers.
37 *
38 * @author Narcis Marcu (narcism@users.sourceforge.net)
39 */
40 public class JsonQLQueryExecuterFactory extends JsonQueryExecuterFactory
41 {
42 @Override
43 public JRQueryExecuter createQueryExecuter(
44 JasperReportsContext jasperReportsContext,
45 JRDataset dataset,
46 Map<String, ? extends JRValueParameter> parameters
47 ) throws JRException
48 {
49 return new JsonQLQueryExecuter(jasperReportsContext, dataset, parameters);
50 }
51
52 }
2323 package net.sf.jasperreports.engine.query;
2424
2525 import java.io.InputStream;
26 import java.util.ArrayList;
27 import java.util.List;
28 import java.util.Locale;
2926 import java.util.Map;
30 import java.util.TimeZone;
3127
32 import org.apache.commons.logging.Log;
33 import org.apache.commons.logging.LogFactory;
34
35 import net.sf.jasperreports.engine.JRDataSource;
28 import net.sf.jasperreports.data.RewindableDataSourceProvider;
3629 import net.sf.jasperreports.engine.JRDataset;
3730 import net.sf.jasperreports.engine.JRException;
3831 import net.sf.jasperreports.engine.JRValueParameter;
3932 import net.sf.jasperreports.engine.JasperReportsContext;
40 import net.sf.jasperreports.engine.data.JsonData;
41 import net.sf.jasperreports.engine.data.JsonDataCollection;
4233 import net.sf.jasperreports.engine.data.JsonDataSource;
4334 import net.sf.jasperreports.engine.data.JsonDataSourceProvider;
4435 import net.sf.jasperreports.engine.data.TextDataSourceAttributes;
4839 *
4940 * @author Narcis Marcu (narcism@users.sourceforge.net)
5041 */
51 public class JsonQueryExecuter extends JRAbstractQueryExecuter
42 public class JsonQueryExecuter extends AbstractJsonQueryExecuter<JsonDataSource>
5243 {
53 private static final Log log = LogFactory.getLog(JsonQueryExecuter.class);
54
55 protected static final String CANONICAL_LANGUAGE = "JSON";
56
57 private JsonData datasource;
44 public static final String CANONICAL_LANGUAGE = "JSON";
5845
5946 /**
6047 *
6653 )
6754 {
6855 super(jasperReportsContext, dataset, parametersMap);
69 parseQuery();
7056 }
7157
7258 @Override
8268 }
8369
8470 @Override
85 public JRDataSource createDatasource() throws JRException
86 {
87 TextDataSourceAttributes textAttributes = getTextAttributes();
88
89 InputStream jsonInputStream = (InputStream) getParameterValue(JsonQueryExecuterFactory.JSON_INPUT_STREAM);
90 if (jsonInputStream != null) {
91 JsonDataSource jsonDatasource = new JsonDataSource(jsonInputStream, getQueryString());
92 jsonDatasource.setTextAttributes(textAttributes);
93 datasource = jsonDatasource;
94 } else {
95 String jsonSource = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_SOURCE);
96 if (jsonSource != null) {
97 JsonDataSource jsonDatasource = new JsonDataSource(getJasperReportsContext(), jsonSource, getQueryString());
98 jsonDatasource.setTextAttributes(textAttributes);
99 datasource = jsonDatasource;
100 } else {
101 List<String> jsonSources = (List<String>) getParameterValue(JsonQueryExecuterFactory.JSON_SOURCES, true);
102 if (jsonSources != null) {
103 List<JsonDataSourceProvider> jsonProviders =
104 new ArrayList<JsonDataSourceProvider>(jsonSources.size());
105 for (String source : jsonSources) {
106 JsonDataSourceProvider jsonProvider = new JsonDataSourceProvider(getJasperReportsContext(),
107 source, getQueryString(), textAttributes);
108 jsonProviders.add(jsonProvider);
109 }
110 datasource = new JsonDataCollection<JsonDataSource>(jsonProviders);
111 } else {
112 if (log.isWarnEnabled()) {
113 log.warn("No JSON source was provided.");
114 }
115 }
116 }
117 }
118
119 return datasource;
120 }
121
122 protected TextDataSourceAttributes getTextAttributes()
123 {
124 TextDataSourceAttributes attributes = new TextDataSourceAttributes();
125 String dateFormatPattern = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_DATE_PATTERN);
126 if(dateFormatPattern != null){
127 attributes.setDatePattern(dateFormatPattern);
128 }
129
130 String numberFormatPattern = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_NUMBER_PATTERN);
131 if(numberFormatPattern != null){
132 attributes.setNumberPattern(numberFormatPattern);
133 }
134
135 Locale jsonLocale = (Locale) getParameterValue(JsonQueryExecuterFactory.JSON_LOCALE, true);
136 if (jsonLocale != null) {
137 attributes.setLocale(jsonLocale);
138 } else {
139 String jsonLocaleCode = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_LOCALE_CODE);
140 if (jsonLocaleCode != null) {
141 attributes.setLocale(jsonLocaleCode);
142 }
143 }
144
145 TimeZone jsonTimezone = (TimeZone) getParameterValue(JsonQueryExecuterFactory.JSON_TIME_ZONE, true);
146 if (jsonTimezone != null) {
147 attributes.setTimeZone(jsonTimezone);
148 } else {
149 String jsonTimezoneId = getStringParameterOrProperty(JsonQueryExecuterFactory.JSON_TIMEZONE_ID);
150 if (jsonTimezoneId != null) {
151 attributes.setTimeZone(jsonTimezoneId);
152 }
153 }
154
155 return attributes;
71 protected JsonDataSource getJsonDataInstance(InputStream jsonInputStream) throws JRException {
72 return new JsonDataSource(jsonInputStream, getQueryString());
15673 }
15774
15875 @Override
159 public void close()
160 {
161 //NOP
76 protected JsonDataSource getJsonDataInstance(String jsonSource) throws JRException {
77 return new JsonDataSource(getJasperReportsContext(), jsonSource, getQueryString());
16278 }
16379
16480 @Override
165 public boolean cancelQuery() throws JRException
166 {
167 //nothing to cancel
168 return false;
81 protected RewindableDataSourceProvider<JsonDataSource> getJsonDataProviderInstance(String source, TextDataSourceAttributes textAttributes) {
82 return new JsonDataSourceProvider(getJasperReportsContext(), source, getQueryString(), textAttributes);
16983 }
170
17184 }
3333 /**
3434 * JSON query executer factory.
3535 * <p/>
36 * The factory creates {@link net.sf.jasperreports.engine.query.JsonQueryExecuter JRJsonQueryExecuter}
36 * The factory creates {@link net.sf.jasperreports.engine.query.JsonQueryExecuter JsonQueryExecuter}
3737 * query executers.
3838 *
3939 * @author Narcis Marcu (narcism@users.sourceforge.net)
3333 GT(">", "Greater than"),
3434 GE(">=", "Greater or equal"),
3535 EQ("==", "Equal"),
36 NE("!=", "Not equal");
36 NE("!=", "Not equal"),
37 CONTAINS("*=", "Contains");
3738
3839 private final transient String value;
3940 private final transient String name;
5455 public String getName() {
5556 return name;
5657 }
58
59 @Override
60 public String toString() {
61 return value;
62 }
5763 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.type;
24
25 import net.sf.jasperreports.engine.JRParameter;
26 import net.sf.jasperreports.engine.JRPropertiesUtil;
27
28 /**
29 * Defines specific moments in time when the default value expression of a parameter is supposed to be evaluated.
30 * @author Teodor Danciu (teodord@users.sourceforge.net)
31 */
32 public enum ParameterEvaluationTimeEnum implements NamedEnum
33 {
34 /**
35 * Evaluate the parameter default value expression before parameter contributors.
36 */
37 EARLY("Early"),
38 /**
39 * Evaluate the parameter default value expression after parameter contributors.
40 */
41 LATE("Late");
42
43 /**
44 * Provides a default value for the {@link JRParameter#getEvaluationTime()} property of parameters and can be set either globally or at dataset level.
45 */
46 public static final String PROPERTY_EVALUATION_TIME = JRPropertiesUtil.PROPERTY_PREFIX + "parameter.evaluation.time";
47
48 private final String name;
49
50 private ParameterEvaluationTimeEnum(String name)
51 {
52 this.name = name;
53 }
54
55 @Override
56 public String getName()
57 {
58 return name;
59 }
60
61 public static ParameterEvaluationTimeEnum byName(String name)
62 {
63 return EnumUtil.getEnumByName(values(), name);
64 }
65 }
3030 public enum PartEvaluationTimeType implements NamedEnum
3131 {
3232 /**
33 * Evaluate the part immediatelly.
33 * Evaluate the part immediately.
3434 */
3535 NOW("Now"),
3636 /**
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.type;
24
25 import net.sf.jasperreports.engine.DatasetPropertyExpression;
26 import net.sf.jasperreports.engine.JRPropertiesUtil;
27
28 /**
29 * Defines specific moments in time when the property expression of a dataset is supposed to be evaluated.
30 * @author Teodor Danciu (teodord@users.sourceforge.net)
31 */
32 public enum PropertyEvaluationTimeEnum implements NamedEnum
33 {
34 /**
35 * Evaluate the property expression before parameter contributors.
36 */
37 EARLY("Early"),
38 /**
39 * Evaluate the property expression after parameter contributors.
40 */
41 LATE("Late"),
42 /**
43 * Evaluate the property expression at the end of the report.
44 */
45 REPORT("Report");
46
47 /**
48 * Provides a default value for the {@link DatasetPropertyExpression#getEvaluationTime()} setting of dataset property expressions and can be set either globally or at dataset level.
49 */
50 public static final String PROPERTY_EVALUATION_TIME = JRPropertiesUtil.PROPERTY_PREFIX + "property.evaluation.time";
51
52 private final String name;
53
54 private PropertyEvaluationTimeEnum(String name)
55 {
56 this.name = name;
57 }
58
59 @Override
60 public String getName()
61 {
62 return name;
63 }
64
65 public static PropertyEvaluationTimeEnum byName(String name)
66 {
67 return EnumUtil.getEnumByName(values(), name);
68 }
69 }
4040 import java.util.Map;
4141 import java.util.Set;
4242 import java.util.SortedSet;
43
44 import org.apache.commons.logging.Log;
45 import org.apache.commons.logging.LogFactory;
46 import org.jfree.chart.plot.PlotOrientation;
47 import org.jfree.data.time.Day;
4348
4449 import net.sf.jasperreports.charts.JRAreaPlot;
4550 import net.sf.jasperreports.charts.JRBar3DPlot;
9196 import net.sf.jasperreports.crosstabs.type.CrosstabPercentageEnum;
9297 import net.sf.jasperreports.crosstabs.type.CrosstabRowPositionEnum;
9398 import net.sf.jasperreports.crosstabs.type.CrosstabTotalPositionEnum;
99 import net.sf.jasperreports.engine.DatasetPropertyExpression;
94100 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
95101 import net.sf.jasperreports.engine.ExpressionReturnValue;
96102 import net.sf.jasperreports.engine.JRAnchor;
172178 import net.sf.jasperreports.engine.type.SortOrderEnum;
173179 import net.sf.jasperreports.engine.type.StretchTypeEnum;
174180 import net.sf.jasperreports.engine.type.TabStopAlignEnum;
175 import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum;
176181 import net.sf.jasperreports.engine.type.WhenResourceMissingTypeEnum;
177182 import net.sf.jasperreports.engine.xml.JRXmlWriter;
178183 import net.sf.jasperreports.export.WriterExporterOutput;
179
180 import org.apache.commons.logging.Log;
181 import org.apache.commons.logging.LogFactory;
182 import org.jfree.chart.plot.PlotOrientation;
183 import org.jfree.data.time.Day;
184184
185185
186186 /**
401401 write( "jasperDesign.setPageWidth({0, number, #});\n", report.getPageWidth());
402402 write( "jasperDesign.setPageHeight({0, number, #});\n", report.getPageHeight());
403403 write( "jasperDesign.setOrientation({0});\n", report.getOrientationValue(), OrientationEnum.PORTRAIT);
404 write( "jasperDesign.setWhenNoDataType({0});\n", report.getWhenNoDataTypeValue(), WhenNoDataTypeEnum.NO_PAGES);
404 write( "jasperDesign.setWhenNoDataType({0});\n", report.getWhenNoDataTypeValue());
405405 write( "jasperDesign.setColumnWidth({0, number, #});\n", report.getColumnWidth());
406406 write( "jasperDesign.setColumnSpacing({0, number, #});\n", report.getColumnSpacing());
407407 write( "jasperDesign.setLeftMargin({0, number, #});\n", report.getLeftMargin());
677677
678678 write( parameterName + ".setForPrompting({0});\n", parameter.isForPrompting(), true);
679679
680 write( parameterName + ".setEvaluationTime({0});\n", parameter.getEvaluationTime());
681
680682 writeProperties( parameter, parameterName);
681683
682684 writeExpression( parameter.getDefaultValueExpression(), parameterName, "DefaultValueExpression");
712714 write( fieldName + ".setDescription(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(field.getDescription()));
713715 write( fieldName + ".setValueClassName(\"{0}\");\n", field.getValueClassName());
714716 writeProperties( field, fieldName);
717 writePropertyExpressions( field.getPropertyExpressions(), fieldName);
715718 flush();
716719 }
717720 }
991994 /**
992995 *
993996 */
997 protected void writePropertyExpressions( DatasetPropertyExpression[] propertyExpressions, String propertyHolderName)
998 {
999 if (propertyExpressions != null && propertyExpressions.length > 0)
1000 {
1001 for (int i = 0; i < propertyExpressions.length; i++)
1002 {
1003 writePropertyExpression( propertyExpressions[i], propertyHolderName + "PropertyExpression" + i);
1004 write( propertyHolderName + ".addPropertyExpression(" + propertyHolderName + "PropertyExpression" + i +");\n");
1005 }
1006 flush();
1007 }
1008 }
1009
1010
1011 /**
1012 *
1013 */
9941014 protected void writePropertyExpression( JRPropertyExpression propertyExpression, String propertyExpressionName)
9951015 {
9961016 if(propertyExpression != null)
9971017 {
9981018 write( "JRDesignPropertyExpression " + propertyExpressionName + " = new JRDesignPropertyExpression();\n");
9991019 write( propertyExpressionName + ".setName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(propertyExpression.getName()));
1020 writeExpression( propertyExpression.getValueExpression(), propertyExpressionName, "ValueExpression");
1021
1022 flush();
1023 }
1024 }
1025
1026
1027 /**
1028 *
1029 */
1030 protected void writePropertyExpression( DatasetPropertyExpression propertyExpression, String propertyExpressionName)
1031 {
1032 if(propertyExpression != null)
1033 {
1034 write( "DesignDatasetPropertyExpression " + propertyExpressionName + " = new DesignDatasetPropertyExpression();\n");
1035 write( propertyExpressionName + ".setName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(propertyExpression.getName()));
1036 write( propertyExpressionName + ".setEvaluationTime({0});\n", propertyExpression.getEvaluationTime());
10001037 writeExpression( propertyExpression.getValueExpression(), propertyExpressionName, "ValueExpression");
10011038
10021039 flush();
34523489 write( datasetName + ".setWhenResourceMissingType({0});\n", dataset.getWhenResourceMissingTypeValue(), WhenResourceMissingTypeEnum.NULL);
34533490
34543491 writeProperties( dataset, datasetName);
3492 writePropertyExpressions( dataset.getPropertyExpressions(), datasetName);
34553493
34563494 writeDatasetContents( dataset, datasetName);
34573495 flush();
3434 *
3535 * To be removed on upgrade to BeanUtils 1.8.1.
3636 *
37 * @deprecated To be removed.
3738 * @author Lucian Chirita (lucianc@users.sourceforge.net)
3839 */
3940 public class JRFloatLocaleConverter extends DecimalLocaleConverter
5757 */
5858 public static final String PROPERTY_AWT_IGNORE_MISSING_FONT = JRPropertiesUtil.PROPERTY_PREFIX + "awt.ignore.missing.font";
5959
60 private static final String PROPERTY_AWT_SUPERSCRIPT_FIX_ENABLED = JRPropertiesUtil.PROPERTY_PREFIX + "awt.superscript.fix.enabled";
60 public static final String PROPERTY_AWT_SUPERSCRIPT_FIX_ENABLED = JRPropertiesUtil.PROPERTY_PREFIX + "awt.superscript.fix.enabled";
6161
6262 private static final boolean AWT_SUPERSCRIPT_FIX_ENABLED =
6363 System.getProperty("java.version").startsWith("1.6")
301301 writeCDATAElement(name, getParentNamespace(), data, attName, attValue);
302302 }
303303
304 public void writeCDATAElement(String name, XmlNamespace namespace,
305 String data, String attName, Object attValue) throws IOException
304 public void writeCDATAElement(
305 String name,
306 XmlNamespace namespace,
307 String data,
308 String attName,
309 Object attValue
310 ) throws IOException
311 {
312 writeCDATAElement(name, namespace, data, new String[]{attName}, new Object[]{attValue});
313 }
314
315 public void writeCDATAElement(
316 String name,
317 XmlNamespace namespace,
318 String data,
319 String[] attNames,
320 Object[] attValues
321 ) throws IOException
306322 {
307323 if (data != null)
308324 {
312328 builder.append('<');
313329 String qName = getQualifiedName(name, namespace);
314330 builder.append(qName);
315 if (attValue != null)
316 {
317 builder.append(' ');
318 builder.append(attName);
319 builder.append("=\"");
320 builder.append(attValue);
321 builder.append("\"");
331 if (attNames != null)
332 {
333 for (int i = 0; i < attNames.length; i++)
334 {
335 if (attValues[i] != null)
336 {
337 builder.append(' ');
338 builder.append(attNames[i]);
339 builder.append("=\"");
340 builder.append(attValues[i]);
341 builder.append("\"");
342 }
343 }
322344 }
323345 builder.append("><![CDATA[");
324346 builder.append(encodeCDATA(data));
6969 /**
7070 * @author Teodor Danciu (teodord@users.sourceforge.net)
7171 */
72 public final class StyleResolver
72 public class StyleResolver
7373 {
7474 public static final String PROPERTY_STYLES_INHERIT_FROM_DEFAULT = JRPropertiesUtil.PROPERTY_PREFIX + "styles.inherit.from.default";
7575
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.util.json;
24
25 import java.io.StringReader;
26 import java.util.List;
27
28 import net.sf.jasperreports.engine.JRException;
29 import net.sf.jasperreports.engine.JRRuntimeException;
30 import net.sf.jasperreports.engine.json.JRJsonNode;
31 import net.sf.jasperreports.engine.json.JsonNodeContainer;
32 import net.sf.jasperreports.engine.json.expression.JsonQLExpression;
33 import net.sf.jasperreports.engine.json.expression.JsonQLExpressionEvaluator;
34 import net.sf.jasperreports.engine.json.parser.JsonQueryLexer;
35 import net.sf.jasperreports.engine.json.parser.JsonQueryParser;
36 import net.sf.jasperreports.engine.json.parser.JsonQueryWalker;
37
38 import org.apache.commons.logging.Log;
39 import org.apache.commons.logging.LogFactory;
40
41 /**
42 * @author Narcis Marcu (narcism@users.sourceforge.net)
43 */
44 public class DefaultJsonQLExecuter implements JsonQLExecuter {
45 private static final Log log = LogFactory.getLog(DefaultJsonQLExecuter.class);
46
47 private JsonQLExpressionEvaluator evaluator;
48
49 public DefaultJsonQLExecuter() {
50 evaluator = new JsonQLExpressionEvaluator();
51 }
52
53 @Override
54 public List<JRJsonNode> selectNodes(JRJsonNode rootNode, String expression) throws JRException {
55 JsonNodeContainer container;
56
57 if (expression != null && expression.trim().length() > 0) {
58 container = evaluator.evaluate(getJsonQLExpression(expression), rootNode);
59
60 if (container != null) {
61 return container.getContainerNodes();
62 }
63 } else {
64 container = new JsonNodeContainer(rootNode);
65
66 return container.getContainerNodes();
67 }
68
69 return null;
70 }
71
72 @Override
73 public JRJsonNode selectNode(JRJsonNode contextNode, JRJsonNode rootNode, String expression) throws JRException {
74 if (expression != null && expression.trim().length() > 0) {
75 JsonQLExpression jsonQLExpression = getJsonQLExpression(expression);
76 JRJsonNode node = contextNode;
77
78 if (jsonQLExpression.isAbsolute()) {
79 node = rootNode;
80 }
81
82 JsonNodeContainer container = evaluator.evaluate(jsonQLExpression, node);
83
84 if (container != null) {
85 return container.getNodes().get(0);
86 }
87 } else {
88 return contextNode;
89 }
90
91 return null;
92 }
93
94 public JsonNodeContainer evaluateExpression(JRJsonNode jrJsonNode, String expression) {
95 if (expression != null && expression.trim().length() > 0) {
96 return evaluator.evaluate(getJsonQLExpression(expression), jrJsonNode);
97 }
98
99 return null;
100 }
101
102 public JsonQLExpressionEvaluator getEvaluator() {
103 return evaluator;
104 }
105
106 protected JsonQLExpression getJsonQLExpression(String expression) {
107 try {
108 JsonQueryLexer lexer = new JsonQueryLexer(new StringReader(expression.trim()));
109
110 JsonQueryParser parser = new JsonQueryParser(lexer);
111 parser.pathExpr();
112
113 JsonQueryWalker walker = new JsonQueryWalker();
114 return walker.jsonQLExpression(parser.getAST());
115
116 } catch (Exception e) {
117 if (log.isDebugEnabled()) {
118 log.debug("Exception is of type: " + e.getClass());
119 }
120 throw new JRRuntimeException(e);
121 }
122 }
123
124 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.util.json;
24
25 import java.util.List;
26
27 import net.sf.jasperreports.engine.JRException;
28 import net.sf.jasperreports.engine.json.JRJsonNode;
29
30 /**
31 * @author Narcis Marcu (narcism@users.sourceforge.net)
32 */
33 public interface JsonQLExecuter {
34
35 List<JRJsonNode> selectNodes(JRJsonNode rootNode, String expression) throws JRException ;
36
37 JRJsonNode selectNode(JRJsonNode contextNode, JRJsonNode rootNode, String expression) throws JRException;
38
39 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.engine.xml;
24
25 import org.xml.sax.Attributes;
26
27 import net.sf.jasperreports.engine.design.DesignDatasetPropertyExpression;
28 import net.sf.jasperreports.engine.type.PropertyEvaluationTimeEnum;
29
30 /**
31 * {@link DesignDatasetPropertyExpression} factory.
32 *
33 * @author Teodor Danciu (teodord@users.sourceforge.net)
34 */
35 public class DatasetPropertyExpressionFactory extends JRBaseFactory
36 {
37
38 @Override
39 public Object createObject(Attributes attrs) throws Exception
40 {
41 DesignDatasetPropertyExpression propertyExpression = new DesignDatasetPropertyExpression();
42
43 String name = attrs.getValue(JRXmlConstants.ATTRIBUTE_name);
44 propertyExpression.setName(name);
45
46 PropertyEvaluationTimeEnum evaluationTime = PropertyEvaluationTimeEnum.byName(attrs.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime));
47 if (evaluationTime != null)
48 {
49 propertyExpression.setEvaluationTime(evaluationTime);
50 }
51
52 return propertyExpression;
53 }
54
55 }
2222 */
2323 package net.sf.jasperreports.engine.xml;
2424
25 import org.xml.sax.Attributes;
26
2527 import net.sf.jasperreports.engine.design.JRDesignParameter;
26
27 import org.xml.sax.Attributes;
28 import net.sf.jasperreports.engine.type.ParameterEvaluationTimeEnum;
2829
2930
3031 /**
6364 {
6465 parameter.setForPrompting(Boolean.valueOf(isForPrompting).booleanValue());
6566 }
67
68 ParameterEvaluationTimeEnum evaluationTime = ParameterEvaluationTimeEnum.byName(atts.getValue(JRXmlConstants.ATTRIBUTE_evaluationTime));
69 if (evaluationTime != null)
70 {
71 parameter.setEvaluationTime(evaluationTime);
72 }
6673 }
6774
6875
2727
2828 import javax.xml.parsers.ParserConfigurationException;
2929 import javax.xml.parsers.SAXParser;
30
31 import org.apache.commons.digester.Digester;
32 import org.apache.commons.digester.SetNestedPropertiesRule;
33 import org.apache.commons.logging.Log;
34 import org.apache.commons.logging.LogFactory;
35 import org.xml.sax.ErrorHandler;
36 import org.xml.sax.SAXException;
37 import org.xml.sax.SAXParseException;
3038
3139 import net.sf.jasperreports.charts.JRChartAxis;
3240 import net.sf.jasperreports.charts.design.JRDesignCategorySeries;
133141 import net.sf.jasperreports.engine.JRPart;
134142 import net.sf.jasperreports.engine.JRPropertiesUtil;
135143 import net.sf.jasperreports.engine.JRPropertyExpression;
144 import net.sf.jasperreports.engine.DatasetPropertyExpression;
136145 import net.sf.jasperreports.engine.JRReportTemplate;
137146 import net.sf.jasperreports.engine.JRScriptlet;
138147 import net.sf.jasperreports.engine.JRSortField;
173182 import net.sf.jasperreports.engine.util.CompositeClassloader;
174183 import net.sf.jasperreports.engine.xml.JRChartFactory.JRCategoryAxisFormatFactory;
175184
176 import org.apache.commons.digester.Digester;
177 import org.apache.commons.digester.SetNestedPropertiesRule;
178 import org.apache.commons.logging.Log;
179 import org.apache.commons.logging.LogFactory;
180 import org.xml.sax.ErrorHandler;
181 import org.xml.sax.SAXException;
182 import org.xml.sax.SAXParseException;
183
184185
185186 /**
186187 * JRXmlDigesterFactory encapsulates the code necessary to construct and configure
239240 /* */
240241 digester.addRule("*/property", new JRPropertyDigesterRule());
241242
242 String propertyExpressionPattern = "*/" + JRXmlConstants.ELEMENT_propertyExpression;
243 String propertyExpressionPattern = "jasperReport/" + JRXmlConstants.ELEMENT_propertyExpression;
244 digester.addFactoryCreate(propertyExpressionPattern, DatasetPropertyExpressionFactory.class.getName());
245 digester.addSetNext(propertyExpressionPattern, "addPropertyExpression", DatasetPropertyExpression.class.getName());
246 digester.addFactoryCreate(propertyExpressionPattern, depStringExprFactoryClass.getName());
247 digester.addSetNext(propertyExpressionPattern, "setValueExpression", JRExpression.class.getName());
248 digester.addCallMethod(propertyExpressionPattern, "setText", 0);
249
250 propertyExpressionPattern = "*/subDataset/" + JRXmlConstants.ELEMENT_propertyExpression;
251 digester.addFactoryCreate(propertyExpressionPattern, DatasetPropertyExpressionFactory.class.getName());
252 digester.addSetNext(propertyExpressionPattern, "addPropertyExpression", DatasetPropertyExpression.class.getName());
253 digester.addFactoryCreate(propertyExpressionPattern, depStringExprFactoryClass.getName());
254 digester.addSetNext(propertyExpressionPattern, "setValueExpression", JRExpression.class.getName());
255 digester.addCallMethod(propertyExpressionPattern, "setText", 0);
256
257 propertyExpressionPattern = "*/" + JRXmlConstants.ELEMENT_propertyExpression;
243258 digester.addFactoryCreate(propertyExpressionPattern, JRPropertyExpressionFactory.class.getName());
244259 digester.addSetNext(propertyExpressionPattern, "addPropertyExpression", JRPropertyExpression.class.getName());
245260 digester.addFactoryCreate(propertyExpressionPattern, depStringExprFactoryClass.getName());
102102 import net.sf.jasperreports.crosstabs.xml.JRCrosstabMeasureFactory;
103103 import net.sf.jasperreports.crosstabs.xml.JRCrosstabParameterFactory;
104104 import net.sf.jasperreports.crosstabs.xml.JRCrosstabRowGroupFactory;
105 import net.sf.jasperreports.engine.DatasetPropertyExpression;
105106 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
106107 import net.sf.jasperreports.engine.ExpressionReturnValue;
107108 import net.sf.jasperreports.engine.JRAnchor;
195196 import net.sf.jasperreports.engine.type.SplitTypeEnum;
196197 import net.sf.jasperreports.engine.type.StretchTypeEnum;
197198 import net.sf.jasperreports.engine.type.VerticalTextAlignEnum;
198 import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum;
199199 import net.sf.jasperreports.engine.type.WhenResourceMissingTypeEnum;
200200 import net.sf.jasperreports.engine.util.JRXmlWriteHelper;
201201 import net.sf.jasperreports.engine.util.XmlNamespace;
444444 writer.addAttribute(JRXmlConstants.ATTRIBUTE_pageWidth, report.getPageWidth());
445445 writer.addAttribute(JRXmlConstants.ATTRIBUTE_pageHeight, report.getPageHeight());
446446 writer.addAttribute(JRXmlConstants.ATTRIBUTE_orientation, report.getOrientationValue(), OrientationEnum.PORTRAIT);
447 writer.addAttribute(JRXmlConstants.ATTRIBUTE_whenNoDataType, report.getWhenNoDataTypeValue(), WhenNoDataTypeEnum.NO_PAGES);
447 writer.addAttribute(JRXmlConstants.ATTRIBUTE_whenNoDataType, report.getWhenNoDataTypeValue());
448448 writer.addAttribute(JRXmlConstants.ATTRIBUTE_sectionType, report.getSectionType(), SectionTypeEnum.BAND);
449449 writer.addAttribute(JRXmlConstants.ATTRIBUTE_columnWidth, report.getColumnWidth());
450450 writer.addAttribute(JRXmlConstants.ATTRIBUTE_columnSpacing, report.getColumnSpacing(), 0);
470470 }
471471
472472 writeProperties(report);
473
474 if (isNewerVersionOrEqual(JRConstants.VERSION_6_3_1))
475 {
476 writePropertyExpressions(report.getPropertyExpressions());
477 }
473478
474479 /* */
475480 String[] imports = report.getImports();
711716 writer.addAttribute(JRXmlConstants.ATTRIBUTE_nestedType, parameter.getNestedTypeName());
712717 }
713718 writer.addAttribute(JRXmlConstants.ATTRIBUTE_isForPrompting, parameter.isForPrompting(), true);
719 if(isNewerVersionOrEqual(JRConstants.VERSION_6_3_1))
720 {
721 writer.addAttribute(JRXmlConstants.ATTRIBUTE_evaluationTime, parameter.getEvaluationTime());
722 }
714723
715724 writeProperties(parameter);
716725
743752 writer.addAttribute(JRXmlConstants.ATTRIBUTE_class, field.getValueClassName());
744753
745754 writeProperties(field);
755 if (isNewerVersionOrEqual(JRConstants.VERSION_6_3_1))
756 {
757 writePropertyExpressions(field.getPropertyExpressions());
758 }
746759
747760 writer.writeCDATAElement(JRXmlConstants.ELEMENT_fieldDescription, field.getDescription());
748761
10691082 }
10701083
10711084
1072 public void writePropertyExpressions(
1073 JRPropertyExpression[] propertyExpressions) throws IOException
1085 public void writePropertyExpressions(JRPropertyExpression[] propertyExpressions) throws IOException
1086 {
1087 if (propertyExpressions != null)
1088 {
1089 for (int i = 0; i < propertyExpressions.length; i++)
1090 {
1091 writePropertyExpression(propertyExpressions[i]);
1092 }
1093 }
1094 }
1095
1096
1097 public void writePropertyExpressions(DatasetPropertyExpression[] propertyExpressions) throws IOException
10741098 {
10751099 if (propertyExpressions != null)
10761100 {
10881112 String expressionText = valueExpression == null ? "" : valueExpression.getText();
10891113 writer.writeCDATAElement(JRXmlConstants.ELEMENT_propertyExpression, getNamespace(), expressionText,
10901114 JRXmlConstants.ATTRIBUTE_name, propertyExpression.getName());
1115 }
1116
1117
1118 protected void writePropertyExpression(DatasetPropertyExpression propertyExpression) throws IOException
1119 {
1120 JRExpression valueExpression = propertyExpression.getValueExpression();
1121 String expressionText = valueExpression == null ? "" : valueExpression.getText();
1122 writer.writeCDATAElement(
1123 JRXmlConstants.ELEMENT_propertyExpression,
1124 getNamespace(),
1125 expressionText,
1126 new String[]{
1127 JRXmlConstants.ATTRIBUTE_name,
1128 JRXmlConstants.ATTRIBUTE_evaluationTime},
1129 new Object[]{
1130 propertyExpression.getName(),
1131 propertyExpression.getEvaluationTime() == null ? null : propertyExpression.getEvaluationTime().getName()}
1132 );
10911133 }
10921134
10931135
32173259
32183260 writeProperties(dataset);
32193261
3262 if (isNewerVersionOrEqual(JRConstants.VERSION_6_3_1))
3263 {
3264 writePropertyExpressions(dataset.getPropertyExpressions());
3265 }
3266
32203267 writeDatasetContents(dataset);
32213268
32223269 writer.closeElement();
2626 /**
2727 * @author Teodor Danciu (teodord@users.sourceforge.net)
2828 */
29 public class AbstractXlsExporterConfiguration extends SimpleExporterConfiguration implements XlsExporterConfiguration
29 public abstract class AbstractXlsExporterConfiguration extends SimpleExporterConfiguration implements XlsExporterConfiguration
3030 {
3131 private Boolean isCreateCustomPalette;
3232 private String workbookTemplate;
3333 private Boolean isKeepWorkbookTemplateSheets;
34 private String metadataTitle;
35 private String metadataAuthor;
36 private String metadataSubject;
37 private String metadataKeywords;
38 private String metadataApplication;
3439
3540
3641 /**
8792 {
8893 this.isKeepWorkbookTemplateSheets = isKeepWorkbookTemplateSheets;
8994 }
95
96 @Override
97 public String getMetadataTitle()
98 {
99 return metadataTitle;
100 }
101
102 /**
103 *
104 */
105 public void setMetadataTitle(String metadataTitle)
106 {
107 this.metadataTitle = metadataTitle;
108 }
109
110 @Override
111 public String getMetadataAuthor()
112 {
113 return metadataAuthor;
114 }
115
116 /**
117 *
118 */
119 public void setMetadataAuthor(String metadataAuthor)
120 {
121 this.metadataAuthor = metadataAuthor;
122 }
123
124 @Override
125 public String getMetadataSubject()
126 {
127 return metadataSubject;
128 }
129
130 /**
131 *
132 */
133 public void setMetadataSubject(String metadataSubject)
134 {
135 this.metadataSubject = metadataSubject;
136 }
137
138 @Override
139 public String getMetadataKeywords()
140 {
141 return metadataKeywords;
142 }
143
144 /**
145 *
146 */
147 public void setMetadataKeywords(String metadataKeywords)
148 {
149 this.metadataKeywords = metadataKeywords;
150 }
151
152 @Override
153 public String getMetadataApplication()
154 {
155 return metadataApplication;
156 }
157
158 /**
159 *
160 */
161 public void setMetadataApplication(String metadataApplication)
162 {
163 this.metadataApplication = metadataApplication;
164 }
90165 }
2222 */
2323 package net.sf.jasperreports.export;
2424
25 import net.sf.jasperreports.engine.JRPropertiesUtil;
2526 import net.sf.jasperreports.engine.export.ooxml.JRDocxExporter;
27 import net.sf.jasperreports.export.annotations.ExporterProperty;
2628
2729
2830 /**
3436 */
3537 public interface DocxExporterConfiguration extends ExporterConfiguration
3638 {
39 /**
40 * Property whose value is used as default for the {@link #getMetadataTitle()} export configuration setting.
41 */
42 public static final String PROPERTY_METADATA_TITLE = JRPropertiesUtil.PROPERTY_PREFIX + "export.docx.metadata.title";
43
44 /**
45 * Property whose value is used as default for the {@link #getMetadataAuthor()} export configuration setting.
46 */
47 public static final String PROPERTY_METADATA_AUTHOR = JRPropertiesUtil.PROPERTY_PREFIX + "export.docx.metadata.author";
48
49 /**
50 * Property whose value is used as default for the {@link #getMetadataSubject()} export configuration setting.
51 */
52 public static final String PROPERTY_METADATA_SUBJECT = JRPropertiesUtil.PROPERTY_PREFIX + "export.docx.metadata.subject";
53
54 /**
55 * Property whose value is used as default for the {@link #getMetadataKeywords()} export configuration setting.
56 */
57 public static final String PROPERTY_METADATA_KEYWORDS = JRPropertiesUtil.PROPERTY_PREFIX + "export.docx.metadata.keywords";
58
59 /**
60 * Property whose value is used as default for the {@link #getMetadataApplication()} export configuration setting.
61 */
62 public static final String PROPERTY_METADATA_APPLICATION = JRPropertiesUtil.PROPERTY_PREFIX + "export.docx.metadata.application";
63
64 /**
65 * The Title of the DOCX document.
66 */
67 @ExporterProperty(PROPERTY_METADATA_TITLE)
68 public String getMetadataTitle();
69
70 /**
71 * The Author of the DOCX document.
72 */
73 @ExporterProperty(PROPERTY_METADATA_AUTHOR)
74 public String getMetadataAuthor();
75
76 /**
77 * The Subject of the DOCX document.
78 */
79 @ExporterProperty(PROPERTY_METADATA_SUBJECT)
80 public String getMetadataSubject();
81
82 /**
83 * The Keywords of the DOCX document.
84 */
85 @ExporterProperty(PROPERTY_METADATA_KEYWORDS)
86 public String getMetadataKeywords();
87
88 /**
89 * The Application for the DOCX document. Defaults to "JasperReports Library version x.x.x".
90 */
91 @ExporterProperty(PROPERTY_METADATA_APPLICATION)
92 public String getMetadataApplication();
3793 }
2222 */
2323 package net.sf.jasperreports.export;
2424
25 import net.sf.jasperreports.engine.JRPropertiesUtil;
2526 import net.sf.jasperreports.engine.export.ooxml.JRPptxExporter;
27 import net.sf.jasperreports.export.annotations.ExporterProperty;
2628
2729
2830 /**
3436 */
3537 public interface PptxExporterConfiguration extends ExporterConfiguration
3638 {
39 /**
40 * Property whose value is used as default for the {@link #getMetadataTitle()} export configuration setting.
41 */
42 public static final String PROPERTY_METADATA_TITLE = JRPropertiesUtil.PROPERTY_PREFIX + "export.pptx.metadata.title";
43
44 /**
45 * Property whose value is used as default for the {@link #getMetadataAuthor()} export configuration setting.
46 */
47 public static final String PROPERTY_METADATA_AUTHOR = JRPropertiesUtil.PROPERTY_PREFIX + "export.pptx.metadata.author";
48
49 /**
50 * Property whose value is used as default for the {@link #getMetadataSubject()} export configuration setting.
51 */
52 public static final String PROPERTY_METADATA_SUBJECT = JRPropertiesUtil.PROPERTY_PREFIX + "export.pptx.metadata.subject";
53
54 /**
55 * Property whose value is used as default for the {@link #getMetadataKeywords()} export configuration setting.
56 */
57 public static final String PROPERTY_METADATA_KEYWORDS = JRPropertiesUtil.PROPERTY_PREFIX + "export.pptx.metadata.keywords";
58
59 /**
60 * Property whose value is used as default for the {@link #getMetadataApplication()} export configuration setting.
61 */
62 public static final String PROPERTY_METADATA_APPLICATION = JRPropertiesUtil.PROPERTY_PREFIX + "export.pptx.metadata.application";
63
64 /**
65 * The Title of the PPTX document.
66 */
67 @ExporterProperty(PROPERTY_METADATA_TITLE)
68 public String getMetadataTitle();
69
70 /**
71 * The Author of the PPTX document.
72 */
73 @ExporterProperty(PROPERTY_METADATA_AUTHOR)
74 public String getMetadataAuthor();
75
76 /**
77 * The Subject of the PPTX document.
78 */
79 @ExporterProperty(PROPERTY_METADATA_SUBJECT)
80 public String getMetadataSubject();
81
82 /**
83 * The Keywords of the PPTX document.
84 */
85 @ExporterProperty(PROPERTY_METADATA_KEYWORDS)
86 public String getMetadataKeywords();
87
88 /**
89 * The Application for the PPTX document. Defaults to "JasperReports Library version x.x.x".
90 */
91 @ExporterProperty(PROPERTY_METADATA_APPLICATION)
92 public String getMetadataApplication();
3793 }
2828 */
2929 public class SimpleDocxExporterConfiguration extends SimpleExporterConfiguration implements DocxExporterConfiguration
3030 {
31 private String metadataTitle;
32 private String metadataAuthor;
33 private String metadataSubject;
34 private String metadataKeywords;
35 private String metadataApplication;
36
37 @Override
38 public String getMetadataTitle()
39 {
40 return metadataTitle;
41 }
42
43 /**
44 *
45 */
46 public void setMetadataTitle(String metadataTitle)
47 {
48 this.metadataTitle = metadataTitle;
49 }
50
51 @Override
52 public String getMetadataAuthor()
53 {
54 return metadataAuthor;
55 }
56
57 /**
58 *
59 */
60 public void setMetadataAuthor(String metadataAuthor)
61 {
62 this.metadataAuthor = metadataAuthor;
63 }
64
65 @Override
66 public String getMetadataSubject()
67 {
68 return metadataSubject;
69 }
70
71 /**
72 *
73 */
74 public void setMetadataSubject(String metadataSubject)
75 {
76 this.metadataSubject = metadataSubject;
77 }
78
79 @Override
80 public String getMetadataKeywords()
81 {
82 return metadataKeywords;
83 }
84
85 /**
86 *
87 */
88 public void setMetadataKeywords(String metadataKeywords)
89 {
90 this.metadataKeywords = metadataKeywords;
91 }
92
93 @Override
94 public String getMetadataApplication()
95 {
96 return metadataApplication;
97 }
98
99 /**
100 *
101 */
102 public void setMetadataApplication(String metadataApplication)
103 {
104 this.metadataApplication = metadataApplication;
105 }
31106 }
2828 */
2929 public class SimplePptxExporterConfiguration extends SimpleExporterConfiguration implements PptxExporterConfiguration
3030 {
31 private String metadataTitle;
32 private String metadataAuthor;
33 private String metadataSubject;
34 private String metadataKeywords;
35 private String metadataApplication;
36
37 @Override
38 public String getMetadataTitle()
39 {
40 return metadataTitle;
41 }
42
43 /**
44 *
45 */
46 public void setMetadataTitle(String metadataTitle)
47 {
48 this.metadataTitle = metadataTitle;
49 }
50
51 @Override
52 public String getMetadataAuthor()
53 {
54 return metadataAuthor;
55 }
56
57 /**
58 *
59 */
60 public void setMetadataAuthor(String metadataAuthor)
61 {
62 this.metadataAuthor = metadataAuthor;
63 }
64
65 @Override
66 public String getMetadataSubject()
67 {
68 return metadataSubject;
69 }
70
71 /**
72 *
73 */
74 public void setMetadataSubject(String metadataSubject)
75 {
76 this.metadataSubject = metadataSubject;
77 }
78
79 @Override
80 public String getMetadataKeywords()
81 {
82 return metadataKeywords;
83 }
84
85 /**
86 *
87 */
88 public void setMetadataKeywords(String metadataKeywords)
89 {
90 this.metadataKeywords = metadataKeywords;
91 }
92
93 @Override
94 public String getMetadataApplication()
95 {
96 return metadataApplication;
97 }
98
99 /**
100 *
101 */
102 public void setMetadataApplication(String metadataApplication)
103 {
104 this.metadataApplication = metadataApplication;
105 }
31106 }
7474 public static final String PROPERTY_WORKBOOK_TEMPLATE_KEEP_SHEETS = JRXlsAbstractExporter.XLS_EXPORTER_PROPERTIES_PREFIX + "workbook.template.keep.sheets";
7575
7676 /**
77 * Property whose value is used as default for the {@link #getMetadataTitle()} export configuration setting.
78 */
79 public static final String PROPERTY_METADATA_TITLE = JRPropertiesUtil.PROPERTY_PREFIX + "export.xls.metadata.title";
80
81 /**
82 * Property whose value is used as default for the {@link #getMetadataAuthor()} export configuration setting.
83 */
84 public static final String PROPERTY_METADATA_AUTHOR = JRPropertiesUtil.PROPERTY_PREFIX + "export.xls.metadata.author";
85
86 /**
87 * Property whose value is used as default for the {@link #getMetadataSubject()} export configuration setting.
88 */
89 public static final String PROPERTY_METADATA_SUBJECT = JRPropertiesUtil.PROPERTY_PREFIX + "export.xls.metadata.subject";
90
91 /**
92 * Property whose value is used as default for the {@link #getMetadataKeywords()} export configuration setting.
93 */
94 public static final String PROPERTY_METADATA_KEYWORDS = JRPropertiesUtil.PROPERTY_PREFIX + "export.xls.metadata.keywords";
95
96 /**
97 * Property whose value is used as default for the {@link #getMetadataApplication()} export configuration setting.
98 */
99 public static final String PROPERTY_METADATA_APPLICATION = JRPropertiesUtil.PROPERTY_PREFIX + "export.xls.metadata.application";
100
101 /**
77102 * Returns a boolean value specifying whether the standard color palette should be customized
78103 * so that the XLS result uses the original report colors.
79104 * <p/>
136161 booleanDefault=false
137162 )
138163 public Boolean isKeepWorkbookTemplateSheets();
164
165 /**
166 * The Title of the XLS document.
167 */
168 @ExporterProperty(PROPERTY_METADATA_TITLE)
169 public String getMetadataTitle();
170
171 /**
172 * The Author of the XLS document.
173 */
174 @ExporterProperty(PROPERTY_METADATA_AUTHOR)
175 public String getMetadataAuthor();
176
177 /**
178 * The Subject of the XLS document.
179 */
180 @ExporterProperty(PROPERTY_METADATA_SUBJECT)
181 public String getMetadataSubject();
182
183 /**
184 * The Keywords of the XLS document.
185 */
186 @ExporterProperty(PROPERTY_METADATA_KEYWORDS)
187 public String getMetadataKeywords();
188
189 /**
190 * The Application for the XLS document. Defaults to "JasperReports Library version x.x.x".
191 */
192 @ExporterProperty(PROPERTY_METADATA_APPLICATION)
193 public String getMetadataApplication();
139194 }
2424
2525 import java.net.URL;
2626 import java.util.ArrayList;
27 import java.util.Collections;
2728 import java.util.HashMap;
29 import java.util.IdentityHashMap;
2830 import java.util.Iterator;
2931 import java.util.LinkedHashMap;
3032 import java.util.List;
3133 import java.util.Map;
34 import java.util.Map.Entry;
3235
3336 import net.sf.jasperreports.engine.JRPropertiesMap;
3437 import net.sf.jasperreports.engine.JRPropertiesUtil;
3639 import net.sf.jasperreports.engine.util.ClassLoaderResource;
3740 import net.sf.jasperreports.engine.util.ClassUtils;
3841 import net.sf.jasperreports.engine.util.JRLoader;
42 import net.sf.jasperreports.engine.util.ObjectUtils;
3943
4044 import org.apache.commons.collections.map.ReferenceMap;
4145 import org.apache.commons.logging.Log;
139143
140144 protected List<ExtensionsRegistry> loadRegistries()
141145 {
146 //there is no identity linked hash map/set, using separate map and list
147 IdentityHashMap<ExtensionsRegistry, Object> registrySet = new IdentityHashMap<>();
142148 List<ExtensionsRegistry> allRegistries = new ArrayList<ExtensionsRegistry>();
149
143150 List<ClassLoaderResource> extensionResources = loadExtensionPropertyResources();
144151 for (ClassLoaderResource extensionResource : extensionResources)
145152 {
146153 ClassLoader classLoader = extensionResource.getClassLoader();
147 Map<URL, List<ExtensionsRegistry>> classLoaderRegistries = getClassLoaderRegistries(classLoader);
154 Map<URL, URLRegistries> classLoaderRegistries = getClassLoaderRegistries(classLoader);
148155
149156 URL url = extensionResource.getUrl();
150157 List<ExtensionsRegistry> registries;
151158 Map<String, Exception> registryExceptions = new LinkedHashMap<String, Exception>();
152159 synchronized (classLoaderRegistries)
153160 {
154 registries = classLoaderRegistries.get(url);
155 if (registries == null)
161 URLRegistries urlRegistries = classLoaderRegistries.get(url);
162 if (urlRegistries == null)
156163 {
157164 if (log.isDebugEnabled())
158165 {
160167 + url);
161168 }
162169
163 registries = loadRegistries(url, registryExceptions);
170 JRPropertiesMap properties = JRPropertiesMap.loadProperties(url);
171 URL duplicateURL = detectDuplicate(properties, classLoaderRegistries);//search across classloaders?
172 if (duplicateURL == null)
173 {
174 registries = loadRegistries(properties, registryExceptions);
175 }
176 else
177 {
178 log.warn("Extension resource " + url + " was found to be a duplicate of "
179 + duplicateURL + " in classloader " + classLoader);
180 registries = Collections.emptyList();
181 }
164182
165 classLoaderRegistries.put(url, registries);
183 classLoaderRegistries.put(url, new URLRegistries(properties, registries));
184 }
185 else
186 {
187 registries = urlRegistries.registries;
166188 }
167189 }
168190
172194 + entry.getKey() + " from " + url, entry.getValue());
173195 }
174196
175 allRegistries.addAll(registries);
197 for (ExtensionsRegistry extensionsRegistry : registries)
198 {
199 //detecting identity duplicates
200 boolean added = registrySet.put(extensionsRegistry, Boolean.FALSE) == null;
201 if (added)
202 {
203 allRegistries.add(extensionsRegistry);
204 }
205 else if (log.isDebugEnabled())
206 {
207 log.debug("Found duplicate extension registry " + extensionsRegistry);
208 }
209 }
176210 }
177211 return allRegistries;
178212 }
183217 EXTENSION_RESOURCE_NAME);
184218 }
185219
186 protected Map<URL, List<ExtensionsRegistry>> getClassLoaderRegistries(ClassLoader classLoader)
220 protected Map<URL, URLRegistries> getClassLoaderRegistries(ClassLoader classLoader)
187221 {
188222 synchronized (registryCache)
189223 {
190 Map<URL, List<ExtensionsRegistry>> registries = (Map<URL, List<ExtensionsRegistry>>) registryCache.get(classLoader);
224 Map<URL, URLRegistries> registries = (Map<URL, URLRegistries>) registryCache.get(classLoader);
191225 if (registries == null)
192226 {
193 registries = new HashMap<URL, List<ExtensionsRegistry>>();
227 registries = new HashMap<URL, URLRegistries>();
194228 registryCache.put(classLoader, registries);
195229 }
196230 return registries;
197231 }
198232 }
199233
200 protected List<ExtensionsRegistry> loadRegistries(URL url, Map<String, Exception> registryExceptions)
201 {
202 JRPropertiesMap properties = JRPropertiesMap.loadProperties(url);
203
234 protected List<ExtensionsRegistry> loadRegistries(JRPropertiesMap properties,
235 Map<String, Exception> registryExceptions)
236 {
204237 List<ExtensionsRegistry> registries = new ArrayList<ExtensionsRegistry>();
205238 List<PropertySuffix> factoryProps = JRPropertiesUtil.getProperties(properties,
206239 PROPERTY_REGISTRY_FACTORY_PREFIX);
245278 ClassUtils.instantiateClass(factoryClass, ExtensionsRegistryFactory.class);
246279 return factory.createRegistry(registryId, props);
247280 }
281
282 protected URL detectDuplicate(JRPropertiesMap properties, Map<URL, URLRegistries> registries)
283 {
284 URL duplicateURL = null;
285 for (Entry<URL, URLRegistries> registryEntry : registries.entrySet())
286 {
287 JRPropertiesMap entryProperties = registryEntry.getValue().properties;
288 if (ObjectUtils.equals(properties, entryProperties))
289 {
290 duplicateURL = registryEntry.getKey();
291 break;
292 }
293 }
294 return duplicateURL;
295 }
296
297 protected static class URLRegistries
298 {
299 JRPropertiesMap properties;
300 List<ExtensionsRegistry> registries;
301
302 public URLRegistries(JRPropertiesMap properties, List<ExtensionsRegistry> registries)
303 {
304 this.properties = properties;
305 this.registries = registries;
306 }
307 }
248308
249309 }
3939 import net.sf.jasperreports.engine.JRDataset;
4040 import net.sf.jasperreports.engine.JRException;
4141 import net.sf.jasperreports.engine.JRField;
42 import net.sf.jasperreports.engine.JRPropertiesUtil;
4243 import net.sf.jasperreports.engine.JRRuntimeException;
4344 import net.sf.jasperreports.olap.mapping.AxisPosition;
4445 import net.sf.jasperreports.olap.mapping.DataMapping;
7374 public static final String EXCEPTION_MESSAGE_KEY_OLAP_DIMENSION_NOT_FOUND = "data.olap.dimension.not.found";
7475 public static final String EXCEPTION_MESSAGE_KEY_OLAP_FIELD_VALUE_NOT_RETRIEVED = "data.olap.field.value.not.retrieved";
7576 public static final String EXCEPTION_MESSAGE_KEY_OLAP_INTERNAL_ERROR = "data.olap.internal.error";
77 public static final String EXCEPTION_MESSAGE_KEY_OLAP_MISSING_FIELD_MAPPING = "data.olap.missing.field.mapping";
7678 public static final String EXCEPTION_MESSAGE_KEY_OLAP_INVALID_FIELD_MAPPING = "data.olap.invalid.field.mapping";
7779 public static final String EXCEPTION_MESSAGE_KEY_OLAP_LEVEL_NOT_FOUND = "data.olap.level.not.found";
7880 public static final String EXCEPTION_MESSAGE_KEY_OLAP_TUPLE_NOT_FOUND = "data.olap.tuple.not.found";
81
82 /**
83 * Property specifying the OLAP mapping for the dataset field.
84 */
85 public static final String PROPERTY_FIELD_MAPPING = JRPropertiesUtil.PROPERTY_PREFIX + "olap.field.mapping";
7986
8087 protected final JROlapResult olapResult;
8188 protected JROlapResultAxis[] axes;
331338 log.debug("Mapping field: " + field.getName() + " - description: " + fieldMapping);
332339 }
333340
341 if (
342 fieldMapping == null
343 || fieldMapping.trim().isEmpty()
344 )
345 {
346 throw
347 new JRRuntimeException(
348 EXCEPTION_MESSAGE_KEY_OLAP_MISSING_FIELD_MAPPING,
349 new Object[]{field.getName()});
350 }
351
334352 MappingLexer lexer = new MappingLexer(new StringReader(fieldMapping));
335353 MappingParser parser = new MappingParser(lexer);
336354 parser.setMappingMetadata(this);
403421
404422 protected String getFieldMapping(JRField field)
405423 {
406 return field.getDescription();
424 String fieldMapping = field.getPropertiesMap().getProperty(PROPERTY_FIELD_MAPPING);
425 if (fieldMapping == null)
426 {
427 fieldMapping = field.getDescription();
428 }
429 return fieldMapping;
407430 }
408431
409432 private void initIterate()
603626 // for other fields, FormattedData mappings are treated in the same way as Data mappings
604627 this.formatted = mapping.isFormatted() && String.class.equals(field.getValueClass());
605628
629 @SuppressWarnings("unchecked")
606630 List<AxisPosition> mappingPositions = mapping.getPositions();
607631 if (mappingPositions == null)
608632 {
285285 }
286286
287287 @Override
288 public void abortSubfiller(JRBaseFiller filler)
289 {
290 //NOP
291 }
292
293 @Override
288294 public boolean isRunToBottom()
289295 {
290296 return true;
3232 import org.apache.batik.gvt.font.GVTFontFamily;
3333
3434 import net.sf.jasperreports.engine.JasperReportsContext;
35 import net.sf.jasperreports.engine.fonts.FontInfo;
36 import net.sf.jasperreports.engine.fonts.FontUtil;
3537
3638
3739 /**
4345 *
4446 */
4547 private final JasperReportsContext jasperReportsContext;
48 private final FontUtil fontUtil;
4649
4750 private final Map<String, GVTFontFamily> resolvedFontFamilies = new HashMap<String, GVTFontFamily>();
4851
5356 private BatikFontFamilyResolver(JasperReportsContext jasperReportsContext)
5457 {
5558 this.jasperReportsContext = jasperReportsContext;
59 this.fontUtil = FontUtil.getInstance(jasperReportsContext);
5660 }
5761
5862
8488
8589 if (gvtFontFamily == null)
8690 {
87 gvtFontFamily = new BatikAWTFontFamily(jasperReportsContext, familyName);
88 resolvedFontFamilies.put(familyName, gvtFontFamily);
91 FontInfo fontInfo = fontUtil.getFontInfoIgnoreCase(familyName, null);//FIXMEBATIK locale
92
93 if (fontInfo != null)
94 {
95 gvtFontFamily = new BatikAWTFontFamily(jasperReportsContext, familyName);
96 resolvedFontFamilies.put(familyName, gvtFontFamily);
97 }
98 else
99 {
100 return DefaultFontFamilyResolver.SINGLETON.resolve(familyName);
101 }
89102 }
90103
91104 return gvtFontFamily;
100100 {
101101 if (JRTypeSniffer.getImageTypeValue(data) == ImageTypeEnum.UNKNOWN)
102102 {
103 //change the general XML sniffer to a test that specifically looks for an <svg> node?
103104 if (XmlDataSniffer.isXmlData(data))
104105 {
105106 return getSvgDataSniffer().isSvgData(data);
150150
151151 private void processFontAttributes(Element styleElement)
152152 {
153 String fontFamily = null;
153 String fontFamilyAttrValue = null;
154154
155155 NamedNodeMap attributes = styleElement.getAttributes();
156156
157157 Node fontFamilyAttrNode = attributes.getNamedItem(SVG_ATTRIBUTE_fontFamily);
158158 if (fontFamilyAttrNode != null)
159159 {
160 fontFamily = fontFamilyAttrNode.getNodeValue();
160 fontFamilyAttrValue = fontFamilyAttrNode.getNodeValue();
161161 }
162162
163163 // values from style property takes precedence over values from attributes
168168 String styleFontFamily = getFontFamily(styleAttrNode.getNodeValue());
169169 if (styleFontFamily != null)
170170 {
171 fontFamily = styleFontFamily;
172 }
173 }
174
175 if (fontFamily != null)
176 {
177 if (
178 fontFamily.startsWith("'")
179 && fontFamily.endsWith("'")
180 )
181 {
182 fontFamily = fontFamily.substring(1, fontFamily.length() - 1);
183 }
184
185 // svg font-family could have locale suffix because it is needed in svg measured by phantomjs
186 int localeSeparatorPos = fontFamily.lastIndexOf(HtmlFontFamily.LOCALE_SEPARATOR);
187 if (localeSeparatorPos > 0)
188 {
189 fontFamily = fontFamily.substring(0, localeSeparatorPos);
190 }
191
192 fontFamily =
193 getFontFamily(
194 fontFamily,
195 locale //FIXMEBATIK could use locale from svg above
196 );
171 fontFamilyAttrValue = styleFontFamily;
172 }
173 }
174
175 if (fontFamilyAttrValue != null)
176 {
177 StringBuilder newFamilyNameAttrValue = new StringBuilder();
178
179 boolean firstToken = true;
180 String[] fontFamilyTokens = fontFamilyAttrValue.split(",");
181 for (String fontFamilyToken : fontFamilyTokens)
182 {
183 if (!firstToken)
184 {
185 newFamilyNameAttrValue.append(",");
186 }
187
188 String fontFamily = fontFamilyToken.trim();
189
190 if (
191 fontFamily.startsWith("'")
192 && fontFamily.endsWith("'")
193 )
194 {
195 fontFamily = fontFamily.substring(1, fontFamily.length() - 1);
196 }
197
198 // svg font-family could have locale suffix because it is needed in svg measured by phantomjs
199 int localeSeparatorPos = fontFamily.lastIndexOf(HtmlFontFamily.LOCALE_SEPARATOR);
200 if (localeSeparatorPos > 0)
201 {
202 fontFamily = fontFamily.substring(0, localeSeparatorPos);
203 }
204
205 fontFamily =
206 getFontFamily(
207 fontFamily,
208 locale //FIXMEBATIK could use locale from svg above
209 );
210
211 newFamilyNameAttrValue.append(" " + fontFamily);
212
213 firstToken = false;
214 }
197215
198216 if (styleAttrNode == null)
199217 {
200218 // do not put single quotes around family name here because the value might already contain quotes,
201219 // especially if it is coming from font extension export configuration
202 styleElement.setAttribute(SVG_ATTRIBUTE_fontFamily, fontFamily);
220 styleElement.setAttribute(SVG_ATTRIBUTE_fontFamily, newFamilyNameAttrValue.toString());
203221 }
204222 else
205223 {
206 String newStyleAttr = replaceOrAddFontFamilyInStyle(styleAttrNode.getNodeValue(), fontFamily);
224 String newStyleAttr = replaceOrAddFontFamilyInStyle(styleAttrNode.getNodeValue(), newFamilyNameAttrValue.toString());
207225 styleElement.setAttribute(SVG_ATTRIBUTE_style, newStyleAttr);
208226 }
209227 }
2929 import javax.xml.parsers.SAXParser;
3030 import javax.xml.parsers.SAXParserFactory;
3131
32 import org.xml.sax.Attributes;
33 import org.xml.sax.InputSource;
3234 import org.xml.sax.SAXException;
3335 import org.xml.sax.helpers.DefaultHandler;
3436
4244 public class XmlDataSniffer
4345 {
4446 private static final String SAX_EXCEPTION_MESSAGE_VALID_XML = "something unique";
47
48 private static class ValidXmlSAXException extends SAXException
49 {
50 private static final long serialVersionUID = 1L;
51
52 ValidXmlSAXException()
53 {
54 super(SAX_EXCEPTION_MESSAGE_VALID_XML);
55 }
56
57 @Override
58 public synchronized Throwable fillInStackTrace()
59 {
60 // stacktrace is not needed, easing the impact using exceptions
61 return this;
62 }
63 }
4564
4665 /**
4766 *
5877 {
5978 SAXParser saxParser = factory.newSAXParser();
6079 saxParser.parse(bais, handler);
80 return true;
6181 }
62 catch (SAXException e)
82 catch (ValidXmlSAXException e)
6383 {
64 if (SAX_EXCEPTION_MESSAGE_VALID_XML.equals(e.getMessage()))
65 {
66 return true;
67 }
84 return true;
6885 }
69 catch (ParserConfigurationException e)
86 catch (SAXException | ParserConfigurationException | IOException e)
7087 {
88 return false;
7189 }
72 catch (IOException e)
73 {
74 }
75
76 return false;
7790 }
7891
7992 private static class SaxHandler extends DefaultHandler
8093 {
8194 @Override
82 public void startDocument() throws SAXException
95 public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
8396 {
84 throw new SAXException(SAX_EXCEPTION_MESSAGE_VALID_XML);
97 throw new ValidXmlSAXException();
98 }
99
100 @Override
101 public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException
102 {
103 //stop any attempt to load entities
104 throw new ValidXmlSAXException();
85105 }
86106 }
87107 }
180180 }
181181
182182 // get the spans for the matched terms
183 AtomicReaderContext context = reader.leaves().get(0);
184 Bits acceptDocs = context.reader().getLiveDocs();
185183 SpanQuery rewrittenQuery = (SpanQuery)query.rewrite(reader);
186 Spans spans = rewrittenQuery.getSpans(context, acceptDocs, termContexts);
187184 LuceneSpansInfo spansInfo = new LuceneSpansInfo(queryTerms.size());
188
189 while (spans.next()) {
190 Document doc = searcher.doc(spans.doc());
191 String uid = doc.get("uid");
192 List<HitTermInfo> hitTermsInfo = hitTermsInfoMap.get(spans.doc());
193
194 for (int i = spans.start(); i < spans.end(); i++) {
195 for (HitTermInfo ti: hitTermsInfo) {
196 if (ti.getPosition() == i) {
197 if (log.isDebugEnabled()) {
198 log.debug(String.format("term: %s@%d [%d, %d] - uid: %s, pageNo: %s", ti.getValue(), ti.getPosition(), ti.getStart(), ti.getEnd(), uid, doc.get("pageNo")));
185 for (AtomicReaderContext context : reader.leaves())
186 {
187 Bits acceptDocs = context.reader().getLiveDocs();
188 Spans spans = rewrittenQuery.getSpans(context, acceptDocs, termContexts);
189
190 while (spans.next()) {
191 int docIndex = spans.doc() + context.docBase;
192 Document doc = searcher.doc(docIndex);
193 String uid = doc.get("uid");
194 List<HitTermInfo> hitTermsInfo = hitTermsInfoMap.get(docIndex);
195
196 for (int i = spans.start(); i < spans.end(); i++) {
197 for (HitTermInfo ti: hitTermsInfo) {
198 if (ti.getPosition() == i) {
199 if (log.isDebugEnabled()) {
200 log.debug(String.format("term: %s@%d [%d, %d] - uid: %s, pageNo: %s", ti.getValue(), ti.getPosition(), ti.getStart(), ti.getEnd(), uid, doc.get("pageNo")));
201 }
202 ti.setPageNo(doc.get("pageNo"));
203 spansInfo.addTermInfo(uid, ti);
199204 }
200 ti.setPageNo(doc.get("pageNo"));
201 spansInfo.addTermInfo(uid, ti);
202205 }
203206 }
204207 }
+0
-62
jasperreports/src/net/sf/jasperreports/web/servlets/ImageServlet.java less more
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.web.servlets;
24
25 import java.io.IOException;
26
27 import javax.servlet.ServletException;
28 import javax.servlet.http.HttpServletRequest;
29 import javax.servlet.http.HttpServletResponse;
30
31 import net.sf.jasperreports.engine.JRConstants;
32 import net.sf.jasperreports.web.util.ImageWebResourceHandler;
33
34
35 /**
36 * @deprecated Replaced by {@link ImageWebResourceHandler} and {@link ResourceServlet}.
37 * @author Teodor Danciu (teodord@users.sourceforge.net)
38 */
39 public class ImageServlet extends AbstractServlet
40 {
41 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
42
43
44 /**
45 * @deprecated Replaced by {@link ImageWebResourceHandler#REQUEST_PARAMETER_IMAGE_NAME}.
46 */
47 public static final String REQUEST_PARAMETER_IMAGE_NAME = ImageWebResourceHandler.REQUEST_PARAMETER_IMAGE_NAME;
48
49
50 @Override
51 public void service(
52 HttpServletRequest request,
53 HttpServletResponse response
54 ) throws IOException, ServletException
55 {
56 ImageWebResourceHandler handler = new ImageWebResourceHandler();
57 handler.handleResource(getJasperReportsContext(), request, response);
58 }
59
60
61 }
3838 import net.sf.jasperreports.export.SimpleJsonReportConfiguration;
3939 import net.sf.jasperreports.web.WebReportContext;
4040 import net.sf.jasperreports.web.util.ReportExecutionHyperlinkProducerFactory;
41 import net.sf.jasperreports.web.util.WebHtmlResourceHandler;
4142 import net.sf.jasperreports.web.util.WebUtil;
4243
4344
138139 {
139140 pageStatus = ReportPageStatus.PAGE_FINAL;
140141 }
141
142
143 String applicationDomain = (String) webReportContext.getParameterValue(WebReportContext.REQUEST_PARAMETER_APPLICATION_DOMAIN);
144 if (applicationDomain == null) {
145 applicationDomain = request.getContextPath();
146 }
147
148 WebUtil webUtil = WebUtil.getInstance(getJasperReportsContext());
149 String resourcesPath = applicationDomain + webUtil.getResourcesPath() + "?" + WebReportContext.REQUEST_PARAMETER_REPORT_CONTEXT_ID + "=" + webReportContext.getId();
150
142151 exporter.setReportContext(webReportContext);
143152 exporter.setExporterInput(new SimpleExporterInput(jasperPrintAccessor.getJasperPrint()));
144 exporter.setExporterOutput(new SimpleJsonExporterOutput(writer));
153 SimpleJsonExporterOutput jsonOutput = new SimpleJsonExporterOutput(writer);
154 jsonOutput.setFontHandler(new WebHtmlResourceHandler(resourcesPath + "&font={0}"));
155 exporter.setExporterOutput(jsonOutput);
145156
146157 configuration.setHyperlinkProducerFactory(
147158 ReportExecutionHyperlinkProducerFactory.getInstance(getJasperReportsContext(), request)
+0
-476
jasperreports/src/net/sf/jasperreports/web/servlets/ReportServlet.java less more
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.web.servlets;
24
25 import java.io.IOException;
26 import java.io.PrintWriter;
27 import java.util.HashMap;
28 import java.util.LinkedHashMap;
29 import java.util.List;
30 import java.util.Map;
31
32 import javax.servlet.ServletException;
33 import javax.servlet.http.HttpServletRequest;
34 import javax.servlet.http.HttpServletResponse;
35
36 import org.apache.commons.logging.Log;
37 import org.apache.commons.logging.LogFactory;
38
39 import net.sf.jasperreports.engine.JRConstants;
40 import net.sf.jasperreports.engine.JRException;
41 import net.sf.jasperreports.engine.JRParameter;
42 import net.sf.jasperreports.engine.JRRuntimeException;
43 import net.sf.jasperreports.engine.ReportContext;
44 import net.sf.jasperreports.engine.export.HtmlExporter;
45 import net.sf.jasperreports.web.JRInteractiveException;
46 import net.sf.jasperreports.web.WebReportContext;
47 import net.sf.jasperreports.web.actions.AbstractAction;
48 import net.sf.jasperreports.web.actions.Action;
49 import net.sf.jasperreports.web.actions.MultiAction;
50 import net.sf.jasperreports.web.util.JacksonUtil;
51 import net.sf.jasperreports.web.util.ReportExecutionHyperlinkProducerFactory;
52 import net.sf.jasperreports.web.util.VelocityUtil;
53 import net.sf.jasperreports.web.util.WebUtil;
54
55
56 /**
57 * @deprecated Replaced by {@link ReportOutputServlet}.
58 * @author Teodor Danciu (teodord@users.sourceforge.net)
59 */
60 public class ReportServlet extends AbstractServlet
61 {
62 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
63
64 private static final Log log = LogFactory.getLog(ReportServlet.class);
65
66 private static final String TEMPLATE_HEADER= "net/sf/jasperreports/web/servlets/resources/templates/HeaderTemplate.vm";
67 private static final String TEMPLATE_BETWEEN_PAGES= "net/sf/jasperreports/web/servlets/resources/templates/BetweenPagesTemplate.vm";
68 private static final String TEMPLATE_FOOTER= "net/sf/jasperreports/web/servlets/resources/templates/FooterTemplate.vm";
69
70 private static final String TEMPLATE_HEADER_NOPAGES = "net/sf/jasperreports/web/servlets/resources/templates/HeaderTemplateNoPages.vm";
71 private static final String TEMPLATE_FOOTER_NOPAGES = "net/sf/jasperreports/web/servlets/resources/templates/FooterTemplateNoPages.vm";
72
73 private static final String REQUEST_PARAMETER_IGNORE_PAGINATION = "jr_ignrpg";
74 private static final String REQUEST_PARAMETER_ACTION = "jr_action";
75
76
77
78 @Override
79 public void service(
80 HttpServletRequest request,
81 HttpServletResponse response
82 ) throws IOException, ServletException
83 {
84 response.setContentType("text/html; charset=UTF-8");
85
86 // Set to expire far in the past.
87 response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
88 // Set standard HTTP/1.1 no-cache headers.
89 response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
90 // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
91 response.addHeader("Cache-Control", "post-check=0, pre-check=0");
92 // Set standard HTTP/1.0 no-cache header.
93 response.setHeader("Pragma", "no-cache");
94
95 PrintWriter out = response.getWriter();
96
97 WebReportContext webReportContext = WebReportContext.getInstance(request);
98
99 try
100 {
101 if (request.getParameterMap().containsKey(WebUtil.REQUEST_PARAMETER_PAGE_UPDATE))
102 {
103 //FIXME move this to a different servlet
104 pageUpdate(request, response, webReportContext);
105 }
106 else
107 {
108 runReport(request, webReportContext);
109 render(request, webReportContext, out);
110 }
111 }
112 catch (JRInteractiveException e)
113 {
114 log.error("Jasper Interactive error", e);
115
116 out.println("<div><pre id=\"jrInteractiveError\">");
117 if (e.getMessage() != null && e.getMessage().indexOf(AbstractAction.ERR_CONCAT_STRING) != -1) {
118 String[] tokens = e.getMessage().split(AbstractAction.ERR_CONCAT_STRING);
119 for (String token: tokens) {
120 out.println(token);
121 }
122
123 } else {
124 out.println(e.getMessage());
125 }
126 out.println("</pre></div>");
127 }
128 catch (Exception e)
129 {
130 log.error("Error on report execution", e);
131
132 response.setContentType("application/json; charset=UTF-8");
133 response.setStatus(404);
134
135 out.println("{");
136 out.println("\"msg\": \"JasperReports encountered an error!\"");
137 out.println("}");
138
139
140
141 /*
142 out.println("<html>");//FIXMEJIVE do we need to render this? or should this be done by the viewer?
143 out.println("<head>");
144 out.println("<title>JasperReports - Web Application Sample</title>");
145 out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" title=\"Style\">");
146
147 out.println("<body bgcolor=\"white\">");
148
149 out.println("<span class=\"bnew\">JasperReports encountered this error :</span>");
150 out.println("<pre>");
151 e.printStackTrace(out);
152 out.println("</pre>");
153 out.println("</body>");
154 out.println("</html>");
155 */
156 }
157
158 }
159
160
161 /**
162 * @throws JRInteractiveException
163 *
164 */
165 public void runReport(
166 HttpServletRequest request, //FIXMEJIVE put request in report context, maybe as a thread local?
167 WebReportContext webReportContext
168 ) throws JRException, JRInteractiveException //IOException, ServletException
169 {
170 JasperPrintAccessor jasperPrintAccessor =
171 (JasperPrintAccessor) webReportContext.getParameterValue(
172 WebReportContext.REPORT_CONTEXT_PARAMETER_JASPER_PRINT_ACCESSOR
173 );
174
175 String runReport = request.getParameter(WebUtil.REQUEST_PARAMETER_RUN_REPORT);
176 if (jasperPrintAccessor == null || Boolean.valueOf(runReport))
177 {
178 String reportUri = request.getParameter(WebUtil.REQUEST_PARAMETER_REPORT_URI);
179 if (reportUri != null)
180 {
181 webReportContext.setParameterValue(WebUtil.REQUEST_PARAMETER_REPORT_URI, reportUri);
182 }
183
184 Boolean isIgnorePagination = Boolean.valueOf(request.getParameter(REQUEST_PARAMETER_IGNORE_PAGINATION));
185 if (isIgnorePagination != null)
186 {
187 webReportContext.setParameterValue(JRParameter.IS_IGNORE_PAGINATION, isIgnorePagination);
188 }
189
190 String async = request.getParameter(WebUtil.REQUEST_PARAMETER_ASYNC_REPORT);
191 if (async != null)
192 {
193 webReportContext.setParameterValue(WebUtil.REQUEST_PARAMETER_ASYNC_REPORT, Boolean.valueOf(async));
194 }
195
196 Action action = getAction(webReportContext, WebUtil.decodeUrl(request.getParameter(REQUEST_PARAMETER_ACTION)));
197
198 Controller controller = new Controller(getJasperReportsContext());
199
200 controller.runReport(webReportContext, action);
201 }
202 }
203
204
205 /**
206 *
207 */
208 public void render(
209 HttpServletRequest request,
210 WebReportContext webReportContext,
211 PrintWriter writer
212 ) throws JRException //IOException, ServletException
213 {
214 JasperPrintAccessor jasperPrintAccessor = (JasperPrintAccessor) webReportContext.getParameterValue(
215 WebReportContext.REPORT_CONTEXT_PARAMETER_JASPER_PRINT_ACCESSOR);
216
217 ReportExecutionStatus reportStatus = jasperPrintAccessor.getReportStatus();
218 if (reportStatus.getStatus() == ReportExecutionStatus.Status.ERROR)
219 {
220 throw
221 new JRRuntimeException(
222 EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_ERROR,
223 (Object[])null,
224 reportStatus.getError());
225 }
226
227 //Integer pageCount = reportStatus.getTotalPageCount();
228 // if the page count is null, it means that the fill is not yet done but there is at least a page
229 //boolean hasPages = pageCount == null || pageCount > 0;//FIXMEJIVE we should call pageStatus here
230 boolean hasPages = jasperPrintAccessor.pageStatus(0, null).pageExists();
231
232 // JRXhtmlExporter exporter = new JRXhtmlExporter(getJasperReportsContext());
233 HtmlExporter exporter = new HtmlExporter(getJasperReportsContext());
234
235 ReportPageStatus pageStatus;
236 if (hasPages)
237 {
238 String reportPage = request.getParameter(WebUtil.REQUEST_PARAMETER_PAGE);
239 int pageIdx = reportPage == null ? 0 : Integer.parseInt(reportPage);
240 String pageTimestamp = request.getParameter(WebUtil.REQUEST_PARAMETER_PAGE_TIMESTAMP);
241 Long timestamp = pageTimestamp == null ? null : Long.valueOf(pageTimestamp);
242
243 pageStatus = jasperPrintAccessor.pageStatus(pageIdx, timestamp);
244
245 if (!pageStatus.pageExists())
246 {
247 throw
248 new JRRuntimeException(
249 EXCEPTION_MESSAGE_KEY_PAGE_NOT_FOUND,
250 new Object[]{pageIdx});
251 }
252
253 exporter.setParameter(net.sf.jasperreports.engine.JRExporterParameter.PAGE_INDEX, pageIdx);
254 }
255 else
256 {
257 pageStatus = ReportPageStatus.PAGE_FINAL;
258 }
259
260 exporter.setReportContext(webReportContext);
261 exporter.setParameter(net.sf.jasperreports.engine.JRExporterParameter.JASPER_PRINT, jasperPrintAccessor.getJasperPrint());
262 exporter.setParameter(net.sf.jasperreports.engine.JRExporterParameter.OUTPUT_WRITER, writer);
263 exporter.setParameter(net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI, "image?" + WebReportContext.REQUEST_PARAMETER_REPORT_CONTEXT_ID + "=" + webReportContext.getId() + "&image=");
264
265 exporter.setParameter(net.sf.jasperreports.engine.export.JRHtmlExporterParameter.HTML_HEADER, getHeader(request, webReportContext, hasPages, pageStatus));
266 exporter.setParameter(net.sf.jasperreports.engine.export.JRHtmlExporterParameter.BETWEEN_PAGES_HTML, getBetweenPages(request, webReportContext));
267 exporter.setParameter(net.sf.jasperreports.engine.export.JRHtmlExporterParameter.HTML_FOOTER, getFooter(request, webReportContext, hasPages, pageStatus));
268
269 exporter.setParameter(
270 net.sf.jasperreports.engine.export.JRHtmlExporterParameter.HYPERLINK_PRODUCER_FACTORY,
271 ReportExecutionHyperlinkProducerFactory.getInstance(getJasperReportsContext(), request)
272 );
273
274 exporter.exportReport();
275
276 }
277
278
279 /**
280 *
281 */
282 protected String getHeader(HttpServletRequest request, WebReportContext webReportContext, boolean hasPages,
283 ReportPageStatus pageStatus)
284 {
285 Map<String, Object> contextMap = new HashMap<String, Object>();
286
287 JasperPrintAccessor jasperPrintAccessor = (JasperPrintAccessor) webReportContext.getParameterValue(
288 WebReportContext.REPORT_CONTEXT_PARAMETER_JASPER_PRINT_ACCESSOR);
289 contextMap.put("totalPages", jasperPrintAccessor.getReportStatus().getTotalPageCount());
290
291 String reportPage = request.getParameter(WebUtil.REQUEST_PARAMETER_PAGE);
292 contextMap.put("currentPage", (reportPage != null ? reportPage : "0"));
293
294 if (!pageStatus.isPageFinal())
295 {
296 contextMap.put("pageTimestamp", String.valueOf(pageStatus.getTimestamp()));
297 }
298
299 if (hasPages)
300 {
301 return VelocityUtil.processTemplate(TEMPLATE_HEADER, contextMap);
302 } else
303 {
304 return VelocityUtil.processTemplate(TEMPLATE_HEADER_NOPAGES, contextMap);
305 }
306 }
307
308
309 /**
310 *
311 */
312 protected String getBetweenPages(HttpServletRequest request, WebReportContext webReportContext)
313 {
314 return VelocityUtil.processTemplate(TEMPLATE_BETWEEN_PAGES, new HashMap<String, Object>());
315 }
316
317
318 /**
319 *
320 */
321 protected String getFooter(HttpServletRequest request, WebReportContext webReportContext, boolean hasPages,
322 ReportPageStatus pageStatus)
323 {
324 Map<String, Object> contextMap = new HashMap<String, Object>();
325 if (hasPages) {
326 return VelocityUtil.processTemplate(TEMPLATE_FOOTER, contextMap);
327 } else
328 {
329 return VelocityUtil.processTemplate(TEMPLATE_FOOTER_NOPAGES, contextMap);
330 }
331 }
332
333
334 /**
335 *
336 */
337 private Action getAction(ReportContext webReportContext, String jsonData)
338 {
339 Action result = null;
340 List<AbstractAction> actions = JacksonUtil.getInstance(getJasperReportsContext()).loadAsList(jsonData, AbstractAction.class);
341 if (actions != null)
342 {
343 if (actions.size() == 1) {
344 result = actions.get(0);
345 } else if (actions.size() > 1){
346 result = new MultiAction(actions);
347 }
348
349 ((AbstractAction)result).init(getJasperReportsContext(), webReportContext);
350 }
351 return result;
352 }
353
354
355 protected void pageUpdate(HttpServletRequest request, HttpServletResponse response,
356 WebReportContext webReportContext) throws JRException, IOException
357 {
358 JasperPrintAccessor jasperPrintAccessor = (JasperPrintAccessor) webReportContext.getParameterValue(
359 WebReportContext.REPORT_CONTEXT_PARAMETER_JASPER_PRINT_ACCESSOR);
360 if (jasperPrintAccessor == null)
361 {
362 throw
363 new JRRuntimeException(
364 EXCEPTION_MESSAGE_KEY_REPORT_NOT_FOUND,
365 (Object[])null);
366 }
367
368 String pageIdxParam = request.getParameter(WebUtil.REQUEST_PARAMETER_PAGE);
369 Integer pageIndex = pageIdxParam == null ? null : Integer.valueOf(pageIdxParam);
370 String pageTimestampParam = request.getParameter(WebUtil.REQUEST_PARAMETER_PAGE_TIMESTAMP);
371 Long pageTimestamp = pageTimestampParam == null ? null : Long.valueOf(pageTimestampParam);
372
373 if (log.isDebugEnabled())
374 {
375 log.debug("report page update check for pageIndex: " + pageIndex
376 + ", pageTimestamp: " + pageTimestamp);
377 }
378
379 LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>();
380 putReportStatusResult(response, jasperPrintAccessor, result);
381
382 if (pageIndex != null && pageTimestamp != null)
383 {
384 ReportPageStatus pageStatus = jasperPrintAccessor.pageStatus(pageIndex, pageTimestamp);
385 boolean modified = pageStatus.hasModified();
386 result.put("pageModified", modified);
387
388 if (log.isDebugEnabled())
389 {
390 log.debug("page " + pageIndex + " modified " + modified);
391 }
392 }
393
394 String resultString = JacksonUtil.getInstance(getJasperReportsContext()).getJsonString(result);
395 response.setContentType("application/json");
396 PrintWriter out = response.getWriter();
397 out.write(resultString);
398 out.flush();
399 }
400
401 protected void putReportStatusResult(HttpServletResponse response,
402 JasperPrintAccessor printAccessor, LinkedHashMap<String, Object> result) throws JRException
403 {
404 ReportExecutionStatus reportStatus = printAccessor.getReportStatus();
405 result.put("partialPageCount", reportStatus.getCurrentPageCount());
406
407 String status;
408 switch (reportStatus.getStatus())
409 {
410 case FINISHED:
411 status = "finished";
412 Integer totalPageCount = reportStatus.getTotalPageCount();
413 result.put("totalPages", totalPageCount);
414
415 if (log.isDebugEnabled())
416 {
417 log.debug("report finished " + totalPageCount + " pages");
418 }
419 break;
420 case ERROR:
421 status = "error";
422 handleReportUpdateError(response, reportStatus);
423 break;
424 case CANCELED:
425 status = "canceled";
426
427 if (log.isDebugEnabled())
428 {
429 log.debug("report canceled");
430 }
431 break;
432 case RUNNING:
433 default:
434 status = "running";
435
436 if (log.isDebugEnabled())
437 {
438 log.debug("report running");
439 }
440 break;
441 }
442
443 result.put("status", status);
444 }
445
446 protected void handleReportUpdateError(HttpServletResponse response, ReportExecutionStatus reportStatus)
447 throws JRException
448 {
449 Throwable error = reportStatus.getError();
450 if (log.isDebugEnabled())
451 {
452 log.debug("report error " + error);// only message
453 }
454 // set a header so that the UI knows it's a report execution error
455 response.setHeader("reportError", "true");
456 // set as a header because we don't have other way to pass it
457 response.setHeader("lastPartialPageIndex", Integer.toString(reportStatus.getCurrentPageCount() - 1));
458
459 // throw an exception to get to the error page
460 if (error instanceof JRException)
461 {
462 throw (JRException) error;
463 }
464 if (error instanceof JRRuntimeException)
465 {
466 throw (JRRuntimeException) error;
467 }
468 throw
469 new JRRuntimeException(
470 EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_ERROR,
471 (Object[])null,
472 error);
473 }
474
475 }
0 /*
1 * JasperReports - Free Java Reporting Library.
2 * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved.
3 * http://www.jaspersoft.com
4 *
5 * Unless you have purchased a commercial license agreement from Jaspersoft,
6 * the following license terms apply:
7 *
8 * This program is part of JasperReports.
9 *
10 * JasperReports is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * JasperReports is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
22 */
23 package net.sf.jasperreports.jsonql;
24
25 import java.lang.reflect.Method;
26
27 import net.sf.jasperreports.engine.DefaultJasperReportsContext;
28 import net.sf.jasperreports.engine.JRException;
29 import net.sf.jasperreports.engine.json.JRJsonNode;
30 import net.sf.jasperreports.engine.json.JsonNodeContainer;
31 import net.sf.jasperreports.engine.util.JsonUtil;
32 import net.sf.jasperreports.engine.util.json.DefaultJsonQLExecuter;
33
34 import org.apache.commons.logging.Log;
35 import org.apache.commons.logging.LogFactory;
36 import org.testng.annotations.BeforeClass;
37 import org.testng.annotations.BeforeMethod;
38 import org.testng.annotations.Test;
39
40 import com.fasterxml.jackson.databind.JsonNode;
41 import com.fasterxml.jackson.databind.node.ArrayNode;
42
43 /**
44 * @author Narcis Marcu (narcism@users.sourceforge.net)
45 */
46 public class JsonQLExpressionsTest {
47 private static final Log log = LogFactory.getLog(JsonQLExpressionsTest.class);
48
49 private JRJsonNode jrJsonNode;
50 private JsonNode expectedResult;
51 private DefaultJsonQLExecuter jsonQLExecuter;
52
53 @BeforeClass
54 public void readJson() throws JRException {
55 JsonNode tree = JsonUtil.parseJson(DefaultJasperReportsContext.getInstance(), "net/sf/jasperreports/jsonql/orders.json");
56
57 jrJsonNode = new JRJsonNode(null, tree);
58 jsonQLExecuter = new DefaultJsonQLExecuter();
59 }
60
61 @BeforeMethod
62 public void expectedResult(Method method) throws JRException {
63 expectedResult = JsonUtil.parseJson(DefaultJasperReportsContext.getInstance(),
64 "net/sf/jasperreports/jsonql/" + method.getName() + "_result.json");
65 }
66
67 @Test
68 public void customerXorders() throws JRException {
69 String jsonQL_1 = "customerXorders";
70 JsonNodeContainer jsonQL_1_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_1);
71
72 // the customerXorders key points to an array
73 assert jsonQL_1_result.getNodes().size() == 1;
74 assert jsonQL_1_result.getFirst().getDataNode().isArray();
75 assert jsonQL_1_result.getFirst().getDataNode().equals(expectedResult);
76
77 String jsonQL_2 = "customerXorders.*";
78 JsonNodeContainer jsonQL_2_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_2);
79
80 // customerXorders has 2 object children
81 assert jsonQL_2_result.getNodes().size() == 2;
82 assert jsonQL_2_result.getNodes().get(0).getDataNode().isObject();
83 assert jsonQL_2_result.getNodes().get(1).getDataNode().isObject();
84 assert toArrayNode(jsonQL_2_result).equals(expectedResult);
85 }
86
87 @Test
88 public void allOrders() throws JRException {
89 String jsonQL_1 = ".*.*.*";
90 JsonNodeContainer jsonQL_1_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_1);
91
92 assert toArrayNode(jsonQL_1_result).equals(expectedResult);
93
94 String jsonQL_2 = "..*(orderId != null)";
95 JsonNodeContainer jsonQL_2_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_2);
96
97 assert toArrayNode(jsonQL_2_result).equals(expectedResult);
98
99 String jsonQL_3 = "..[orderId, orderDate, shipped, shippedOn, products]";
100 JsonNodeContainer jsonQL_3_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_3);
101
102 assert toArrayNode(jsonQL_3_result).equals(expectedResult);
103 }
104
105 @Test
106 public void customerXproducts() throws JRException {
107 String jsonQL_1 = "customerXorders.products.*.*";
108 JsonNodeContainer jsonQL_1_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_1);
109
110 assert toArrayNode(jsonQL_1_result).equals(expectedResult);
111
112 String jsonQL_2 = "customerXorders..[prodId, prodQty]";
113 JsonNodeContainer jsonQL_2_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_2);
114
115 assert toArrayNode(jsonQL_2_result).equals(expectedResult);
116
117 String jsonQL_3 = "customerXorders.products..[prodId, prodQty]";
118 JsonNodeContainer jsonQL_3_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_3);
119
120 assert toArrayNode(jsonQL_3_result).equals(expectedResult);
121
122 String jsonQL_4 = "..products[0,1].*.*";
123 JsonNodeContainer jsonQL_4_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_4);
124
125 assert toArrayNode(jsonQL_4_result).equals(expectedResult);
126
127 String jsonQL_5 = "..*(prodId != null && (^{2}.orderId == 1001 || ^^.orderId == 1002))";
128 JsonNodeContainer jsonQL_5_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_5);
129
130 assert toArrayNode(jsonQL_5_result).equals(expectedResult);
131
132 String jsonQL_6 = "*[0]..[prodId, prodQty]";
133 JsonNodeContainer jsonQL_6_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_6);
134
135 assert toArrayNode(jsonQL_6_result).equals(expectedResult);
136 }
137
138 @Test
139 public void allProducts() throws JRException {
140 String jsonQL_1 = "..[prodId, prodQty]";
141 JsonNodeContainer jsonQL_1_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_1);
142
143 assert toArrayNode(jsonQL_1_result).equals(expectedResult);
144
145 String jsonQL_2 = "..*(prodId != null)";
146 JsonNodeContainer jsonQL_2_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_2);
147
148 assert toArrayNode(jsonQL_2_result).equals(expectedResult);
149
150 String jsonQL_3 = "..prodId(@isNotNull)^";
151 JsonNodeContainer jsonQL_3_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_3);
152
153 assert toArrayNode(jsonQL_3_result).equals(expectedResult);
154
155 String jsonQL_4 = "..prodId(!@isNull)^";
156 JsonNodeContainer jsonQL_4_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_4);
157
158 assert toArrayNode(jsonQL_4_result).equals(expectedResult);
159
160 String jsonQL_5 = "..prodId(@val != null)^";
161 JsonNodeContainer jsonQL_5_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_5);
162
163 assert toArrayNode(jsonQL_5_result).equals(expectedResult);
164 }
165
166 @Test
167 public void productsOfShippedOrders() throws JRException {
168 String jsonQL_1 = "..[prodId, prodQty](^^^.shipped == null)";
169 JsonNodeContainer jsonQL_1_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_1);
170
171 assert toArrayNode(jsonQL_1_result).equals(expectedResult);
172
173 String jsonQL_2 = "..*(prodId != null && ^^.shippedOn != null)";
174 JsonNodeContainer jsonQL_2_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_2);
175
176 assert toArrayNode(jsonQL_2_result).equals(expectedResult);
177
178 String jsonQL_3 = "..shippedOn(@val != null)^..[prodId, prodQty]";
179 JsonNodeContainer jsonQL_3_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_3);
180
181 assert toArrayNode(jsonQL_3_result).equals(expectedResult);
182
183 String jsonQL_4 = "..products(^.shippedOn != null)..[prodId, prodQty]";
184 JsonNodeContainer jsonQL_4_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_4);
185
186 assert toArrayNode(jsonQL_4_result).equals(expectedResult);
187 }
188
189 @Test
190 public void productsOfOrdersWithAtLeast2products() throws JRException {
191 String jsonQL_1 = "..products(*@size >=2)..*(prodId != null)";
192 JsonNodeContainer jsonQL_1_result = jsonQLExecuter.evaluateExpression(jrJsonNode, jsonQL_1);
193
194 assert toArrayNode(jsonQL_1_result).equals(expectedResult);
195 }
196
197 private ArrayNode toArrayNode(JsonNodeContainer container) {
198 ArrayNode result = jsonQLExecuter.getEvaluator().getEvaluationContext().getObjectMapper().createArrayNode();
199
200 for (JRJsonNode node: container.getContainerNodes()) {
201 result.add(node.getDataNode());
202 }
203
204 return result;
205 }
206
207 }
0 [
1 {
2 "orderId": 1001,
3 "orderDate": "2016-08-01",
4 "shipped": false,
5 "products": {
6 "product_1": {
7 "prodId": 1,
8 "prodQty": 3
9 },
10 "product_2": {
11 "prodId": 5,
12 "prodQty": 2
13 }
14 }
15 },
16 {
17 "orderId": 1002,
18 "orderDate": "2016-01-01",
19 "shippedOn": "2016-01-06",
20 "products": {
21 "product_1": {
22 "prodId": 34,
23 "prodQty": 5
24 }
25 }
26 },
27 {
28 "orderId": 1200,
29 "orderDate": "2015-12-01",
30 "shippedOn": "2015-12-03",
31 "products": [
32 {
33 "prodId": 135,
34 "prodQty": 6
35 },
36 {
37 "prodId": 2355,
38 "prodQty": 20
39 },
40 {
41 "prodId": 64,
42 "prodQty": 7
43 }
44 ]
45 },
46 {
47 "orderId": 1201,
48 "orderDate": "2015-12-11",
49 "shipped": false,
50 "products": {
51 "product_1": {
52 "prodId": 34,
53 "prodQty": 5
54 },
55 "product_2": {
56 "prodId": 567,
57 "prodQty": 3
58 }
59 }
60 }
61 ]
0 [
1 {
2 "prodId": 1,
3 "prodQty": 3
4 },
5 {
6 "prodId": 5,
7 "prodQty": 2
8 },
9 {
10 "prodId": 34,
11 "prodQty": 5
12 },
13 {
14 "prodId": 135,
15 "prodQty": 6
16 },
17 {
18 "prodId": 2355,
19 "prodQty": 20
20 },
21 {
22 "prodId": 64,
23 "prodQty": 7
24 },
25 {
26 "prodId": 34,
27 "prodQty": 5
28 },
29 {
30 "prodId": 567,
31 "prodQty": 3
32 }
33 ]
0 [
1 {
2 "orderId": 1001,
3 "orderDate": "2016-08-01",
4 "shipped": false,
5 "products": {
6 "product_1": {
7 "prodId": 1,
8 "prodQty": 3
9 },
10 "product_2": {
11 "prodId": 5,
12 "prodQty": 2
13 }
14 }
15 },
16 {
17 "orderId": 1002,
18 "orderDate": "2016-01-01",
19 "shippedOn": "2016-01-06",
20 "products": {
21 "product_1": {
22 "prodId": 34,
23 "prodQty": 5
24 }
25 }
26 }
27 ]
0 [
1 {
2 "prodId": 1,
3 "prodQty": 3
4 },
5 {
6 "prodId": 5,
7 "prodQty": 2
8 },
9 {
10 "prodId": 34,
11 "prodQty": 5
12 }
13 ]
0 {
1 "customerXorders": [
2 {
3 "orderId": 1001,
4 "orderDate": "2016-08-01",
5 "shipped": false,
6 "products": {
7 "product_1": {
8 "prodId": 1,
9 "prodQty": 3
10 },
11 "product_2": {
12 "prodId": 5,
13 "prodQty": 2
14 }
15 }
16 },
17 {
18 "orderId": 1002,
19 "orderDate": "2016-01-01",
20 "shippedOn": "2016-01-06",
21 "products": {
22 "product_1": {
23 "prodId": 34,
24 "prodQty": 5
25 }
26 }
27 }
28 ],
29 "customerYorders": [
30 {
31 "orderId": 1200,
32 "orderDate": "2015-12-01",
33 "shippedOn": "2015-12-03",
34 "products": [
35 {
36 "prodId": 135,
37 "prodQty": 6
38 },
39 {
40 "prodId": 2355,
41 "prodQty": 20
42 },
43 {
44 "prodId": 64,
45 "prodQty": 7
46 }
47 ]
48 },
49 {
50 "orderId": 1201,
51 "orderDate": "2015-12-11",
52 "shipped": false,
53 "products": {
54 "product_1": {
55 "prodId": 34,
56 "prodQty": 5
57 },
58 "product_2": {
59 "prodId": 567,
60 "prodQty": 3
61 }
62 }
63 }
64 ]
65 }
0 [
1 {
2 "prodId": 1,
3 "prodQty": 3
4 },
5 {
6 "prodId": 5,
7 "prodQty": 2
8 },
9 {
10 "prodId": 135,
11 "prodQty": 6
12 },
13 {
14 "prodId": 2355,
15 "prodQty": 20
16 },
17 {
18 "prodId": 64,
19 "prodQty": 7
20 },
21 {
22 "prodId": 34,
23 "prodQty": 5
24 },
25 {
26 "prodId": 567,
27 "prodQty": 3
28 }
29 ]
0 [
1 {
2 "prodId": 34,
3 "prodQty": 5
4 },
5 {
6 "prodId": 135,
7 "prodQty": 6
8 },
9 {
10 "prodId": 2355,
11 "prodQty": 20
12 },
13 {
14 "prodId": 64,
15 "prodQty": 7
16 }
17 ]
56425642 <textContent><![CDATA[10725]]></textContent>
56435643 </text>
56445644 <text textHeight="9.3125" lineSpacingFactor="1.1640625" leadingOffset="-1.8867188">
5645 <reportElement uuid="c0997027-e1d3-4d9b-99c4-10dad87d5b42" x="345" y="753" width="110" height="11" origin="9" srcId="33" printId="121">
5645 <reportElement uuid="c0997027-e1d3-4d9b-99c4-10dad87d5b42" x="345" y="753" width="110" height="18" origin="9" srcId="33" printId="121">
56465646 <property name="net.sf.jasperreports.export.csv.column.name" value="ShipCity"/>
56475647 <property name="net.sf.jasperreports.export.xls.column.name" value="ShipCity"/>
56485648 <property name="net.sf.jasperreports.export.csv.data" value="Sao Paulo"/>