From cc3e985f2ed5c78b04f494feb2abdb534479a06e Mon Sep 17 00:00:00 2001 From: emusic Date: Fri, 17 Jan 2020 14:39:04 +0100 Subject: changes in qr placeholder search - additional information removed, location of dictionary used for storing qr info --- .../lib/impl/placeholder/PlaceholderExtractor.java | 3 +- .../lib/impl/placeholder/PlaceholderFilter.java | 64 ++++++++++----------- .../impl/placeholder/SignaturePlaceholderData.java | 3 +- pdf-as-lib/src/main/resources/config/config.zip | Bin 1276507 -> 1276742 bytes 4 files changed, 34 insertions(+), 36 deletions(-) (limited to 'pdf-as-lib/src/main') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderExtractor.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderExtractor.java index 62a26a16..4c352b90 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderExtractor.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderExtractor.java @@ -4,6 +4,5 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsException; import at.gv.egiz.pdfas.lib.impl.status.PDFObject; public interface PlaceholderExtractor { - public SignaturePlaceholderData extract(PDFObject doc, - String placeholderId, int matchMode) throws PdfAsException; + SignaturePlaceholderData extract(PDFObject doc, String placeholderId, int matchMode) throws PdfAsException; } diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java index 51cd3ff2..5919ee5d 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java @@ -36,18 +36,22 @@ import at.gv.egiz.pdfas.lib.impl.status.OperationStatus; public class PlaceholderFilter implements IConfigurationConstants, PlaceholderExtractorConstants { - public static SignaturePlaceholderData checkPlaceholderSignature( - OperationStatus status, ISettings settings) throws PdfAsException, + public static SignaturePlaceholderData checkPlaceholderSignatureLocation( + OperationStatus status, ISettings settings, String signatureLocation) throws PdfAsException, IOException { + String placeholderID; + if (status.getPlaceholderConfiguration().isGlobalPlaceholderEnabled()) { - PlaceholderExtractor extractor = status.getBackend() - .getPlaceholderExtractor(); + PlaceholderExtractor extractor = status.getBackend().getPlaceholderExtractor(); - String placeholderID = PlaceholderWebConfiguration.getValue(PLACEHOLDER_WEB_ID); - if(placeholderID == null) - { - placeholderID = settings.getValue(PLACEHOLDER_ID); + if(signatureLocation!=null) { + placeholderID = signatureLocation; + } else { + placeholderID = PlaceholderWebConfiguration.getValue(PLACEHOLDER_WEB_ID); + if(placeholderID == null) { + placeholderID = settings.getValue(PLACEHOLDER_ID); + } } String placeholderModeString = settings.getValue(PLACEHOLDER_MODE); @@ -55,7 +59,6 @@ public class PlaceholderFilter implements IConfigurationConstants, if (placeholderModeString != null) { try { placeholderMode = Integer.parseInt(placeholderModeString); - if (placeholderMode < PLACEHOLDER_MODE_MIN || placeholderMode > PLACEHOLDER_MODE_MAX) { throw new PdfAsErrorCarrier(new PDFASError( @@ -66,39 +69,36 @@ public class PlaceholderFilter implements IConfigurationConstants, PDFASError.ERROR_INVALID_PLACEHOLDER_MODE, e)); } } - SignaturePlaceholderData signaturePlaceholderData = extractor - .extract(status.getPdfObject(), placeholderID, placeholderMode); - + SignaturePlaceholderData signaturePlaceholderData = extractor.extract(status.getPdfObject(), placeholderID, placeholderMode); return signaturePlaceholderData; + } else if (status.getPlaceholderConfiguration().isProfileConfigurationEnabled(status.getRequestedSignature().getSignatureProfileID())) { //filter for local placeholder in selected profiles - PlaceholderExtractor extractor = status.getBackend() - .getPlaceholderExtractor(); + PlaceholderExtractor extractor = status.getBackend().getPlaceholderExtractor(); int placeholderMode = PLACEHOLDER_MATCH_MODE_SORTED; - String placeholderID =status.getPlaceholderConfiguration().getProfilePlaceholderID(status.getRequestedSignature().getSignatureProfileID()); - if(placeholderID != null) - { + placeholderID = status.getPlaceholderConfiguration().getProfilePlaceholderID(status.getRequestedSignature().getSignatureProfileID()); + if(placeholderID != null) { placeholderMode = PLACEHOLDER_MATCH_MODE_MODERATE; } String placeholderModeString = settings.getValue(PLACEHOLDER_MODE); - if (placeholderModeString != null) { - try { - placeholderMode = Integer.parseInt(placeholderModeString); - if (placeholderMode < PLACEHOLDER_MODE_MIN - || placeholderMode > PLACEHOLDER_MODE_MAX) { - throw new PdfAsErrorCarrier(new PDFASError( - PDFASError.ERROR_INVALID_PLACEHOLDER_MODE)); - } - } catch (NumberFormatException e) { + if (placeholderModeString != null) { + try { + placeholderMode = Integer.parseInt(placeholderModeString); + if (placeholderMode < PLACEHOLDER_MODE_MIN + || placeholderMode > PLACEHOLDER_MODE_MAX) { throw new PdfAsErrorCarrier(new PDFASError( - PDFASError.ERROR_INVALID_PLACEHOLDER_MODE, e)); + PDFASError.ERROR_INVALID_PLACEHOLDER_MODE)); } + } catch (NumberFormatException e) { + throw new PdfAsErrorCarrier(new PDFASError( + PDFASError.ERROR_INVALID_PLACEHOLDER_MODE, e)); } - SignaturePlaceholderData signaturePlaceholderData = extractor - .extract(status.getPdfObject(), placeholderID, placeholderMode); - - return signaturePlaceholderData; } + SignaturePlaceholderData signaturePlaceholderData = extractor.extract(status.getPdfObject(), placeholderID, placeholderMode); + return signaturePlaceholderData; + } return null; - }} \ No newline at end of file + } + +} \ No newline at end of file diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java index 3dbedee5..cf0ad149 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java @@ -54,8 +54,7 @@ import at.knowcenter.wag.egov.egiz.pdf.TablePos; * @author exthex * */ -public class -SignaturePlaceholderData { +public class SignaturePlaceholderData { public static final String ID_KEY = "id"; diff --git a/pdf-as-lib/src/main/resources/config/config.zip b/pdf-as-lib/src/main/resources/config/config.zip index 3be3dd92..387e3e41 100644 Binary files a/pdf-as-lib/src/main/resources/config/config.zip and b/pdf-as-lib/src/main/resources/config/config.zip differ -- cgit v1.2.3