summaryrefslogtreecommitdiff
path: root/pdf-over-signer/pdf-over-sigpdfas
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:16:02 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:16:02 +0000
commit5754642c1d607049c013bb6f37718559e9449172 (patch)
tree4120daf36602be70eb64dddb994ebc7a196bc371 /pdf-over-signer/pdf-over-sigpdfas
parentdd5a8c1969db9a67b169fc0e253d066be7647ab5 (diff)
downloadmocca-5754642c1d607049c013bb6f37718559e9449172.tar.gz
mocca-5754642c1d607049c013bb6f37718559e9449172.tar.bz2
mocca-5754642c1d607049c013bb6f37718559e9449172.zip
Enable signature block lang selection for PDF-AS
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@231 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-signer/pdf-over-sigpdfas')
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java15
-rw-r--r--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/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java
index d613232f..e05a8ad5 100644
--- a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java
+++ b/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/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
index 899fa890..43916d08 100644
--- a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
+++ b/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);