aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-01 14:02:31 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-01 14:02:31 +0000
commita4f9018bf6a9fd74312ad62a3633a71a9724f3ab (patch)
tree0fc521352559bb102c105496100ad9c7b9a1d1ec /src/main/java/at/gv/egiz
parent23b3cb0f072ccbe12163dc25e10da64baeec2f54 (diff)
downloadpdf-as-3-a4f9018bf6a9fd74312ad62a3633a71a9724f3ab.tar.gz
pdf-as-3-a4f9018bf6a9fd74312ad62a3633a71a9724f3ab.tar.bz2
pdf-as-3-a4f9018bf6a9fd74312ad62a3633a71a9724f3ab.zip
fixed override properties for binsig with placeholders
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@659 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java52
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/signator/textual/TextualSignator_1_0_0.java44
2 files changed, 54 insertions, 42 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
index 4b6f483..3d4be31 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java
@@ -43,6 +43,7 @@ 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.cfg.OverridePropertyHolder;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
import at.knowcenter.wag.egov.egiz.exceptions.NormalizeException;
import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException;
@@ -322,28 +323,35 @@ public class BinarySignator_1_0_0 implements Signator
*/
protected void fillReplacesWithValues(final IncrementalUpdateInformation iui)
{
- Iterator it = iui.replaces.iterator();
- HashMap ognlCtx = new HashMap();
- ognlCtx.put("iui", iui);
- ognlCtx.put("sso", iui.signed_signature_object);
- ognlCtx.put("issuer", iui.signed_signature_object.getIssuerDNMap());
- ognlCtx.put("subject", iui.signed_signature_object.getSubjectDNMap());
- OgnlUtil ognl = new OgnlUtil(ognlCtx);
-
- while (it.hasNext())
- {
- ReplaceInfo ri = (ReplaceInfo) it.next();
-
- // dferbas
- if (ognl.containsExpression(ri.sfd.value)) {
- // evaluate expression
- String res = ognl.compileMessage(ri.sfd.value);
-
- ri.value = this.normalizer.normalize(res, true);
-
- } else {
- ri.value = iui.signed_signature_object.retrieveStringValue(ri.sfd.field_name);
- }
+ try {
+ Iterator it = iui.replaces.iterator();
+ HashMap ognlCtx = new HashMap();
+ ognlCtx.put("iui", iui);
+ ognlCtx.put("sso", iui.signed_signature_object);
+ ognlCtx.put("issuer", iui.signed_signature_object.getIssuerDNMap());
+ ognlCtx.put("subject", iui.signed_signature_object.getSubjectDNMap());
+ OgnlUtil ognl = new OgnlUtil(ognlCtx);
+
+ OverridePropertyHolder.setOgnlUtil(ognl);
+
+ while (it.hasNext()) {
+ ReplaceInfo ri = (ReplaceInfo) it.next();
+ String overrideVal = OverridePropertyHolder.getProperty(ri.sfd.field_name);
+ if (overrideVal != null) {
+ ri.sfd.value = overrideVal;
+ ri.value = overrideVal;
+ } else if (ognl.containsExpression(ri.sfd.value)) { // dferbas
+ // evaluate expression
+ String res = ognl.compileMessage(ri.sfd.value);
+
+ ri.value = this.normalizer.normalize(res, true);
+
+ } else if (overrideVal == null) {
+ ri.value = iui.signed_signature_object.retrieveStringValue(ri.sfd.field_name);
+ }
+ }
+ } finally {
+ OverridePropertyHolder.removeOgnlUtil();
}
}
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 942814a..b29f0e6 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
@@ -33,6 +33,7 @@ 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.cfg.OverridePropertyHolder;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
import at.knowcenter.wag.egov.egiz.framework.SignatorFactory;
import at.knowcenter.wag.egov.egiz.pdf.IncrementalUpdateInformation;
@@ -162,6 +163,9 @@ public class TextualSignator_1_0_0 implements Signator
{
throw new SignatorException(pe);
}
+ finally {
+ OverridePropertyHolder.removeOgnlUtil();
+ }
// catch (IOException e)
// {
// throw new SignatorException(ErrorCode.DOCUMENT_CANNOT_BE_READ, e);
@@ -170,27 +174,27 @@ 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.getSigEntries().values().iterator();
- while (it.hasNext())
- {
- SignatureEntry se = (SignatureEntry) it.next();
+ //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);
+ OverridePropertyHolder.setOgnlUtil(ognl);
+
+ Iterator it = so.getSigEntries().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);
- 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)