From 05bb51dd0190c56f7ec59f6f0c759e00f1d72edc Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 11 Dec 2013 12:04:19 +0100 Subject: Signature profile implementations --- .../pdfas/common/settings/IProfileConstants.java | 2 ++ .../at/gv/egiz/pdfas/common/settings/Settings.java | 4 ++-- .../common/settings/SignatureProfileSettings.java | 22 +++++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) (limited to 'pdf-as-common/src/main') diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/IProfileConstants.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/IProfileConstants.java index 897ced8e..4ebcc019 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/IProfileConstants.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/IProfileConstants.java @@ -64,4 +64,6 @@ public interface IProfileConstants { public final static String TMP_DIR = "default.pdfastmp_dir"; public final static String TMP_DIR_DEFAULT_VALUE = "pdfastmp"; + + public final static String SIGNING_REASON = "adobeSignReasonValue"; } diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/Settings.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/Settings.java index da946215..f3e17ab8 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/Settings.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/Settings.java @@ -47,9 +47,9 @@ public class Settings implements ISettings, IProfileConstants{ } logger.debug("Configured Properties:"); - if(logger.isDebugEnabled()) { + /*if(logger.isDebugEnabled()) { properties.list(System.out); - } + }*/ } catch (IOException e) { throw new PdfAsSettingsException("Failed to read settings!", e); diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java index 46f2ed09..ff5e5d29 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java @@ -14,6 +14,8 @@ public class SignatureProfileSettings implements IProfileConstants { private Map profileSettings = new HashMap(); private String profileID; + + private ISettings configuration; public SignatureProfileSettings(String profileID, ISettings configuration) { this.profileID = profileID; @@ -21,6 +23,7 @@ public class SignatureProfileSettings implements IProfileConstants { String keysPrefix = profilePrefix + PROFILE_KEY; String valuesPrefix = profilePrefix + PROFILE_VALUE; String tablePrefix = profilePrefix + TABLE; + this.configuration = configuration; logger.debug("Reading Profile: " + profileID); logger.debug("Keys Prefix: " + keysPrefix); @@ -100,22 +103,39 @@ public class SignatureProfileSettings implements IProfileConstants { return null; } + protected String getDefaultValue(String key) { + String profilePrefix = SIG_OBJ + profileID + KEY_SEPARATOR; + logger.debug("Searching default value for: " + key); + if(key.startsWith(profilePrefix)) { + key = key.substring(profilePrefix.length()); + } + key = "default." + key; + logger.debug("Searching default value for: " + key); + return this.configuration.getValue(key); + } + public String getValue(String key) { + logger.debug("Searching: " + key); SignatureProfileEntry entry = profileInformations.get(key); if(entry != null) { String value = entry.getValue(); if(value == null) { // TODO: try to find default value for key! + return getDefaultValue(key); } return value; } // TODO: try to find default value for key! - return null; + return getDefaultValue(key); } public String getProfileID() { return profileID; } + + public String getSigningReason() { + return this.getValue(SIGNING_REASON); + } } -- cgit v1.2.3