diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-08 11:17:02 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-08 11:17:02 +0200 |
commit | 0199d4dad04d8c0e1e8c531435bbd24956338824 (patch) | |
tree | 182e0eea487740ffec0bba646c7f1e065eadc6ae | |
parent | 517cad7044e5861220f1b6da88fa93ad06153ce4 (diff) | |
download | pdf-over-0199d4dad04d8c0e1e8c531435bbd24956338824.tar.gz pdf-over-0199d4dad04d8c0e1e8c531435bbd24956338824.tar.bz2 pdf-over-0199d4dad04d8c0e1e8c531435bbd24956338824.zip |
refactor out the "generic properties map" that is only used by a single property (the signature note)
4 files changed, 9 insertions, 18 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java index f97f8c0b..73313152 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java @@ -350,7 +350,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { PdfAs4SignatureParameter param = new PdfAs4SignatureParameter(); param.signatureProfile = this.configurationContainer.getSignatureProfile(); if(this.configurationContainer.signatureNote != null && !this.configurationContainer.signatureNote.isEmpty()) { - param.setProperty("SIG_NOTE", this.configurationContainer.signatureNote); + param.signatureNote = this.configurationContainer.signatureNote; } param.signatureLanguage = this.configurationContainer.signatureLocale.getLanguage(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index 29a37970..7d29d22b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -111,9 +111,8 @@ public class PositioningState extends State { Emblem emblem = new Emblem(config.getDefaultEmblemPath()); param.emblem = emblem; - if(config.getSignatureNote() != null && !config.getSignatureNote().isEmpty()) { - param.setProperty("SIG_NOTE", config.getSignatureNote()); - } + if(config.getSignatureNote() != null && !config.getSignatureNote().isEmpty()) + param.signatureNote = config.getSignatureNote(); param.signatureLanguage = config.getSignatureLocale().getLanguage(); param.enablePDFACompat = config.getSignaturePdfACompat(); diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java index c52625dd..c4999014 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java @@ -75,18 +75,19 @@ public class PdfAs4SignatureParameter { /** The signature device */ public BKUs signatureDevice; + /** The siganture note, if any */ + public String signatureNote = null; + /** Whether so look for placeholder signatures or not. */ public boolean searchForPlaceholderSignatures = false; - private HashMap<String, String> genericProperties = new HashMap<String, String>(); - public Profile signatureProfile = Profile.getDefaultProfile(); public Image getPlaceholder() { String sigProfile = getPdfAsSignatureProfileId(); String sigEmblem = (this.emblem == null ? null : this.emblem.getCachedFileName()); - String sigNote = getProperty("SIG_NOTE"); + String sigNote = this.signatureNote; try { X509Certificate cert = new X509Certificate(PdfAs4SignatureParameter.class.getResourceAsStream("/example.cer")); @@ -133,15 +134,6 @@ public class PdfAs4SignatureParameter { } } - // TODO review this - public void setProperty(String key, String value) { - this.genericProperties.put(key, value); - } - - public String getProperty(String key) { - return this.genericProperties.get(key); - } - /** * Gets the Signature Position String for PDF-AS * @@ -195,7 +187,7 @@ public class PdfAs4SignatureParameter { break; } - if (getProperty("SIG_NOTE") != null) + if (this.signatureNote) profileId += "_NOTE"; if (this.enablePDFACompat) diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java index 7a67a35a..51e36037 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java @@ -47,7 +47,7 @@ public class PdfAs4Signer { String sigProfile = parameter.getPdfAsSignatureProfileId(); String sigEmblem = (parameter.emblem == null ? null : parameter.emblem.getCachedFileName()); - String sigNote = parameter.getProperty("SIG_NOTE"); + String sigNote = parameter.signatureNote; String sigPos = null; if (parameter.signaturePosition != null) { sigPos = parameter.getPdfAsSignaturePosition(); |