summaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authorTobias Kellner <tobias.kellner@iaik.tugraz.at>2012-11-07 23:04:19 +0100
committerTobias Kellner <tobias.kellner@iaik.tugraz.at>2012-11-07 23:04:19 +0100
commit3cfa8e9e20fa3d90d03ce1ae7dd6ec7508bdbea4 (patch)
tree85a5fe7d6f4d2eb7e82baedff2b7fbf8d63e9eaa /trunk
parente90835197c31c9f8167bfb4be8a7d8dc36635006 (diff)
downloadpdf-over-3cfa8e9e20fa3d90d03ce1ae7dd6ec7508bdbea4.tar.gz
pdf-over-3cfa8e9e20fa3d90d03ce1ae7dd6ec7508bdbea4.tar.bz2
pdf-over-3cfa8e9e20fa3d90d03ce1ae7dd6ec7508bdbea4.zip
Enable signature block lang selection for PDF-AS
Diffstat (limited to 'trunk')
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java15
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java25
2 files changed, 26 insertions, 14 deletions
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java
index d613232f..e05a8ad5 100644
--- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java
@@ -34,17 +34,6 @@ public class PDFASSigner implements Signer {
static final Logger log = LoggerFactory.getLogger(PDFASSigner.class);
/**
- * The profile ID
- */
- protected static final String PROFILE_ID = "SIGNATURBLOCK_SMALL_DE";
-
- /**
- * The profile ID
- * if a signature note is set
- */
- protected static final String PROFILE_NOTE_ID = "SIGNATURBLOCK_SMALL_DE_NOTE";
-
- /**
* The template URL
*/
protected static final String URL_TEMPLATE = "http://pdfover.4.gv.at/template";
@@ -83,7 +72,8 @@ public class PDFASSigner implements Signer {
// params.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOBILETEST);
}
params.setSignatureType(Constants.SIGNATURE_TYPE_BINARY);
- params.setSignatureProfileId(PROFILE_ID);
+
+ params.setSignatureProfileId(sign_para.getSignatureProfileID());
params.setOutput(new ByteArrayDataSink());
if (parameter.getEmblem() != null) {
@@ -93,7 +83,6 @@ public class PDFASSigner implements Signer {
if(parameter.getProperty("SIG_NOTE") != null) {
params.setProfileOverrideValue("SIG_NOTE", parameter.getProperty("SIG_NOTE"));
- params.setSignatureProfileId(PROFILE_NOTE_ID);
}
// Prepare Output sink
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
index 899fa890..43916d08 100644
--- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
@@ -55,6 +55,15 @@ public class PdfAsSignatureParameter extends SignatureParameter {
static final Logger log = LoggerFactory
.getLogger(PdfAsSignatureParameter.class);
+ /** The profile ID for the german signature block */
+ private static final String PROFILE_ID_DE = "SIGNATURBLOCK_SMALL_DE";
+ /** The profile ID for the german signature block if a signature note is set */
+ private static final String PROFILE_ID_DE_NOTE = "SIGNATURBLOCK_SMALL_DE_NOTE";
+ /** The profile ID for the english signature block */
+ private static final String PROFILE_ID_EN = "SIGNATURBLOCK_SMALL_EN";
+ /** The profile ID for the english signature block if a signature note is set */
+ private static final String PROFILE_ID_EN_NOTE = "SIGNATURBLOCK_SMALL_EN_NOTE";
+
private static final int PLACEHOLDER_SCALE = 4;
private HashMap<String, String> genericProperties = new HashMap<String, String>();
@@ -117,6 +126,20 @@ public class PdfAsSignatureParameter extends SignatureParameter {
return new SignatureDimension(276, 95);
}
+ /**
+ * Get the Signature Profile ID for this set of parameters
+ * @return the Signature Profile ID
+ */
+ public String getSignatureProfileID() {
+ String lang = getSignatureLanguage();
+ boolean useNote = (getProperty("SIG_NOTE") != null);
+
+ if (lang != null && lang.equals("en"))
+ return useNote ? PROFILE_ID_EN_NOTE : PROFILE_ID_EN;
+
+ return useNote ? PROFILE_ID_DE_NOTE : PROFILE_ID_DE;
+ }
+
/*
* (non-Javadoc)
*
@@ -129,7 +152,7 @@ public class PdfAsSignatureParameter extends SignatureParameter {
PDFASHelper.getPdfAs();
SignatureObject sign_obj = at.knowcenter.wag.egov.egiz.PdfAS
- .createSignatureObjectFromType(PDFASSigner.PROFILE_ID);
+ .createSignatureObjectFromType(getSignatureProfileID());
sign_obj.fillValues(' ', true, false);
sign_obj.setKZ(BinarySignator_1_1_0.MY_ID);