diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java | 20 | ||||
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSourceHolder.java | 26 |
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;
+ }
+
+
+
+}
|