aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
authorAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-04-10 22:15:18 +0200
committerAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-04-10 22:15:18 +0200
commitbc6073700024e4b3c95bcf5bf3e48efb6edd14ab (patch)
treedc070186c463f9285101cd0b0bc553de234b1853 /pdf-as-cli/src/main/java/at/gv/egiz/pdfas
parent7824a4d85cfe855ddeb330c6ff753a2e60f8009b (diff)
downloadpdf-as-4-bc6073700024e4b3c95bcf5bf3e48efb6edd14ab.tar.gz
pdf-as-4-bc6073700024e4b3c95bcf5bf3e48efb6edd14ab.tar.bz2
pdf-as-4-bc6073700024e4b3c95bcf5bf3e48efb6edd14ab.zip
parsing off signature block CLI parameters
Diffstat (limited to 'pdf-as-cli/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java29
1 files changed, 23 insertions, 6 deletions
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
index 47d06576..86769c49 100644
--- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
@@ -85,6 +85,9 @@ public class Main {
public static final String CLI_ARG_CONF_SHORT = "conf";
public static final String CLI_ARG_CONF = "configuration";
+ public static final String CLI_ARG_SIGNATURE_BLOCK_PARAM_SHORT = "sbp";
+ public static final String CLI_ARG_SIGNATURE_BLOCK_PARAM = "signature_block_parameter";
+
public static final String CLI_ARG_DEPLOY_SHORT = "d";
public static final String CLI_ARG_DEPLOY = "deploy";
@@ -199,6 +202,10 @@ public class Main {
true, "The output file");
cliOptions.addOption(outputOption);
+ Option signatureBlockParameters = new Option(CLI_ARG_SIGNATURE_BLOCK_PARAM_SHORT, CLI_ARG_SIGNATURE_BLOCK_PARAM,
+ true, "Parameters or signature block");
+ cliOptions.addOption(signatureBlockParameters);
+
return cliOptions;
}
@@ -434,12 +441,22 @@ public class Main {
System.out.println("Starting signature for " + pdfFile);
System.out.println("Selected signature Profile " + profilID);
- //TODO get values from CLI
- Map<String, String> test = new HashMap<>();
- test.put("schoolName", "EGIZ testschule");
-
- test.put("subject","bbDbb");
- signParameter.setDynamicSignatureBlockArguments(test);
+ // get console parameters related to signature block
+ String[] signatureBlockParameters = null;
+ if (cli.hasOption(CLI_ARG_SIGNATURE_BLOCK_PARAM_SHORT)) {
+ signatureBlockParameters = cli.getOptionValues(CLI_ARG_SIGNATURE_BLOCK_PARAM_SHORT);
+ }
+ Map<String, String> signatureBlockParametersMap = new HashMap<>();
+ if(signatureBlockParameters != null && signatureBlockParameters.length > 0) {
+ for(String s : signatureBlockParameters) {
+ if(!s.contains("=")) {
+ throw new Exception("Invalid parameter: "+s);
+ }
+ String[] values = s.split("=", 2);
+ signatureBlockParametersMap.put(values[0], values[1]);
+ }
+ }
+ signParameter.setDynamicSignatureBlockArguments(signatureBlockParametersMap);
SignResult result = null;
try {