Skip to content

Commit

Permalink
Fix #74: JasperReports 7.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 3, 2024
1 parent 713bf0c commit d3c0061
Show file tree
Hide file tree
Showing 9 changed files with 14,066 additions and 14,044 deletions.
20 changes: 1 addition & 19 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,7 @@ updates:
- dependency-name: "io.quarkus:quarkus-maven-plugin"
- dependency-name: "io.quarkus:quarkus-extension-processor"
- dependency-name: "io.quarkus:quarkus-extension-maven-plugin"
- dependency-name: "net.sf.jasperreports:jasperreports"
- dependency-name: "net.sf.jasperreports:jasperreports-fonts"
- dependency-name: "jaxen:jaxen"
groups:
quarkus:
patterns:
- "io.quarkus*"
- "quarkus*"
quarkiverse:
patterns:
- "io.quarkiverse*"
dependencies:
patterns:
- "*"
exclude-patterns:
- "io.quarkus*"
- "quarkus*"
- "io.quarkiverse*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "daily"
5 changes: 5 additions & 0 deletions deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-awt-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.poi</groupId>
<artifactId>quarkus-poi-deployment</artifactId>
<version>${version.quarkus-poi}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-dev-ui-spi</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package io.quarkiverse.jasperreports.deployment;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedPackageBuildItem;
import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem;

Expand All @@ -25,24 +33,49 @@ UberJarMergedResourceBuildItem mergeResource() {
return new UberJarMergedResourceBuildItem(EXTENSIONS_FILE);
}

@BuildStep
void indexTransitiveDependencies(BuildProducer<IndexDependencyBuildItem> index) {
index.produce(new IndexDependencyBuildItem("com.fasterxml.jackson.dataformat", "jackson-dataformat-xml"));
index.produce(new IndexDependencyBuildItem("com.ibm.icu", "icu4j"));
index.produce(new IndexDependencyBuildItem("jaxen", "jaxen"));
index.produce(new IndexDependencyBuildItem("net.java.dev.msv", "msv-core"));
index.produce(new IndexDependencyBuildItem("net.sf.jasperreports", "jasperreports"));
index.produce(new IndexDependencyBuildItem("net.sf.jasperreports", "jasperreports-fonts"));
index.produce(new IndexDependencyBuildItem("net.sf.jasperreports", "jasperreports-jaxen"));
index.produce(new IndexDependencyBuildItem("org.dom4j", "dom4j"));
index.produce(new IndexDependencyBuildItem("org.jdom", "jdom"));
index.produce(new IndexDependencyBuildItem("org.mozilla", "rhino"));
index.produce(new IndexDependencyBuildItem("xom", "xom"));
}

@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
CombinedIndexBuildItem combinedIndex) {

final List<String> classNames = new ArrayList<>();
// Fonts
classNames.add(net.sf.jasperreports.engine.fonts.SimpleFontFace.class.getName());
classNames.add(net.sf.jasperreports.engine.fonts.SimpleFontFamily.class.getName());
classNames.add(net.sf.jasperreports.engine.fonts.AwtFontManager.class.getName());
classNames.add(org.apache.batik.gvt.font.AWTGVTFont.class.getName());

reflectiveClass.produce(
ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods(true).serialization(true).build());
}

@BuildStep
void runtimeInitializedClasses(BuildProducer<RuntimeInitializedPackageBuildItem> runtimeInitializedPackages) {
//@formatter:off
Stream.of(
javax.swing.plaf.metal.MetalIconFactory.class.getPackageName(),
net.sf.jasperreports.data.http.HttpDataService.class.getPackageName(),
net.sf.jasperreports.engine.SimpleReportContext.class.getPackageName(),
net.sf.jasperreports.engine.design.JRAbstractCompiler.class.getPackageName(),
net.sf.jasperreports.engine.export.JRXlsExporter.class.getPackageName(),
net.sf.jasperreports.engine.export.oasis.JROdtExporter.class.getPackageName(),
net.sf.jasperreports.engine.export.ooxml.DocxRunHelper.class.getPackageName(),
net.sf.jasperreports.engine.fonts.AwtFontManager.class.getPackageName(),
net.sf.jasperreports.engine.print.JRPrinterAWT.class.getPackageName(),
net.sf.jasperreports.engine.type.ColorEnum.class.getPackageName(),
net.sf.jasperreports.engine.util.ExifUtil.class.getPackageName(),
net.sf.jasperreports.engine.util.json.DefaultJsonQLExecuter.class.getPackageName(),
net.sf.jasperreports.renderers.AbstractSvgDataToGraphics2DRenderer.class.getPackageName(),
net.sf.jasperreports.renderers.util.SvgFontProcessor.class.getPackageName()
"org.apache.xmlbeans.impl.config.Parser",
org.apache.batik.bridge.CSSUtilities.class.getName(),
org.apache.batik.bridge.CursorManager.class.getName(),
org.apache.batik.bridge.SVGFilterElementBridge.class.getName(),
org.apache.batik.ext.awt.image.spi.DefaultBrokenLinkProvider.class.getName(),
org.apache.xmlbeans.impl.schema.TypeSystemHolder.class.getName(),
org.apache.xmlbeans.impl.xpath.saxon.SaxonXPath.class.getName(),
net.sf.jasperreports.engine.base.ElementsBlock.class.getName(),
net.sf.jasperreports.engine.type.ColorEnum.class.getName()
)
.map(RuntimeInitializedPackageBuildItem::new)
.forEach(runtimeInitializedPackages::produce);
Expand All @@ -64,4 +97,19 @@ void substrateResourceBuildItems(BuildProducer<NativeImageResourceBuildItem> nat
resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("metadata_messages"));
resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("metadata_messages-defaults"));
}

public List<String> collectClassesInPackage(CombinedIndexBuildItem combinedIndex, String packageName) {
final List<String> classes = new ArrayList<>();
final List<DotName> packages = new ArrayList<>(combinedIndex.getIndex().getSubpackages(packageName));
packages.add(DotName.createSimple(packageName));
for (DotName aPackage : packages) {
final List<String> packageClasses = combinedIndex.getIndex()
.getClassesInPackage(aPackage)
.stream()
.map(ClassInfo::toString)
.toList();
classes.addAll(packageClasses);
}
return classes;
}
}
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.jasperreports</groupId>
Expand Down
133 changes: 53 additions & 80 deletions integration-tests/src/main/resources/CustomersReport.jrxml
Original file line number Diff line number Diff line change
@@ -1,94 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="CustomersReport" pageWidth="595" pageHeight="842" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" uuid="6386a198-a31e-4f65-936d-2bc9fe5ac907">
<style name="Sans_Normal" isDefault="true" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="Sans_Bold" fontName="DejaVu Sans" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="Sans_Italic" fontName="DejaVu Sans" fontSize="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false"/>
<queryString language="xPath">
<![CDATA[/Northwind/Customers]]>
</queryString>
<jasperReport name="CustomersReport" language="java" pageWidth="595" pageHeight="842" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" uuid="6386a198-a31e-4f65-936d-2bc9fe5ac907">
<style name="Sans_Normal" default="true" fontName="DejaVu Sans" fontSize="12.0" bold="false" italic="false" underline="false" strikeThrough="false"/>
<style name="Sans_Bold" fontName="DejaVu Sans" fontSize="12.0" bold="true" italic="false" underline="false" strikeThrough="false"/>
<style name="Sans_Italic" fontName="DejaVu Sans" fontSize="12.0" bold="false" italic="true" underline="false" strikeThrough="false"/>
<query language="xPath"><![CDATA[/Northwind/Customers]]></query>
<field name="CustomerID" class="java.lang.String">
<property name="net.sf.jasperreports.xpath.field.expression" value="CustomerID"/>
</field>
<field name="CompanyName" class="java.lang.String">
<property name="net.sf.jasperreports.xpath.field.expression" value="CompanyName"/>
</field>
<title>
<band height="50">
<line>
<reportElement x="0" y="0" width="515" height="1" uuid="9c2633d9-9bfe-433b-8f5f-533a8280c386"/>
</line>
<staticText>
<reportElement style="Sans_Normal" x="0" y="10" width="515" height="30" uuid="69cf7a16-df9e-4a92-8dee-005fa6f01193"/>
<textElement textAlignment="Center">
<font size="22"/>
</textElement>
<text><![CDATA[Customer Orders Report]]></text>
</staticText>
</band>
<title height="50">
<element kind="line" uuid="9c2633d9-9bfe-433b-8f5f-533a8280c386" x="0" y="0" width="515" height="1"/>
<element kind="staticText" uuid="69cf7a16-df9e-4a92-8dee-005fa6f01193" x="0" y="10" width="515" height="30" fontSize="22.0" hTextAlign="Center" style="Sans_Normal">
<text><![CDATA[Customer Orders Report]]></text>
</element>
</title>
<pageHeader>
<band height="21">
<staticText>
<reportElement style="Sans_Bold" mode="Opaque" x="0" y="5" width="515" height="15" forecolor="#FFFFFF" backcolor="#333333" uuid="ee9cbaa3-142e-42ab-af98-2873869ded2d"/>
<text><![CDATA[Customer Order List]]></text>
</staticText>
</band>
<pageHeader height="21">
<element kind="staticText" uuid="ee9cbaa3-142e-42ab-af98-2873869ded2d" mode="Opaque" x="0" y="5" width="515" height="15" forecolor="#FFFFFF" backcolor="#333333" style="Sans_Bold">
<text><![CDATA[Customer Order List]]></text>
</element>
</pageHeader>
<detail>
<band height="50">
<textField>
<reportElement style="Sans_Bold" x="5" y="5" width="100" height="15" isPrintWhenDetailOverflows="true" uuid="880e92c9-d6cc-4ad4-bc60-7e45887b9fe1"/>
<textFieldExpression><![CDATA[$F{CustomerID}]]></textFieldExpression>
</textField>
<staticText>
<reportElement style="Sans_Bold" isPrintRepeatedValues="false" x="404" y="5" width="100" height="15" isPrintWhenDetailOverflows="true" uuid="e40dae0e-0859-4881-bbe2-290bfa88d7d7"/>
<element kind="textField" uuid="880e92c9-d6cc-4ad4-bc60-7e45887b9fe1" x="5" y="5" width="100" height="15" printWhenDetailOverflows="true" style="Sans_Bold">
<expression><![CDATA[$F{CustomerID}]]></expression>
</element>
<element kind="staticText" uuid="e40dae0e-0859-4881-bbe2-290bfa88d7d7" x="404" y="5" width="100" height="15" printWhenDetailOverflows="true" printRepeatedValues="false" style="Sans_Bold">
<text><![CDATA[(continued)]]></text>
</staticText>
<line>
<reportElement x="0" y="20" width="515" height="1" isPrintWhenDetailOverflows="true" uuid="2d5a60ee-3d8d-4f50-ba2a-72f82e76e38e"/>
</line>
<subreport>
<reportElement isPrintRepeatedValues="false" x="5" y="25" width="507" height="20" isRemoveLineWhenBlank="true" backcolor="#FFCC99" uuid="e7de82f1-2e1c-4459-bef3-307e57903e0b"/>
<subreportParameter name="XML_DATA_DOCUMENT">
<subreportParameterExpression><![CDATA[$P{XML_DATA_DOCUMENT}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="XML_DATE_PATTERN">
<subreportParameterExpression><![CDATA[$P{XML_DATE_PATTERN}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="XML_NUMBER_PATTERN">
<subreportParameterExpression><![CDATA[$P{XML_NUMBER_PATTERN}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="XML_LOCALE">
<subreportParameterExpression><![CDATA[$P{XML_LOCALE}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="XML_TIME_ZONE">
<subreportParameterExpression><![CDATA[$P{XML_TIME_ZONE}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="CustomerID">
<subreportParameterExpression><![CDATA[$F{CustomerID}]]></subreportParameterExpression>
</subreportParameter>
<subreportExpression><![CDATA["OrdersReport.jasper"]]></subreportExpression>
</subreport>
<textField>
<reportElement style="Sans_Bold" x="109" y="5" width="291" height="15" isPrintWhenDetailOverflows="true" uuid="ded07e37-4c41-4617-9f13-8a819cc1e745"/>
<textFieldExpression><![CDATA[$F{CompanyName}]]></textFieldExpression>
</textField>
</element>
<element kind="line" uuid="2d5a60ee-3d8d-4f50-ba2a-72f82e76e38e" x="0" y="20" width="515" height="1" printWhenDetailOverflows="true"/>
<element kind="subreport" uuid="e7de82f1-2e1c-4459-bef3-307e57903e0b" x="5" y="25" width="507" height="20" backcolor="#FFCC99" printRepeatedValues="false" removeLineWhenBlank="true">
<expression><![CDATA["OrdersReport.jasper"]]></expression>
<parameter name="XML_DATA_DOCUMENT">
<expression><![CDATA[$P{XML_DATA_DOCUMENT}]]></expression>
</parameter>
<parameter name="XML_DATE_PATTERN">
<expression><![CDATA[$P{XML_DATE_PATTERN}]]></expression>
</parameter>
<parameter name="XML_NUMBER_PATTERN">
<expression><![CDATA[$P{XML_NUMBER_PATTERN}]]></expression>
</parameter>
<parameter name="XML_LOCALE">
<expression><![CDATA[$P{XML_LOCALE}]]></expression>
</parameter>
<parameter name="XML_TIME_ZONE">
<expression><![CDATA[$P{XML_TIME_ZONE}]]></expression>
</parameter>
<parameter name="CustomerID">
<expression><![CDATA[$F{CustomerID}]]></expression>
</parameter>
</element>
<element kind="textField" uuid="ded07e37-4c41-4617-9f13-8a819cc1e745" x="109" y="5" width="291" height="15" printWhenDetailOverflows="true" style="Sans_Bold">
<expression><![CDATA[$F{CompanyName}]]></expression>
</element>
</band>
</detail>
<pageFooter>
<band height="40">
<line>
<reportElement x="0" y="10" width="515" height="1" uuid="33a41154-ab20-4fbc-8f20-b47eb00b7c12"/>
</line>
<textField>
<reportElement x="200" y="20" width="80" height="15" uuid="e6339776-ad98-448c-9ede-58a76a109cc0"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="280" y="20" width="75" height="15" uuid="36404df1-6aa0-467f-915b-9b0166073249"/>
<textFieldExpression><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
</textField>
</band>
<pageFooter height="40">
<element kind="line" uuid="33a41154-ab20-4fbc-8f20-b47eb00b7c12" x="0" y="10" width="515" height="1"/>
<element kind="textField" uuid="e6339776-ad98-448c-9ede-58a76a109cc0" x="200" y="20" width="80" height="15" hTextAlign="Right">
<expression><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></expression>
</element>
<element kind="textField" uuid="36404df1-6aa0-467f-915b-9b0166073249" x="280" y="20" width="75" height="15" evaluationTime="Report">
<expression><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></expression>
</element>
</pageFooter>
</jasperReport>
</jasperReport>
Loading

0 comments on commit d3c0061

Please sign in to comment.