aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-01-18 15:13:13 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-01-18 15:13:13 +0000
commit877758d9ec4deb53aad8a6c1d8669cc7186b1a48 (patch)
tree97cbeef0ef915511f94782d2501b283b8a077e2e /src/main/java/at/knowcenter
parent9770635e1bdcc3338468e9687545d5326a394630 (diff)
downloadpdf-as-3-877758d9ec4deb53aad8a6c1d8669cc7186b1a48.tar.gz
pdf-as-3-877758d9ec4deb53aad8a6c1d8669cc7186b1a48.tar.bz2
pdf-as-3-877758d9ec4deb53aad8a6c1d8669cc7186b1a48.zip
update dealing with incremental updates
(NoSignatureHolder introduced that indicates incremental updates. NoSignatureHolders are transported as SignatureHolder withing analysis but are finally removed to maintain compatibility. This allowes to show which signatures are followed by incremental updates containing no signature. If the last signature is followed by an incremental update, an exception is thrown to indicate an illegal modification. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@248 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/NoSignatureHolder.java61
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java17
2 files changed, 76 insertions, 2 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/NoSignatureHolder.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/NoSignatureHolder.java
new file mode 100644
index 0000000..08e48bb
--- /dev/null
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/NoSignatureHolder.java
@@ -0,0 +1,61 @@
+package at.knowcenter.wag.egov.egiz.pdf;
+
+import java.io.Serializable;
+
+import at.gv.egiz.pdfas.framework.input.DataSource;
+import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
+
+public class NoSignatureHolder implements Serializable, SignatureHolder {
+
+ private static final long serialVersionUID = 1L;
+
+ // # sigs before modification
+ private int position;
+
+ public NoSignatureHolder(int pos) {
+ this.position = pos;
+ }
+
+ public DataSource getDataSource() {
+ return null;
+ }
+
+ public SignatureObject getSignatureObject() {
+ return null;
+ }
+
+ public int getPosition() {
+ return this.position;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + this.position;
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final NoSignatureHolder other = (NoSignatureHolder) obj;
+
+ if (this.position != other.position) {
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java
index 7b935de..eb07828 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java
@@ -20,6 +20,7 @@ package at.knowcenter.wag.egov.egiz.web.servlets;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -50,6 +51,8 @@ import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingNotFoundException;
+import at.knowcenter.wag.egov.egiz.pdf.NoSignatureHolder;
+import at.knowcenter.wag.egov.egiz.pdf.SignatureHolder;
import at.knowcenter.wag.egov.egiz.sig.ConnectorFactory;
import at.knowcenter.wag.egov.egiz.sig.SignatureResponse;
import at.knowcenter.wag.egov.egiz.web.FormFields;
@@ -324,12 +327,22 @@ public class VerifyServlet extends HttpServlet
ExtractionStage es = new ExtractionStage();
List signature_holders = es.extractSignatureHolders(dataSource, parameters);
- if (signature_holders.size() == 0)
+ // filter out NoSignatureHolders that are possibly present due to the direct call method extractSignatureHolders()
+ List filtered_signature_holders = new ArrayList();
+ Iterator it = signature_holders.iterator();
+ while(it.hasNext()) {
+ SignatureHolder current = (SignatureHolder) it.next();
+ if(!(current instanceof NoSignatureHolder)) {
+ filtered_signature_holders.add(current);
+ }
+ }
+
+ if (filtered_signature_holders.size() == 0)
{
throw new PDFDocumentException(206, "PDF document not signed."); //$NON-NLS-1$
}
- return signature_holders;
+ return filtered_signature_holders;
}
// TODO obsolete method - remove