com.ibm.as400.util.servlet

Class RecordListRowData

  • All Implemented Interfaces:
    java.io.Serializable


    public class RecordListRowData
    extends RowData
    implements java.io.Serializable
    The RecordListRowData class represents a list of records.

    A Record represents the data described by a RecordFormat. It can represent:

    • An entry in a data queue.
    • The parameter data provided to or returned by a program call.
    • A record to be written to or read from a file.
    • Any data returned from the IBM i system that needs to be converted between IBM i format and Java format.

    A RecordListRowData object maintains a position in the list that points to its current row of data. The initial position in the list is set before the first row. The next method moves to the next row in the list.

    The getObject method is used to retrieve the column value for the current row indexed by the column number. Columns are numbered starting from 0.

    The number, types, and properties of the list's columns are provided by the RecordFormatMetaData object returned by the getMetaData method.

    RecordListRowData objects generate the following events:

    • RowDataEvent - The events fired are:
      • rowAdded()
      • rowChanged()
      • rowRemoved()

    The following example creates a RecordListRowData object and adds the records from a sequential file.

      
      // Create an object to represent the system.
      AS400 mySystem = new AS400("mySystem.myCompany.com");
     
       // Create a file object that represents the file.
      SequentialFile sf = new SequentialFile(mySystem, ifspath);
    
      // Set the record format of the file.
      sf.setRecordFormat();
    
      // Get the records in the file.
      Record[] records = sf.readAll();
    
      // Create a RecordListRowData object and add the records.
      RecordListRowData rowData = new RecordListRowData();
      for (int i=0; i < records.length; i++)
      {
        rowData.addRow(records[i]);
      }
      
    See Also:
    Serialized Form
    • Constructor Detail

      • RecordListRowData

        public RecordListRowData()
        Constructs a default RecordListRowData object.
      • RecordListRowData

        public RecordListRowData(RecordFormat recordFormat)
        Constructs a RecordListRowData object with the specified recordFormat.
        Parameters:
        recordFormat - The record format.
    >
    • Method Detail

      • addRow

        public void addRow(Record record)
                    throws RowDataException
        Adds the specified record to the end of the record list.
        Parameters:
        record - The record to be added.
        Throws:
        RowDataException - If a row data error occurs.
      • addRow

        public void addRow(Record record,
                  java.util.Vector[] properties)
        Adds the specified record to the end of the record list. Each field in the record is assigned the appropriate properties list specified by properties.
        Parameters:
        record - The record to be added.
        properties - The properties list.
      • addRow

        public void addRow(Record record,
                  int rowIndex)
                    throws RowDataException
        Adds the specified record to the record list at the specified rowIndex.
        Parameters:
        record - The record to be added.
        rowIndex - The rowIndex (0-based).
        Throws:
        RowDataException - If a row data error occurs.
      • addRow

        public void addRow(Record record,
                  int rowIndex,
                  java.util.Vector[] properties)
        Adds the specified record to the record list at the specified rowIndex. Each field in the record is assigned the appropriate properties list specified by properties.
        Parameters:
        record - The record to be added.
        rowIndex - The row index (0-based).
        properties - The properties list.
      • addRowDataListener

        public void addRowDataListener(RowDataListener listener)
        Adds a RowDataListener. The RowDataListener object is added to an internal list of row data listeners; it can be removed with removeRowDataListener.
        Parameters:
        listener - The RowDataListener.
      • getObject

        public java.lang.Object getObject(int columnIndex)
                                   throws RowDataException
        Returns the current record's field at the specified columnIndex.
        Overrides:
        getObject in class RowData
        Parameters:
        columnIndex - The column index (0-based).
        Returns:
        The field object.
        Throws:
        RowDataException - If a row data error occurs.
      • getRecordFormat

        public RecordFormat getRecordFormat()
        Returns the record format.
        Returns:
        The record format.
      • getRow

        public Record getRow()
        Returns the Record object for the current row.
        Returns:
        The row.
      • removeRowDataListener

        public void removeRowDataListener(RowDataListener listener)
        Removes this RowDataListener from the internal list. If the RowDataListener is not on the list, nothing is done.
        Parameters:
        listener - The RowDataListener.
      • removeRow

        public void removeRow(int rowIndex)
        Removes a record from the record list at the specified rowIndex.
        Parameters:
        rowIndex - The row index (0-based).
      • setRow

        public void setRow(Record record,
                  int rowIndex)
        Sets the record at the specified rowIndex to be the specified record.
        Parameters:
        record - The record.
        rowIndex - The row index (0-based).
      • setRow

        public void setRow(Record record,
                  int rowIndex,
                  java.util.Vector[] properties)
        Sets the record at the specified rowIndex to be the specified record. Each object in the row is assigned the appropriate properties list specified by properties.
        Parameters:
        record - The record.
        rowIndex - The row index (0-based).
        properties - The row properties.
      • setRecordFormat

        public void setRecordFormat(RecordFormat recordFormat)
                             throws java.beans.PropertyVetoException
        Sets the record format for the record list. The metadata is set using the specified recordFormat. If a record format already exists, then setting a new record format will remove all rows from the list.
        Parameters:
        recordFormat - The record format.
        Throws:
        java.beans.PropertyVetoException - If a change is vetoed.
        See Also:
        getRecordFormat(), getMetaData()