com.ibm.gre.samples.collectionhelpers
Class IRMQuery

java.lang.Object
  |
  +--com.ibm.gre.samples.collectionhelpers.IRMQuery
Direct Known Subclasses:
IRMBatchQuery

public class IRMQuery
extends java.lang.Object

The IRMQuery class forms the basis for Easy Inteligent Query dialogs. IRMQuery objects are constructed using QueryControllerEJB saved query XML values. The class contains methods to assist in displaying Query Forms. There are methods to execute Queries with modified values.


Constructor Summary
IRMQuery(java.lang.String queryXML, ClientSession session, java.lang.String strScope, boolean addDisplayInfo)
          Constructor
 
Method Summary
 int getBlockSize()
          Gets the value indicating the number of elements that will be returned.
 int getBlockStart()
          Get the Block Start value.
 java.lang.String getCondition()
          The Condition element of the saved query.
 java.lang.String getFieldValue(java.lang.String key)
          Gets the string value for the XML element represented by the unique key
 java.lang.String getFlPlnCmpntDefName()
          The File Plan Component Definition Name for the saved query.
 Line getLine(int index)
          Gets the Line object for the specified index.
 int getLineCount()
          The total number of lines that will be displayed to draw a Query Form.
 java.lang.String getModifiedQuery()
          The XML string representing a new Saved Query with modified values.
 java.lang.String getQuery()
          The Query element of the saved query
 int getQueryResultOptions()
          Gets the queryResultOption paramater for the QueryController runQuery method.
 int getQueryType()
          The Query Type.
 java.lang.String getReportTemplate()
          The ReportTemplate of the saved query.
 java.lang.String getResultList()
          Return the XML string result from the last call to the QueryController runQuery method.
 ClientSession getSession()
          The encapsulated ClientSession.
 int getTotalResults()
          Return the total result count for the query.
 void Initialize()
          Call the Initialize method immediately after the class has been constructed to generate the internal representation of the query.
 int runQuery(int nBlockStart, int nBlockSize)
          Calls the QueryController runQuery using the mofified query values.
 void setBlockSize(int value)
          Sets the value indicating the number of elements that will be returned.
 void setBlockStart(int value)
          Set the Block Start where 0 is the first element.
 boolean setFieldValue(java.lang.String key, java.lang.String val)
          Sets the XML element value for the element named by the unique key value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IRMQuery

public IRMQuery(java.lang.String queryXML,
                ClientSession session,
                java.lang.String strScope,
                boolean addDisplayInfo)
         throws com.ibm.gre.engine.util.RecordManagerException,
                java.lang.Exception
Constructor

Parameters:
queryXML - he XML string containing the values making up the Query. This string can be a saved query value returned by the QueryControllerEJB.getQueryById method.
session - A ClientSession object containing references to the Records Manager API objects.
strScope - The full path string indicating the scope of the query.
addDisplayInfo - Set to true if you wish to use this object to generate display information.
Throws:
com.ibm.gre.engine.util.RecordManagerException
java.lang.Exception
Method Detail

Initialize

public void Initialize()
                throws java.rmi.RemoteException,
                       com.ibm.gre.engine.util.RecordManagerException,
                       java.lang.Exception
Call the Initialize method immediately after the class has been constructed to generate the internal representation of the query.

Throws:
java.rmi.RemoteException
com.ibm.gre.engine.util.RecordManagerException
java.lang.Exception

runQuery

public int runQuery(int nBlockStart,
                    int nBlockSize)
             throws java.rmi.RemoteException,
                    com.ibm.gre.engine.util.RecordManagerException,
                    java.lang.Exception
Calls the QueryController runQuery using the mofified query values. Saves the result internally. Call getResultList to retreive the XML return value.

Parameters:
nBlockStart - The index value return a block of values from. 0 indicates the first value.
nBlockSize - The number of values to return. 0 indicates return all values.
Returns:
Always returns 100 meaning 100% complete.
Throws:
java.rmi.RemoteException
com.ibm.gre.engine.util.RecordManagerException
java.lang.Exception

getQueryResultOptions

public int getQueryResultOptions()
                          throws java.lang.Exception
Gets the queryResultOption paramater for the QueryController runQuery method. The default value is com.ibm.gre.engine.util.QueryResultOptions.INCLUDE_COLUMNS.

Returns:
int
java.lang.Exception

getTotalResults

public int getTotalResults()
                    throws java.lang.Exception
Return the total result count for the query.

Returns:
int
java.lang.Exception

getResultList

public java.lang.String getResultList()
                               throws java.lang.Exception
Return the XML string result from the last call to the QueryController runQuery method.

Returns:
XML formatted String.
java.lang.Exception

getBlockStart

public int getBlockStart()
Get the Block Start value.

Returns:
int

setBlockStart

public void setBlockStart(int value)
Set the Block Start where 0 is the first element.

Parameters:
value -

getBlockSize

public int getBlockSize()
Gets the value indicating the number of elements that will be returned.

Returns:
int

setBlockSize

public void setBlockSize(int value)
Sets the value indicating the number of elements that will be returned.

Parameters:
value -

getSession

public ClientSession getSession()
The encapsulated ClientSession.

Returns:
ClientSession

getQueryType

public int getQueryType()
The Query Type.

Returns:
See com.ibm.gre.engine.types.QueryTypes

getLineCount

public int getLineCount()
                 throws java.lang.Exception
The total number of lines that will be displayed to draw a Query Form.

Returns:
int
java.lang.Exception

getLine

public Line getLine(int index)
             throws java.lang.Exception
Gets the Line object for the specified index.

Parameters:
index -
Returns:
Line
java.lang.Exception

setFieldValue

public boolean setFieldValue(java.lang.String key,
                             java.lang.String val)
                      throws java.lang.Exception
Sets the XML element value for the element named by the unique key value.

Parameters:
key - The unique key identifying the element to set the value for.
val - The value to set.
Returns:
true if the value was set.
java.lang.Exception

getFieldValue

public java.lang.String getFieldValue(java.lang.String key)
                               throws java.lang.Exception
Gets the string value for the XML element represented by the unique key

Parameters:
key - The unique value identifying the XML element to get the value for.
Returns:
The value of the XML element or "" if not found.
Throws:
java.lang.Exception

getModifiedQuery

public java.lang.String getModifiedQuery()
                                  throws java.lang.Exception
The XML string representing a new Saved Query with modified values.

Returns:
String
java.lang.Exception

getCondition

public java.lang.String getCondition()
The Condition element of the saved query.

Returns:
XML formatted String.

getQuery

public java.lang.String getQuery()
The Query element of the saved query

Returns:
XML formatted String.

getReportTemplate

public java.lang.String getReportTemplate()
The ReportTemplate of the saved query.

Returns:
XML formatted String.

getFlPlnCmpntDefName

public java.lang.String getFlPlnCmpntDefName()
                                      throws java.rmi.RemoteException,
                                             com.ibm.gre.engine.util.RecordManagerException,
                                             java.lang.Exception
The File Plan Component Definition Name for the saved query.

Returns:
String name
Throws:
java.rmi.RemoteException
com.ibm.gre.engine.util.RecordManagerException
java.lang.Exception