aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:21:37 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:21:37 +0000
commitad50af1a88dc8426ee49c63eba8efce5790a5e86 (patch)
treefc2fb56461c4f86978ce9791d9b977aab80d79b1 /src/main/java/at/gv/egiz
parent2ae4ef2c8cc4fd58e02ec2d2b398ec45b0c08558 (diff)
downloadpdf-as-3-ad50af1a88dc8426ee49c63eba8efce5790a5e86.tar.gz
pdf-as-3-ad50af1a88dc8426ee49c63eba8efce5790a5e86.tar.bz2
pdf-as-3-ad50af1a88dc8426ee49c63eba8efce5790a5e86.zip
added datasourceholder
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@623 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java20
-rw-r--r--src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSourceHolder.java26
2 files changed, 38 insertions, 8 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java b/src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java
index 36d9bd8..7d58d2a 100644
--- a/src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java
+++ b/src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java
@@ -10,6 +10,7 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.exceptions.framework.VerificationFilterException;
+import at.gv.egiz.pdfas.framework.DataSourceHolder;
import at.gv.egiz.pdfas.framework.vfilter.VerificationFilter;
import at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters;
import at.gv.egiz.pdfas.impl.input.IncrementalUpdateParser;
@@ -29,23 +30,26 @@ public class ExtractionStage
*/
private static final Log log = LogFactory.getLog(ExtractionStage.class);
- public List extractSignatureHolders(final DataSource dataSource, VerificationFilterParameters parameters) throws PresentableException
+ public List extractSignatureHolders(final DataSourceHolder dataSource, VerificationFilterParameters parameters) throws PresentableException
{
- if (dataSource instanceof PdfDataSource)
+ if (dataSource.getDataSource() instanceof PdfDataSource)
{
- PdfDataSource pdfDataSource = (PdfDataSource) dataSource;
+ PdfDataSource pdfDataSource = (PdfDataSource) dataSource.getDataSource();
- List blocks = parsePdfIntoBlocks(pdfDataSource);
+ PdfDataSourceHolder pdsh = new PdfDataSourceHolder(pdfDataSource);
+ List blocks = parsePdfIntoBlocks(pdsh);
+ dataSource.setDataSource(pdsh.getDataSource());
+ parameters.setBeenCorrected(pdsh.hasChanged());
VerificationFilter vf = new VerificationFilterImpl();
- List signatures = vf.extractSignatureHolders(pdfDataSource, blocks, parameters);
+ List signatures = vf.extractSignatureHolders(pdsh.getDataSource(), blocks, parameters);
return signatures;
}
- if (dataSource instanceof TextDataSource)
+ if (dataSource.getDataSource() instanceof TextDataSource)
{
- TextDataSource textDataSource = (TextDataSource) dataSource;
+ TextDataSource textDataSource = (TextDataSource) dataSource.getDataSource();
VerificationFilter vf = new VerificationFilterImpl();
List signatures = vf.extractSignaturHolders(textDataSource, parameters);
@@ -58,7 +62,7 @@ public class ExtractionStage
throw new VerificationFilterException(ErrorCode.DOCUMENT_CANNOT_BE_READ, msg);
}
- protected List parsePdfIntoBlocks(PdfDataSource pdfDataSource) throws PDFDocumentException
+ protected List parsePdfIntoBlocks(PdfDataSourceHolder pdfDataSource) throws PDFDocumentException
{
List blocks = IncrementalUpdateParser.parsePdfIntoIUBlocks(pdfDataSource);
return blocks;
diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSourceHolder.java b/src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSourceHolder.java
new file mode 100644
index 0000000..84ebce1
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSourceHolder.java
@@ -0,0 +1,26 @@
+package at.gv.egiz.pdfas.framework.input;
+
+public class PdfDataSourceHolder {
+ private PdfDataSource dataSource;
+ private boolean hasChanged = false;
+
+ public PdfDataSourceHolder(PdfDataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ public PdfDataSource getDataSource() {
+ return dataSource;
+ }
+
+ public void setDataSource(PdfDataSource dataSource) {
+ this.dataSource = dataSource;
+ this.hasChanged = true;
+ }
+
+ public boolean hasChanged() {
+ return this.hasChanged;
+ }
+
+
+
+}