diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-08-01 09:10:43 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-08-01 09:10:43 +0000 |
commit | 2c398de4ce47e3725da3f544a5da7e1b62c0156a (patch) | |
tree | 96b03fa1dc895e5db1cde515d0771bd2d7bcf1ec /Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties | |
parent | 91841d3a3dfaeb272e60c35dda7362e63d6e42e5 (diff) | |
download | pdf-over-2c398de4ce47e3725da3f544a5da7e1b62c0156a.tar.gz pdf-over-2c398de4ce47e3725da3f544a5da7e1b62c0156a.tar.bz2 pdf-over-2c398de4ce47e3725da3f544a5da7e1b62c0156a.zip |
Removed old spezification projekt
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12242 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties')
11 files changed, 0 insertions, 480 deletions
diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/DateProfileProperty.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/DateProfileProperty.java deleted file mode 100644 index ac5df52a..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/DateProfileProperty.java +++ /dev/null @@ -1,36 +0,0 @@ -package at.asit.pdfover.pdfsignator.profileproperties; - -import java.util.Date; - -import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException; -import at.asit.pdfover.pdfsignator.InvalidPropertyValueException; - -/** - * A Date Property - */ -public class DateProfileProperty extends ProfileProperty { - - /** - * Date value of property - */ - protected Date dvalue = null; - - /** - * Sets the date value of the Property - * @param value The date value - * @throws InvalidPropertyValueException - * @throws InvalidPropertyTypeException - */ - public void SetValue(Date value) throws InvalidPropertyValueException, InvalidPropertyTypeException { - this.SetTextValue(value.toString()); - this.dvalue = value; - } - - /** - * Gets the date value - * @return the date value of the property - */ - public Date GetValue() { - return this.dvalue; - } -} diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/FileProfileProperty.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/FileProfileProperty.java deleted file mode 100644 index 46c5cd12..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/FileProfileProperty.java +++ /dev/null @@ -1,33 +0,0 @@ -package at.asit.pdfover.pdfsignator.profileproperties; - -import java.io.File; - -import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException; -import at.asit.pdfover.pdfsignator.InvalidPropertyValueException; - -public class FileProfileProperty extends ProfileProperty { - - /** - * File value of property - */ - protected File fvalue = null; - - /** - * Sets the file value of the Property - * @param value The file value - * @throws InvalidPropertyValueException - * @throws InvalidPropertyTypeException - */ - public void SetValue(File value) throws InvalidPropertyValueException, InvalidPropertyTypeException { - this.SetTextValue(value.getAbsolutePath()); - this.fvalue = value; - } - - /** - * Gets the file value - * @return the file value of the property - */ - public File GetValue() { - return this.fvalue; - } -} diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/FloatProfileProperty.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/FloatProfileProperty.java deleted file mode 100644 index 51c4089e..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/FloatProfileProperty.java +++ /dev/null @@ -1,30 +0,0 @@ -package at.asit.pdfover.pdfsignator.profileproperties; - -import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException; -import at.asit.pdfover.pdfsignator.InvalidPropertyValueException; - -public class FloatProfileProperty extends ProfileProperty { - /** - * Float value of property - */ - protected Float fvalue = null; - - /** - * Sets the float value of the Property - * @param value The float value - * @throws InvalidPropertyValueException - * @throws InvalidPropertyTypeException - */ - public void SetValue(float value) throws InvalidPropertyValueException, InvalidPropertyTypeException { - this.SetTextValue(Float.toString(value)); - this.fvalue = value; - } - - /** - * Gets the float value - * @return the float value of the property - */ - public Float GetValue() { - return this.fvalue; - } -} diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/IntegerProfileProperty.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/IntegerProfileProperty.java deleted file mode 100644 index 7bb91226..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/IntegerProfileProperty.java +++ /dev/null @@ -1,31 +0,0 @@ -package at.asit.pdfover.pdfsignator.profileproperties; - -import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException; -import at.asit.pdfover.pdfsignator.InvalidPropertyValueException; - -public class IntegerProfileProperty extends ProfileProperty { - - /** - * Integer value of property - */ - protected Integer ivalue = null; - - /** - * Sets the integer value of the Property - * @param value The integer value - * @throws InvalidPropertyValueException - * @throws InvalidPropertyTypeException - */ - public void SetValue(int value) throws InvalidPropertyValueException, InvalidPropertyTypeException { - this.SetTextValue(Integer.toString(value)); - this.ivalue = value; - } - - /** - * Gets the integer value - * @return the integer value of the property - */ - public Integer GetValue() { - return this.ivalue; - } -} diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/ProfileProperty.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/ProfileProperty.java deleted file mode 100644 index ebd247d6..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/ProfileProperty.java +++ /dev/null @@ -1,112 +0,0 @@ -package at.asit.pdfover.pdfsignator.profileproperties; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException; -import at.asit.pdfover.pdfsignator.InvalidPropertyValueException; -import at.asit.pdfover.pdfsignator.profileproperties.validators.PropertyValidator; -import at.asit.pdfover.pdfsignator.profileproperties.validators.PropertyValidatorComparer; - -/** - * Defines a Profile Property - */ -public abstract class ProfileProperty { - - /** - * Is this property optional - */ - protected boolean optional; - - /** - * The value of the property - */ - private String value; - - /** - * The key of the property - */ - private String key; - - /** - * The list of PropertyValidator - * @uml.property name="propertyValidator" - * @uml.associationEnd multiplicity="(0 -1)" ordering="true" aggregation="shared" inverse="profileProperty:at.asit.pdfover.pdfsignator.profileproperties.validators.PropertyValidator" - */ - protected List<PropertyValidator> validators = new ArrayList<PropertyValidator>(); - - /** - * Validates the ProfileProperty - * @throws InvalidPropertyValueException - * @throws InvalidPropertyTypeException - */ - protected void Validate() throws InvalidPropertyValueException, InvalidPropertyTypeException { - for(PropertyValidator validator : validators) { - validator.validate(this); - } - } - - /** - * Adds a new PropertyValidator to this Property and sorts the validators according to their priority - * @param validator - * @throws InvalidPropertyTypeException - */ - public void AddValidator(PropertyValidator validator) throws InvalidPropertyTypeException { - validator.CheckPropertyType(this); - validators.add(validator); - Collections.sort(validators, new PropertyValidatorComparer()); - } - - /** - * Sets if the property is optional - * @param value The new optional value - */ - public void SetOptional(boolean value) { - this.optional = value; - } - - /** - * Gets if the Property is Optional - * @return Is the property optional - */ - public boolean GetOptional() { - return this.optional; - } - - /** - * Sets the string value of the property and validates the Property - * (All subclasses should set the value via this method!) - * @param value The new value - * @throws InvalidPropertyValueException - * @throws InvalidPropertyTypeException - */ - public void SetTextValue(String value) throws InvalidPropertyValueException, InvalidPropertyTypeException { - this.value = value; - this.Validate(); - } - - /** - * Gets the property text value - * @return The property text value - */ - public String GetTextValue() { - return this.value; - } - - /** - * Sets the propety key - * @param value The new property key - */ - public void SetKey(String value) { - this.key = value; - } - - /** - * Gets the property Key - * @return The property key - */ - public String GetKey() { - return this.key; - } -} diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/StringProfileProperty.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/StringProfileProperty.java deleted file mode 100644 index 35d903af..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/StringProfileProperty.java +++ /dev/null @@ -1,24 +0,0 @@ -package at.asit.pdfover.pdfsignator.profileproperties; - -import at.asit.pdfover.pdfsignator.InvalidPropertyTypeException; -import at.asit.pdfover.pdfsignator.InvalidPropertyValueException; - -public class StringProfileProperty extends ProfileProperty { - /** - * Sets the string value of the Property - * @param value The string value - * @throws InvalidPropertyValueException - * @throws InvalidPropertyTypeException - */ - public void SetValue(String value) throws InvalidPropertyValueException, InvalidPropertyTypeException { - this.SetTextValue(value); - } - - /** - * Gets the string value - * @return the string value of the property - */ - public String GetValue() { - return this.GetTextValue(); - } -} diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/FloatRangeValidator.java deleted file mode 100644 index 8cca9230..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/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/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/IntegerRangeValidator.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/IntegerRangeValidator.java deleted file mode 100644 index 504cb482..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/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/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidator.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidator.java deleted file mode 100644 index 8da9babc..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/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/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidatorComparer.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidatorComparer.java deleted file mode 100644 index 448b690a..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/PropertyValidatorComparer.java +++ /dev/null @@ -1,17 +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> { - - @Override - public int compare(PropertyValidator o1, PropertyValidator o2) { - return o1.GetPriority() - o2.GetPriority(); - } - -} diff --git a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/RegExValidator.java b/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/RegExValidator.java deleted file mode 100644 index 6337231c..00000000 --- a/Spezifikation/PDFSignator Schnittstelle/src/at/asit/pdfover/pdfsignator/profileproperties/validators/RegExValidator.java +++ /dev/null @@ -1,41 +0,0 @@ -package at.asit.pdfover.pdfsignator.profileproperties.validators; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -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 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 - } -} |