aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl
diff options
context:
space:
mode:
authorThomas <>2023-06-27 08:56:21 +0200
committerThomas <>2023-06-27 08:56:21 +0200
commitca7b9d0863dcc1c02849a23db66310146f91c104 (patch)
treef8f1400fe8d1f9771bbccf4d26414948bf37dd0a /pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl
parentcc26fbd157a39ea243d1d253e6b62f38ccad244e (diff)
downloadpdf-as-4-ca7b9d0863dcc1c02849a23db66310146f91c104.tar.gz
pdf-as-4-ca7b9d0863dcc1c02849a23db66310146f91c104.tar.bz2
pdf-as-4-ca7b9d0863dcc1c02849a23db66310146f91c104.zip
feat(web): add request parameter to enable/disable QR-code placeholder searching on request level
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignParameterImpl.java4
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java32
2 files changed, 24 insertions, 12 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignParameterImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignParameterImpl.java
index 2dc047f1..06b1b34f 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignParameterImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/SignParameterImpl.java
@@ -44,6 +44,10 @@ public class SignParameterImpl extends PdfAsParameterImpl implements SignParamet
@Setter
protected String placeHolderId;
+ @Getter
+ @Setter
+ protected boolean placeHolderSearchEnabled;
+
protected DataSource output = null;
protected IPlainSigner signer = null;
protected OutputStream outputStream = 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 0d652b76..1615482f 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
@@ -33,7 +33,9 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.common.settings.ISettings;
import at.gv.egiz.pdfas.lib.api.IConfigurationConstants;
import at.gv.egiz.pdfas.lib.impl.status.OperationStatus;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class PlaceholderFilter implements IConfigurationConstants,
PlaceholderExtractorConstants {
@@ -42,19 +44,25 @@ public class PlaceholderFilter implements IConfigurationConstants,
String signingProfile = status.getRequestedSignature().getSignatureProfileID();
- if (status.getPlaceholderConfiguration().isGlobalPlaceholderEnabled()) {
- String defaultPlaceHolderId = settings.getValue(PLACEHOLDER_ID);
- return status.getBackend().getPlaceholderExtractor().extract(
- status.getPdfObject(), getPlaceHolderId(placeholderId, defaultPlaceHolderId) ,
- getPlaceHolderMode(settings, PLACEHOLDER_MATCH_MODE_SORTED));
+ if (status.getSignParamter().isPlaceHolderSearchEnabled()) {
+ if (status.getPlaceholderConfiguration().isGlobalPlaceholderEnabled()) {
+ String defaultPlaceHolderId = settings.getValue(PLACEHOLDER_ID);
+ return status.getBackend().getPlaceholderExtractor().extract(
+ status.getPdfObject(), getPlaceHolderId(placeholderId, defaultPlaceHolderId) ,
+ getPlaceHolderMode(settings, PLACEHOLDER_MATCH_MODE_SORTED));
- } else if (status.getPlaceholderConfiguration().isProfileConfigurationEnabled(signingProfile)) {
- String defaultPlaceHolderId = status.getPlaceholderConfiguration().getProfilePlaceholderID(signingProfile);
- return status.getBackend().getPlaceholderExtractor().extract(
- status.getPdfObject(), getPlaceHolderId(placeholderId, defaultPlaceHolderId),
- getPlaceHolderMode(settings,
- StringUtils.isNotEmpty(defaultPlaceHolderId) ? PLACEHOLDER_MATCH_MODE_MODERATE : PLACEHOLDER_MATCH_MODE_SORTED));
- }
+ } else if (status.getPlaceholderConfiguration().isProfileConfigurationEnabled(signingProfile)) {
+ String defaultPlaceHolderId = status.getPlaceholderConfiguration().getProfilePlaceholderID(signingProfile);
+ return status.getBackend().getPlaceholderExtractor().extract(
+ status.getPdfObject(), getPlaceHolderId(placeholderId, defaultPlaceHolderId),
+ getPlaceHolderMode(settings,
+ StringUtils.isNotEmpty(defaultPlaceHolderId) ? PLACEHOLDER_MATCH_MODE_MODERATE : PLACEHOLDER_MATCH_MODE_SORTED));
+ }
+ } else {
+ log.debug("Searching placeholders are disabled for this request");
+
+ }
+
return null;
}