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/PlaceholderFilter.java | 64 +++++++++++----------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java') 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 -- cgit v1.2.3