aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv')
-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)