summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Abraham <andreas.abraham@egiz.gv.at>2020-11-12 14:13:18 +0100
committerAndreas Abraham <andreas.abraham@egiz.gv.at>2020-11-12 14:13:18 +0100
commit1eddc2b51034df2ce3e814c297311e27dccacee1 (patch)
tree046240ec3303603abd53af55c61ba093e7046fcc
parent9e89577de5f2421085bab9b8466007cb4b229e1b (diff)
downloadpdf-over-1eddc2b51034df2ce3e814c297311e27dccacee1.tar.gz
pdf-over-1eddc2b51034df2ce3e814c297311e27dccacee1.tar.bz2
pdf-over-1eddc2b51034df2ce3e814c297311e27dccacee1.zip
fixed problem handing over the selected profile to pdf-as4 signer
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java14
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java4
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java5
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java16
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java2
5 files changed, 36 insertions, 5 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java
index 4e18cd52..26f67da3 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java
@@ -663,8 +663,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
try {
if (this.signer != null) {
- SignatureParameter param = this.signer.getPDFSigner()
- .newParameter();
+ SignatureParameter param = this.signer.getPDFSigner().newParameter();
if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().isEmpty()) {
param.setProperty("SIG_NOTE", this.configurationContainer.getSignatureNote()); //$NON-NLS-1$
}
@@ -762,6 +761,16 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
this.cmbSingatureProfiles.select(selected.ordinal());
}
+ void setSignatureProfileSetting(){
+ try {
+ SignatureParameter param = this.signer.getPDFSigner().newParameter();
+ param.setSignatureProfile(this.configurationContainer.getSignatureProfile().getName());
+
+ } catch (Exception e){
+ log.debug("Cannot save siganture profile" + e.getMessage());
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -771,6 +780,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite {
@Override
protected void signerChanged() {
this.setVisibleImage();
+ this.setSignatureProfileSetting();
}
/**
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 f9827ba4..9d17a3e8 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
@@ -166,6 +166,8 @@ public class PrepareSigningState extends State {
this.state.signatureParameter
.setSignaturePdfACompat(configuration.getSignaturePdfACompat());
+ this.state.signatureParameter.setSignatureProfile(configuration.getSignatureProfile());
+
this.state.signingState = this.state.signer
.prepare(this.state.signatureParameter);
@@ -199,7 +201,7 @@ public class PrepareSigningState extends State {
at.asit.pdfover.signator.SigningState signingState = null;
- Signer signer;
+ Signer signer;
Exception threadException = null;
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java
index c52370d4..edf50b23 100644
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java
@@ -221,4 +221,9 @@ public abstract class SignatureParameter {
* @return associated value
*/
public abstract String getProperty(String key);
+
+
+ public abstract void setSignatureProfile(String profile);
+
+ public abstract String getSignatureProfile();
}
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
index 38a2bc8f..aed66b9b 100644
--- a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
@@ -68,6 +68,7 @@ public class PdfAs4SignatureParameter extends SignatureParameter {
**/
static final Logger log = LoggerFactory
.getLogger(PdfAs4SignatureParameter.class);
+ private String profile;
/* (non-Javadoc)
* @see at.asit.pdfover.signator.SignatureParameter#getPlaceholderDimension()
@@ -164,7 +165,7 @@ public class PdfAs4SignatureParameter extends SignatureParameter {
String lang = getSignatureLanguage();
boolean useNote = (getProperty("SIG_NOTE") != null);
boolean usePdfACompat = (getSignaturePdfACompat());
- String profile = getProperty("SIGNATURE_PROFILE");
+
//Add Signature Param here//
String profileId;
@@ -191,4 +192,17 @@ public class PdfAs4SignatureParameter extends SignatureParameter {
log.debug("Profile ID: " + profileId);
return profileId;
}
+
+ @Override
+ public void setSignatureProfile(String profile) {
+ this.profile = profile;
+ }
+
+ @Override
+ public String getSignatureProfile() {
+ return this.profile;
+ }
}
+
+
+
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
index a729f65b..5c4782ba 100644
--- a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
@@ -91,7 +91,7 @@ public class PdfAs4Signer implements Signer {
param.getConfiguration().setValue(IConfigurationConstants.PLACEHOLDER_SEARCH_ENABLED, IConfigurationConstants.TRUE);
}
-
+
state.setSignParameter(param);
state.setOutput(output);