com.ibm.gre.samples.collectionhelpers
Class IRMResultList

java.lang.Object
  |
  +--com.ibm.gre.samples.collectionhelpers.IRMResultList

public class IRMResultList
extends java.lang.Object

The IRMResultList encapsulates the XML returned from a Records Manager Query. The class contains methods for iterating through all the results from a query while iterating through all the individual Columns for each result. Tables of values can be built using this process. There are methods that can be used to limit the number of columns to display.


Constructor Summary
IRMResultList(IRMQuery irmQuery)
          Constructor
IRMResultList(java.lang.String resultList)
          Constructor
 
Method Summary
 void AddColumn(java.lang.String strFlPlnCmpntAttrDefColNm)
          This method specifies the name of a column to include in the displayed results.
 int getColumnCount()
          The number of columns to be displayed.
 java.lang.String getFlPlnCmpntAttrDefCapt(int index)
          Gets the Caption of a table column for the specified index.
 java.lang.String getFlPlnCmpntAttrDefColNm(int index)
          Gets the FlPlnCmpntAttrDefColNm of a table column for the specified index.
 java.lang.String getItemByFlPlnCmpntAttrDefColNm(int index, java.lang.String strFlPlnCmpntAttrDefColNm)
          This method gets the value for the column as specified by the strFlPlnCmpntAttrDefColNm param for the result set row specified by the index parameter.
 java.lang.String getItemByRowColumnIndex(int row, int column)
          This is a variation on the above method.
 int getItemCount()
          The Number of rows that will be returned in the result set.
 int getPercentageColumnWidth(int index)
          The suggested percentage of the total width for all Columns that the specified column should take up.
 void setWheight1(byte val)
          Set the wheight value that is used for BINARY and BOOLEAN values when the percentage width is calculated for these types.
 void setWheight2(byte val)
          Set the wheight value that is used for DATE, DOUBLE, INTEGER and VIRTUAL values when the percentage width is calculated for these types.
 void setWheight3(byte val)
          Set the wheight value that is used for DATETIME, CLOB and STRING values when the percentage width is calculated for these types.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IRMResultList

public IRMResultList(IRMQuery irmQuery)
              throws com.ibm.gre.engine.util.RecordManagerException,
                     java.lang.Exception
Constructor

Parameters:
irmQuery - An IRMQuery object. This constructor is provide for future expansion of the class so that it may be possible to re-order column results for stateless clients.
Throws:
com.ibm.gre.engine.util.RecordManagerException
java.lang.Exception

IRMResultList

public IRMResultList(java.lang.String resultList)
              throws com.ibm.gre.engine.util.RecordManagerException
Constructor

Parameters:
resultList - The XML formatted String returned from the QueryControllerEJB.runQuery method. NOTE the queryResultOption value supplied to the the runQuery method must be the value com.ibm.gre.engine.util.QueryResultOptions.INCLUDE_COLUMNS so that the MetaData element is included in the result.
Throws:
com.ibm.gre.engine.util.RecordManagerException
Method Detail

AddColumn

public void AddColumn(java.lang.String strFlPlnCmpntAttrDefColNm)
               throws java.lang.Exception
This method specifies the name of a column to include in the displayed results. If no names are specified the class will include all the columns specified in the XML used to construct this object.

Parameters:
strFlPlnCmpntAttrDefColNm - The File Plan Component Attribute Column Name that should be displayed.
Throws:
java.lang.Exception

getColumnCount

public int getColumnCount()
                   throws java.lang.Exception
The number of columns to be displayed. Note this is either the number of columns that are specified using the above AddColumn method or all of the columns in the original XML if the AddColumn method is never called.

Returns:
int
Throws:
java.lang.Exception

getFlPlnCmpntAttrDefCapt

public java.lang.String getFlPlnCmpntAttrDefCapt(int index)
                                          throws java.lang.Exception
Gets the Caption of a table column for the specified index.

Parameters:
index - The index into the collection of Columns for this result list.
Returns:
The Caption to display in the table header.
Throws:
java.lang.Exception

getFlPlnCmpntAttrDefColNm

public java.lang.String getFlPlnCmpntAttrDefColNm(int index)
                                           throws java.lang.Exception
Gets the FlPlnCmpntAttrDefColNm of a table column for the specified index. This value is used in the getItemByFlPlnCmpntAttrDefColNm method to specify which value to return.

Parameters:
index - The index into the collection of Columns for this result list.
Returns:
The FlPlnCmpntAttrDefColNm to use to get the values for the column value.
Throws:
java.lang.Exception

getPercentageColumnWidth

public int getPercentageColumnWidth(int index)
The suggested percentage of the total width for all Columns that the specified column should take up.

Parameters:
index - The index into the collection of Columns for this result list.
Returns:
Percentage Width

getItemCount

public int getItemCount()
The Number of rows that will be returned in the result set.

Returns:
int

getItemByFlPlnCmpntAttrDefColNm

public java.lang.String getItemByFlPlnCmpntAttrDefColNm(int index,
                                                        java.lang.String strFlPlnCmpntAttrDefColNm)
                                                 throws java.lang.Exception
This method gets the value for the column as specified by the strFlPlnCmpntAttrDefColNm param for the result set row specified by the index parameter. You fill table values by iterating through all index values from 0 to ItemCount. For each row you then iterate through all columns and call the getFlPlnCmpntAttrDefColNm method for each column value from 0 to ColumnCount to get the value to supply for the strFlPlnCmpntAttrDefColNm param.

Parameters:
index - Use this value to specify the index value of the Item (row) in the result set to return the value for.
strFlPlnCmpntAttrDefColNm - Use this value to specify the name of the column to return the result for.
Returns:
Returns the value of the named XML attribute in the specified position.
Throws:
java.lang.Exception

getItemByRowColumnIndex

public java.lang.String getItemByRowColumnIndex(int row,
                                                int column)
                                         throws java.lang.Exception
This is a variation on the above method. The FlPlnCmpntAttrDefColNm does not have to be known only the index of the column in the table.

Parameters:
row - Use this value to specify the index value of the Item (row) in the result set to return the value for.
column - Use this value to specify the index value of the column in the table.
Returns:
Returns the value of the XML attribute in the specified position.
Throws:
java.lang.Exception

setWheight1

public void setWheight1(byte val)
Set the wheight value that is used for BINARY and BOOLEAN values when the percentage width is calculated for these types. The default value is 1.

Parameters:
val -

setWheight2

public void setWheight2(byte val)
Set the wheight value that is used for DATE, DOUBLE, INTEGER and VIRTUAL values when the percentage width is calculated for these types. The default value is 2. This means a DATE value will take up twice as much column width as a BOOLEAN

Parameters:
val -

setWheight3

public void setWheight3(byte val)
Set the wheight value that is used for DATETIME, CLOB and STRING values when the percentage width is calculated for these types. The default value is 3. This means a DATE value will take up three times as much column width as a BOOLEAN

Parameters:
val -