aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:25:07 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:25:07 +0000
commite64b9d44d4b83756c135649a50f7c1348f6d86cc (patch)
tree4471f3109737ad2450fe0ae56ff1991a06e5317e /src/main/java/at/gv
parent00877283bd024ec86b5f4974f4ebde3a997d865a (diff)
downloadpdf-as-3-e64b9d44d4b83756c135649a50f7c1348f6d86cc.tar.gz
pdf-as-3-e64b9d44d4b83756c135649a50f7c1348f6d86cc.tar.bz2
pdf-as-3-e64b9d44d4b83756c135649a50f7c1348f6d86cc.zip
added ognl support for text sign
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@631 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java
index ed673ac..f7de6a8 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java
@@ -17,6 +17,9 @@
*/
package at.gv.egiz.pdfas.impl.signator.textual;
+import java.util.HashMap;
+import java.util.Iterator;
+
import at.gv.egiz.pdfas.api.timestamp.TimeStamper;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.exceptions.framework.SignatorException;
@@ -27,6 +30,7 @@ import at.gv.egiz.pdfas.framework.signator.Signator;
import at.gv.egiz.pdfas.framework.signator.SignatorInformation;
import at.gv.egiz.pdfas.impl.input.TextDataSourceImpl;
import at.gv.egiz.pdfas.impl.signator.IncrementalUpdateHelper;
+import at.gv.egiz.pdfas.utils.OgnlUtil;
import at.knowcenter.wag.egov.egiz.PdfAS;
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
@@ -35,8 +39,8 @@ import at.knowcenter.wag.egov.egiz.pdf.IncrementalUpdateInformation;
import at.knowcenter.wag.egov.egiz.pdf.ObjectExtractor;
import at.knowcenter.wag.egov.egiz.pdf.PositioningInstruction;
import at.knowcenter.wag.egov.egiz.pdf.TablePos;
-import at.knowcenter.wag.egov.egiz.pdf.TextualSignature;
import at.knowcenter.wag.egov.egiz.sig.SignatureDataImpl;
+import at.knowcenter.wag.egov.egiz.sig.SignatureEntry;
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
import at.knowcenter.wag.egov.egiz.sig.SignatureTypeDefinition;
import at.knowcenter.wag.egov.egiz.sig.SignatureTypes;
@@ -138,6 +142,8 @@ public class TextualSignator_1_0_0 implements Signator
SignatureObject so = SignatureObjectHelper.convertSignSignatureObjectToSignatureObject(tsi.signSignatureObject, tsi.profile);
+ evaluteOgnl(so, tsi);
+
PdfPTable pdf_table = PdfAS.createPdfPTableFromSignatureObject(so);
PositioningInstruction pi = PdfAS.determineTablePositioning(tsi.pos, tsi.profile, tsi.originalDocument, pdf_table);
@@ -162,6 +168,30 @@ public class TextualSignator_1_0_0 implements Signator
// }
}
+ private void evaluteOgnl(SignatureObject so, TextualSignatorInformation tsi) {
+ HashMap ognlCtx = new HashMap();
+ //ognlCtx.put("iui", tsi.);
+ ognlCtx.put("sso", tsi.signSignatureObject);
+ ognlCtx.put("issuer", tsi.signSignatureObject.getIssuerDNMap());
+ ognlCtx.put("subject", tsi.signSignatureObject.getSubjectDNMap());
+ OgnlUtil ognl = new OgnlUtil(ognlCtx);
+
+ Iterator it = so.sigEntries_.values().iterator();
+ while (it.hasNext())
+ {
+ SignatureEntry se = (SignatureEntry) it.next();
+
+ if (ognl.containsExpression(se.getValue())) {
+ // evaluate expression
+ String res = ognl.compileMessage(se.getValue());
+ se.setValue(res);
+ //ri.value = this.normalizer.normalize(res, true);
+
+ }
+ }
+
+}
+
public String getEncoding() {
// old signatures used this encoding implicit most of the time (windows default)
return "cp1252";