aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-common/src/main/java
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-12-11 12:04:19 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-12-11 12:04:19 +0100
commit05bb51dd0190c56f7ec59f6f0c759e00f1d72edc (patch)
tree0c49fa461cc659b335f6e2979d53954d599c6988 /pdf-as-common/src/main/java
parent84553d9bc5eb670ee6f9cf21b3f9aa516530bc56 (diff)
downloadpdf-as-4-05bb51dd0190c56f7ec59f6f0c759e00f1d72edc.tar.gz
pdf-as-4-05bb51dd0190c56f7ec59f6f0c759e00f1d72edc.tar.bz2
pdf-as-4-05bb51dd0190c56f7ec59f6f0c759e00f1d72edc.zip
Signature profile implementations
Diffstat (limited to 'pdf-as-common/src/main/java')
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/IProfileConstants.java2
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/Settings.java4
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java22
3 files changed, 25 insertions, 3 deletions
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<String, String> profileSettings = new HashMap<String, String>();
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);
+ }
}