|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.makumba.providers.datadefinition.makumba.validation.BasicValidationRule
public abstract class BasicValidationRule
This class provides basic support for validation rules. New rules should extend this class, or
SingleFieldValidationRule
if they are operating on one field only.
Field Summary | |
---|---|
protected int[] |
allowedTypes
Stores what types of fields are allowed (int, char.. see FieldDefinition . |
protected String |
errorMessage
|
protected FieldDefinition |
fd
The field definition this rule applies to. |
protected static String |
fieldDef
|
protected static String |
fieldFunction
|
protected String |
fieldName
The name of the field (not always the same as fd.getName() for compound forms). |
protected static String |
lowerFunction
|
static int[] |
NUMBER_TYPES
Number types, int and real. |
(package private) static ArrayList<String> |
operators
|
protected static String |
rangeDef
|
protected static String |
rangeValue
|
protected String |
ruleName
|
protected String |
ruleSyntax
|
static int[] |
STRING_TYPES
String types, char and text |
protected static String |
upperFunction
|
Constructor Summary | |
---|---|
protected |
BasicValidationRule()
|
|
BasicValidationRule(FieldDefinition fd,
String fieldName,
String errorMessage,
String ruleName,
int[] allowedTypes)
|
Method Summary | |
---|---|
protected Object |
applyFunction(Object o1,
String functionName)
Apply a function to the fields value. |
int |
compareTo(ValidationRule o)
We order the rules such that comparison rules come last. |
static String |
extractFunctionArgument(String statement)
Extract the function argument from the rule definition statement. |
static String |
extractFunctionNameFromStatement(String statement)
Extract the function name from the rule definition statement. |
protected String |
getAllowedTypes()
Return a string represenation of the allowed types. |
DataDefinition |
getDataDefinition()
Gets the DataDefinition this rule applies to |
String |
getErrorMessage()
Gets the error message that should be shown for this rule. |
FieldDefinition |
getFieldDefinition()
Gets the FieldDefinition this rule applies to. |
String |
getFieldName()
return the (first) field name the rule operates on. |
String |
getRuleName()
Gets the name of this rule. |
Collection<String> |
getValidationRuleArguments()
Gets the arguments (field names) this rule applies to |
static ArrayList<String> |
getValidationRuleOperators()
|
static boolean |
isFunctionCall(String statement)
Checks if the given statement contains a syntactically correct function call. |
static boolean |
isValidFunctionCall(String s)
Checks if the given statement contains a syntactically correct and known function call. |
static void |
main(String[] args)
Main class for testing purposes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.makumba.ValidationRule |
---|
validate |
Field Detail |
---|
static ArrayList<String> operators
protected static final String rangeValue
protected static final String rangeDef
protected static final String fieldDef
protected static final String lowerFunction
protected static final String upperFunction
protected static final String fieldFunction
protected FieldDefinition fd
protected String fieldName
protected int[] allowedTypes
FieldDefinition
.
protected String ruleSyntax
protected String errorMessage
protected String ruleName
public static int[] NUMBER_TYPES
public static int[] STRING_TYPES
Constructor Detail |
---|
public BasicValidationRule(FieldDefinition fd, String fieldName, String errorMessage, String ruleName, int[] allowedTypes)
protected BasicValidationRule()
Method Detail |
---|
public String getRuleName()
ValidationRule
getRuleName
in interface ValidationRule
public String getErrorMessage()
ValidationRule
getErrorMessage
in interface ValidationRule
public FieldDefinition getFieldDefinition()
ValidationRule
FieldDefinition
this rule applies to.
getFieldDefinition
in interface ValidationRule
protected String getAllowedTypes()
protected Object applyFunction(Object o1, String functionName)
public String getFieldName()
public static String extractFunctionArgument(String statement)
public static boolean isFunctionCall(String statement)
public static boolean isValidFunctionCall(String s)
public static String extractFunctionNameFromStatement(String statement)
public static void main(String[] args)
public int compareTo(ValidationRule o)
compareTo
in interface Comparable<ValidationRule>
public static ArrayList<String> getValidationRuleOperators()
public Collection<String> getValidationRuleArguments()
ValidationRule
getValidationRuleArguments
in interface ValidationRule
public DataDefinition getDataDefinition()
ValidationRule
DataDefinition
this rule applies to
getDataDefinition
in interface ValidationRule
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |