From 8522b8b8cb0043883b8801e619384f94efe981e8 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Tue, 2 Aug 2022 15:32:12 +0200 Subject: YAGNI SignatureParameter setters/getters --- .../configuration/SimpleConfigurationComposite.java | 9 +++++---- .../pdfover/gui/utils/SignaturePlaceholderCache.java | 10 +++++----- .../pdfover/gui/workflow/states/PositioningState.java | 6 +++--- .../pdfover/gui/workflow/states/PrepareSigningState.java | 16 ++++++++-------- 4 files changed, 21 insertions(+), 20 deletions(-) (limited to 'pdf-over-gui/src') 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 c3392a46..a737bdfe 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 @@ -445,11 +445,11 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { param.setProperty("SIG_NOTE", this.configurationContainer.signatureNote); } - param.setSignatureLanguage(this.configurationContainer.signatureLocale.getLanguage()); - param.setSignaturePdfACompat(this.configurationContainer.signaturePDFACompat); + param.signatureLanguage = this.configurationContainer.signatureLocale.getLanguage(); + param.enablePDFACompat = this.configurationContainer.signaturePDFACompat; if (image != null && !image.trim().isEmpty()) { logo = new ImageData(image); - param.setEmblem(new CachedFileNameEmblem(image)); + param.emblem = new CachedFileNameEmblem(image); } //TODO deactivated the placeholder preview //TODO display accurate placeholder preview -> now its only standard placeholder shown @@ -554,8 +554,9 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { void setSignatureProfileSetting(){ try { + // TODO this doesn't do anything...? PdfAs4SignatureParameter param = new PdfAs4SignatureParameter(); - param.setSignatureProfile(this.configurationContainer.getSignatureProfile().name()); + param.signatureProfileName = this.configurationContainer.getSignatureProfile().name(); } catch (Exception e){ log.warn("Cannot save signature profile {}", e.getMessage()); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java index 7d2d444f..80b27183 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java @@ -74,11 +74,11 @@ public class SignaturePlaceholderCache { final String sigNoteProp = "NOTE"; final String sigProfProp = "PROF"; - String sigLang = param.getSignatureLanguage(); + String sigLang = param.signatureLanguage; String sigEmbl = ""; String sigEHsh = ""; - if (param.getEmblem() != null) { - Emblem embl = param.getEmblem(); + if (param.emblem != null) { + Emblem embl = param.emblem; if (embl instanceof CachedFileNameEmblem) { sigEmbl = ((CachedFileNameEmblem) embl).getOriginalFileName(); sigEHsh = ((CachedFileNameEmblem) embl).getOriginalFileHash(); @@ -86,11 +86,11 @@ public class SignaturePlaceholderCache { sigEmbl = embl.getFileName(); } } - String sigPdfA = param.getSignaturePdfACompat() ? Constants.TRUE : Constants.FALSE; + String sigPdfA = param.enablePDFACompat ? Constants.TRUE : Constants.FALSE; String sigNote = param.getProperty("SIG_NOTE"); if (sigNote == null) sigNote = ""; - String profile = param.getSignatureProfile(); + String profile = param.signatureProfileName; if (profile == null){ // set default value profile = Profile.getDefaultProfile(); 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 ea6f3003..5ed63e0b 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 @@ -109,13 +109,13 @@ public class PositioningState extends State { ConfigurationManager config = stateMachine.configProvider; PdfAs4SignatureParameter param = new PdfAs4SignatureParameter(); Emblem emblem = new CachedFileNameEmblem(config.getDefaultEmblem()); - param.setEmblem(emblem); + param.emblem = emblem; if(config.getSignatureNote() != null && !config.getSignatureNote().isEmpty()) { param.setProperty("SIG_NOTE", config.getSignatureNote()); } - param.setSignatureLanguage(config.getSignatureLocale().getLanguage()); - param.setSignaturePdfACompat(config.getSignaturePdfACompat()); + param.signatureLanguage = config.getSignatureLocale().getLanguage(); + param.enablePDFACompat = config.getSignaturePdfACompat(); this.positionComposite.setPlaceholder( SignaturePlaceholderCache.getPlaceholder(param), diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java index 26fd0cab..786ed920 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java @@ -128,14 +128,14 @@ public class PrepareSigningState extends State { this.state.signatureParameter = new PdfAs4SignatureParameter(); } - this.state.signatureParameter.setInputDocument(new PDFFileDocumentSource(status.document)); - this.state.signatureParameter.setSignatureDevice(status.bku); + this.state.signatureParameter.inputDocument = new PDFFileDocumentSource(status.document); + this.state.signatureParameter.signatureDevice = status.bku; if (status.signaturePosition != null) { - this.state.signatureParameter.setSignaturePosition(status.signaturePosition); + this.state.signatureParameter.signaturePosition = status.signaturePosition; } if (configuration.getDefaultEmblem() != null && !configuration.getDefaultEmblem().isEmpty()) { - this.state.signatureParameter.setEmblem(new CachedFileNameEmblem(configuration.getDefaultEmblem())); + this.state.signatureParameter.emblem = new CachedFileNameEmblem(configuration.getDefaultEmblem()); } if (configuration.getSignatureNote() != null @@ -144,13 +144,13 @@ public class PrepareSigningState extends State { "SIG_NOTE", configuration.getSignatureNote()); } - this.state.signatureParameter.setSearchForPlaceholderSignatures(getStateMachine().status.searchForPlacehoderSignature); + this.state.signatureParameter.searchForPlaceholderSignatures = getStateMachine().status.searchForPlacehoderSignature; - this.state.signatureParameter.setSignatureLanguage(configuration.getSignatureLocale().getLanguage()); + this.state.signatureParameter.signatureLanguage = configuration.getSignatureLocale().getLanguage(); - this.state.signatureParameter.setSignaturePdfACompat(configuration.getSignaturePdfACompat()); + this.state.signatureParameter.enablePDFACompat = configuration.getSignaturePdfACompat(); - this.state.signatureParameter.setSignatureProfile(configuration.getSignatureProfile()); + this.state.signatureParameter.signatureProfileName = configuration.getSignatureProfile(); this.state.signingState = PdfAs4Signer.prepare(this.state.signatureParameter); -- cgit v1.2.3