|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ls.util.validation.BaseValidation
This class is for testing of regular expressions. It uses the "gnu.regexp" library.
Field Summary | |
static String |
ERROR
The constant that store the "error" string |
static String |
RULE_DEFAULTVALUE
The constant that store the "default" string |
static String |
RULE_MANDATORY
The constant that store the "mandatory" string |
static String |
RULE_MAXLENGTH
The constant that store the "maxlength" string |
static String |
RULE_MINLENGTH
The constant that store the "minlength" string |
static String |
RULE_NAME
The constant that store the "name" string |
static String |
RULE_REGEX
The constant that store the "regex" string |
static String |
RULE_TYPE
The constant that store the "typecode" string |
Constructor Summary | |
BaseValidation()
Creates a new Validator object. |
Method Summary | |
void |
addRule(String ruleKey,
Map rule)
The following function group adds a rule to the know rule sets. |
void |
addRuleType(String ruleTypeKey,
Map rule)
The following function adds a rule type to the typeHash. |
Map |
convertValues(Map rule)
Convert values like MIN_LENGTH, MAX_LENGTH to integers and add them again to the map and returns it afterwards. |
List |
getAllErrors()
Returns a list of all errors that occured during validation of an input map. |
List |
getErrors()
Returns a list with the errors that occured during validation. |
boolean |
isValid(Map input)
Function to check the content of an input Map against the rule set If no rule for a content entry exists the check for this entry will be successfull. |
boolean |
isValid(String value,
String ruleKey)
Function to check a value (from the user input side) against the rule set for a rule key. |
Map |
mergeRules(Map ruleType,
Map rule)
The following function group adds a rule to the know rule sets. |
boolean |
validateMandatory(String value,
String ruleKey,
Map rule)
Check if the it is a mandatory flag and the value exits. |
boolean |
validateMaxLength(String value,
String ruleKey,
Map rule)
Check if the value is long enough. |
boolean |
validateMinLength(String value,
String ruleKey,
Map rule)
Check if the value is long enough. |
boolean |
validateRegEx(String value,
String ruleKey,
Map rule)
Checks if the value is matching the regular expression. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String RULE_NAME
public static final String RULE_TYPE
public static final String RULE_MANDATORY
public static final String RULE_DEFAULTVALUE
public static final String RULE_MAXLENGTH
public static final String RULE_MINLENGTH
public static final String RULE_REGEX
public static final String ERROR
Constructor Detail |
public BaseValidation()
Method Detail |
public void addRuleType(String ruleTypeKey, Map rule) throws ValidationConfigurationException
ruleTypeKey
- The identifier of the rule if want to be calledrule
- The Map containin the rules for one field / typeValidationConfigurationException
- If an error happens when adding the rule type.public void addRule(String ruleKey, Map rule) throws ValidationConfigurationException
ruleKey
- Rule code generated by makeRuleCode(),
i.e. parse_template.insert_item.emailrule
- The map of rulesValidationConfigurationException
- If an error happens when adding the rule.public Map convertValues(Map rule) throws ValidationConfigurationException
rule
- The Map containing the rules for one field / typeValidationConfigurationException
- If an error happens when converting the values.public Map mergeRules(Map ruleType, Map rule)
ruleType
- Rule code generated by makeRuleCode(),
i.e. parse_template.insert_item.emailrule
- The set of rulespublic boolean isValid(Map input)
input
- The Map with content that has to be validated.public boolean isValid(String value, String ruleKey)
value
- The user input to check.ruleKey
- The rule key that identifies the rule to use for the check.public boolean validateMandatory(String value, String ruleKey, Map rule)
value
- The user input to check.ruleKey
- The rule key that identifies the rule to use for the check.rule
- The rule that is applied to the rule keypublic boolean validateMinLength(String value, String ruleKey, Map rule)
value
- The user input to check.ruleKey
- The rule key that identifies the rule to use for the check.rule
- The rule that is applied to the rule keypublic boolean validateMaxLength(String value, String ruleKey, Map rule)
value
- The user input to check.ruleKey
- The rule key that identifies the rule to use for the check.rule
- The rule that is applied to the rule keypublic boolean validateRegEx(String value, String ruleKey, Map rule)
value
- The user input to check.ruleKey
- The rule key that identifies the rule to use for the check.rule
- The rule that is applied to the rule keypublic List getErrors()
public List getAllErrors()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |