org.moremotion.process
Class BlockQueryProcess

java.lang.Object
  extended by org.moremotion.process.Process
      extended by org.moremotion.process.QueryProcess
          extended by org.moremotion.process.BlockQueryProcess

public class BlockQueryProcess
extends QueryProcess

Version:
$Id: BlockQueryProcess.java 51 2008-03-10 11:46:54Z erkan $

Constructor Summary
BlockQueryProcess()
          Creates a new instance of BlockQueryProcess
 
Method Summary
 void finalizeProcess()
          This method is called by the process manager after there is no more records to process.
 java.lang.String[] getFieldNames()
          The process should return the names of the fields as a String array
 MemoryProcessRecord getNextResultRecord()
          The query process should create and return the next result record as a MemoryProcessRecord.
 void prepare()
          The Process should prepare to be called for each process records existing in the configured process block.
 void processRecord(ProcessRecord prec)
          This method is called by the process manager for each process record in the configured process block that passes through the configured record filter.
 
Methods inherited from class org.moremotion.process.Process
createMessage, createMessage, getCompletionCode, resolve, setCompletionCode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockQueryProcess

public BlockQueryProcess()
Creates a new instance of BlockQueryProcess

Method Detail

getFieldNames

public java.lang.String[] getFieldNames()
                                 throws ProcessException
Description copied from class: QueryProcess
The process should return the names of the fields as a String array

Specified by:
getFieldNames in class QueryProcess
Throws:
ProcessException

getNextResultRecord

public MemoryProcessRecord getNextResultRecord()
                                        throws ProcessException
Description copied from class: QueryProcess
The query process should create and return the next result record as a MemoryProcessRecord. If there is no more records to return then the method should return null.

Specified by:
getNextResultRecord in class QueryProcess
Throws:
ProcessException

prepare

public void prepare()
             throws ProcessException
Description copied from class: Process
The Process should prepare to be called for each process records existing in the configured process block. The preparation can be accessing to the process configuration, establishing any necessary database connection and store the results of this preparation in private data members.

Specified by:
prepare in class Process
Throws:
ProcessException - indicates that the preparation failed and means other methods of this process instance will not be called and the overall completion code of the process execution will be set to 20.

processRecord

public void processRecord(ProcessRecord prec)
                   throws ProcessException
Description copied from class: Process
This method is called by the process manager for each process record in the configured process block that passes through the configured record filter. For example if the call definition of the process is as follows
 <callProcess name="x" blockName="PBx" recordFilter="PRICE < 100" ... 
then the process manager will call the processRecord() method for each record in the process block "PBx" that satisfies the "PRICE < 100" pre-condition.

Specified by:
processRecord in class Process
Parameters:
prec - The ProcessRecord Object that contains process fields
Throws:
ProcessException - indicates that there is an error and the process cannot continue. This exception will set the overall completion code to 20.

finalizeProcess

public void finalizeProcess()
                     throws ProcessException
Description copied from class: Process
This method is called by the process manager after there is no more records to process. This is the last call to the process instance and therefore the process should finalize its tasks.

Note that this method is called regardless of the completion code if the prepare method did not throw an exception.

The method should take care of the current completion code and act accordingly

  public void finalizeProcess() throws ProcessException {
    if (getCompletionCode() <= 4) {
      // successfull completion
    } else {
      // unsuccessfull completion
    }
   }
 

Specified by:
finalizeProcess in class Process
Throws:
ProcessException - that indicates that finalization was in an unrecoverable error. This exception will set the completion code to 20.


Copyright © 2002-2008 MOR YAZILIM. All Rights Reserved.