org.osesb.msgrouting.test.deployabletestpackage2
Class PutCreditRatingOnMessageContextPipelineStage

java.lang.Object
  extended by org.osesb.messagepipeline.PipelineStage
      extended by org.osesb.msgrouting.test.deployabletestpackage2.PutCreditRatingOnMessageContextPipelineStage

public class PutCreditRatingOnMessageContextPipelineStage
extends PipelineStage

A custom PipelineStage that puts the value of the customer credit rating on the MessagePipelineContext as a DOM Element. The DOM Element is added to the LoanApplicationRequest by the next PipelineStage, which is a XMLUpdaterPipelineStage.

The customer credit rating was retrieved from the customer table and put on the MessagePipelineContext by RetrieveCustomerCreditRatingDatabaseQueryWithXMLParametersPipelineStage. The MessagePipelineContext variable is a java.sql.ResultSet and the variable name is "stageName.sqlStatementName.resultSet" where:

The ResultSet contains one row with one column (CREDITRATING).

The PipelineStage after this, which is a XMLUpdaterPipelineStage, expects an Object[] named "stageName.xmlUpdateItems" where 'stageName' is the name of the XMLUpdaterPipelineStage. The Object[] will contain one item, a DOM Element named creditRating, which the XMLUpdaterPipelineStage adds to the LoanApplicationRequest.

This PipelineStage retrieves the customer credit rating from the ResultSet, creates an Element named 'creditRating', and creates the Object[] for the XMLUpdaterPipelineStage.

Finally, this PipelineStage adds a variable named 'customerCreditRating' to the MessagePipelineContext. 'customerCreditRating' holds the value of the customer credit for convenient access by subsequent PipelineStages.

See the PutCreditRatingOnMessageContextPipelineStage configuration in processloanapplication-message-pipeline-config.xml.


Field Summary
 
Fields inherited from class org.osesb.messagepipeline.PipelineStage
log, messagePipelineContext, nextStage, parentMessagePipeline, pipelineStageConfiguration, previousStage, thisClassName
 
Constructor Summary
PutCreditRatingOnMessageContextPipelineStage(MessagePipeline parentMessagePipeline, PipelineStageConfiguration pipelineStageConfiguration)
          Creates a new instance of PutCreditRatingOnMessageContextPipelineStage.
 
Method Summary
 boolean runStage(EAIMessage eaiMessage)
          Run PipelineStage logic.
 
Methods inherited from class org.osesb.messagepipeline.PipelineStage
beingDroppedFromPool, commit, getMessagePipelineContext, getNextStage, getParentMessagePipeline, getPipelineStageConfiguration, getPreviousStage, handlePipelineException, handlePipelineException, logMessage, propagate, rollback, setNextStage, setOutputMessage, setPreviousStage, setResultMessage, stageProcessingComplete, stageProcessingStarting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PutCreditRatingOnMessageContextPipelineStage

public PutCreditRatingOnMessageContextPipelineStage(MessagePipeline parentMessagePipeline,
                                                    PipelineStageConfiguration pipelineStageConfiguration)
                                             throws java.lang.Exception
Creates a new instance of PutCreditRatingOnMessageContextPipelineStage.

Parameters:
parentMessagePipeline - The MessagePipeline that constructed this PipelineStage.
pipelineStageConfiguration - A PipelineStageConfiguration for this PipelineStage.
Throws:
java.lang.Exception - if constructed with a null parentMessagePipeline or a null pipelineStageConfiguration.
Method Detail

runStage

public boolean runStage(EAIMessage eaiMessage)
                 throws PipelineStageException
Run PipelineStage logic.

Retrieve the value for the customer credit rating from the MessagePipelineContext and put a DOM Element on the MessagePipelineContext. The name of the DOM Element is 'creditRating' and the value of the Element is the customer's credit rating.

Overrides:
runStage in class PipelineStage
Parameters:
eaiMessage - The EAI message, which is the output of the last PipeLineStage that invoked setOutputMessage(), or, if this is the first PiplelineStage, then this is the EAIMessage that the MessagePipeline was invoked with.
Returns:
true to continue pipeline processing or false to terminate pipeline processing.
Throws:
a - PipelineStageException if any errors occur.
PipelineStageException