com.sap.aii.af.service.cpa

Class TableData

java.lang.Object
  extended by com.sap.aii.af.service.cpa.TableData
All Implemented Interfaces:
Serializable, Cloneable

public class TableData
extends Object
implements Cloneable, Serializable

Attribute extended CPAObjects (i.e. currently only the Channel object) support CPA Cache specific data types, besides the following basic Java types: String, int, long and boolean. The data fields of the adapter type specific Channel object can be defined through the adapter type meta data (schema). Currently supported additional data types are the BinaryData and TableData objects. Such data fields can be read from a Channel object by the attribute name (defined in the schema), using the methods getValueAsBinary or getValueAsTable. The adapters using the CPA Cache service API should never need to create the described data container objects and should always retrieve them from a given Channel object, instead.

The TableData object is a container for table data, which can be read from the Channel object, as configured in the Integration Directory or PCK configuration UI. TableData represent a table instance, as defined in the adapter specific meta data (schema). It offers some basic methods to retrieve data from the tables rows and columns. This rudimentary table implementation does not support key columns (unique column value check).

See Also:
BinaryData, Serialized Form

Nested Class Summary
 class TableData.Row
           The inner class Row represents one row of the table.
 
Field Summary
protected  LinkedList<String> columnNames
           
protected  LinkedList<TableData.Row> rows
           
 
Constructor Summary
TableData(LinkedList<String> columnNames)
          The default constructor for the TableData object.
TableData(String tableName, LinkedList<String> columnNames)
          The constructor for the TableData object.
 
Method Summary
 void addRow(TableData.Row row)
          Adds a row to the table.
 Object clone()
          This method clones the structure of the given table.
 LinkedList getColumnNames()
          Returns a list of all column names, defined for this table.
 TableData.Row getRow(int rowNumber)
          Returns a Row by index.
 int getRowCount()
          Returns the amount of currently stored rows in this table.
 LinkedList<TableData.Row> getRows(String fieldName, String fieldValue)
          Returns all Rows, where the specified column name contains a given value.
 String getTableName()
          Returns the name of the table.
 String retrieveTableValueByKeyColumn(String columnName, String keyColName, String keyColValue)
          Returns the value of the given column name from a Rows, where the specified key column name matches the given key value (first occurrence).
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

columnNames

protected LinkedList<String> columnNames

rows

protected LinkedList<TableData.Row> rows
Constructor Detail

TableData

public TableData(LinkedList<String> columnNames)
The default constructor for the TableData object. Using this cunstructor, the table name remains undefined.

Parameters:
columnNames - A LinkedList containing the tables column names.

TableData

public TableData(String tableName,
                 LinkedList<String> columnNames)
The constructor for the TableData object. This constructor creates a named table instance.

Parameters:
tableName - The name of the table.
columnNames - A LinkedList containing the tables column names.
Method Detail

getTableName

public String getTableName()
Returns the name of the table.

Returns:
The name of the table.

getColumnNames

public LinkedList getColumnNames()
Returns a list of all column names, defined for this table.

Returns:
A LinkedList of column names.

getRowCount

public int getRowCount()
Returns the amount of currently stored rows in this table.

Returns:
The amount of table rows.

addRow

public void addRow(TableData.Row row)
Adds a row to the table.

Parameters:
row - The Row to add to the table.

getRow

public TableData.Row getRow(int rowNumber)
Returns a Row by index.

Parameters:
rowNumber - The number of the Row to return.
Returns:
The Row requested by index.

getRows

public LinkedList<TableData.Row> getRows(String fieldName,
                                         String fieldValue)
Returns all Rows, where the specified column name contains a given value.

Parameters:
fieldName - The column name, for which the value is to be checked.
fieldValue - The value for which the content of the column specified by the fieldName parameter is to be checked.
Returns:
A LinkedList containing all Rows where the content of the checked column matched the given value.

retrieveTableValueByKeyColumn

public String retrieveTableValueByKeyColumn(String columnName,
                                            String keyColName,
                                            String keyColValue)
Returns the value of the given column name from a Rows, where the specified key column name matches the given key value (first occurrence). Note, that the table implementation itself does not ensure uniqueness of any column. This method can only be used, if the uniqueness of the key column is ensured by the implementation using the table.

Parameters:
columnName - The column name, for which the value is to be returned, in case that the content of the given keyColName column matches the keyColValue.
keyColName - The column name, for which the content is to be checked for the given keyColValue.
keyColValue - The value for which the content of the given keyColName column is to be checked.
Returns:
The value of the requested column, in case that the column to be checked contains the given value. Otherwise null.

clone

public Object clone()
             throws CloneNotSupportedException
This method clones the structure of the given table. Note, that it does not clone the content of the rows.

Overrides:
clone in class Object
Returns:
The cloned table (structure).
Throws:
CloneNotSupportedException

toString

public String toString()
Overrides:
toString in class Object
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] SAP_XIAF [sap.com] com.sap.aii.af.svc.facade api BC-XI


Copyright 2014 SAP AG Complete Copyright Notice