IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.automaton.html
Class HtmlProcessorXValidate

java.lang.Object
  extended by com.ibm.btt.automaton.html.HtmlProcessorXValidate
All Implemented Interfaces:
ProcessorXValidate, OperationXValidate

public abstract class HtmlProcessorXValidate
extends java.lang.Object
implements ProcessorXValidate

This class implements a error management toolkit for validators. The base validator class forces the user to manage a string array of error messages that may change in size dynamically as validation is carried out. To alleviate this, this class manages a collection of error messages that can be accessed using the addMessage(String) and deleteMessage(String) methods. At the end of validation, these error messages are composed into a string array and returned automatically. The main caveat of using this class is that subclasses must implement their validation logic in the doXValidate(...) method instead of the xValidate(...) method.


Constructor Summary
HtmlProcessorXValidate()
          HtmlProcessorXValidate constructor.
 
Method Summary
 void addMessage(java.lang.String message)
          Adds a message to the collection of error messages for this validator.
 void deleteMessage(java.lang.String message)
          Removes a message from the collection of messages for this validator.
protected  void doValidate(java.lang.String fullyQualifiedName, DataField df, Context ctxt)
          Should be overriden by subclasses to do the actual work of semantic validation or validation based on business rules for the given field.
abstract  void doXValidate(Context context, java.lang.String transitionName)
          Should be overriden by subclasses to do the actual work of cross-validation.
 boolean isEmpty(java.lang.String value)
          This is equivalent to calling isEmpty(String, true)
 boolean isEmpty(java.lang.String value, boolean trim)
          Returns true if the string passed to it as argument is either null or if it contains no data.
 void validate(java.lang.String fullyQualifiedName, DataField df, Context ctxt)
          Delegates the actual work of semantic validation for a data field to subclasses.
 java.lang.String[] xValidate(Context ctx)
          Performs the operation cross-validation service
 java.lang.String[] xValidate(Context context, java.lang.String transitionName)
          Delegates the actual work of cross validation to subclasses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlProcessorXValidate

public HtmlProcessorXValidate()
HtmlProcessorXValidate constructor.

Method Detail

addMessage

public void addMessage(java.lang.String message)
Adds a message to the collection of error messages for this validator.

Parameters:
message - java.lang.String

deleteMessage

public void deleteMessage(java.lang.String message)
Removes a message from the collection of messages for this validator.

Parameters:
message - java.lang.String

doValidate

protected void doValidate(java.lang.String fullyQualifiedName,
                          DataField df,
                          Context ctxt)
                   throws DSETypeException
Should be overriden by subclasses to do the actual work of semantic validation or validation based on business rules for the given field. This method should contain the logic that would normally have been placed in the validate(String, DataField, Context) method of a class that subclasses from com.ibm.btt.automaton.html.ProcessorXValidate.

Parameters:
fullyQualifiedName - java.lang.String
df - com.ibm.btt.base.DataField
context - com.ibm.btt.base.Context
Throws:
DSETypeException - - If the field has not been successfully validated.

doXValidate

public abstract void doXValidate(Context context,
                                 java.lang.String transitionName)
                          throws java.lang.Exception
Should be overriden by subclasses to do the actual work of cross-validation. This method should contain the logic that would normally have been placed in the xValidate(Context, String) method of a class that subclasses from com.ibm.btt.automaton.html.ProcessorXValidate. Users of this method can utilize addMessage(String) and deleteMessage(String) to manage error messages. They also do not have to worry about creating and resizing string arrays to hold their error messages. The class handles all of this.

Parameters:
context - com.ibm.btt.base.Context
transitionName - java.lang.String
Throws:
java.lang.Exception

isEmpty

public boolean isEmpty(java.lang.String value)
This is equivalent to calling isEmpty(String, true)

Parameters:
value - java.lang.String
Returns:
boolean

isEmpty

public boolean isEmpty(java.lang.String value,
                       boolean trim)
Returns true if the string passed to it as argument is either null or if it contains no data. If the boolean trim argument is true, the string argument is trimmed before it is validated.

Parameters:
value - java.lang.String
Returns:
boolean

validate

public void validate(java.lang.String fullyQualifiedName,
                     DataField df,
                     Context ctxt)
              throws DSETypeException
Delegates the actual work of semantic validation for a data field to subclasses. It then goes through the chain of DSEExceptions to collect the whole set of generated error messages and update the data field errorInfo accordingly.

Specified by:
validate in interface OperationXValidate
Parameters:
fullyQualifiedName - java.lang.String
df - com.ibm.btt.base.DataField
context - com.ibm.btt.base.Context
Throws:
DSETypeException - - If the field has not been successfully validated.

xValidate

public java.lang.String[] xValidate(Context ctx)
Description copied from interface: OperationXValidate
Performs the operation cross-validation service

Specified by:
xValidate in interface OperationXValidate
Returns:
String[] - The validation error string list

xValidate

public java.lang.String[] xValidate(Context context,
                                    java.lang.String transitionName)
                             throws java.lang.Exception
Delegates the actual work of cross validation to subclasses. It then collects any generated error messages and returns them as an array of strings as required by the toolkit

Specified by:
xValidate in interface ProcessorXValidate
Parameters:
context - com.ibm.btt.base.Context
transitionName - java.lang.String
Returns:
java.lang.String[]
Throws:
java.lang.Exception

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009