org.osesb.messagepipeline.test.builtinstagesunittest
Class ValidationBean_ValidateCDElementPrice

java.lang.Object
  extended by org.osesb.validationbeans.ValidationBean
      extended by org.osesb.messagepipeline.test.builtinstagesunittest.ValidationBean_ValidateCDElementPrice

public class ValidationBean_ValidateCDElementPrice
extends ValidationBean

ValidationBean_ValidateCDElementPrice extends XMLValidationBeanPipelineStage to that a propagated cd element has a valid a price does not exceed 24.99.

Since:
Version .9

Field Summary
 
Fields inherited from class org.osesb.validationbeans.ValidationBean
jdbcConnectionManager, log, thisClassName, validationBeanConfiguration, validationBeanException
 
Constructor Summary
ValidationBean_ValidateCDElementPrice(ValidationBeanConfiguration validationBeanConfiguration)
          Creates a new instance of a ValidationBean with a ValidationBeanConfiguration.
 
Method Summary
 ProcessingContext evaluate(java.lang.Object obj)
          The ValidationBean evaluate() method.
 
Methods inherited from class org.osesb.validationbeans.ValidationBean
closeJDBCConnection, closeJDBCConnection, executeQuery, getJDBCConnection, getValidationBeanConfiguration, handleAssertionException, loadJDBCConnectionManager, releaseJDBCConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationBean_ValidateCDElementPrice

public ValidationBean_ValidateCDElementPrice(ValidationBeanConfiguration validationBeanConfiguration)
Creates a new instance of a ValidationBean with a ValidationBeanConfiguration.

Parameters:
validationBeanConfiguration - A ValidationBeanConfiguration
Method Detail

evaluate

public ProcessingContext evaluate(java.lang.Object obj)
                           throws java.lang.Exception,
                                  ValidationBeanException
The ValidationBean evaluate() method.

The object to be evaluated is XML text with multiple customer purchase orders. For each purchase order, assert that customerCreditLimit <= customerCreditBalance + totalPurchaseOrderCost where the customer credit limit and balance are retrieved from the CUSTOMER table in the JDBCTEST tables.

A ValidationBean that is configured with 'processAllErrors' set to true will continue to process data constraints after the first error is encountered, accumulate ValidationError(s) using the validationErrorList, and finally throw a ValidationBeanException with all ValidationError(s) after all constraints are evaluated. In this case, the 'owner' of the ValidationBean can discover all ValidationError(s) by using the iterate() method of ValidationBeanException.

A ValidationBean that is configured with 'processAllErrors' set to false will throw a ValidationBeanException when the first data constraint error occurs. In this case, the 'owner' of the ValidationBean can discover the first validation error by calling the getMessage() method of ValidationBeanException.

If all constraints pass, then the ValidationBean can return a non-empty ProcessingContext. The purpose of returning a ProcessingContext is to allow a ValidationBean to return information that it may have retrieved or calculated during constraint evaluation, which may be useful to downstream processes.

Overrides:
evaluate in class ValidationBean
Parameters:
obj - The String object (xmlText) to apply constraints to.
Returns:
a ProcessingContext indicating that all data conatraints on obj were met.
Throws:
java.lang.Exception - if invoked with a obj eaiMessage or if an internal error occurs during validation.
ValidationBeanException - if one or more constraints fail.