|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.frontend.editor.MCRInputValidator
public class MCRInputValidator
This class provides input validation methods for editor data.
| Method Summary | |
|---|---|
boolean |
compare(String valueA,
String valueB,
String operator,
String type,
String format)
Compares two input fields using a comparison operator. |
static MCRInputValidator |
instance()
|
static void |
main(String[] args)
|
boolean |
validateExternally(String clazz,
String method,
Element elem)
Calls a "public static boolean" method in the given class and validates an XML element |
boolean |
validateExternally(String clazz,
String method,
String value)
Calls a "public static boolean" method in the given class and validates the value externally using the given method in that class. |
boolean |
validateExternally(String clazz,
String method,
String value1,
String value2)
Calls a "public static boolean" method in the given class and validates the two values externally using the given method in that class. |
boolean |
validateLength(String input,
String smin,
String smax)
Checks an input string for minimum and/or maximum length. |
boolean |
validateMinMaxType(String input,
String type,
String min,
String max,
String format)
Checks input for correct data type and minimum/maximum value. |
boolean |
validateRegularExpression(String input,
String regexp)
Checks the input string against a regular expression. |
boolean |
validateRequired(String input)
Checks if input is null or empty or just contains whitespace. |
boolean |
validateXSLCondition(Element input,
String condition)
|
boolean |
validateXSLCondition(String input,
String condition)
Checks the input string against an XSL condition. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static MCRInputValidator instance()
public boolean validateXSLCondition(String input,
String condition)
input - the string that should be validatedcondition - the XSL condition as it would be used in xsl:when or xsl:if
MCRConfigurationException - if XSL condition has syntax errors
public boolean validateXSLCondition(Element input,
String condition)
public boolean validateRegularExpression(String input,
String regexp)
input - the string that should be validatedregexp - the regular expression using the syntax of the
java.util.regex.Pattern class
Pattern.compile(java.lang.String)
public boolean validateLength(String input,
String smin,
String smax)
input - the input string thats length should be checkedsmin - minimum length as a string, or null if min lenght should not
be checkedsmax - maximum length as a string, or null if max length should not
be checked
public boolean validateRequired(String input)
input - the string to be checked
public boolean validateMinMaxType(String input,
String type,
String min,
String max,
String format)
input - the input string to checktype - one of "string", "integer", "decimal" or "datetime"min - the minimum value as a string, or null if min should not be
testedmax - the maximum value as a string, or null if max should not be
testedformat - for datetime input, a java.text.SimpleDateFormat pattern; for
decimal input, a ISO-639 language code
SimpleDateFormat,
Locale,
NumberFormat.getInstance(java.util.Locale)
public boolean compare(String valueA,
String valueB,
String operator,
String type,
String format)
valueA - the first input string to checkvalueB - the second input string to checktype - one of "string", "integer", "decimal" or "datetime"operator - One of =, <, >, <=, >=, !=format - for datetime input, a java.text.SimpleDateFormat pattern; for
decimal input, a ISO-639 language code
public boolean validateExternally(String clazz,
String method,
String value)
clazz - the name of the class that contains the validation methodmethod - the name of the public static boolean method that should be
calledvalue - the value to validate
public boolean validateExternally(String clazz,
String method,
String value1,
String value2)
clazz - the name of the class that contains the validation methodmethod - the name of the public static boolean method that should be
calledvalue1 - the first value to validatevalue2 - the second value to validate
public boolean validateExternally(String clazz,
String method,
Element elem)
clazz - the name of the class that contains the validation methodmethod - the name of the public static boolean method that should be
calledelem - the XML element to validate
public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||