com.ibm.websphere.samples.ejbquery.employeefinderwar
Class ProcessQueryBean

java.lang.Object
  extended by com.ibm.websphere.samples.ejbquery.employeefinderwar.ProcessQueryBean

public class ProcessQueryBean
extends java.lang.Object

The ProcessQueryBean class provides the "run Query" implementation for DynamicQuery.jsp


Field Summary
 java.lang.String[] answer
          This holds the correct answer for the query.
 java.lang.Boolean answerCheck
          The answerCheck attribute indicates if the query results are correct.
 java.lang.String checkPlan
          This indicates if DynamicQuery is printing the Query Plan
 java.lang.String endRow
          This holds the ending row in the database for the query.
 java.lang.String local
          This indicates if DynamicQuery is using the Local Query interface
 java.lang.String query
          This is the query created in the associated DynamicQuery.jsp.
 java.lang.String[] results
          This holds the results of the query.
 java.lang.String selectorIndex
          This is the index position of the predefined query selector radio button used in the associated DynamicQuery.jsp.
 java.lang.String startRow
          This holds the starting row in the database for the query.
 
Constructor Summary
ProcessQueryBean()
           
 
Method Summary
 void compareResults()
          compareResults method compares the result String[] with the answer String[] to setAnswerCheck.
 java.lang.String doLocalPlan(java.lang.String query, java.lang.StringBuffer error)
           
 com.ibm.websphere.ejbquery.QueryLocalIterator doLocalQuery(java.lang.String qstmt, java.lang.StringBuffer error)
          This method looks up the com.ibm.websphere.ejbquery.QueryBean's local interface, executes its create(), executes its executeQuery(), and returns, if successful, an html table containing the query results, and if unsuccessful, fills error with a html text area error message
 java.lang.String doPlan(java.lang.String query, java.lang.StringBuffer error)
           
 com.ibm.websphere.ejbquery.QueryIterator doQuery(java.lang.String qstmt, java.lang.StringBuffer error)
          This method looks up the com.ibm.websphere.ejbquery.QueryBean's remote interface, executes its create(), executes its executeQuery(), and returns, if successful, an html table containing the query results, and if unsuccessful, fills error with a html text area error message
 java.lang.String[] getAnswer()
          This accessor method gets the answer attribute.
 java.lang.Boolean getAnswerCheck()
          This accessor method gets the answerCheck attribute.
 java.lang.String getCheckPlan()
          This accessor method gets the checkPlan attribute.
 java.lang.String getEndRow()
          This accessor method gets the endRow attribute.
 java.lang.String getLocal()
          This accessor method gets the local attribute.
 java.lang.String getQuery()
          This accessor method gets the query attribute.
 java.lang.String[] getResults()
          This accessor method gets the results attribute.
 java.lang.String getSelectorIndex()
          This accessor method gets the selectorIndex attribute.
 java.lang.String getStartRow()
          This accessor method gets the startRow attribute.
 java.lang.StringBuffer localprint(com.ibm.websphere.ejbquery.QueryLocalIterator iter)
          This method iterates through the passed in QueryLocalIterator formatting an html table structure returning, if successful, an html table containing the query results, and if unsuccessful, an html text area error message
 java.lang.String[] parseInput(java.lang.String osqlNormalized)
          This method separates query part of the input string from parameter string part, saves the query part as an object attribute, and turns the parameter string into an array of strings each containing a TypeName value pair which it returns.
 java.lang.StringBuffer print(com.ibm.websphere.ejbquery.QueryIterator iter)
          This method iterates through the passed in QueryIterator formatting an html table structure returning, if successful, an html table containing the query results, and if unsuccessful, an html text area error message
 java.lang.String processQuery()
          This method acts like main and processes the query attribute returning, if successful, an html table containing the query results, and if unsuccessful, an html text area error message.
 java.lang.Object processSet(java.lang.String[] parmStringArray)
          This method changes the array of strings containing type value pairs to an array of java objects of the specified type and having the specified value.
 void setAnswer(java.lang.String[] s)
          This accessor method sets the answer attribute.
 void setAnswerCheck(java.lang.Boolean s)
          This accessor method sets the answerCheck attribute.
 void setCheckPlan(java.lang.String s)
          This accessor method sets the checkPlan attribute.
 void setEndRow(java.lang.String s)
          This accessor method sets the endRow attribute.
 void setLocal(java.lang.String s)
          This accessor method sets the local attribute.
 void setQuery(java.lang.String s)
          This accessor method sets the query attribute.
 void setResults(java.lang.String[] s)
          This accessor method sets the results attribute.
 void setSelectorIndex(java.lang.String s)
          This accessor method sets the selectorIndex attribute.
 void setStartRow(java.lang.String s)
          This accessor method sets the startRow attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selectorIndex

public java.lang.String selectorIndex
This is the index position of the predefined query selector radio button used in the associated DynamicQuery.jsp.


query

public java.lang.String query
This is the query created in the associated DynamicQuery.jsp.


results

public java.lang.String[] results
This holds the results of the query.


answer

public java.lang.String[] answer
This holds the correct answer for the query.


local

public java.lang.String local
This indicates if DynamicQuery is using the Local Query interface


startRow

public java.lang.String startRow
This holds the starting row in the database for the query.


endRow

public java.lang.String endRow
This holds the ending row in the database for the query.


checkPlan

public java.lang.String checkPlan
This indicates if DynamicQuery is printing the Query Plan


answerCheck

public java.lang.Boolean answerCheck
The answerCheck attribute indicates if the query results are correct.

Constructor Detail

ProcessQueryBean

public ProcessQueryBean()
Method Detail

getSelectorIndex

public java.lang.String getSelectorIndex()
This accessor method gets the selectorIndex attribute.

Returns:
java.lang.String

setSelectorIndex

public void setSelectorIndex(java.lang.String s)
This accessor method sets the selectorIndex attribute.

Parameters:
s - java.lang.String

getLocal

public java.lang.String getLocal()
This accessor method gets the local attribute.

Returns:
java.lang.String

setLocal

public void setLocal(java.lang.String s)
This accessor method sets the local attribute.

Parameters:
s - java.lang.String

getCheckPlan

public java.lang.String getCheckPlan()
This accessor method gets the checkPlan attribute.

Returns:
java.lang.String

setCheckPlan

public void setCheckPlan(java.lang.String s)
This accessor method sets the checkPlan attribute.

Parameters:
s - java.lang.String

getStartRow

public java.lang.String getStartRow()
This accessor method gets the startRow attribute.

Returns:
java.lang.String

setStartRow

public void setStartRow(java.lang.String s)
This accessor method sets the startRow attribute.

Parameters:
s - java.lang.String

getEndRow

public java.lang.String getEndRow()
This accessor method gets the endRow attribute.

Returns:
java.lang.String

setEndRow

public void setEndRow(java.lang.String s)
This accessor method sets the endRow attribute.

Parameters:
s - java.lang.String

getQuery

public java.lang.String getQuery()
This accessor method gets the query attribute.

Returns:
java.lang.String

setQuery

public void setQuery(java.lang.String s)
This accessor method sets the query attribute.

Parameters:
s - java.lang.String

getResults

public java.lang.String[] getResults()
This accessor method gets the results attribute.

Returns:
java.lang.String[]

setResults

public void setResults(java.lang.String[] s)
This accessor method sets the results attribute.

Parameters:
s - java.lang.String[]

getAnswer

public java.lang.String[] getAnswer()
This accessor method gets the answer attribute.

Returns:
java.lang.String[]

setAnswer

public void setAnswer(java.lang.String[] s)
This accessor method sets the answer attribute.

Parameters:
s - java.lang.String[]

getAnswerCheck

public java.lang.Boolean getAnswerCheck()
This accessor method gets the answerCheck attribute.

Returns:
java.lang.Boolean

setAnswerCheck

public void setAnswerCheck(java.lang.Boolean s)
This accessor method sets the answerCheck attribute.

Parameters:
s - java.lang.Boolean

compareResults

public void compareResults()
compareResults method compares the result String[] with the answer String[] to setAnswerCheck.


processQuery

public java.lang.String processQuery()
This method acts like main and processes the query attribute returning, if successful, an html table containing the query results, and if unsuccessful, an html text area error message. To do this it uses doQuery() and print().

Returns:
java.lang.String

doQuery

public com.ibm.websphere.ejbquery.QueryIterator doQuery(java.lang.String qstmt,
                                                        java.lang.StringBuffer error)
This method looks up the com.ibm.websphere.ejbquery.QueryBean's remote interface, executes its create(), executes its executeQuery(), and returns, if successful, an html table containing the query results, and if unsuccessful, fills error with a html text area error message

Parameters:
qstmt - java.lang.String
error - java.lang.StringBuffer
Returns:
com.ibm.websphere.ejbquery.QueryIterator

doLocalQuery

public com.ibm.websphere.ejbquery.QueryLocalIterator doLocalQuery(java.lang.String qstmt,
                                                                  java.lang.StringBuffer error)
This method looks up the com.ibm.websphere.ejbquery.QueryBean's local interface, executes its create(), executes its executeQuery(), and returns, if successful, an html table containing the query results, and if unsuccessful, fills error with a html text area error message

Parameters:
qstmt - java.lang.String
error - java.lang.StringBuffer
Returns:
com.ibm.websphere.ejbquery.QueryIterator

print

public java.lang.StringBuffer print(com.ibm.websphere.ejbquery.QueryIterator iter)
This method iterates through the passed in QueryIterator formatting an html table structure returning, if successful, an html table containing the query results, and if unsuccessful, an html text area error message

Parameters:
iter - com.ibm.websphere.ejbquery.QueryIterator
Returns:
java.lang.StringBuffer

localprint

public java.lang.StringBuffer localprint(com.ibm.websphere.ejbquery.QueryLocalIterator iter)
This method iterates through the passed in QueryLocalIterator formatting an html table structure returning, if successful, an html table containing the query results, and if unsuccessful, an html text area error message

Parameters:
iter - com.ibm.websphere.ejbquery.QueryLocalIterator
Returns:
java.lang.StringBuffer

doPlan

public java.lang.String doPlan(java.lang.String query,
                               java.lang.StringBuffer error)

doLocalPlan

public java.lang.String doLocalPlan(java.lang.String query,
                                    java.lang.StringBuffer error)

processSet

public java.lang.Object processSet(java.lang.String[] parmStringArray)
This method changes the array of strings containing type value pairs to an array of java objects of the specified type and having the specified value.

Parameters:
parmStringArray - java.lang.String[]
Returns:
java.lang.Object[]

parseInput

public java.lang.String[] parseInput(java.lang.String osqlNormalized)
This method separates query part of the input string from parameter string part, saves the query part as an object attribute, and turns the parameter string into an array of strings each containing a TypeName value pair which it returns. The parameter string part of the input is surrounded by {} and contains TypeName, value pairs separated by commas. example input select e from EmpBean e where e.dept.deptno = ?1 and e.isManager = ?2 {Integer 10, boolean true}. example query output select e from EmpBean e where e.dept.deptno = ?1 and e.isManager = ?2. example parameter output Integer 10. example parameter output boolean true.

Parameters:
osqlNormalized - java.lang.String
Returns:
java.lang.String[]