aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.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/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.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/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java')
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java22
1 files changed, 21 insertions, 1 deletions
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);
+ }
}