aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/commandline
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/commandline')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/commandline/Main.java38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
index 40d0e5a..373f4be 100644
--- a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
+++ b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
@@ -26,6 +26,7 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -114,7 +115,7 @@ public abstract class Main
* Command line parameter selecting the position of the signature.
*/
protected static final String PARAMETER_POS = "-pos";
-
+
/**
* Command line parameter signaling to search the source document for a placeholder for the signature
*/
@@ -238,7 +239,7 @@ public abstract class Main
String user_name = null;
String user_password = null;
String pos_string = null;
-
+
boolean search_placeholder = false;
String placeholderId = null;
int placeholderMatchMode = SignParameters.PLACEHOLDER_MATCH_MODE_MODERATE;
@@ -1014,7 +1015,7 @@ public abstract class Main
writer.print(" " + PARAMETER_SIGNATURE_TYPE + " <");
SignatureTypes sig_types = SignatureTypes.getInstance();
SettingsReader settings = SettingsReader.getInstance();
- List types_array = sig_types.getSignatureTypes();
+ Set types_array = sig_types.getSignatureTypes();
Iterator it = types_array.iterator();
while (it.hasNext())
{
@@ -1055,7 +1056,7 @@ public abstract class Main
writer.println(" 'new' ... new page");
writer.println(" intvalue ... pagenumber must be > 0 if p>number of pages in document p-->handled like p:'new'");
writer.println(" f_algo floatvalue ... consider footerline must be >= 0 (only if y_algo is auto and p_algo is not 'new')");
-
+
writer.println(" " + PARAMETER_SEARCH_PLACEHOLDER + " ... [optional] if set, the source document will be scanned for signature placeholder images");
writer.println(" " + PARAMETER_PLACEHOLDER_ID + " <id> ... [optional] search for signature placeholder images containing the given id");
writer.println(" " + PARAMETER_PLACEHOLDER_MATCH_MODE + " <" + VALUE_PLACEHOLDER_MATCH_MODE_LENIENT + "|" + VALUE_PLACEHOLDER_MATCH_MODE_MODERATE + "|" + VALUE_PLACEHOLDER_MATCH_MODE_STRICT + "> ... [optional] specify the behaviour if no matching placeholder could be found. Default is <moderate>.");
@@ -1114,7 +1115,7 @@ public abstract class Main
}
/**
- * Checks the value for correctness.
+ * Checks the value for correctness (meaning if it exists)
*
* @param signature_type
* The parameter's value.
@@ -1122,18 +1123,21 @@ public abstract class Main
*/
protected static boolean checkSignatureType(String signature_type) throws SignatureTypesException
{
- SignatureTypes sig_types = SignatureTypes.getInstance();
- List types_array = sig_types.getSignatureTypes();
- Iterator it = types_array.iterator();
- while (it.hasNext())
- {
- String type = (String) it.next();
- if (type.equals(signature_type))
- {
- return true;
- }
- }
- return false;
+ return SignatureTypes.getInstance().getSignatureTypes().contains(signature_type);
+
+ // exthex: uuuaaaahhhhh WHY???, dont do that.
+ // Please read: http://www.amazon.de/Java-f%C3%BCr-Dummies-Barry-Burd/dp/382662999X
+// List types_array = sig_types.getSignatureTypes();
+// Iterator it = types_array.iterator();
+// while (it.hasNext())
+// {
+// String type = (String) it.next();
+// if (type.equals(signature_type))
+// {
+// return true;
+// }
+// }
+// return false;
}
/**