From 23a45a68b73681fdcb736c35300fea43f44ec824 Mon Sep 17 00:00:00 2001 From: Sergey Grigoriev Date: Fri, 25 Oct 2024 16:02:22 +0200 Subject: [PATCH] feat: Polarion 2410 support Refs: #276 --- pom.xml | 70 +++++++++++++------ .../settings/CoverPageSettings.java | 7 +- 2 files changed, 50 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 0942333b..c7954657 100644 --- a/pom.xml +++ b/pom.xml @@ -75,6 +75,52 @@ ${skipTests} + + + + polarion2310 + + velocity-engine-core-2.3 + + + + + + polarion2404 + + velocity-engine-core-2.3 + + + + + polarion2410 + + org.apache.velocity.engine-core_2.3.0 + + + + + tests-with-weasyprint-docker + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + true + + docker + + + + + + + + ch.sbb.polarion.extensions @@ -84,7 +130,7 @@ com.polarion.thirdparty - velocity-engine-core-2.3 + ${velocity-engine-core.artifactId} ${polarion.version} provided @@ -270,26 +316,4 @@ - - - tests-with-weasyprint-docker - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - true - - docker - - - - - - - diff --git a/src/main/java/ch/sbb/polarion/extension/pdf_exporter/settings/CoverPageSettings.java b/src/main/java/ch/sbb/polarion/extension/pdf_exporter/settings/CoverPageSettings.java index 7aaa4c21..a068dfaa 100644 --- a/src/main/java/ch/sbb/polarion/extension/pdf_exporter/settings/CoverPageSettings.java +++ b/src/main/java/ch/sbb/polarion/extension/pdf_exporter/settings/CoverPageSettings.java @@ -11,7 +11,6 @@ import com.polarion.core.util.logging.Logger; import com.polarion.platform.service.repository.IRepositoryReadOnlyConnection; import com.polarion.subterra.base.location.ILocation; -import com.polarion.subterra.base.location.Location; import org.jetbrains.annotations.NotNull; import javax.ws.rs.InternalServerErrorException; @@ -24,6 +23,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.TreeSet; import java.util.UUID; @@ -151,15 +151,14 @@ public String persistTemplateImage(String template, String scope, String imageFi } } - @SuppressWarnings("unchecked") public void deleteCoverPageImages(String coverPageName, String scope) { String uuid = getIdByName(scope, true, coverPageName); ILocation coverPageFolderLocation = ScopeUtils.getContextLocation(scope).append(getSettingsFolder()); final IRepositoryReadOnlyConnection readOnlyConnection = pdfExporterPolarionService.getReadOnlyConnection(coverPageFolderLocation); - List subLocations = readOnlyConnection.getSubLocations(coverPageFolderLocation, false); + List subLocations = readOnlyConnection.getSubLocations(coverPageFolderLocation, false); subLocations.forEach(location -> { String locationFileName = location.getLastComponent(); - if (locationFileName.startsWith(uuid) && imageExtensions.contains(locationFileName.substring(locationFileName.lastIndexOf(".")))) { + if (locationFileName.startsWith(Objects.requireNonNull(uuid)) && imageExtensions.contains(locationFileName.substring(locationFileName.lastIndexOf(".")))) { getSettingsService().delete(location); } });