aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-common
diff options
context:
space:
mode:
authorThomas <>2023-01-11 23:23:30 +0100
committerThomas <>2023-01-11 23:23:30 +0100
commit42e68c8f3e53b34663d2fe9c434b0b034ff9ddf0 (patch)
treede9aceb59655ff02fcbc4100f07fe33d035f34f1 /pdf-as-common
parent989f7685e730255a08c32e7a10c090f2ffc22d26 (diff)
downloadpdf-as-4-42e68c8f3e53b34663d2fe9c434b0b034ff9ddf0.tar.gz
pdf-as-4-42e68c8f3e53b34663d2fe9c434b0b034ff9ddf0.tar.bz2
pdf-as-4-42e68c8f3e53b34663d2fe9c434b0b034ff9ddf0.zip
feat(web): add bulk-light functionality into PDF-AS-Web
Diffstat (limited to 'pdf-as-common')
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/CoreSignParams.java32
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/DocumentToSign.java22
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignRequest.java62
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignResponse.java23
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/SignedDocument.java25
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java14
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java10
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasGetMultipleRequest.java24
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignDocument.java37
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleRequest.java60
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleResponse.java35
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignedDocument.java30
12 files changed, 370 insertions, 4 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/CoreSignParams.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/CoreSignParams.java
new file mode 100644
index 00000000..f86e93b6
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/CoreSignParams.java
@@ -0,0 +1,32 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector;
+import lombok.Data;
+
+@Data
+public class CoreSignParams implements Serializable {
+
+ private static final long serialVersionUID = 947480605651880556L;
+
+ String transactionId;
+
+ Connector connector;
+
+ String invokeUrl;
+
+ String invokeTarget;
+
+ String invokeErrorUrl;
+
+ String keyIdentifier;
+
+ Map<String,String> preprocessor;
+
+ Map<String,String> overrides;
+
+ Map<String,String> signatureBlockParameters;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/DocumentToSign.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/DocumentToSign.java
new file mode 100644
index 00000000..6cc3a933
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/DocumentToSign.java
@@ -0,0 +1,22 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+
+import lombok.Data;
+
+@Data
+public class DocumentToSign implements Serializable {
+
+ private static final long serialVersionUID = 551977730667465367L;
+
+ byte[] inputData;
+
+ String fileName;
+
+ String position;
+
+ String qrCodeContent;
+
+ String profile;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignRequest.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignRequest.java
new file mode 100644
index 00000000..b36b5a4c
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignRequest.java
@@ -0,0 +1,62 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import at.gv.egiz.pdfas.api.ws.VerificationLevel;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+public class PdfasSignRequest implements Serializable, Iterator<DocumentToSign> {
+
+ private static final long serialVersionUID = -7245405996920651806L;
+
+ @Setter
+ String requestID;
+
+ @Setter
+ CoreSignParams coreParams;
+
+ @Setter
+ VerificationLevel verificationLevel;
+
+ List<DocumentToSign> input;
+
+ /**
+ * Add single PDF for signing.
+ *
+ * @param pdf PDF to sign
+ */
+ public void addDocumentToSign(DocumentToSign pdf) {
+ if (input == null) {
+ input = new ArrayList<>();
+
+ }
+ input.add(pdf);
+
+ }
+
+
+ /**
+ * <code>true</code> if there is one or more {@link DocumentToSign}, otherwise <code>false</code>.
+ */
+ @Override
+ public boolean hasNext() {
+ return input != null && !input.isEmpty();
+
+ }
+
+ /**
+ * Get next {@link DocumentToSign}.
+ */
+ @Override
+ public synchronized DocumentToSign next() {
+ return input.remove(0);
+
+ }
+
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignResponse.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignResponse.java
new file mode 100644
index 00000000..3618715f
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/PdfasSignResponse.java
@@ -0,0 +1,23 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+import java.util.List;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.Singular;
+
+@Data
+@Builder(toBuilder = true)
+public class PdfasSignResponse implements Serializable {
+
+ private static final long serialVersionUID = -3235466827933651452L;
+
+ String requestId;
+
+ String transactionId;
+
+ @Singular
+ List<SignedDocument> signedPdfs;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/SignedDocument.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/SignedDocument.java
new file mode 100644
index 00000000..348746df
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/processing/SignedDocument.java
@@ -0,0 +1,25 @@
+package at.gv.egiz.pdfas.api.processing;
+
+import java.io.Serializable;
+
+import at.gv.egiz.pdfas.api.ws.PDFASVerificationResponse;
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class SignedDocument implements Serializable {
+
+ private static final long serialVersionUID = 5409915106152807937L;
+
+ Long signingTimestamp;
+
+ byte[] outputData;
+
+ String fileName;
+
+ String signerCertificate;
+
+ PDFASVerificationResponse verificationResponse;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java
index 94906112..a70b8f56 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignParameters.java
@@ -23,11 +23,8 @@
******************************************************************************/
package at.gv.egiz.pdfas.api.ws;
-import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.Serializable;
+import java.util.Arrays;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnumValue;
@@ -71,6 +68,15 @@ public class PDFASSignParameters implements Serializable {
public String toString(){
return name;
}
+
+ public static Connector fromString(String value) {
+ return Arrays.asList(Connector.values()).stream()
+ .filter(el -> el.toString().equalsIgnoreCase(value))
+ .findFirst()
+ .get();
+
+ }
+
}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java
index 667080fa..beeff937 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSigning.java
@@ -44,4 +44,14 @@ public interface PDFASSigning {
@WebMethod(operationName = "signBulk")
@WebResult(name="bulkResponse")
public PDFASBulkSignResponse signPDFDokument(@WebParam(name = "signBulkRequest") PDFASBulkSignRequest request);
+
+ @WebMethod(operationName = "signMultiple")
+ @WebResult(name="signMultipleResponse")
+ public PdfasSignMultipleResponse signPDFDokument(@WebParam(name = "signMultipleRequest") PdfasSignMultipleRequest request);
+
+ @WebMethod(operationName = "getMultiple")
+ @WebResult(name="getMultipleResponse")
+ public PdfasSignMultipleResponse getSignedDokument(@WebParam(name = "getMultipleRequest") PdfasGetMultipleRequest request);
+
+
}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasGetMultipleRequest.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasGetMultipleRequest.java
new file mode 100644
index 00000000..5f4f3a27
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasGetMultipleRequest.java
@@ -0,0 +1,24 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="getMultipleRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasGetMultipleRequest implements Serializable {
+
+ private static final long serialVersionUID = -7105371679206044280L;
+
+ @XmlElement(required = true, nillable = false, name="token")
+ String token;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignDocument.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignDocument.java
new file mode 100644
index 00000000..e065ef5e
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignDocument.java
@@ -0,0 +1,37 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="signMultipleFile")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasSignDocument implements Serializable {
+
+ private static final long serialVersionUID = -2422995343468207094L;
+
+ @XmlElement(required = true, nillable = false, name="inputData")
+ byte[] inputData;
+
+ @XmlElement(required = true, nillable = false, name="fileName")
+ String fileName;
+
+ @XmlElement(required = false, nillable = true, name="position")
+ String position;
+
+ @XmlElement(required = false, nillable = true, name="qrCodeContent")
+ String qrCodeContent;
+
+ @XmlElement(required = false, nillable = true, name="profile")
+ String profile;
+
+}
+
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleRequest.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleRequest.java
new file mode 100644
index 00000000..8d172bfb
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleRequest.java
@@ -0,0 +1,60 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="signMultipleRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasSignMultipleRequest implements Serializable {
+
+ private static final long serialVersionUID = 4338536417988335976L;
+
+ @XmlElement(required = true, nillable = false, name="requestID")
+ String requestID;
+
+ @XmlElement(required = false, nillable = true, name="transactionId")
+ String transactionId;
+
+ @XmlElement(required = true, nillable = false, name="connector")
+ Connector connector;
+
+ @XmlElement(required = false, nillable = true, name="invoke-url")
+ String invokeUrl;
+
+ @XmlElement(required = false, nillable = true, name="invoke-target")
+ String invokeTarget;
+
+ @XmlElement(required = false, nillable = true, name="invoke-error-url")
+ String invokeErrorUrl;
+
+ @XmlElement(required = false, nillable = true, name="keyIdentifier")
+ String keyIdentifier;
+
+ @XmlElement(required = false, nillable = true, name="preprocessorArguments")
+ PDFASPropertyMap preprocessor;
+
+ @XmlElement(required = false, nillable = true, name="configurationOverrides")
+ PDFASPropertyMap overrides;
+
+ @XmlElement(required = false, nillable = true, name="signatureBlockParameter")
+ Map<String,String> signatureBlockParameters;
+
+ @XmlElement(required = false, nillable = true, name="verificationLevel")
+ VerificationLevel verificationLevel;
+
+ @XmlElement(required = true, nillable = false, name="documents")
+ List<PdfasSignDocument> input;
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleResponse.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleResponse.java
new file mode 100644
index 00000000..a2391d11
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignMultipleResponse.java
@@ -0,0 +1,35 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="signMultipleResponse")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasSignMultipleResponse implements Serializable {
+ private static final long serialVersionUID = 2544165926674778203L;
+
+ @XmlElement(required = true, nillable = false, name="requestID")
+ String requestID;
+
+ @XmlElement(required = false, nillable = true, name="transactionId")
+ String transactionId;
+
+ @XmlElement(required = false, name="error")
+ String error;
+
+ @XmlElement(required = false, name="redirectUrl")
+ String redirectUrl;
+
+ @XmlElement(required = true, nillable = false, name="documents")
+ List<PdfasSignedDocument> output;
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignedDocument.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignedDocument.java
new file mode 100644
index 00000000..7ac13e1d
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PdfasSignedDocument.java
@@ -0,0 +1,30 @@
+package at.gv.egiz.pdfas.api.ws;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@XmlType(name="signedMultipleFile")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PdfasSignedDocument implements Serializable {
+
+ private static final long serialVersionUID = -2621030544869357960L;
+
+ @XmlElement(required = true, nillable = false, name="outputData")
+ byte[] outputData;
+
+ @XmlElement(required = false, nillable = true, name="fileName")
+ String fileName;
+
+ @XmlElement(required = false, nillable = false, name="verificationResponse")
+ PDFASVerificationResponse verificationResponse;
+
+}