From ac49b41cbc52e3e8df771825ff22f72a8fb81138 Mon Sep 17 00:00:00 2001 From: emusic Date: Thu, 14 Nov 2019 14:33:16 +0100 Subject: Enable placeholder search on a profile level --- .../lib/impl/configuration/PlaceholderConfiguration.java | 11 +++++++++++ .../egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java | 12 ++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'pdf-as-lib/src/main/java/at') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java index 7a67160a..326ed142 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java @@ -69,5 +69,16 @@ public class PlaceholderConfiguration extends SpecificBaseConfiguration } return false; } + + public String getProfilePlaceholderID(String selectedProfileID) + { + logger.info("SelectedProfileID in ProfileConfEnabled: "+selectedProfileID); + String profileMatch = SIG_OBJECT+SEPERATOR+selectedProfileID+SEPERATOR+PLACEHOLDER_ID; + if (configuration.getValuesPrefix(profileMatch)!=null) { + Map map = configuration.getValuesPrefix(profileMatch); + return map.get(profileMatch); + } + return null; + } } 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 f511525d..51cd3ff2 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 @@ -74,13 +74,17 @@ public class PlaceholderFilter implements IConfigurationConstants, //filter for local placeholder in selected profiles PlaceholderExtractor extractor = status.getBackend() .getPlaceholderExtractor(); - String placeholderID = settings.getValue(PLACEHOLDER_ID); - String placeholderModeString = settings.getValue(PLACEHOLDER_MODE); - int placeholderMode = PLACEHOLDER_MATCH_MODE_SORTED; + int placeholderMode = PLACEHOLDER_MATCH_MODE_SORTED; + + String 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( -- cgit v1.2.3