Copyright 2009,2010, Lapetus Systems Ltd. (All rights reserved)

com.lapetus_ltd.api.db.xml.types
Class TLptsXmlRowSetSingleRowType

java.lang.Object
  extended by com.lapetus_ltd._2009.xml.types.XLptsXmlRowSetSingleRowType
      extended by com.lapetus_ltd.api.db.xml.types.TLptsXmlRowSetSingleRowType

public class TLptsXmlRowSetSingleRowType
extends XLptsXmlRowSetSingleRowType

Class Description : This type holds the data for a single row of data within the XLptsXmlRowSetTableType.

Refer to TLptsXmlRowSetType for a full example of how to use this and the other related
classes so that all the levels of information can be populated correctly.

This class contains two list for objects and sub tables (sub rowsets of data).
The table in turn contains a list of this class (rows). In this way the hierarchy is build for one to many relationships.

$LastChangedRevision: 1165 $
$LastChangedDate:: 2010-11-03 10:37:03#$


Field Summary
 
Fields inherited from class com.lapetus_ltd._2009.xml.types.XLptsXmlRowSetSingleRowType
rowNumber, rowObjectListItem, subTableListItem
 
Constructor Summary
TLptsXmlRowSetSingleRowType()
           This constructor initiates a XmlRowSetSingleRowType object.
TLptsXmlRowSetSingleRowType(int rowNo, java.util.List<java.lang.Object> rowObjects, java.util.List<java.lang.Integer> sqlTypes, java.util.List<byte[]> byteData)
          Constructs a single row type from the supplied information.
TLptsXmlRowSetSingleRowType(XLptsXmlRowSetSingleRowType item)
           This constructor copies the XmlRowSetSingleRowType information from another XLptsXmlRowSetSingleRowType.
 
Method Summary
 void addRowObjectListItem(XLptsXmlRowSetRowObjectType type)
           Adds the XLptsXmlRowSetRowObjectType to the rowObjectListItem list.
 void addSubTableListItem(XLptsXmlRowSetTableType tableType)
           Adds the XLptsXmlRowSetTableType to the subTableListItem list.
 void clearRowObjectListItem()
           Clears the rowObjectListItem list.
 void clearSubTableListItem()
           Clears the subTableListItem list.
 java.util.List<XLptsXmlRowSetRowObjectType> getRowObjectListItem()
           Returns a copy of the object list.
 int getRowObjectListItemSize()
          Returns the size of the object list.
 java.util.List<XLptsXmlRowSetTableType> getSubTableListItem()
           Returns a copy of the sub-table list.
 int getSubTableListItemSize()
           Returns the size of the table list.
 void removeRowObjectListItem(XLptsXmlRowSetRowObjectType type)
           Removes the XLptsXmlRowSetRowObjectType object from the rowObjectListItem list.
 void removeSubTableListItem(XLptsXmlRowSetTableType tableType)
           Removes the XLptsXmlRowSetTableType from the subTableListItem list.
 
Methods inherited from class com.lapetus_ltd._2009.xml.types.XLptsXmlRowSetSingleRowType
getRowNumber, setRowNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TLptsXmlRowSetSingleRowType

public TLptsXmlRowSetSingleRowType()

This constructor initiates a XmlRowSetSingleRowType object.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : Never.

Notes :

Example :


 TLptsXmlRowSetSingleRowType xrssrt = new TLptsXmlRowSetSingleRowType();
 xrssrt.addRowObjectListItem((XLptsXmlRowSetRowObjectType)rowObject);
 xrssrt.addSubTableListItem((XLptsXmlRowSetTableType)tableObject);
 
 


TLptsXmlRowSetSingleRowType

public TLptsXmlRowSetSingleRowType(int rowNo,
                                   java.util.List<java.lang.Object> rowObjects,
                                   java.util.List<java.lang.Integer> sqlTypes,
                                   java.util.List<byte[]> byteData)
Constructs a single row type from the supplied information.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : N/A

Notes : If the list lengths are not the same, then all lists are returned empty.

Example :


  List objectList1 = new LinkedList();
  objectList1.add("My String for column 1 - Level 1");
  objectList1.add(123);

  List byteList1 = new LinkedList();
  byteList1.add(TLptsBytesUtil.string2Bytes("My String for column 1 - Level 1"));
  byteList1.add(TLptsBytesUtil.int2Bytes(123));

  List sqlTypeList = new LinkedList();
  sqlTypeList.add(java.sql.Types.VARCHAR);
  sqlTypeList.add(java.sql.Types.INTEGER);

  TLptsXmlRowSetSingleRowType row = new TLptsXmlRowSetSingleRowType(1,
                                                                    objectList1,
                                                                    sqlTypeList,
                                                                    byteList1 );
 

Parameters:
rowNo - The row number for this row.
rowObjects - The objects of this row. The toString() is used for the String value of the object.
sqlTypes - The java.sql.Types of the row objects.
byteData - The byte data of each row object.

TLptsXmlRowSetSingleRowType

public TLptsXmlRowSetSingleRowType(XLptsXmlRowSetSingleRowType item)

This constructor copies the XmlRowSetSingleRowType information from another XLptsXmlRowSetSingleRowType.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : Never.

Notes :

Example :


 public XLptsXmlRowSetSingleRowType copyRow(XLptsXmlRowSetSingleRowType item)
 {
   return new XLptsXmlRowSetSingleRowType(item);
 }

 

Parameters:
item - the class object to copy.
Method Detail

addRowObjectListItem

public void addRowObjectListItem(XLptsXmlRowSetRowObjectType type)

Adds the XLptsXmlRowSetRowObjectType to the rowObjectListItem list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : n/a

Notes : Use this to add to the list. Getting the list with getRowObjectListItem and
then adding does not have any affect.

Example :


 TLptsXmlRowSetSingleRowType rowSetSingleRowType = new TLptsXmlRowSetSingleRowType();
 TLptsXmlRowSetRowObjectType rsot = new TLptsXmlRowSetRowObjectType("123", Types.VARCHAR, "123".getBytes());
 rowSetSingleRowType.addRowObjectListItem(rsot);

 

Parameters:
type - the single rowSet object type to add in the list.

addSubTableListItem

public void addSubTableListItem(XLptsXmlRowSetTableType tableType)

Adds the XLptsXmlRowSetTableType to the subTableListItem list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : n/a

Notes : Use this to add to the list. Getting the list with getSubTableListItem and
then adding does not have any affect.

Example :


 TLptsXmlRowSetSingleRowType rowSetSingleRowType = new TLptsXmlRowSetSingleRowType();
 XLptsXmlRowSetTableType rst = new XLptsXmlRowSetTableType();
 rst.setName("MyTable");
 rst.addColumnNamesListItem("Column 1");
 rst.addColumnNamesListItem("Column 2");
 rst.addColumnNamesListItem("Column 3");
 rowSetSingleRowType.addSubTableListItem(rst);

 

Parameters:
tableType - the table type to add to this list as a child table under this row.

clearRowObjectListItem

public void clearRowObjectListItem()

Clears the rowObjectListItem list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : n/a

Notes : Use this to clear the list. Getting the list with getRowObjectListItem and
then clearing does not have any affect.

Example :


 TLptsXmlRowSetSingleRowType rowSetSingleRowType = new TLptsXmlRowSetSingleRowType();
 if(rowSetSingleRowType.getRowObjectListItemSize() > 0)
   rowSetSingleRowType.clearRowObjectListItem();

 


clearSubTableListItem

public void clearSubTableListItem()

Clears the subTableListItem list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : n/a

Notes : Use this to clear the list. Getting the list with getSubTableListItem and
then clearing does not have any affect.

Example :


 TLptsXmlRowSetSingleRowType rowSetSingleRowType = new TLptsXmlRowSetSingleRowType();
 rowSetSingleRowType.addSubTableListItem(table1);
 if(rowSetSingleRowType.getSubTableListItemSize() > 0)
   rowSetSingleRowType.clearSubTableListItem();

 


getRowObjectListItem

public java.util.List<XLptsXmlRowSetRowObjectType> getRowObjectListItem()

Returns a copy of the object list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : Never. The result may be an empty list.

Notes : Do not add to this list as there is no result. Use the addRowObjectListItem function.

Example :


 String string = "id";
 TLptsXmlRowSetSingleRowType rowSetSingleRowType = new TLptsXmlRowSetSingleRowType();
 for (XLptsXmlRowSetRowObjectType rsot : rowSetSingleRowType.getRowObjectListItem())
   if(rsot.getString().equals(string))
     System.out.println("Found the object!");

 

Overrides:
getRowObjectListItem in class XLptsXmlRowSetSingleRowType
Returns:
Returns a list of Xml RowSet Object Types for this rowObjectListItem list.

getRowObjectListItemSize

public int getRowObjectListItemSize()
Returns the size of the object list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL :

Notes : Do not use getRowObjectListItem().size().

Example :


 TLptsXmlRowSetSingleRowType rowSetSingleRowType = new TLptsXmlRowSetSingleRowType();
 if(rowSetSingleRowType.getRowObjectListItemSize() > 0)
   return true;
 else
   return false;

 

Returns:
Returns the number of connections.

getSubTableListItem

public java.util.List<XLptsXmlRowSetTableType> getSubTableListItem()

Returns a copy of the sub-table list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : Never. The result may be an empty list.

Notes : Do not add to this list as there is no result. Use the addSubTableListItem function.

Example :


 TLptsXmlRowSetSingleRowType rowSetSingleRowType = new TLptsXmlRowSetSingleRowType();
 for (XLptsXmlRowSetTableType rst : rowSetSingleRowType.getSubTableListItem())
 {
   System.out.println("Columns for child table " + rst.getName() + ": ");
   for (String column : rst.getColumnNamesListItem())
     System.out.print();
 }
 
 

Overrides:
getSubTableListItem in class XLptsXmlRowSetSingleRowType
Returns:
Returns a list of Xml RowSet Single Rows of this subTableListItem list.

getSubTableListItemSize

public int getSubTableListItemSize()

Returns the size of the table list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL :

Notes : Do not use getSubTableListItem().size().

Example :


 TLptsXmlRowSetSingleRowType rowSetSingleRowType = new TLptsXmlRowSetSingleRowType();
 if(rowSetSingleRowType.getSubTableListItemSize() > 0)
   return true;
 else
   return false;

 

Returns:
Returns the number of child tables for this row.

removeRowObjectListItem

public void removeRowObjectListItem(XLptsXmlRowSetRowObjectType type)

Removes the XLptsXmlRowSetRowObjectType object from the rowObjectListItem list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : n/a

Notes : Use this to remove from the list. Getting the list with getRowObjectListItem and
then removing does not have any affect.

Example :


 String string = "id";
 TLptsXmlRowSetSingleRowType rowSetSingleRowType = new TLptsXmlRowSetSingleRowType();
 for (XLptsXmlRowSetRowObjectType rsot : rowSetSingleRowType.getRowObjectListItem())
   if(rsot.getString().equals(string))
     System.out.println("Found the object!");

 

Parameters:
type - the single rowSet object type to add in the list.

removeSubTableListItem

public void removeSubTableListItem(XLptsXmlRowSetTableType tableType)

Removes the XLptsXmlRowSetTableType from the subTableListItem list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : n/a

Notes : Use this to remove from the list. Getting the list with getSubTableListItem and
then removing does not have any affect.

Example :


 // remove all tables - without using learSubTableListItem
 for (XLptsXmlRowSetTableType rst : rowSetSingleRowType.getSubTableListItem())
 {
    rowSetSingleRowType.removeSubTableListItem(rst);  
 }

 

Parameters:
tableType - the single rowSet type to add in the list.


Copyright 2009,2010, Lapetus Systems Ltd. (All rights reserved)