|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.billpringle.utils.WrpValidateCsv
public class WrpValidateCsv
This class implements an Application Specific Language (ASL) that can be used to validate a CSV file.
Validation consists of examining the individual fields within a CSV file, applying various rules to determine if the content of the CSV file is syntactically and possibly semantically correct. The validation routines can generate a series of messages that can be used to communicate the validation results. Typically these messages are only generated in the case of errors or warnings, but they could also be used for other purposes.
Examples of validation rules are testing the number of fields in the CSV file against a minimum or maximum value, testing the length of a given field against a minimum or maximum value, etc. The language also provides the ability to test the pattern of the field values, such as all numeric, or following a more specific format. For example, a US Zip Code could be tested using the patterns Z5 or Z5-9999, where the first pattern indicates numeric string of at least five digits with leading zeros supplied if needed, while the second pattern could be used to test for the nine-digit Zip Code.
Commands have the following components, which are optional unless noted otherwise:
minlen
command fires
if the field length is less than the specified value.
When a command fires, a message is displayed (if present),
the status of the record is set to Result (if present),
and if GoTo Destination is present, it is executed next.
Typically, this field will be left blank or set to BAD, indicating an error was encountered. The record status is affected if the specified status is worse than the current value. (For example, if the current status is "GOOD", and a command fires with a status of "BAD", then the status of the record will be changed from "GOOD" to "BAD". The status would not be changed from "BAD" to "GOOD".
$[name]
, where name is the
name of the variable to be displayed.
{{litval}}
,
where litval is a named literal value.
(See the method litVal.)
The following commands are supported. All string comparisons are case sensitive.
Command | Syntax | Description |
---|---|---|
Control commands | ||
NOP | nop | A do-nothing command that never fires |
ALWAYS | always |
This command always fires, so any message is displayed, and if a GoTo Destination is present, it will be the next command to be executed. |
DONE | done |
This command terminates processing normally. The status of the record will be set to the current status value set by Result. |
ABORT | abort |
This command terminates with an error condition. It is typically used for logic errors, and issues a Message. |
STAT | stat arg1 |
This command fires if the current status of the record matches arg1 |
WRITE | write |
This command causes a normalized form of the record to be written to the previously specified output file |
Data definition commands | ||
MAP | map arg1 outvar |
Map field number arg1 to the variable outvar.
Each time a new record is read, this field is copied to this variable.
The argument arg1can also be: NFLDS, indicating the number of fields in the input line or REC for the entire input line |
DECLARE | invar declare arg1 [arg2] |
Declare variable invar with data type arg1. All variables must be declared, but the declarations don't need to appear before they are referenced. If arg2 is present, the initial value for the variable is set to arg2 |
Assignment commands | ||
COPY | invar copy outvar |
Copy the contents of the variable invar into the variable outvar. Both invar and outvar must be the same data type. |
SET | set arg1 outvar |
Copy the value of the literal arg1 to the variable outvar. The data types of arg1 and outvar must be the same. |
String manipulation and validation commands | ||
ASCII | invar ascii |
This command fires if any non-ASCII characters are found in the string variable invar |
NODATA | nodata arg1 arg2 |
This command fires if all of the fields in the specified range are empty or contain only whitespace. The data types of arg1 and arg2 must be integer |
MATCH | invar match arg1 |
This command fires if the string value of invar is the same as the string literal arg1. |
STARTS | invar starts arg1 |
This command fires if the string in invar begins with the literal string arg1. |
ENDS | invar ends arg1 |
This command fires if the string in invar ends with the literal string arg1. |
CONTAINS | invar contains arg1 [outvar] |
This command fires if the string in invar contains the literal string arg1. If outvar is present, the index of the literal into the string invar is stored in the numeric variable outvar. |
PATT | invar patt arg1 outvar |
This command applies the pattern indicated by arg1 on the string variable invar and places the resulting string in outvar. |
SUBSTR | invar substr arg1 [arg2] outvar |
This command extracts the substring starting at location arg1 (where zero is the start of the string). If arg2 is present, the substring terminates at that location (the character at that position is not included in the output string). If arg2 is not present, then the rest of the string is included. |
APPEND | invar append outvar |
The string variable invar is appended to the current value of outvar |
REPLACE | invar replace arg1 arg2 outvar |
Replace arg1 with arg2 in invar storing the results in outvar |
TRIM | invar trim outvar |
Trim leading and trailing spaces in invar and store the results in outvar. |
TRIMALL | trimall arg1 |
If arg1 is "y" or "t", then all fields will be trimmed; otherwise none of them will. |
NORM | invar norm arg1 outvar |
This command normalizes the string value of invar using the pattern indicated by arg1 and places the result in outvar. If the string value doesn't match the normalization pattern, the command will fire. |
Numeric test and manipulation commands | ||
MINLEN | invar minlen arg1 |
This command fires if the length of the string in invar is less than the numeric literal arg1 |
MAXLEN | invar maxlen arg1 |
This command fires if the length of the string in invar is greater than the numeric literal in arg1 |
EQ | invar eq arg1 |
This command fires if the numeric value of invar equals the numeric literal arg1 |
LT | invar lt arg1 |
This command fires if the numeric value of invar is less than the numeric literal arg1 |
GT | invar gt arg1 |
This command fires if the numeric variable invar is greater than the numeric literal arg1 |
LEN | invar len outvar |
This command stores the length of the string variable invar into the numeric variable outvar |
INTVAL | invar intval outvar |
This command converts the numeric string in invar into the numeric variable outvar. The command fires if the string is non-numeric. |
Miscellaneous commands | ||
ZIP | invar zip outvar |
This command validates the city/state/zip combination in invar, in the form "city|state|zip", with the fields separated by vertical bars. The command fires if the zipcode combination is not valid, and outvar will contain an error message |
ZIPCITY | invar zipcity outvar |
This command finds the cities that are defined for the zipcode in invar and places them in outvar. |
The following patterns are supported for the match command:
The following patterns are supported for the norm command:
This program assumes that the CSV file has been parsed and stored in an instance of the WrpCsv class.
Nested Class Summary | |
---|---|
class |
WrpValidateCsv.GoToLoc
Inner class for statement label |
class |
WrpValidateCsv.ValidationRule
Inner class for validation rule |
class |
WrpValidateCsv.ValidationRuntimeException
Inner class for validation run time exception |
class |
WrpValidateCsv.Variable
Inner class for variable. |
Field Summary | |
---|---|
protected int |
breakpt
breakpoint sequence number (place actual breakpoint in executeCommand). |
protected int |
compileErrors
compilation errors for rules |
WrpCsv |
csv
the current CSV file that is being validated |
private int |
csvLine
line number of this CSV |
(package private) java.util.Vector<java.lang.String> |
errMsgs
list of error messages |
private WrpCsv |
headerCsv
parsed header line |
private java.lang.String |
headerLine
expected header line |
protected int |
IC
instruction counter - location of next instruction to be executed |
protected java.util.Vector<WrpValidateCsv.GoToLoc> |
labels
list of statement labels- created during compile time. |
protected int |
lastseq
previous sequence number. |
protected java.util.Vector<WrpValidateCsv.Variable> |
literals
defined literals (arg1 and arg2) |
static int |
MAP_ERR
invalid map |
static int |
MAP_NFLDS
number of fields |
static int |
MAP_REC
entire record |
protected java.util.Vector<WrpValidateCsv.Variable> |
maps
field mapping for each record |
java.util.Vector<java.lang.String> |
normalized
array of normalized fields for this record |
java.lang.String |
normString
output file for normalized record |
WrpPattern |
patt
pattern building object |
private int |
prevErr
previous error line (if any) |
(package private) java.io.PrintStream |
prtLog
Log file, if logging is enabled. |
static int |
REC_BAD
record has errors |
static int |
REC_ERROR
record status unknown |
static int |
REC_FUZZY
record is suspicious |
static int |
REC_GOOD
record status is good |
static int |
REC_NONE
record is missing |
static int |
REC_WARN
record has warnings |
java.util.Vector<WrpValidateCsv.ValidationRule> |
rules
the set of validation rules to be used for validation |
protected int |
runErrors
the number of run-time errors for this CSV validation |
protected int |
runFlg
run flag - zero means done; non-zero, keep running |
protected int |
runTot
the total number of run-time errors for this compilation |
protected int |
Stat
current status of the current record |
boolean |
trimall
flag to trim all fields (default true) |
static int |
TYPE_BOOL
data type boolean |
static int |
TYPE_ERR
data type in error |
static int |
TYPE_FLT
data type float |
static int |
TYPE_INT
data type integer |
static int |
TYPE_STR
data type string |
static java.lang.String |
UNKNOWN
Used as String representation of unknown / error values |
protected java.util.Vector<WrpValidateCsv.Variable> |
variables
list of declared variables |
protected WrpZipCode |
zipCodes
|
Constructor Summary | |
---|---|
WrpValidateCsv()
Default constructor. |
|
WrpValidateCsv(java.util.Vector<WrpValidateCsv.ValidationRule> rules)
Constructor with validation rules. |
|
WrpValidateCsv(java.util.Vector<WrpValidateCsv.ValidationRule> rules,
int csvLine,
WrpCsv csv)
Create a validation object with the given rules and then validate the given CSV string. |
Method Summary | |
---|---|
void |
addRule(WrpValidateCsv.ValidationRule rule)
Add a new rule to the current list of rules. |
boolean |
ascii(java.lang.String fld)
Test the input string for non-ASCII characters |
void |
checkSyntax(int ndx)
Check the syntax of the specified command There is a validation segment for each instruction / command. |
void |
chkCmdArg1(int ndx)
Check syntax for the form: cmd arg1 |
void |
chkCmdArg1Outvar(int ndx)
Check syntax for form: cmd arg1 outvar |
void |
chkInvarCmdArg1(int ndx)
Check syntax for form: invar cmd arg1 This command can be used for any type of literal. |
void |
chkInvarCmdArg1Outvar(int ndx)
Check syntax for form: invar cmd arg1 outvar |
void |
chkInvarCmdOutvar(int ndx)
Check syntax for form: invar cmd outvar |
int |
compileRules()
check rules for syntax, build list of destinations and variables, validate GoTo destinations |
void |
declareVariable(int ndx)
Add variable declaration to list of variables |
java.lang.String |
decodeMsg(int ndx,
java.lang.String msg)
Replace variable names in a string with their values. |
java.lang.Boolean |
executeCommand(int ndx)
Execute the current command |
private int |
executeRules()
Validate supplied CSV using supplied rules |
int |
executeRules(int csvLine)
Execute the current list of rules, with the current line number |
int |
findGoTo(java.lang.String label)
Find target destination of GoTo in list of statement labels |
int |
findLiteral(java.lang.String litval)
Find (or create) literal for the given value |
int |
findMap(java.lang.String name)
Find the map entry for the specified field |
int |
findVariable(java.lang.String vname)
Find specified variable in list of variables for the given variable |
void |
fireCommand(int ndx)
Fire the current command If a command returns true, then the command fired. |
void |
firstPass(int ndx)
Perform first pass of compile |
private WrpValidateCsv.Variable |
getArg1(WrpValidateCsv.ValidationRule rule)
Get the Arg1 variable for the specified rule |
private WrpValidateCsv.Variable |
getArg2(WrpValidateCsv.ValidationRule rule)
Get the Arg2 variable for the specified rule |
int |
getCompileErrors()
get the number of compile-time errors for the most recent compile |
WrpCsv |
getCsv()
Return the current CSV object to be (or was) validated |
java.util.Vector<java.lang.String> |
getErrMsgs()
Return the validation messages from the most recent validation. |
java.lang.String |
getHeaderLine()
Get the expected header line. |
private WrpValidateCsv.Variable |
getInVar(WrpValidateCsv.ValidationRule rule)
Obtain the InVar variable for this rule |
java.util.Vector<java.lang.String> |
getNormalized()
Get the list of normalized strings. |
java.lang.String |
getNormString()
Get the normalized form of the record. |
int |
getNumberRules()
Get the current number of rules. |
private WrpValidateCsv.Variable |
getOutVar(WrpValidateCsv.ValidationRule rule)
Obtain the OutVar variable for the specified rule |
java.util.Vector<WrpValidateCsv.ValidationRule> |
getRules()
Return the current list of validation rules. |
int |
getRunErrors()
get the number of run-time errors for the latest execution |
int |
getRunTot()
get the total number of run-time errors since compilation |
int |
getStat()
Get the validation status for the record that was most recently validated. |
java.lang.String |
litVal(java.lang.String litval)
Resolve any variable expressions. |
void |
loadRules(java.sql.ResultSet rs)
Obtain rules from database and load into list using the given ResultSet. |
void |
logError(int ndx,
java.lang.String msg)
Add error message to list of messages |
static void |
main(java.lang.String[] args)
Example driver for this class. |
void |
mapField(int ndx)
Map a field into a local variable. |
void |
mapFields()
Map the defined fields in CSV to variables. |
WrpValidateCsv.ValidationRule |
newRule()
A constructor for the ValidationRule subclass. |
boolean |
nodata(int n1,
int n2)
Determine if the specified fields are empty or contain only white space |
java.lang.String |
norm(int ndx,
java.lang.String strIn,
java.lang.String pattern)
Normalize the input string using the specified pattern. |
protected void |
nullArg(int ndx)
Raise exception if a null argument is passed for a required argument. |
int |
numErrors()
Return the number of compile errors that were encountered during the most recent compilation. |
java.lang.String |
patt(java.lang.String str,
java.lang.String pattern)
Apply the specified pattern to the specified string |
static java.lang.String |
recStat(int num)
convert record status number to a string |
static int |
recStat(java.lang.String name)
Convert record status from string to integer |
void |
secondPass(int ndx)
Perform second compile pass |
void |
setCsv(WrpCsv csv)
Specify the CSV object to be validated. |
void |
setCsvLine(int csvLine)
Set the CSV line number. |
void |
setErrMsgs(java.util.Vector<java.lang.String> msgs)
Set the error messages for this validation. |
void |
setHeaderLine(java.lang.String headerLine)
Set the expected header line. |
void |
setLog(java.io.PrintStream log)
Set the log file for debugging. |
void |
setRules(java.util.Vector<WrpValidateCsv.ValidationRule> rules)
Specify the validation rules to be used when validating lines |
void |
setZipCodes(WrpZipCode zc)
This method imports a list of ZipCodes that can be used to validate city/state/zipcode combinations. |
void |
storeLabel(int ndx)
Add statement label of this rule to list of labels |
void |
typeArg1(int ndx,
int type)
Check data type for literal Arg1 |
void |
typeArg2(int ndx,
int type)
Check data type for literal Arg2 |
void |
typeInvar(int ndx,
int type)
Check data type for InVar |
void |
typeOutvar(int ndx,
int type)
Check data type for OutVar |
int |
validate()
Validate the given CSV record using the specified rules |
int |
validate(int csvLine)
Validate the current record using the specified line number. |
int |
validate(java.util.Vector<WrpValidateCsv.ValidationRule> rules,
int csvLine,
WrpCsv csv)
Validate the given CSV record using the given rules |
int |
validate(WrpCsv csv)
Validate the specified CSV using the previously supplied rules |
int |
validateHeader()
Validate the header line. |
protected boolean |
validateZipCode(java.lang.String str,
WrpValidateCsv.Variable outvar)
Validate the city/state/zip combination. |
static java.lang.String |
varType(int num)
Convert type number to name |
static int |
varType(java.lang.String name)
Convert type name to integer value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_STR
public static final int TYPE_INT
public static final int TYPE_FLT
public static final int TYPE_BOOL
public static final int TYPE_ERR
public static final int MAP_REC
public static final int MAP_NFLDS
public static final int MAP_ERR
public static final int REC_GOOD
public static final int REC_WARN
public static final int REC_FUZZY
public static final int REC_BAD
public static final int REC_NONE
public static final int REC_ERROR
public static final java.lang.String UNKNOWN
public WrpCsv csv
public boolean trimall
public WrpPattern patt
public java.util.Vector<WrpValidateCsv.ValidationRule> rules
public java.util.Vector<java.lang.String> normalized
public java.lang.String normString
private int csvLine
private int prevErr
private java.lang.String headerLine
private WrpCsv headerCsv
protected java.util.Vector<WrpValidateCsv.GoToLoc> labels
protected java.util.Vector<WrpValidateCsv.Variable> variables
protected java.util.Vector<WrpValidateCsv.Variable> maps
protected java.util.Vector<WrpValidateCsv.Variable> literals
protected int compileErrors
java.util.Vector<java.lang.String> errMsgs
protected int lastseq
protected WrpZipCode zipCodes
java.io.PrintStream prtLog
protected int runFlg
protected int runErrors
protected int runTot
protected int IC
protected int Stat
protected int breakpt
You can modify the source code so that breakpt isn't initialized to -1 (which effectively turns off this feature) or you can place a breakpoint at some place within the program, and then use the debugger to change the value of breakpt.
Constructor Detail |
---|
public WrpValidateCsv()
Once created, the object can be used to validate CSV strings by first specifying a list of rules with the setRules method, and then calling the validate method for each string.
public WrpValidateCsv(java.util.Vector<WrpValidateCsv.ValidationRule> rules)
rules
- the validation rules to usepublic WrpValidateCsv(java.util.Vector<WrpValidateCsv.ValidationRule> rules, int csvLine, WrpCsv csv)
rules
- a vector containing the validation rules.csvLine
- a sequential line number within the CSV line for this stringcsv
- the CSV object to be validatedMethod Detail |
---|
public WrpValidateCsv.ValidationRule newRule()
This method can be used to create a new empty validation rule. It is most likely used while reading validation rules from the database (or other source).
public void setCsv(WrpCsv csv)
This method is called by the validate(WrpCsv csv) method, followed by a call to validate(). It isn't clear why a user would want to call this method, but at the same time there is no reason to prevent them.
csv
- the WrpCsv object that is to be validatedpublic WrpCsv getCsv()
public void setCsvLine(int csvLine)
The csvLine variable is used to determine if the original input line is to be included in the validation messages. The previous value is stored internally so that the original line is only included the first time that logError is called with that line number. This prevents the input line from being repeated if a line contains more than one validation error (or generates more than one valiation message).
csvLine
- public java.lang.String getHeaderLine()
public void setHeaderLine(java.lang.String headerLine)
headerLine
- public int getStat()
The status value is normally returned from the variout validate methods.
public void setRules(java.util.Vector<WrpValidateCsv.ValidationRule> rules)
rules
- a vector of validation rulespublic void setZipCodes(WrpZipCode zc)
zc
- a ZipCode structure that has been loaded with ZipCodes.public void setLog(java.io.PrintStream log)
log
- a printstream or null to disable debuggingpublic java.util.Vector<java.lang.String> getNormalized()
public java.lang.String getNormString()
public int numErrors()
public java.util.Vector<java.lang.String> getErrMsgs()
public void setErrMsgs(java.util.Vector<java.lang.String> msgs)
msgs
- the list of error messagespublic int getCompileErrors()
public int getRunErrors()
public int getRunTot()
public void loadRules(java.sql.ResultSet rs) throws java.sql.SQLException
This method loops through the ResultSet and reads the resulting valiation rules into the instance vector rules. Any previous set of rules are replace by these rules.
rs
- RecordSet containing rules query
java.sql.SQLException
public java.util.Vector<WrpValidateCsv.ValidationRule> getRules()
public void addRule(WrpValidateCsv.ValidationRule rule)
rule
- public int getNumberRules()
public int compileRules()
Compilation takes place in two passes. The first pass is performed on all the rules, followed by the second pass.
public void firstPass(int ndx)
This pass will build lists of statement labels and declared variables. It will generate error messages for invalid declare statements
ndx
- index into rules for this rulepublic void storeLabel(int ndx)
ndx
- index into rules of the rulepublic void declareVariable(int ndx)
ndx
- index into rules for this declarationpublic void mapField(int ndx)
This routine is called during the first pass
when a map
command is encountered.
Create a new local variable with the specified name
(if it doesn't already exist),
and map it to field arg1
,
with type arg2
.
The default field type is String, except for NFLDS,
which is type Integer.
The following special field names are reserved words:
For each new string to be validated, the string is parsed (if not a WrpCsv object), and the input fields are copied to the mapped variables.
ndx
- the location of the map statementpublic int findVariable(java.lang.String vname)
vname
- name of variable to find
public int findLiteral(java.lang.String litval)
Search for the specified literal value. If not found, create a new literal for it. Return the location of a variable for this literal
This implies that literals are constant values. There is currently no command that will allow the user to modify these values.
Literal values can have encoded values of the form
{{value}}
, where value is the
name of the literal code.
See the litVal method.
litval
- literal value to find
public java.lang.String litVal(java.lang.String litval)
Special literal values can be encoded by enclosing a key word between curly braces. These notations are then replaced by the string they represent. Currently defined literals are:
{{quote}}
– a double quote{{apos}}
– a single quote or apostrophe
litval
- the value of the literal
public int findMap(java.lang.String name)
name
- the name of the map field to find
public int findGoTo(java.lang.String label)
label
- the statement label to find
public void secondPass(int ndx)
This pass will validate commands and resolve any references (variables or goto) by inserting the index to the variable or rule. It will also detect any undeclared variables or undefined goto targets. It will also generate errors for invalid syntax.
ndx
- index into rules for the rule to be compiledpublic void checkSyntax(int ndx)
ndx
- the index into rules for the specified commandpublic void chkInvarCmdArg1(int ndx)
ndx
- the index into rules for this rulepublic void chkInvarCmdOutvar(int ndx)
ndx
- index into rules for this rulepublic void chkInvarCmdArg1Outvar(int ndx)
ndx
- index into rules for this rulepublic void chkCmdArg1(int ndx)
ndx
- index into rules for this rulepublic void chkCmdArg1Outvar(int ndx)
ndx
- index into rules for this rulepublic void typeInvar(int ndx, int type)
ndx
- index into variables for this variabletype
- expected data typepublic void typeArg1(int ndx, int type)
ndx
- index into literals for elementtype
- expected data typepublic void typeArg2(int ndx, int type)
ndx
- index into literals for this elementtype
- expected data typepublic void typeOutvar(int ndx, int type)
ndx
- index into variables for elementtype
- expected data typeprivate int executeRules() throws WrpValidateCsv.ValidationRuntimeException
The rules should be compiled before this routine is called. The supplied rules are executed against the supplied CSV
WrpValidateCsv.ValidationRuntimeException
public int executeRules(int csvLine)
The line number can be used if the same compilation will be used to execute against multiple CSV entries. The line number is used to determine if the input line should be displayed.
csvLine
- the line number for the current CSV entry
public void mapFields()
public java.lang.Boolean executeCommand(int ndx) throws WrpValidateCsv.ValidationRuntimeException
ndx
- index into Rules of the command to execute
WrpValidateCsv.ValidationRuntimeException
public void fireCommand(int ndx)
public java.lang.String decodeMsg(int ndx, java.lang.String msg)
If a string of the form "$[varname]" is present, replace it with the current value of the variable.
ndx
- index into rules for the current rulemsg
- text of the message string to be decoded
private WrpValidateCsv.Variable getInVar(WrpValidateCsv.ValidationRule rule)
rule
- the rule containing the specified invar
private WrpValidateCsv.Variable getOutVar(WrpValidateCsv.ValidationRule rule)
rule
- the rule containing the OutVar
private WrpValidateCsv.Variable getArg1(WrpValidateCsv.ValidationRule rule)
rule
- the rule containing the Arg1 literal
private WrpValidateCsv.Variable getArg2(WrpValidateCsv.ValidationRule rule)
rule
- the rule containing the Arg2 literal
public boolean ascii(java.lang.String fld)
fld
- input string to be tested
public boolean nodata(int n1, int n2)
n1
- lowest field to check (base 1)n2
- highest field to check (base 1)
public java.lang.String patt(java.lang.String str, java.lang.String pattern)
str
- input stringpattern
- the pattern code to be applied to the string
public java.lang.String norm(int ndx, java.lang.String strIn, java.lang.String pattern)
Supported match characters:
Notice that the characters "X", "9", and "a" can't be inserted into the output string using the pattern.
ndx
- index into rules for current rulestrIn
- input stringpattern
- normalization pattern
protected void nullArg(int ndx) throws WrpValidateCsv.ValidationRuntimeException
ndx
- the index into Rules of the command being executed.
WrpValidateCsv.ValidationRuntimeException
protected boolean validateZipCode(java.lang.String str, WrpValidateCsv.Variable outvar)
str
- input string: "city|state|zip"outvar
- error message, if any
public void logError(int ndx, java.lang.String msg)
msg
- an error message explaining the problemndx
- location of invalid rulepublic int validate(java.util.Vector<WrpValidateCsv.ValidationRule> rules, int csvLine, WrpCsv csv)
rules
- the validation rules to usecsvLine
- the line number to use for this validationcsv
- the CSV record to validate
public int validate(int csvLine)
csvLine
- the line number to use for this validation
public int validate()
public int validate(WrpCsv csv)
csv
- CSV line to be validated
public int validateHeader()
public static java.lang.String varType(int num)
num
- type number (TYPE_something)
public static int varType(java.lang.String name)
name
- the name of the type
public static int recStat(java.lang.String name)
name
- the record status name
public static java.lang.String recStat(int num)
num
- a numerical representation of the record status
public static void main(java.lang.String[] args)
args
- not used
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |