From 7824a4d85cfe855ddeb330c6ff753a2e60f8009b Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Sat, 10 Apr 2021 18:14:01 +0200 Subject: pass parameters to resolver(s) --- .../src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java | 8 +++++++- pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java | 7 ++++++- .../main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java | 5 +++++ .../java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java | 6 ------ 4 files changed, 18 insertions(+), 8 deletions(-) (limited to 'pdf-as-lib/src/main/java') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java index 11a1941b..6303c0a0 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java @@ -82,10 +82,16 @@ public interface PdfAsParameter { public void setPreprocessorArguments(Map map); /** - * Sets the dynamic signatur block values. + * Sets the dynamic signature-block values. * * @param map the map */ public void setDynamicSignatureBlockArguments(Map map); + /** + * Gets the dynamic signature-block values. + * + * @return the dynamic signature-block values + */ + public Map getDynamicSignatureBlockArguments(); } diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java index 324712cb..55891bb2 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java @@ -23,6 +23,7 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.impl; +import at.gv.egiz.pdfas.lib.impl.status.PDFObject; import iaik.x509.X509Certificate; import java.awt.Image; @@ -144,7 +145,11 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, IPdfSigner signer = backend.getPdfSigner(); - status.setPdfObject(signer.buildPDFObject(status)); + + PDFObject pdfObject = signer.buildPDFObject(status); + //TODO verify map??? + pdfObject.getStatus().getRequestParameters().putAll(status.getSignParamter().getDynamicSignatureBlockArguments()); + status.setPdfObject(pdfObject); // set Original PDF Document Data status.getPdfObject() diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java index f3e1c301..d6161f2c 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java @@ -82,4 +82,9 @@ protected Configuration configuration; public void setDynamicSignatureBlockArguments(Map map) { this.dynamicSignatureBlockArgumentsMap = map; } + + @Override + public Map getDynamicSignatureBlockArguments() { + return this.dynamicSignatureBlockArgumentsMap; + } } 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 2481c77b..ab118857 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 @@ -63,12 +63,6 @@ public class ValueResolver implements IProfileConstants, IResolver { private IResolver internalResolver; public ValueResolver(ICertificateProvider certProvider, OperationStatus operationStatus) { -// Map test = new HashMap<>(); -// test.put("schoolNameRand", RandomStringUtils.randomAlphabetic(5)); -// test.put("schoolName", "EGIZ testschule"); -// -// test.put("subject","bbBbb"); -// internalRequestParameterResolver = new RequestParameterResolver(test); internalResolver = new CertificateAndRequestParameterResolver(certProvider.getCertificate(), operationStatus); } -- cgit v1.2.3