diff options
4 files changed, 38 insertions, 1 deletions
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 40a1bb15..bd9e9d99 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 @@ -46,6 +46,7 @@ public interface IConfigurationConstants { public static final String MIN_WIDTH = "minWidth"; public static final String PLACEHOLDER_ID = "placeholder_id"; + public static final String PLACEHOLDER_WEB_ID = "placeholder_web_id"; public static final String PLACEHOLDER_MODE = "placeholder_mode"; public static final String PLACEHOLDER_PROFILE_OVERWRITE = "placeholder_profile_overwrite"; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/ConfigurationImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/ConfigurationImpl.java index fd47bac5..79854641 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/ConfigurationImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/ConfigurationImpl.java @@ -28,6 +28,8 @@ import java.util.Map; import java.util.Properties; import java.util.Vector; +import org.apache.commons.lang3.StringUtils; + import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.lib.api.Configuration; import at.gv.egiz.pdfas.lib.settings.Settings; @@ -57,6 +59,28 @@ public class ConfigurationImpl implements ISettings, Configuration { } @Override + public boolean isValue(String key) { + return isValue(key, false); + } + + @Override + public boolean isValue(String key, boolean defaultValue) { + if (overwrittenProperties.containsKey(key)) { + String value = overwrittenProperties.getProperty(key); + if (StringUtils.isNotEmpty(value)) { + return Boolean.valueOf(value); + + } else { + return defaultValue; + + } + } else { + return this.settings.isValue(key); + + } + } + + @Override public boolean hasValue(String key) { if (overwrittenProperties.containsKey(key)) { return true; diff --git a/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/lib/test/stamping/CertificateAndRequestParameterResolverTest.java b/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/lib/test/stamping/CertificateAndRequestParameterResolverTest.java index fdc8fa7e..7ba6747a 100644 --- a/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/lib/test/stamping/CertificateAndRequestParameterResolverTest.java +++ b/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/lib/test/stamping/CertificateAndRequestParameterResolverTest.java @@ -113,6 +113,17 @@ public class CertificateAndRequestParameterResolverTest { // TODO Auto-generated method stub return null; } + + @Override + public boolean isValue(String key) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isValue(String key, boolean defaultValue) { + return defaultValue; + } }; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java index ee0cc4b0..ea139e87 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java @@ -165,7 +165,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { signature.setLocation(nextPlaceholderData.getPlaceholderName()); if (nextPlaceholderData.getProfile() != null) { - if ( pdfObject.getStatus().getSettings().isValue(IConfigurationConstants.PLACEHOLDER_PROFILE_OVERWRITE, true)) { + if (pdfObject.getStatus().getSettings().isValue(IConfigurationConstants.PLACEHOLDER_PROFILE_OVERWRITE, true)) { log.debug("Placeholder Profile set to: {}", nextPlaceholderData.getProfile()); requestedSignature.setSignatureProfileID(nextPlaceholderData.getProfile()); @@ -174,6 +174,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { } } + } final SignatureProfileSettings signatureProfileSettings = |