From b71f3a679d6c78eb6225b6faaf1519e601e2b5cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 05:21:12 +0000 Subject: [PATCH 1/2] build(deps): bump itextpdf.version from 8.0.5 to 9.0.0 Bumps `itextpdf.version` from 8.0.5 to 9.0.0. Updates `com.itextpdf:kernel` from 8.0.5 to 9.0.0 Updates `com.itextpdf:itext-core` from 8.0.5 to 9.0.0 - [Release notes](https://github.com/itext/itext7/releases) - [Commits](https://github.com/itext/itext7/compare/8.0.5...9.0.0) Updates `com.itextpdf:layout` from 8.0.5 to 9.0.0 --- updated-dependencies: - dependency-name: com.itextpdf:kernel dependency-type: direct:production update-type: version-update:semver-major - dependency-name: com.itextpdf:itext-core dependency-type: direct:production update-type: version-update:semver-major - dependency-name: com.itextpdf:layout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 46704cd07f..1c2e33e8a4 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ 32.1 18.1 1.20.0 - 8.0.5 + 9.0.0 42.7.4 2024.1.0 23.6.0.24.10 From 2a83843899598d95c50ae476787a6477ebf4f6fa Mon Sep 17 00:00:00 2001 From: Mark Prins <1165786+mprins@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:43:47 +0100 Subject: [PATCH 2/2] Verwerk breaking itext API upgrades in de code --- .../brmo/loader/checks/AfgifteChecker.java | 10 ++++---- .../loader/checks/AfgiftelijstReport.java | 23 +++++++++---------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/checks/AfgifteChecker.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/checks/AfgifteChecker.java index 629fbeca89..ec6a623b6e 100644 --- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/checks/AfgifteChecker.java +++ b/brmo-loader/src/main/java/nl/b3p/brmo/loader/checks/AfgifteChecker.java @@ -18,7 +18,6 @@ import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.sql.SQLException; @@ -53,7 +52,7 @@ public void init(InputStream input, StagingProxy staging) throws IOException { } public void check() { - afgiftes.forEach((afgifte) -> check(afgifte)); + afgiftes.forEach(this::check); } /** @@ -85,22 +84,21 @@ private void processFoundLaadprocess(Afgifte afgifte, LaadProces lp) throws SQLE List berichten = staging.getBerichtByLaadProces(lp); Map counts = afgifte.getStatussen(); berichten.stream() - .map( + .peek( (bericht) -> { if (!counts.containsKey(bericht.getStatus())) { counts.put(bericht.getStatus(), 0); } - return bericht; }) .forEachOrdered( (bericht) -> counts.put(bericht.getStatus(), counts.get(bericht.getStatus()) + 1)); } - public File getResults(String input, String f) throws FileNotFoundException { + public File getResults(String input, String f) throws IOException { return getResults(input, new File(f)); } - public File getResults(String input, File f) throws FileNotFoundException { + public File getResults(String input, File f) throws IOException { AfgiftelijstReport reporter = new AfgiftelijstReport(); reporter.createReport(afgiftes, input, f); diff --git a/brmo-loader/src/main/java/nl/b3p/brmo/loader/checks/AfgiftelijstReport.java b/brmo-loader/src/main/java/nl/b3p/brmo/loader/checks/AfgiftelijstReport.java index 6079ff09a8..bfaaf982f8 100644 --- a/brmo-loader/src/main/java/nl/b3p/brmo/loader/checks/AfgiftelijstReport.java +++ b/brmo-loader/src/main/java/nl/b3p/brmo/loader/checks/AfgiftelijstReport.java @@ -18,9 +18,6 @@ import com.itextpdf.io.font.constants.StandardFonts; import com.itextpdf.kernel.colors.DeviceRgb; -import com.itextpdf.kernel.events.Event; -import com.itextpdf.kernel.events.IEventHandler; -import com.itextpdf.kernel.events.PdfDocumentEvent; import com.itextpdf.kernel.font.PdfFont; import com.itextpdf.kernel.font.PdfFontFactory; import com.itextpdf.kernel.geom.PageSize; @@ -29,6 +26,9 @@ import com.itextpdf.kernel.pdf.PdfPage; import com.itextpdf.kernel.pdf.PdfWriter; import com.itextpdf.kernel.pdf.canvas.PdfCanvas; +import com.itextpdf.kernel.pdf.event.AbstractPdfDocumentEvent; +import com.itextpdf.kernel.pdf.event.AbstractPdfDocumentEventHandler; +import com.itextpdf.kernel.pdf.event.PdfDocumentEvent; import com.itextpdf.kernel.pdf.xobject.PdfFormXObject; import com.itextpdf.layout.Canvas; import com.itextpdf.layout.Document; @@ -41,7 +41,6 @@ import com.itextpdf.layout.element.Table; import com.itextpdf.layout.properties.TextAlignment; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -64,7 +63,7 @@ public class AfgiftelijstReport { private String datum; public void createReport(List afgiftes, String inputFileName, File output) - throws FileNotFoundException { + throws IOException { datum = sdf.format(new Date()); PdfDocument pdfDoc = new PdfDocument(new PdfWriter(output)); @@ -151,21 +150,21 @@ private void createRow(Afgifte afgifte, Table table) { } private String getStatusString(Afgifte afgifte) { - String res = ""; + StringBuilder res = new StringBuilder(); Map stati = afgifte.getStatussen(); for (STATUS status : stati.keySet()) { if (!res.isEmpty()) { - res += "\n"; + res.append("\n"); } - res += status.name() + ":" + stati.get(status); + res.append(status.name()).append(":").append(stati.get(status)); } if (res.isEmpty()) { - res = "-"; + res = new StringBuilder("-"); } - return res; + return res.toString(); } - protected class Footer implements IEventHandler { + protected class Footer extends AbstractPdfDocumentEventHandler { protected PdfFormXObject placeholder; protected float side = 20; @@ -179,7 +178,7 @@ public Footer(PdfDocument pdf) { } @Override - public void handleEvent(Event event) { + public void onAcceptedEvent(AbstractPdfDocumentEvent event) { PdfDocumentEvent docEvent = (PdfDocumentEvent) event; PdfDocument pdf = docEvent.getDocument(); PdfPage page = docEvent.getPage();