aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderExtractor.java3
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java64
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java3
3 files changed, 34 insertions, 36 deletions
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";