aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-common/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-12-17 11:08:51 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-12-17 11:08:51 +0100
commitc1af1550afe468537f480b399896d477f950c7d1 (patch)
tree0aa858e6fe13b7a779d583ae4038f39ade80f2c5 /pdf-as-common/src/main/java/at/gv/egiz/pdfas
parente5316db083e46c8ae9e4b07bff57812d9314200b (diff)
downloadpdf-as-4-c1af1550afe468537f480b399896d477f950c7d1.tar.gz
pdf-as-4-c1af1550afe468537f480b399896d477f950c7d1.tar.bz2
pdf-as-4-c1af1550afe468537f480b399896d477f950c7d1.zip
Added default value for Signature Profile Entries
Diffstat (limited to 'pdf-as-common/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/DefaultSignatureProfileSettings.java75
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileEntry.java6
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java24
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/DNUtils.java3
4 files changed, 108 insertions, 0 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/DefaultSignatureProfileSettings.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/DefaultSignatureProfileSettings.java
new file mode 100644
index 00000000..9cd8cfea
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/DefaultSignatureProfileSettings.java
@@ -0,0 +1,75 @@
+package at.gv.egiz.pdfas.common.settings;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DefaultSignatureProfileSettings {
+
+ private static Map<String, SignatureProfileEntry> profileSettings = new HashMap<String, SignatureProfileEntry>();
+
+ public static final String KEY_SIG_SUBJECT = "SIG_SUBJECT";
+ public static final String KEY_SIG_SUBJECT_DEFAULT = "Unterzeichner";
+
+ public static final String KEY_SIG_ISSUER = "SIG_ISSUER";
+ public static final String KEY_SIG_ISSUER_DEFAULT = "Aussteller-Zertifikat";
+
+ public static final String KEY_SIG_NUMBER = "SIG_NUMBER";
+ public static final String KEY_SIG_NUMBER_DEFAULT = "Serien-Nr.";
+
+ public static final String KEY_SIG_KZ = "SIG_KZ";
+ public static final String KEY_SIG_KZ_DEFAULT = "Methode";
+
+ public static final String KEY_SIG_ID = "SIG_ID";
+ public static final String KEY_SIG_ID_DEFAULT = "Parameter";
+
+ public static final String KEY_SIG_META = "SIG_META";
+ public static final String KEY_SIG_META_DEFAULT = "Pr\u00fcfinformation";
+
+ public static final String KEY_SIG_DATE = "SIG_DATE";
+ public static final String KEY_SIG_DATE_DEFAULT = "Datum/Zeit-UTC";
+
+ public static final String VALUE_SIG_SUBJECT_DEFAULT = "${subject.T != null ? (subject.T + \" \") : \"\"}${subject.CN}";
+
+ public static final String VALUE_SIG_ISSUER_DEFAULT = "${issuer.DN}";
+
+ public static final String VALUE_SIG_NUMBER_DEFAULT = "${sn}";
+
+ public static final String VALUE_SIG_KZ_DEFAULT = "";
+
+ public static final String VALUE_SIG_ID_DEFAULT = "";
+
+ public static final String VALUE_SIG_META_DEFAULT = "Informationen zur Pr\u00FCfung der elektronischen Signatur finden Sie unter: https://www.signaturpruefung.gv.at\n\nInformationen zur Pr\u00FCfung des Ausdrucks finden Sie unter: https://www.behoerde.gv.at/el_signatur/";
+
+ public static final String VALUE_SIG_DATE_DEFAULT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+
+ static {
+ profileSettings.put(KEY_SIG_SUBJECT, new SignatureProfileEntry(KEY_SIG_SUBJECT, KEY_SIG_SUBJECT_DEFAULT, VALUE_SIG_SUBJECT_DEFAULT) );
+ profileSettings.put(KEY_SIG_ISSUER, new SignatureProfileEntry(KEY_SIG_ISSUER, KEY_SIG_ISSUER_DEFAULT, VALUE_SIG_ISSUER_DEFAULT) );
+ profileSettings.put(KEY_SIG_NUMBER, new SignatureProfileEntry(KEY_SIG_NUMBER, KEY_SIG_NUMBER_DEFAULT, VALUE_SIG_NUMBER_DEFAULT) );
+ profileSettings.put(KEY_SIG_KZ, new SignatureProfileEntry(KEY_SIG_KZ, KEY_SIG_KZ_DEFAULT, VALUE_SIG_KZ_DEFAULT) );
+ profileSettings.put(KEY_SIG_ID, new SignatureProfileEntry(KEY_SIG_ID, KEY_SIG_ID_DEFAULT, VALUE_SIG_ID_DEFAULT) );
+ profileSettings.put(KEY_SIG_META, new SignatureProfileEntry(KEY_SIG_META, KEY_SIG_META_DEFAULT, VALUE_SIG_META_DEFAULT) );
+ profileSettings.put(KEY_SIG_DATE, new SignatureProfileEntry(KEY_SIG_DATE, KEY_SIG_DATE_DEFAULT, VALUE_SIG_DATE_DEFAULT) );
+ }
+
+ public static Map<String, SignatureProfileEntry> getDefaultValues() {
+ return profileSettings;
+ }
+
+ public static String getDefaultKeyValue(String key) {
+ SignatureProfileEntry entry = profileSettings.get(key);
+ if(entry != null) {
+ return entry.getValue();
+ }
+ return null;
+ }
+
+ public static String getDefaultKeyCaption(String key) {
+ SignatureProfileEntry entry = profileSettings.get(key);
+ if(entry != null) {
+ return entry.getCaption();
+ }
+ return null;
+ }
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileEntry.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileEntry.java
index 3df929b1..d8842014 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileEntry.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileEntry.java
@@ -7,6 +7,12 @@ public class SignatureProfileEntry {
public SignatureProfileEntry() {
}
+
+ public SignatureProfileEntry(String key, String caption, String value) {
+ this.key = key;
+ this.caption = caption;
+ this.value = value;
+ }
public String getKey() {
return key;
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 5c443039..456e58b2 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
@@ -46,6 +46,15 @@ public class SignatureProfileSettings implements IProfileConstants {
String valueValue = values.get(valuesPrefix + KEY_SEPARATOR
+ key);
+ // Lookup default values
+ if(valueKey == null) {
+ valueKey = DefaultSignatureProfileSettings.getDefaultKeyCaption(key);
+ }
+
+ if(valueValue == null) {
+ valueValue = DefaultSignatureProfileSettings.getDefaultKeyValue(key);
+ }
+
SignatureProfileEntry entry = new SignatureProfileEntry();
entry.setKey(key);
entry.setCaption(valueKey);
@@ -66,6 +75,11 @@ public class SignatureProfileSettings implements IProfileConstants {
String valueValue = values.get(valuesPrefix + KEY_SEPARATOR
+ key);
+ // Lookup default values
+ if(valueValue == null) {
+ valueValue = DefaultSignatureProfileSettings.getDefaultKeyValue(key);
+ }
+
SignatureProfileEntry entry = profileInformations.get(key);
if (entry == null) {
entry = new SignatureProfileEntry();
@@ -100,6 +114,16 @@ public class SignatureProfileSettings implements IProfileConstants {
logger.debug(" Settings: " + key + " : " + value);
}
+
+
+ Iterator<SignatureProfileEntry> dumpIterator =
+ profileInformations.values().iterator();
+
+ logger.debug("Settings for profile {}", profileID);
+ while(dumpIterator.hasNext()) {
+ SignatureProfileEntry entry = dumpIterator.next();
+ logger.debug(" " + entry.toString());
+ }
}
public String getCaption(String key) {
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/DNUtils.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/DNUtils.java
index 429151ee..d61a1694 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/DNUtils.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/DNUtils.java
@@ -28,6 +28,9 @@ public class DNUtils {
logger.debug(rdn.getType() + " = " + rdn.getValue().toString());
map.put(rdn.getType(), rdn.getValue().toString());
}
+
+ map.put("DN", dn);
+ logger.debug("DN = " + dn);
return map;
}