From 08911a1b4f7bc825841f99053cf98af795e506f2 Mon Sep 17 00:00:00 2001 From: emusic Date: Wed, 21 Mar 2018 17:56:48 +0100 Subject: enabled placeholder serach for pdf-as web --- pdf-as-lib/src/configuration/cfg/config.properties | 4 +- .../pdfas/lib/api/IConfigurationConstants.java | 3 +- .../at/gv/egiz/pdfas/lib/api/PdfAsFactory.java | 45 ++++++++-------------- .../configuration/PlaceholderConfiguration.java | 3 +- .../configuration/PlaceholderWebConfiguration.java | 18 +++++++++ .../lib/impl/placeholder/PlaceholderFilter.java | 10 ++++- 6 files changed, 46 insertions(+), 37 deletions(-) create mode 100644 pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderWebConfiguration.java (limited to 'pdf-as-lib/src') diff --git a/pdf-as-lib/src/configuration/cfg/config.properties b/pdf-as-lib/src/configuration/cfg/config.properties index fe2385a8..42193ec5 100644 --- a/pdf-as-lib/src/configuration/cfg/config.properties +++ b/pdf-as-lib/src/configuration/cfg/config.properties @@ -102,6 +102,4 @@ include.01 = profiles/*.properties # Legt das Standard-Signaturprofil fest sig_obj.type.default=SIGNATURBLOCK_SMALL_DE_NOTE -################## -# Protect PDF files from copying and extractiong content -# Set values to be true|false|unchanged + diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java index 3c560142..e9e7e0f4 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java @@ -44,7 +44,8 @@ public interface IConfigurationConstants { public static final String LEGACY_POSITIONING = ".legacy.pos"; public static final String LEGACY_40_POSITIONING = ".legacy40.pos"; public static final String MIN_WIDTH = "minWidth"; - + + public static final String PLACEHOLDER_WEB_ID = "placeholder_web_id"; public static final String PLACEHOLDER_ID = "placeholder_id"; public static final String PLACEHOLDER_MODE = "placeholder_mode"; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java index c3c2b6fd..f917de64 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java @@ -23,17 +23,26 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.api; +import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsValidationException; +import at.gv.egiz.pdfas.common.settings.ISettings; +import at.gv.egiz.pdfas.lib.api.sign.SignParameter; +import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; +import at.gv.egiz.pdfas.lib.configuration.ConfigurationValidator; +import at.gv.egiz.pdfas.lib.impl.PdfAsImpl; +import at.gv.egiz.pdfas.lib.impl.SignParameterImpl; +import at.gv.egiz.pdfas.lib.impl.VerifyParameterImpl; +import at.gv.egiz.pdfas.lib.impl.configuration.ConfigValidatorLoader; import iaik.security.ec.provider.ECCelerate; import iaik.security.provider.IAIK; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.awt.Graphics2D; +import javax.activation.DataSource; +import javax.crypto.Cipher; +import java.awt.*; import java.awt.image.BufferedImage; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; import java.lang.management.RuntimeMXBean; @@ -44,28 +53,6 @@ import java.util.Map.Entry; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import javax.activation.DataSource; -import javax.crypto.Cipher; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsException; -import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsValidationException; -import at.gv.egiz.pdfas.common.settings.ISettings; -import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; -import at.gv.egiz.pdfas.lib.configuration.ConfigurationValidator; -import at.gv.egiz.pdfas.lib.impl.PdfAsImpl; -import at.gv.egiz.pdfas.lib.impl.SignParameterImpl; -import at.gv.egiz.pdfas.lib.impl.VerifyParameterImpl; -import at.gv.egiz.pdfas.lib.impl.configuration.ConfigValidatorLoader; - - -import org.bouncycastle.jce.provider.BouncyCastleProvider; - -import org.bouncycastle.jce.provider.BouncyCastleProvider; - public class PdfAsFactory implements IConfigurationConstants { private static final Logger logger = LoggerFactory diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java index b20215fc..69d83239 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java @@ -47,8 +47,7 @@ public class PlaceholderConfiguration extends SpecificBaseConfiguration } return false; } - - + /** * Match selected Profile for Placeholder * Enables to activate placeholder search/match for different profiles diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderWebConfiguration.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderWebConfiguration.java new file mode 100644 index 00000000..8c63ed02 --- /dev/null +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderWebConfiguration.java @@ -0,0 +1,18 @@ +package at.gv.egiz.pdfas.lib.impl.configuration; + +import java.util.Properties; + +public class PlaceholderWebConfiguration { + + protected static Properties properties = new Properties(); + + public static void setValue(String key, String value) + { + properties.setProperty(key,value); + } + public static String getValue(String key) + { + return properties.getProperty(key); + } + +} diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java index 4b1a5a49..455077a8 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java @@ -30,6 +30,7 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsErrorCarrier; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.lib.api.IConfigurationConstants; +import at.gv.egiz.pdfas.lib.impl.configuration.PlaceholderWebConfiguration; import at.gv.egiz.pdfas.lib.impl.status.OperationStatus; public class PlaceholderFilter implements IConfigurationConstants, @@ -42,9 +43,14 @@ public class PlaceholderFilter implements IConfigurationConstants, if (status.getPlaceholderConfiguration().isGlobalPlaceholderEnabled()) { PlaceholderExtractor extractor = status.getBackend() .getPlaceholderExtractor(); - String placeholderID = settings.getValue(PLACEHOLDER_ID); - String placeholderModeString = settings.getValue(PLACEHOLDER_MODE); + String placeholderID = PlaceholderWebConfiguration.getValue(PLACEHOLDER_WEB_ID); + if(placeholderID == null) + { + placeholderID = settings.getValue(PLACEHOLDER_ID); + } + + String placeholderModeString = settings.getValue(PLACEHOLDER_MODE); int placeholderMode = PLACEHOLDER_MATCH_MODE_MODERATE; if (placeholderModeString != null) { try { -- cgit v1.2.3