org.moremotion.process
Class QueryProcess

java.lang.Object
  extended by org.moremotion.process.Process
      extended by org.moremotion.process.QueryProcess
Direct Known Subclasses:
BlockQueryProcess

public abstract class QueryProcess
extends Process

The QueryProcess Interface is defined for the processes that can create output records from the given input record. The term "Query" here does not imply a database query. It means in general a query that returns 0 or more results.

The process manager will call the methods of this interface as in the following example.

 pro.prepare(pbc);
 ProcessRecord prec = new ProcessRecord(pb);
 for (int i = 0; i < pb.getRecordCount(); i++) {
   prec.setIndex(i);
   if (isThroughRecordFilter(prec)) {
     pro.processRecord(prec);
     MemoryProcessBlock outblock = new MemoryProcessBlock( pro.getFieldNames() );
     ProcessRecord outrec = new ProcessRecord( outblock );
     while (pro.hasMoreResultRecords()) {
       outblock.addRecord( pro.getNextResultRecord() );
       outrec.setIndex(1);
       // Call subprocesses with outblock
 
       subpro.processRecord(outrec);
     }
   }
 }
 int cc = pro.finalizeProcess();
 
Please note that the process classes that implements this interface can have private data members safely since the process manager will create a new instance of them before calling their methods.

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

Constructor Summary
QueryProcess()
           
 
Method Summary
abstract  java.lang.String[] getFieldNames()
          The process should return the names of the fields as a String array
abstract  MemoryProcessRecord getNextResultRecord()
          The query process should create and return the next result record as a MemoryProcessRecord.
 
Methods inherited from class org.moremotion.process.Process
createMessage, createMessage, finalizeProcess, getCompletionCode, prepare, processRecord, resolve, setCompletionCode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryProcess

public QueryProcess()
Method Detail

getFieldNames

public abstract java.lang.String[] getFieldNames()
                                          throws ProcessException
The process should return the names of the fields as a String array

Throws:
ProcessException

getNextResultRecord

public abstract MemoryProcessRecord getNextResultRecord()
                                                 throws ProcessException
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.

Throws:
ProcessException


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