com.billpringle.utils.wrputils
Class WrpValidateCsv.ValidationRule

java.lang.Object
  extended by com.billpringle.utils.wrputils.WrpValidateCsv.ValidationRule
Enclosing class:
WrpValidateCsv

public class WrpValidateCsv.ValidationRule
extends java.lang.Object

Inner class for validation rule

This class instantiates a rule used to validate a CSV record. A rule can "fire", which typically indicates a sucessful test or an exception to the operation.

A validation rule consists of various arguments. Which arguments are required depends on the command itself. The rule can have a statement label as well as a GoTo destination. (Execution continues at the GoTo label if the command fires.) It can also have a message to be displayed if the command fires, as well as a record status if the command fires. Two variables can be specified - an input and an output variable (invar and outvar) (which can be the same variable), and two literals (arg1 and arg2), which are constants.

The data type of a literal depends on its name:

To reduce overhead during run time, the index into variables or literals for each argument is stored for each referenced variable or literal.

Author:
Bill Pringle

Field Summary
 java.lang.String Arg1
          argument 1
 int Arg1Loc
          location of literal in arg1
 java.lang.String Arg2
          argument 2
 int Arg2Loc
          location of literal in arg2
 java.lang.String Cmd
          command for rule
 java.lang.String Comment
          comment
 java.lang.String GoTo
          GoTo destination
 int GoToLoc
          compiled index into rules for destination
 int Id
          unique row ID (from the database)
 java.lang.String InVar
          input variable
 int InVarLoc
          compiled location of input variable
 java.lang.String Label
          destination label
 java.lang.String Msg
          output message for user
 java.lang.String OutVar
          output variable - where results are stored
 int OutVarLoc
          compiled location of output variable
 java.lang.String Result
          validation results for entry
 int Seq
          sequence number for rule
 
Constructor Summary
WrpValidateCsv.ValidationRule()
          default constructor
 
Method Summary
 java.lang.String getArg1()
          Get the first literal value
 int getArg1Loc()
          Obtain the location of the literal for arg1
 java.lang.String getArg2()
          Get the second literal value for this rule
 int getArg2Loc()
          Obtain the location of the literal for arg2
 java.lang.String getCmd()
          Return the command name for this rule
 java.lang.String getComment()
          Get the comment for this rule
 java.lang.String getGoTo()
          Get the "GoTo" destination for this rule
 int getGoToLoc()
          Get the location in rules for the GoTo destination of this rule
 int getId()
          Get the unique database ID for this rule
 java.lang.String getInVar()
          Get the input variable for this rule
 int getInVarLoc()
          Get the location in variables for the input variable for this rule
 java.lang.String getLabel()
          Get the statement label for this rule
 java.lang.String getMsg()
          Get the user message for this rule
 java.lang.String getOutVar()
          Get the output variable for this rule
 int getOutVarLoc()
          Get the location in variables of the output variable for this rule
 java.lang.String getResult()
          Get the optional result value for this rule
 int getSeq()
          Get the sequence number for the current rule
 void setArg1(java.lang.String arg1)
          Set the first literal value
 void setArg1Loc(int loc)
          Save location of literal for arg1 of this command
 void setArg2(java.lang.String arg2)
          Set the second literal value for this rule
 void setArg2Loc(int loc)
          Save location of literal for arg2 of this command
 void setCmd(java.lang.String cmd)
          set the command name for this rule
 void setComment(java.lang.String comment)
          Set the comment for this rule
 void setGoTo(java.lang.String goTo)
          Set the "GoTo" destination for this rule
 void setGoToLoc(int goToLoc)
          Set the location inrules for the GoTo destination label of this rule
 void setId(int id)
          Set the unique database ID for this rule
 void setInVar(java.lang.String inVar)
          Set the input variable for this rule
 void setInVarLoc(int inVarLoc)
          Set the location in variables of the input variable for this rule
 void setLabel(java.lang.String label)
          Set the statement label for this rule
 void setMsg(java.lang.String msg)
          Set the user message for this rule
 void setOutVar(java.lang.String outVar)
          Set the second literal value for this rule
 void setOutVarLoc(int outVarLoc)
          Set the location in variables of the outvariable for this rule
 void setResult(java.lang.String result)
          Set the result string for this rule
 void setSeq(int seq)
          Set the sequence number for this rule
 java.lang.String toString()
          Provide a string representation of the validation rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Id

public int Id
unique row ID (from the database)


Seq

public int Seq
sequence number for rule


Label

public java.lang.String Label
destination label


InVar

public java.lang.String InVar
input variable


InVarLoc

public int InVarLoc
compiled location of input variable


Cmd

public java.lang.String Cmd
command for rule


Arg1

public java.lang.String Arg1
argument 1


Arg1Loc

public int Arg1Loc
location of literal in arg1


Arg2

public java.lang.String Arg2
argument 2


Arg2Loc

public int Arg2Loc
location of literal in arg2


OutVar

public java.lang.String OutVar
output variable - where results are stored


OutVarLoc

public int OutVarLoc
compiled location of output variable


Result

public java.lang.String Result
validation results for entry


Msg

public java.lang.String Msg
output message for user


GoTo

public java.lang.String GoTo
GoTo destination


GoToLoc

public int GoToLoc
compiled index into rules for destination


Comment

public java.lang.String Comment
comment

Constructor Detail

WrpValidateCsv.ValidationRule

public WrpValidateCsv.ValidationRule()
default constructor

Method Detail

toString

public java.lang.String toString()
Provide a string representation of the validation rule. The command (cmd) parameter is always displayed; other missing fields are not displayed.

Overrides:
toString in class java.lang.Object

getSeq

public int getSeq()
Get the sequence number for the current rule

Returns:
the sequence number

setSeq

public void setSeq(int seq)
Set the sequence number for this rule

Parameters:
seq - the sequence number to set

getLabel

public java.lang.String getLabel()
Get the statement label for this rule

Returns:
the statement label

setLabel

public void setLabel(java.lang.String label)
Set the statement label for this rule

Parameters:
label - the statement label to set

getInVar

public java.lang.String getInVar()
Get the input variable for this rule

Returns:
the input variable

setInVar

public void setInVar(java.lang.String inVar)
Set the input variable for this rule

Parameters:
inVar - the input variable to set

getCmd

public java.lang.String getCmd()
Return the command name for this rule

Returns:
the command

setCmd

public void setCmd(java.lang.String cmd)
set the command name for this rule

Parameters:
cmd - the command to set

getArg1

public java.lang.String getArg1()
Get the first literal value

Returns:
the first argument

setArg1

public void setArg1(java.lang.String arg1)
Set the first literal value

Parameters:
arg1 - the first argument to set

setArg1Loc

public void setArg1Loc(int loc)
Save location of literal for arg1 of this command

Parameters:
loc - the index into literals for arg1 of this command

getArg1Loc

public int getArg1Loc()
Obtain the location of the literal for arg1

Returns:
the index into literals for the literal in arg1

getArg2

public java.lang.String getArg2()
Get the second literal value for this rule

Returns:
the second argument

setArg2

public void setArg2(java.lang.String arg2)
Set the second literal value for this rule

Parameters:
arg2 - the second argument to set

setArg2Loc

public void setArg2Loc(int loc)
Save location of literal for arg2 of this command

Parameters:
loc - the index into literals for arg2 of this command

getArg2Loc

public int getArg2Loc()
Obtain the location of the literal for arg2

Returns:
the index into literals for arg2

getOutVar

public java.lang.String getOutVar()
Get the output variable for this rule

Returns:
the output variable

setOutVar

public void setOutVar(java.lang.String outVar)
Set the second literal value for this rule

Parameters:
outVar - the output variable to set

getResult

public java.lang.String getResult()
Get the optional result value for this rule

Returns:
the validation result

setResult

public void setResult(java.lang.String result)
Set the result string for this rule

Parameters:
result - the validation result to set

getMsg

public java.lang.String getMsg()
Get the user message for this rule

Returns:
the user message

setMsg

public void setMsg(java.lang.String msg)
Set the user message for this rule

Parameters:
msg - the user message to set

getGoTo

public java.lang.String getGoTo()
Get the "GoTo" destination for this rule

Returns:
the destination label

setGoTo

public void setGoTo(java.lang.String goTo)
Set the "GoTo" destination for this rule

Parameters:
goTo - the destination label to set

getComment

public java.lang.String getComment()
Get the comment for this rule

Returns:
the comment

setComment

public void setComment(java.lang.String comment)
Set the comment for this rule

Parameters:
comment - the comment to set

getId

public int getId()
Get the unique database ID for this rule

Returns:
the id

setId

public void setId(int id)
Set the unique database ID for this rule

Parameters:
id - the id to set

getInVarLoc

public int getInVarLoc()
Get the location in variables for the input variable for this rule

Returns:
the inVarLoc

setInVarLoc

public void setInVarLoc(int inVarLoc)
Set the location in variables of the input variable for this rule

Parameters:
inVarLoc - the inVarLoc to set

getOutVarLoc

public int getOutVarLoc()
Get the location in variables of the output variable for this rule

Returns:
the outVarLoc

setOutVarLoc

public void setOutVarLoc(int outVarLoc)
Set the location in variables of the outvariable for this rule

Parameters:
outVarLoc - the outVarLoc to set

getGoToLoc

public int getGoToLoc()
Get the location in rules for the GoTo destination of this rule

Returns:
the goToLoc

setGoToLoc

public void setGoToLoc(int goToLoc)
Set the location inrules for the GoTo destination label of this rule

Parameters:
goToLoc - the goToLoc to set