summaryrefslogtreecommitdiff
path: root/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators')
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java57
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/IntegerRangeValidator.java58
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidator.java41
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidatorComparer.java16
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/RegExValidator.java37
5 files changed, 0 insertions, 209 deletions
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java
deleted file mode 100644
index 8cca9230..00000000
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package at.asit.pdfover.pdfsignator.profileproperties.validators;
-
-import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException;
-import at.asit.pdfover.pdfsignator.InvalidPropertyValueException;
-import at.asit.pdfover.pdfsignator.profileproperties.FloatProfileProperty;
-import at.asit.pdfover.pdfsignator.profileproperties.ProfileProperty;
-
-public class FloatRangeValidator extends PropertyValidator {
-
- /**
- * The maximum value
- */
- protected float max;
-
- /**
- * The minimum value
- */
- protected float min;
-
- /**
- * Constructor
- * @param min The minimum allowed value
- * @param max The maximum allowed value
- */
- public FloatRangeValidator(float min, float max) {
- this.max = max;
- this.min = min;
- }
-
- @Override
- public void validate(ProfileProperty property)
- throws InvalidPropertyValueException, InvalidPropertyTypeException {
- this.CheckPropertyType(property);
-
- FloatProfileProperty prop = (FloatProfileProperty) property;
-
- if (prop.GetValue() == null) {
- throw new InvalidPropertyValueException(property,
- "Value is not set!");
- }
-
- float value = prop.GetValue();
-
- if (value < min || value > max) {
- throw new InvalidPropertyValueException(property, String.format(
- "Value has to be between %f and %f", min, max));
- }
- }
-
- @Override
- public void CheckPropertyType(ProfileProperty property)
- throws InvalidPropertyTypeException {
- if (!(property instanceof FloatProfileProperty)) {
- throw new InvalidPropertyTypeException(property, this);
- }
- }
-}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/IntegerRangeValidator.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/IntegerRangeValidator.java
deleted file mode 100644
index 504cb482..00000000
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/IntegerRangeValidator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package at.asit.pdfover.pdfsignator.profileproperties.validators;
-
-import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException;
-import at.asit.pdfover.pdfsignator.InvalidPropertyValueException;
-import at.asit.pdfover.pdfsignator.profileproperties.IntegerProfileProperty;
-import at.asit.pdfover.pdfsignator.profileproperties.ProfileProperty;
-
-public class IntegerRangeValidator extends PropertyValidator {
-
- /**
- * Maximum value of property
- */
- protected int max;
-
- /**
- * Minimum value of property
- */
- protected int min;
-
- /**
- * Constructor
- * @param min The minimum allowed value
- * @param max The maximum allowed value
- */
- public IntegerRangeValidator(int min, int max) {
- this.max = max;
- this.min = min;
- }
-
- @Override
- public void validate(ProfileProperty property)
- throws InvalidPropertyValueException, InvalidPropertyTypeException {
- this.CheckPropertyType(property);
-
- IntegerProfileProperty prop = (IntegerProfileProperty) property;
-
- if(prop.GetValue() == null)
- {
- throw new InvalidPropertyValueException(property, "Value is not set!");
- }
-
- int value = prop.GetValue();
-
- if(value < min || value > max) {
- throw new InvalidPropertyValueException(property,
- String.format("Value has to be between %d and %d", min, max));
- }
- }
-
- @Override
- public void CheckPropertyType(ProfileProperty property)
- throws InvalidPropertyTypeException {
- if(!(property instanceof IntegerProfileProperty)) {
- throw new InvalidPropertyTypeException(property, this);
- }
- }
-
-}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidator.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidator.java
deleted file mode 100644
index 8da9babc..00000000
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package at.asit.pdfover.pdfsignator.profileproperties.validators;
-
-import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException;
-import at.asit.pdfover.pdfsignator.InvalidPropertyValueException;
-import at.asit.pdfover.pdfsignator.profileproperties.ProfileProperty;
-
-/**
- * Validates the value of a property
- */
-public abstract class PropertyValidator {
-
- /**
- * The priority of this property should determine the order of validations
- */
- protected int priority = 1;
-
- /**
- * Called to validate the value of the given property and throws an InvalidPropertyValueException if value is invalid
- * @param propety
- * @throws InvalidPropertyValueException
- */
- public abstract void validate(ProfileProperty property) throws InvalidPropertyValueException, InvalidPropertyTypeException;
-
- /**
- * Sets the priority of this validator
- * @param value The new priority
- */
- public void SetPriority(int value) {
- this.priority = value;
- }
-
- /**
- * Gets the priority of this validator
- * @return The priority of this validator
- */
- public int GetPriority() {
- return this.priority;
- }
-
- public abstract void CheckPropertyType(ProfileProperty property) throws InvalidPropertyTypeException;
-}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidatorComparer.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidatorComparer.java
deleted file mode 100644
index 76c7f0e2..00000000
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidatorComparer.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package at.asit.pdfover.pdfsignator.profileproperties.validators;
-
-import java.util.Comparator;
-
-/**
- * Compares the Priority of two PropertyValidators
- * @author afitzek
- *
- */
-public class PropertyValidatorComparer implements Comparator<PropertyValidator> {
-
- public int compare(PropertyValidator o1, PropertyValidator o2) {
- return o1.GetPriority() - o2.GetPriority();
- }
-
-}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/RegExValidator.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/RegExValidator.java
deleted file mode 100644
index 9ca8d113..00000000
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsignator/profileproperties/validators/RegExValidator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package at.asit.pdfover.pdfsignator.profileproperties.validators;
-
-import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException;
-import at.asit.pdfover.pdfsignator.InvalidPropertyValueException;
-import at.asit.pdfover.pdfsignator.profileproperties.ProfileProperty;
-
-public class RegExValidator extends PropertyValidator {
-
- /**
- * The regex value
- */
- protected String regex;
-
- /**
- * Constructor
- * @param regex The regex to check
- */
- public RegExValidator(String regex) {
- this.regex = regex;
- }
-
- @Override
- public void validate(ProfileProperty property)
- throws InvalidPropertyValueException, InvalidPropertyTypeException {
-
- if(!property.GetTextValue().matches(this.regex)) {
- throw new InvalidPropertyValueException(property, String.format(
- "Value is invalid!"));
- }
- }
-
- @Override
- public void CheckPropertyType(ProfileProperty property)
- throws InvalidPropertyTypeException {
- // Is valid on all Property Types
- }
-}