com.ibm.etill.framework.payapi
Class ParameterValidationItem

java.lang.Object
  |
  +--com.ibm.etill.framework.payapi.ParameterValidationItem
All Implemented Interfaces:
FrameworkReturnCodes, com.ibm.etill.framework.payapi.validation.IParameterValidator, PaymentAPIConstants
Direct Known Subclasses:
AliasValidationItem, BooleanValidationItem, ByteArrayValidationItem, IntegerValidationItem, LongValidationItem, PathValidationItem, StringValidationItem, TimestampValidationItem

public abstract class ParameterValidationItem
extends Object
implements PaymentAPIConstants, com.ibm.etill.framework.payapi.validation.IParameterValidator

The ParameterValidationItem object is used to verify a parameter's value and insert that parameter and its value into a ParameterTable if the parameter passes verification.

A cassette's ParameterValidationTable should be built during cassette initialization. The table should contain the parsing rules, expressed in terms of the various subclasses of com.ibm.etill.framework.payapi.ParameterValidationItem, for every protocol data parameter that the cassette supports. Note that only one such table should exist for the cassette. Each time the Framework parses an incoming command that is directed toward the cassette, it will call the following method on the cassette's com.ibm.etill.framework.cassette.Cassette object to access the cassette's validation table: public Hashtable getParameterValidationTable. After accessing the cassette's table, the Framework parses the protocol data parameters according to the rule defined in the table.

This class is meant to be extended. A child class must implement the validateAndInsertValue method.


 
Method Summary
 String getAliasKey()
          Get the parameter name alias for this parameter.
 Object validateAndInsert(byte[] value, ParameterTable resultTable)
          Validates and inserts valid values into the table if the parameter validates.
 Object validateAndInsert(String[] values, ParameterTable resultTable, String overrideParameterName)
          Validates and inserts a vector of values into a table if it validates.
 Object validateAndInsert(Vector values, ParameterTable resultTable)
          Validates and inserts a vector of values into a table if it validates.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

validateAndInsert

public final Object validateAndInsert(byte[] value,
                                      ParameterTable resultTable)
                               throws ETillAbortOperation
Validates and inserts valid values into the table if the parameter validates. If the parameter does not validate, an exception is thrown. This method cannot be overridden in a child class. This method calls validateAndInsertValue which must be overridden in a child class.
Parameters:
value - value that is to be inserted in the resultTable if it validates
resultTable - a ParameterTable object that value/key pair will be inserted into if the parameter validates
Returns:
Object - object inserted if the parameter was validated
Throws:
ETillAbortOperation - thrown to report errors

validateAndInsert

public final Object validateAndInsert(Vector values,
                                      ParameterTable resultTable)
                               throws ETillAbortOperation
Validates and inserts a vector of values into a table if it validates. If the parameter does not validate, an exception is thrown. This method cannot be overridden in a child class. This method calls validateAndInsertValue which must be overridden in a child class.
Parameters:
values - values that are to be validated and inserted in the resultTable
resultTable - a ParameterTable object that value will be inserted into if it is valid
Returns:
Object - object inserted if the parameter was validated
Throws:
ETillAbortOperation - thrown to report errors

validateAndInsert

public Object validateAndInsert(String[] values,
                                ParameterTable resultTable,
                                String overrideParameterName)
                         throws ETillAbortOperation
Validates and inserts a vector of values into a table if it validates. If the parameter does not validate, an exception is thrown.
Specified by:
validateAndInsert in interface com.ibm.etill.framework.payapi.validation.IParameterValidator
Parameters:
values - a vector of values that are to be inserted if it validates
resultTable - a ParameterTable object that value/key pair will be inserted into if the parameter validates
overrideParameterName - the key that should be inserted into resultTable if validation is successful If this value is null, then the parameterName specified on the constructor will be used.
Returns:
Object - object inserted if the parameter was validated
Throws:
ETillAbortOperation - thrown to report errors

getAliasKey

public String getAliasKey()
Get the parameter name alias for this parameter.
Returns:
String the parameter name alias