diff options
4 files changed, 17 insertions, 5 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 index 611a9480..f5293935 100644 --- 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 @@ -63,7 +63,7 @@ public class DefaultSignatureProfileSettings { 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'"; + public static final String VALUE_SIG_DATE_DEFAULT = "yyyy-MM-dd'T'HH:mm:ssXXX"; static { profileSettings.put(KEY_SIG_SUBJECT, new SignatureProfileEntry(KEY_SIG_SUBJECT, KEY_SIG_SUBJECT_DEFAULT, VALUE_SIG_SUBJECT_DEFAULT) ); 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 aaa00ed6..6cdfa0b3 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 @@ -90,5 +90,6 @@ public interface IProfileConstants { public final static String SIGNING_REASON = "adobeSignReasonValue"; public final static String SIGNFIELD_VALUE = "adobeSignFieldValue"; + public final static String TIMEZONE_BASE = "timezone"; public final static String SIG_PDFA1B_VALID = "SIG_PDFA1B_VALID"; } 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 45b5c375..462bf743 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 @@ -199,6 +199,10 @@ public class SignatureProfileSettings implements IProfileConstants { return this.getValue(SIGNFIELD_VALUE); } + public String getProfileTimeZone() { + return this.getValue(TIMEZONE_BASE); + } + public boolean isPDFA() { SignatureProfileEntry entry = profileInformations.get(SIG_PDFA1B_VALID); if (entry != null) { diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java index fc3ffef3..fd7bb0dd 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java @@ -25,6 +25,7 @@ package at.gv.egiz.pdfas.lib.impl.stamping; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,7 +48,7 @@ public class ValueResolver implements IProfileConstants, IResolver { public static final String PatternRegex = "\\$(\\{[^\\$]*\\})"; - public static final String defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; + public static final String defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ssXXX"; public static final String EXP_START = "${"; public static final String EXP_END = "}"; @@ -69,11 +70,17 @@ public class ValueResolver implements IProfileConstants, IResolver { if (value == null) { value = defaultDateFormat; } + // Value holds the date format! - SimpleDateFormat formater = new SimpleDateFormat(value); - //formater.setTimeZone(TimeZone.getTimeZone("UTC")); + // + SimpleDateFormat fdf = new SimpleDateFormat(value); + String timeZone = settings.getProfileTimeZone(); + + if(timeZone != null) { + fdf.setTimeZone(TimeZone.getTimeZone("timeZone")); + } Calendar cal = Calendar.getInstance(); - return formater.format(cal.getTime()); + return fdf.format(cal.getTime()); } if (value != null) { |