diff options
author | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-12-07 09:53:11 +0000 |
---|---|---|
committer | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-12-07 09:53:11 +0000 |
commit | f9e1c1419ebfccb6343460a989ed891054358bef (patch) | |
tree | 6e3a6cf07f56bdcb9d1d0ee24507fd6950620df3 | |
parent | cded133a98ae8402ea56213fa0e3549222dfd3ec (diff) | |
download | pdf-as-3-f9e1c1419ebfccb6343460a989ed891054358bef.tar.gz pdf-as-3-f9e1c1419ebfccb6343460a989ed891054358bef.tar.bz2 pdf-as-3-f9e1c1419ebfccb6343460a989ed891054358bef.zip |
Added enable_placeholder_search config parameter
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@692 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java | 71 | ||||
-rw-r--r-- | src/main/resources/DefaultConfiguration.zip | bin | 671784 -> 671973 bytes | |||
-rw-r--r-- | work/cfg/config.properties | 7 |
3 files changed, 61 insertions, 17 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java index 2c9a9ad..dc6e106 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java @@ -39,6 +39,7 @@ import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult; import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData;
import at.gv.egiz.pdfas.commandline.CommandlineConnectorChooser;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
+import at.gv.egiz.pdfas.exceptions.framework.PlaceholderExtractionException;
import at.gv.egiz.pdfas.framework.ConnectorParameters;
import at.gv.egiz.pdfas.framework.DataSourceHolder;
import at.gv.egiz.pdfas.framework.config.SettingsHelper;
@@ -73,6 +74,7 @@ import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException; import at.knowcenter.wag.egov.egiz.exceptions.OutOfMemoryException;
import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
+import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
import at.knowcenter.wag.egov.egiz.exceptions.SignatorFactoryException;
import at.knowcenter.wag.egov.egiz.exceptions.SignatureException;
import at.knowcenter.wag.egov.egiz.framework.SignatorFactory;
@@ -104,6 +106,8 @@ public class PdfAsObject implements PdfAs */
private static Log log = LogFactory.getLog(CheckHelper.class);
+ private static final String ENABLE_PLACEHOLDER_SEARCH_KEY = "enable_placeholder_search";
+
/**
* This constructor is for internal use only - use
* {@link at.gv.egiz.pdfas.PdfAsFactory} instead.
@@ -631,26 +635,24 @@ public class PdfAsObject implements PdfAs }
signParameters.setDocument(PdfAS.applyStrictMode(signParameters.getDocument()));
-
- SignaturePlaceholderData spd = null;
- SignaturePlaceholderContext.setSignaturePlaceholderData(null);
- if (signParameters.isCheckForPlaceholder()) {
- spd = SignaturePlaceholderExtractor.extract(signParameters.getDocument().createInputStream(), signParameters.getPlaceholderId(), signParameters.getPlaceholderMatchMode());
- if (spd != null){
- if (spd.getProfile() != null)
- signParameters.setSignatureProfileId(spd.getProfile());
- if (spd.getType() != null)
- signParameters.setSignatureType(spd.getType());
- if (spd.getKey() != null)
- signParameters.setSignatureKeyIdentifier(spd.getKey());
- }
+
+ SettingsReader settings = SettingsReader.getInstance();
+ String defaultProfile = settings.getValueFromKey(SignatureTypes.DEFAULT_TYPE);
+
+ SignaturePlaceholderData spd = getSignaturePlaceholder(signParameters, defaultProfile);
+ if (spd != null){
+ if (spd.getProfile() != null)
+ signParameters.setSignatureProfileId(spd.getProfile());
+ if (spd.getType() != null)
+ signParameters.setSignatureType(spd.getType());
+ if (spd.getKey() != null)
+ signParameters.setSignatureKeyIdentifier(spd.getKey());
+ // check again, we might have destroyed something
+ CheckHelper.checkSignParameters(signParameters, true);
}
- CheckHelper.checkSignParameters(signParameters, true);
-
+
if (signParameters.getSignatureProfileId() == null)
{
- SettingsReader settings = SettingsReader.getInstance();
- String defaultProfile = settings.getValueFromKey(SignatureTypes.DEFAULT_TYPE);
signParameters.setSignatureProfileId(defaultProfile);
}
@@ -674,6 +676,41 @@ public class PdfAsObject implements PdfAs }
+ private SignaturePlaceholderData getSignaturePlaceholder(SignParameters signParameters,
+ String defaultProfile) throws SettingsException, PDFDocumentException, PlaceholderExtractionException {
+ SignaturePlaceholderData spd = null;
+ SignaturePlaceholderContext.setSignaturePlaceholderData(null);
+
+ SettingsReader settings = SettingsReader.getInstance();
+
+ // check sig_obj.PROFILID.enable_placeholder_search
+ String profile = signParameters.getSignatureProfileId();
+ if (profile == null)
+ profile = defaultProfile;
+ String key = SignatureTypes.SIG_OBJ + profile + "." + ENABLE_PLACEHOLDER_SEARCH_KEY;
+ String enableSearchString = settings.getValueFromKey(key);
+
+ if (enableSearchString == null){
+ // check global enable_placeholder_search
+ enableSearchString = settings.getValueFromKey(ENABLE_PLACEHOLDER_SEARCH_KEY);
+ }
+
+ boolean enableSearch = true;
+ if (enableSearchString != null && enableSearchString.trim().equalsIgnoreCase("false"))
+ enableSearch = false;
+
+ if (enableSearch)
+ {
+ if (signParameters.isCheckForPlaceholder()) {
+ spd = SignaturePlaceholderExtractor.extract(
+ signParameters.getDocument().createInputStream(),
+ signParameters.getPlaceholderId(),
+ signParameters.getPlaceholderMatchMode());
+ }
+ }
+ return spd;
+ }
+
private Signator createSignator(String signatureType) throws SignatorFactoryException {
PdfASID signatorId = null;
if (signatureType.equals(Constants.SIGNATURE_TYPE_BINARY))
diff --git a/src/main/resources/DefaultConfiguration.zip b/src/main/resources/DefaultConfiguration.zip Binary files differindex d83bacb..d665f61 100644 --- a/src/main/resources/DefaultConfiguration.zip +++ b/src/main/resources/DefaultConfiguration.zip diff --git a/work/cfg/config.properties b/work/cfg/config.properties index 2ef963c..0ec79c3 100644 --- a/work/cfg/config.properties +++ b/work/cfg/config.properties @@ -64,6 +64,11 @@ external_corrector_timeout=15000 # In beiden Fällen wird check_old_textual_sigs berücksichtigt.
check_document=true
+# Aktiviert, oder deaktiviert grundsätzlich das - potenziell sehr Zeit- und Resourcen-aufändige -
+# Suchen nach Platzhalter-Bildern in PDF-Dokumenten
+# Die Suche ist standardmässig aktiviert, also der Defaultwert hier = true
+enable_placeholder_search=true
+
#VerificationFilterParameters
# modify only if you really know the algorithms
binary_only=false
@@ -430,6 +435,8 @@ sig_obj.SIGNATURBLOCK_MINIMAL_DE.pos=w:230.0;f:80 sig_obj.SIGNATURBLOCK_MINIMAL_DE.adobeSignFieldValue=PDF-AS Signatur
sig_obj.SIGNATURBLOCK_MINIMAL_DE.adobeSignReasonValue=Informationen zur Prüfung finden Sie unter http://www.signaturpruefung.gv.at
sig_obj.SIGNATURBLOCK_MINIMAL_DE.verifyURL=http://www.signaturpruefung.gv.at
+# Deaktiviert nur für dieses Profil die Suche nach und das Ersetzen von Platzhalter-Bildern
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.enable_placeholder_search=false
#---------------------- MAIN TABLE -------------------------
sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.1=SIG_LABEL-i
|