SilverStream
Application Server 3.5

com.sssw.rt.util
Interface AgiDataRow


public interface AgiDataRow

Abstraction of a data row for insert/update/delete purposes. Within a data source triggered business object, will normally hold the row's data, plus some identifying information. This is part of the low-level API for accessing row-based data sources; see AgiDataSource for details.

A user-written data source will not need to implement its own AgiDataRow object. Instead, the data source is supplied with an AgiDataRowFactory during its initialization, and it must use the supplied AgiDataRowFactory to construct any data rows that it returns.


Method Summary
 AgiBandDescriptor getBandDescriptor()
          Get a "band description" for this row, describing the contents of the row and its columns.
 Object getData(int colid)
          Get the contents of the specified column as an Object.
 int getPresentColumnCount()
          Return the number of columns present (i.e.
 String getRowKey()
          Get the row key for the specified row.
 boolean isColumnPresent(int colid)
          Returns true if the specified column has data.
 boolean rowKeyMatch(String rowKey)
          Return true if the row key matches the specified key.
 void setData(int colid, Object data)
          Set the contents of the specified column.
 

Method Detail

getBandDescriptor

public AgiBandDescriptor getBandDescriptor()
Get a "band description" for this row, describing the contents of the row and its columns.
Example:

To print the column names of all the columns of a given AgiDataRow:

 AgiDataRow row;
 AgiBandDescriptor desc = row.getBandDescriptor();
 for (int col = 0; col < desc.getColumnCount(); col++) {
     System.out.println("Column " + col + " name is " + desc.getColumnName(col));
 }
 

getPresentColumnCount

public int getPresentColumnCount()
Return the number of columns present (i.e. having data) in the row. This can be less than the column count for "sparse" rows -- for example, a row of data supplied in an update request, in which only the modified columns are present.
Example:

Get the number of columns having data in the row.

 AgiDataRow row;
 int presentColCount = row.getPresentColumnCount();
 

isColumnPresent

public boolean isColumnPresent(int colid)
Returns true if the specified column has data. May be false for some columns of a "sparse" row such as a row of data supplied in an update request.
Parameters:
colid - Column number within the row (0-based).
Usage:

This is used to determine whether the user supplied data for a row.

Example:

Print an indication of whether each column in the row is present

 AgiDataRow row;
 int colCount = row.getBandDescriptor().getColumnCount();
 for (int i = 0; i < colCount; i++) {
     if (row.isColumnPresent(i))
         System.out.println("Column " + i + " has data");
     else
         System.out.println("Column " + i + " does not have data");
 }
 
See Also:
AgoDataUpdateRow.m_updateRow

getData

public Object getData(int colid)
Get the contents of the specified column as an Object.
Parameters:
colid - Column number within the row (0-based).
Example:
 AgiDataRow row;
 for (int i = 0; i < row.getBandDescriptor().getColumnCount(); i++) {
     Object value = row.getData(i);
     System.out.println("The value of column " + i + " is " + value);
 }
 

setData

public void setData(int colid,
                    Object data)
Set the contents of the specified column.
Parameters:
colid - column number within the row (0-based)
data - the data to set
Usage:

Example:
 AgiDataRow row;
 row.setData(0, new Integer(10));
 row.setData(1, "A fine kettle of fish");
 

getRowKey

public String getRowKey()
Get the row key for the specified row. The "row key" is an identifier for the row, set by the row factory at row creation time. The row key may be null, and callers must be prepared for this.
Example:
 AgiDataRow row;
 String rowKey = row.getRowKey();
 

rowKeyMatch

public boolean rowKeyMatch(String rowKey)
Return true if the row key matches the specified key.
Parameters:
rowKey - The row key to be matched
Example:
 AgiDataRow[] rows;
 String matchKey;
 
 for (int i = 0; i < rows.length; i++) {
     AgiDataRow row = rows[i];
     if (rows[i].rowKeyMatch(matchKey))
         return rows[i];
 }
 System.out.println("No rows match row key " + matchKey);
 

SilverStream
Application Server 3.5