Skip to content

Commit 137bc4e

Browse files
authored
Merge pull request #3709 from mapfish/jasperreport-7-migration
Jasperreport 7 migration
2 parents 8b16376 + 2382ec5 commit 137bc4e

File tree

111 files changed

+3148
-5004
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+3148
-5004
lines changed

core/build.gradle

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,15 @@ dependencies {
162162
'org.geotools:gt-cql:33.2',
163163
)
164164
jasper(
165-
'net.sf.jasperreports:jasperreports:6.21.4',
166-
'net.sf.jasperreports:jasperreports-fonts:6.21.4',
167-
'net.sf.jasperreports:jasperreports-functions:6.21.4',
168-
'org.codehaus.groovy:groovy-all:3.0.23',
169165
'ar.com.fdvs:DynamicJasper:5.3.9',
170-
'joda-time:joda-time:2.13.1',
166+
'com.itextpdf:itextpdf:5.5.13.4',
167+
'net.sf.jasperreports:jasperreports:7.0.2',
168+
'net.sf.jasperreports:jasperreports-excel-poi:7.0.2',
169+
'net.sf.jasperreports:jasperreports-fonts:7.0.2',
170+
'net.sf.jasperreports:jasperreports-functions:7.0.2',
171+
'net.sf.jasperreports:jasperreports-json:7.0.2',
172+
'net.sf.jasperreports:jasperreports-jdt:7.0.2',
173+
'net.sf.jasperreports:jasperreports-pdf:7.0.2',
171174
)
172175
implementation(
173176
'org.slf4j:slf4j-api:2.0.16',
@@ -185,6 +188,11 @@ dependencies {
185188
'net.logstash.logback:logstash-logback-encoder:8.0',
186189
// For PDF/A
187190
'com.adobe.xmp:xmpcore:6.1.11',
191+
// For JasperReports
192+
'joda-time:joda-time:2.14.0',
193+
'org.jfree:jcommon:1.0.24',
194+
'org.apache.groovy:groovy-all:4.0.26',
195+
'xalan:serializer:2.7.3',
188196
)
189197

190198
implementation(

core/src/main/java/org/mapfish/print/attribute/JsonDatasourceAttribute.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.List;
66
import javax.annotation.Nonnull;
77
import net.sf.jasperreports.engine.JRException;
8-
import net.sf.jasperreports.engine.data.JsonDataSource;
8+
import net.sf.jasperreports.json.data.JsonDataSource;
99
import org.json.JSONException;
1010
import org.json.JSONObject;
1111
import org.json.JSONWriter;

core/src/main/java/org/mapfish/print/output/AbstractJasperReportOutputFormat.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ private void checkRequiredValues(
321321
for (int i = 0; i < parameters.getLength(); i++) {
322322
final Element param = (Element) parameters.item(i);
323323
final String name = param.getAttribute("name");
324+
if (param.getParentNode() != null
325+
&& !"jasperReport".equals(param.getParentNode().getNodeName())) {
326+
continue;
327+
}
324328
if (!values.containsKey(name)) {
325329
if (param.getElementsByTagName("defaultValueExpression").getLength() == 0) {
326330
missing.append("\t* ").append(name).append("\n");

core/src/main/java/org/mapfish/print/output/JRPdfExporterWeakHashMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import java.util.WeakHashMap;
44
import net.sf.jasperreports.engine.JasperReportsContext;
5-
import net.sf.jasperreports.engine.export.JRPdfExporter;
65
import net.sf.jasperreports.engine.util.ExifOrientationEnum;
76
import net.sf.jasperreports.engine.util.Pair;
8-
import net.sf.jasperreports.export.pdf.PdfImage;
7+
import net.sf.jasperreports.pdf.JRPdfExporter;
8+
import net.sf.jasperreports.pdf.common.PdfImage;
99

1010
public class JRPdfExporterWeakHashMap extends JRPdfExporter {
1111

core/src/main/java/org/mapfish/print/output/JasperReportExcelOutputFormat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import java.io.OutputStream;
44
import net.sf.jasperreports.engine.JRException;
5-
import net.sf.jasperreports.engine.export.JRXlsExporter;
65
import net.sf.jasperreports.export.SimpleExporterInput;
76
import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
7+
import net.sf.jasperreports.poi.export.JRXlsExporter;
88

99
/** An PDF output format that uses Jasper reports to generate the result. */
1010
public final class JasperReportExcelOutputFormat extends AbstractJasperReportOutputFormat

core/src/main/java/org/mapfish/print/output/JasperReportPDFOutputFormat.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import net.sf.jasperreports.engine.JRException;
55
import net.sf.jasperreports.engine.JasperPrint;
66
import net.sf.jasperreports.engine.PrintPageFormat;
7-
import net.sf.jasperreports.engine.export.JRPdfExporter;
87
import net.sf.jasperreports.export.SimpleExporterInput;
98
import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;
10-
import net.sf.jasperreports.export.SimplePdfExporterConfiguration;
11-
import net.sf.jasperreports.export.type.PdfVersionEnum;
9+
import net.sf.jasperreports.pdf.JRPdfExporter;
10+
import net.sf.jasperreports.pdf.SimplePdfExporterConfiguration;
11+
import net.sf.jasperreports.pdf.type.PdfVersionEnum;
1212
import org.mapfish.print.config.PDFConfig;
1313
import org.mapfish.print.processor.ExecutionStats;
1414

Lines changed: 39 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<!-- Created with Jaspersoft Studio version last-->
3-
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="DJR_2141" pageWidth="555" pageHeight="842" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" scriptletClass="ar.com.fdvs.dj.core.DJDefaultScriptlet" whenResourceMissingType="Key" uuid="e034c6ef-7449-4a6a-9b5e-4ce04cc083b2">
1+
<jasperReport name="DJR_2141" language="java" pageWidth="555" pageHeight="842" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" scriptletClass="ar.com.fdvs.dj.core.DJDefaultScriptlet" whenResourceMissingType="Key" uuid="e034c6ef-7449-4a6a-9b5e-4ce04cc083b2">
42
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
53
<property name="com.jaspersoft.studio.unit." value="pixel"/>
6-
<style name="header_style_1" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Center" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="7" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded="false">
4+
<style name="header_style_1" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hTextAlign="Center" vTextAlign="Middle" hImageAlign="Center" vImageAlign="Middle" rotation="None" blankWhenNull="true" fontName="DejaVu Sans" fontSize="7.0" bold="true" italic="false" underline="false" pdfEmbedded="false">
75
<box padding="8">
86
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
97
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -12,7 +10,7 @@
1210
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
1311
</box>
1412
</style>
15-
<style name="header_style_2" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Center" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="7" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded="false">
13+
<style name="header_style_2" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hTextAlign="Center" vTextAlign="Middle" hImageAlign="Center" vImageAlign="Middle" rotation="None" blankWhenNull="true" fontName="DejaVu Sans" fontSize="7.0" bold="true" italic="false" underline="false" pdfEmbedded="false">
1614
<box padding="8">
1715
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
1816
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -21,7 +19,7 @@
2119
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
2220
</box>
2321
</style>
24-
<style name="header_style_3" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Center" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="7" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded="false">
22+
<style name="header_style_3" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hTextAlign="Center" vTextAlign="Middle" hImageAlign="Center" vImageAlign="Middle" rotation="None" blankWhenNull="true" fontName="DejaVu Sans" fontSize="7.0" bold="true" italic="false" underline="false" pdfEmbedded="false">
2523
<box padding="8">
2624
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
2725
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -30,37 +28,34 @@
3028
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
3129
</box>
3230
</style>
33-
<style name="column_style_1" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Left" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false">
31+
<style name="column_style_1" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hTextAlign="Left" vTextAlign="Middle" hImageAlign="Left" vImageAlign="Middle" rotation="None" blankWhenNull="true" fontName="DejaVu Sans" fontSize="8.0" bold="false" italic="false" underline="false" pdfEmbedded="false">
3432
<box padding="8">
3533
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
3634
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#BABABA"/>
3735
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
3836
</box>
39-
<conditionalStyle>
37+
<conditionalStyle mode="Opaque" backcolor="#F2F2F2">
4038
<conditionExpression><![CDATA[new java.lang.Boolean(((Number)$V{REPORT_COUNT}).doubleValue() % 2 == 0)]]></conditionExpression>
41-
<style mode="Opaque" backcolor="#F2F2F2"/>
4239
</conditionalStyle>
4340
</style>
44-
<style name="column_style_2" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Left" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false">
41+
<style name="column_style_2" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hTextAlign="Left" vTextAlign="Middle" hImageAlign="Left" vImageAlign="Middle" rotation="None" blankWhenNull="true" fontName="DejaVu Sans" fontSize="8.0" bold="false" italic="false" underline="false" pdfEmbedded="false">
4542
<box padding="8">
4643
<pen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
4744
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#BABABA"/>
4845
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
4946
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
5047
</box>
51-
<conditionalStyle>
48+
<conditionalStyle mode="Opaque" backcolor="#F2F2F2">
5249
<conditionExpression><![CDATA[new java.lang.Boolean(((Number)$V{REPORT_COUNT}).doubleValue() % 2 == 0)]]></conditionExpression>
53-
<style mode="Opaque" backcolor="#F2F2F2"/>
5450
</conditionalStyle>
5551
</style>
56-
<style name="column_style_3" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hAlign="Left" vAlign="Middle" rotation="None" isBlankWhenNull="true" fontName="DejaVu Sans" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded="false">
52+
<style name="column_style_3" mode="Transparent" forecolor="#000000" backcolor="#FFFFFF" radius="0" hTextAlign="Left" vTextAlign="Middle" hImageAlign="Left" vImageAlign="Middle" rotation="None" blankWhenNull="true" fontName="DejaVu Sans" fontSize="8.0" bold="false" italic="false" underline="false" pdfEmbedded="false">
5753
<box padding="8">
5854
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#BABABA"/>
5955
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
6056
</box>
61-
<conditionalStyle>
57+
<conditionalStyle mode="Opaque" backcolor="#F2F2F2">
6258
<conditionExpression><![CDATA[new java.lang.Boolean(((Number)$V{REPORT_COUNT}).doubleValue() % 2 == 0)]]></conditionExpression>
63-
<style mode="Opaque" backcolor="#F2F2F2"/>
6459
</conditionalStyle>
6560
</style>
6661
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
@@ -73,66 +68,43 @@
7368
<parameter name="attribute_rotation" class="java.lang.String"/>
7469
<parameter name="map_main" class="java.awt.image.BufferedImage"/>
7570
<parameter name="attribute_units" class="java.lang.String"/>
76-
<queryString>
77-
<![CDATA[]]>
78-
</queryString>
71+
<query language="sql"><![CDATA[]]></query>
7972
<field name="col1" class="java.lang.String"/>
8073
<field name="col2" class="java.lang.String"/>
8174
<field name="col3" class="java.lang.String"/>
82-
<pageHeader>
83-
<band/>
84-
</pageHeader>
85-
<columnHeader>
86-
<band height="20">
87-
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
88-
<property name="local_mesure_unitheight" value="pixel"/>
75+
<pageHeader/>
76+
<columnHeader height="20">
77+
<element kind="textField" uuid="3a4e9d49-3645-4ca7-8e36-abfb35c0f688" key="header_id" positionType="Float" stretchType="ElementGroupHeight" x="0" y="0" width="185" height="20" textAdjust="StretchHeight" blankWhenNull="true" printWhenDetailOverflows="true" style="header_style_1">
78+
<expression><![CDATA["col1"]]></expression>
8979
<property name="com.jaspersoft.studio.unit.height" value="px"/>
90-
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
91-
<reportElement key="header_id" style="header_style_1" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="185" height="20" isPrintWhenDetailOverflows="true" uuid="3a4e9d49-3645-4ca7-8e36-abfb35c0f688">
92-
<property name="com.jaspersoft.studio.unit.height" value="px"/>
93-
</reportElement>
94-
<textFieldExpression><![CDATA["col1"]]></textFieldExpression>
95-
</textField>
96-
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
97-
<reportElement key="header_name" style="header_style_2" positionType="Float" stretchType="RelativeToTallestObject" x="185" y="0" width="185" height="20" isPrintWhenDetailOverflows="true" uuid="9fac5b94-c27f-4ed4-960c-ac48b60d0598">
98-
<property name="com.jaspersoft.studio.unit.height" value="px"/>
99-
</reportElement>
100-
<textFieldExpression><![CDATA["col2"]]></textFieldExpression>
101-
</textField>
102-
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
103-
<reportElement key="header_icon" style="header_style_3" positionType="Float" stretchType="RelativeToTallestObject" x="370" y="0" width="185" height="20" isPrintWhenDetailOverflows="true" uuid="91317b7c-b366-4720-8e25-689630c8db0f">
104-
<property name="com.jaspersoft.studio.unit.height" value="px"/>
105-
</reportElement>
106-
<textElement>
107-
<font fontName="DejaVu Sans" size="8"/>
108-
</textElement>
109-
<textFieldExpression><![CDATA["col3"]]></textFieldExpression>
110-
</textField>
111-
</band>
80+
</element>
81+
<element kind="textField" uuid="9fac5b94-c27f-4ed4-960c-ac48b60d0598" key="header_name" positionType="Float" stretchType="ElementGroupHeight" x="185" y="0" width="185" height="20" textAdjust="StretchHeight" blankWhenNull="true" printWhenDetailOverflows="true" style="header_style_2">
82+
<expression><![CDATA["col2"]]></expression>
83+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
84+
</element>
85+
<element kind="textField" uuid="91317b7c-b366-4720-8e25-689630c8db0f" key="header_icon" positionType="Float" stretchType="ElementGroupHeight" x="370" y="0" width="185" height="20" fontName="DejaVu Sans" fontSize="8.0" textAdjust="StretchHeight" blankWhenNull="true" printWhenDetailOverflows="true" style="header_style_3">
86+
<expression><![CDATA["col3"]]></expression>
87+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
88+
</element>
89+
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
90+
<property name="local_mesure_unitheight" value="pixel"/>
91+
<property name="com.jaspersoft.studio.unit.height" value="px"/>
11292
</columnHeader>
11393
<detail>
11494
<band height="53">
95+
<element kind="image" uuid="45c4a4a3-7262-4f70-86cc-bb0b35c5b758" key="column_1" x="0" y="0" width="185" height="53" style="column_style_1">
96+
<expression><![CDATA[$F{col1}]]></expression>
97+
</element>
98+
<element kind="textField" uuid="1e0ee0ef-22a5-43d5-b8d2-a731fc573055" key="style2" positionType="Float" stretchType="ElementGroupHeight" x="185" y="0" width="185" height="53" textAdjust="StretchHeight" blankWhenNull="true" printWhenDetailOverflows="true" style="column_style_2">
99+
<expression><![CDATA[$F{col2}]]></expression>
100+
</element>
101+
<element kind="textField" uuid="25f68c48-9238-4b5b-b3dd-884418c66f7d" key="style3" positionType="Float" stretchType="ElementGroupHeight" x="370" y="0" width="185" height="53" textAdjust="StretchHeight" blankWhenNull="true" printWhenDetailOverflows="true" style="column_style_3">
102+
<expression><![CDATA[$F{col2}]]></expression>
103+
<property name="local_mesure_unitheight" value="pixel"/>
104+
</element>
115105
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
116-
<image>
117-
<reportElement key="column_1" style="column_style_1" x="0" y="0" width="185" height="53" uuid="45c4a4a3-7262-4f70-86cc-bb0b35c5b758"/>
118-
<imageExpression><![CDATA[$F{col1}]]></imageExpression>
119-
</image>
120-
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
121-
<reportElement key="style2" style="column_style_2" positionType="Float" stretchType="RelativeToTallestObject" x="185" y="0" width="185" height="53" isPrintWhenDetailOverflows="true" uuid="1e0ee0ef-22a5-43d5-b8d2-a731fc573055"/>
122-
<textFieldExpression><![CDATA[$F{col2}]]></textFieldExpression>
123-
</textField>
124-
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
125-
<reportElement key="style3" style="column_style_3" positionType="Float" stretchType="RelativeToTallestObject" x="370" y="0" width="185" height="53" isPrintWhenDetailOverflows="true" uuid="25f68c48-9238-4b5b-b3dd-884418c66f7d">
126-
<property name="local_mesure_unitheight" value="pixel"/>
127-
</reportElement>
128-
<textFieldExpression><![CDATA[$F{col2}]]></textFieldExpression>
129-
</textField>
130106
</band>
131107
</detail>
132-
<pageFooter>
133-
<band/>
134-
</pageFooter>
135-
<summary>
136-
<band/>
137-
</summary>
108+
<pageFooter/>
109+
<summary/>
138110
</jasperReport>

core/src/test/java/org/mapfish/print/attribute/JsonDatasourceAttributeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import java.util.HashMap;
88
import java.util.concurrent.atomic.AtomicBoolean;
99
import net.sf.jasperreports.engine.JRException;
10-
import net.sf.jasperreports.engine.data.JsonDataSource;
1110
import net.sf.jasperreports.engine.design.JRDesignField;
11+
import net.sf.jasperreports.json.data.JsonDataSource;
1212
import org.junit.Test;
1313
import org.mapfish.print.AbstractMapfishSpringTest;
1414
import org.mapfish.print.TestHttpClientFactory;

0 commit comments

Comments
 (0)