From 1b337e50a9edb280aea49879f901613e1fe17b55 Mon Sep 17 00:00:00 2001 From: pdanner Date: Fri, 26 Nov 2010 12:01:18 +0000 Subject: Changes for xmldsig reconstruction git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@612 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/gv/egiz/pdfas/api/sign/SignParameters.java | 87 +++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/gv/egiz/pdfas/api/sign') diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java b/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java index 7dd2f6d..fc4ebaf 100644 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java +++ b/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java @@ -16,6 +16,27 @@ import at.gv.egiz.pdfas.api.timestamp.TimeStamper; */ public class SignParameters { +// 23.11.2010 changed by exthex - added parameters for placeholder handling + /** + * Strict matching mode for placeholder extraction.
+ * If the placeholder with the given id is not found in the document, an exception will be thrown. + */ + public static final int PLACEHOLDER_MATCH_MODE_STRICT = 0; + + /** + * A moderate matching mode for placeholder extraction.
+ * If the placeholder with the given id is not found in the document, the first placeholder without an id will be taken.
+ * If there is no such placeholder, the signature will be placed as usual, according to the pos parameter of the signature profile used. + */ + public static final int PLACEHOLDER_MATCH_MODE_MODERATE = 1; + + /** + * A more lenient matching mode for placeholder extraction.
+ * If the placeholder with the given id is not found in the document, the first found placeholder will be taken, regardless if it has an id set, or not.
+ * If there is no placeholder at all, the signature will be placed as usual, according to the pos parameter of the signature profile used. + */ + public static final int PLACEHOLDER_MATCH_MODE_LENIENT = 2; + /** * The document to be signed. * @@ -99,8 +120,26 @@ public class SignParameters protected DataSink output = null; protected TimeStamper timeStamperImpl; + + /** + * + */ + protected boolean checkForPlaceholder; + + /** + * The id of the placeholder which should be replaced. + */ + protected String placeholderId; + + /** + * The matching mode for placeholder extraction.
+ * If a {@link SignParameters#placeholderId} is set, the match mode determines what is to be done, if no matching placeholder is found in the document. + *
+ * Defaults to {@link SignParameters#PLACEHOLDER_MATCH_MODE_MODERATE}. + */ + protected int placeholderMatchMode = PLACEHOLDER_MATCH_MODE_MODERATE; - + /** * {@link #setTimeStamperImpl(TimeStamper)} * @return @@ -236,5 +275,51 @@ public class SignParameters this.signatureKeyIdentifier = signatureKeyIdentifier; } + /** + * + * @return + */ + public boolean isCheckForPlaceholder() { + return this.checkForPlaceholder; + } + + /** + * + * @param check + */ + public void setCheckForPlaceholder(boolean check) { + this.checkForPlaceholder = check; + } + + /** + * + * @param placeholderId + */ + public void setPlaceholderId(String placeholderId) { + this.placeholderId = placeholderId; + } + + /** + * + * @return the placeholderId + */ + public String getPlaceholderId() { + return placeholderId; + } + + /** + * + * @param placeholderMatchMode + */ + public void setPlaceholderMatchMode(int placeholderMatchMode) { + this.placeholderMatchMode = placeholderMatchMode; + } + /** + * + * @return the placeholderMatchMode + */ + public int getPlaceholderMatchMode() { + return this.placeholderMatchMode; + } } -- cgit v1.2.3