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

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

java.lang.Object
  extended by com.lapetus_ltd._2009.xml.types.XLptsDBStatementCriteriaType
      extended by com.lapetus_ltd.api.db.xml.types.TLptsDBStatementCriteriaType

public class TLptsDBStatementCriteriaType
extends XLptsDBStatementCriteriaType

Class Description : This initialises the XLptsDBStatementCriteriaType, which is utilised in the WHERE, JOIN and DYNAMIC processing or statements.

This class holds the WHERE OR JOIN CLAUSE information for a related statement.
The 4 types of parameter information that are supported by dbJAPI are STATIC, DYNAMIC, JOIN and NONE.
The static parameter indicates a WHERE clause with static criteria for the selection of the resultset.
The join specifies the parameters for JOIN processing of the select statement.
The dynamic type is a WHERE clause with data being fed in, one record at a time, from a primary statement.
This causes the statement to be executed with every primary rowset and a resultset generated every time which relates to the primary.
Furthermore there is no limit to the levels and complexity of these dynamic-primary links.

This class therefore happens to be a major player in the dynamic rowset processing as it can link one statement to another.
Instead of setting the values in this class, it is easier to use the TLptsStatement.setPrimaryStatement(java.lang.String, boolean) & TLptsStatement.addPrimaryRelationship(int, int[], java.lang.String)
Those functions actually set the values in this and the TLptsDBStatementCriteriaItemType.

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


Field Summary
 
Fields inherited from class com.lapetus_ltd._2009.xml.types.XLptsDBStatementCriteriaType
criteriaListItem, id, statementId, substituteDynamicIntoSQLString, type
 
Constructor Summary
TLptsDBStatementCriteriaType()
           This constructor initiates the Statement Parameter Type and initialize the criteriaListItem list.
TLptsDBStatementCriteriaType(XLptsDBStatementCriteriaType spt)
           This constructor copies the statement parameter type information from an XLptsDBStatementCriteriaType.
 
Method Summary
 void addCriteriaListItem(XLptsDBStatementCriteriaItemType spit)
           Adds the statement parameter item type to the criteriaListItem list.
 void clearCriteriaListItem()
           Clears the criteriaListItem list.
 boolean equals(java.lang.Object obj)
           Check for equal TLptsDBStatementCriteriaType objects.
 java.util.List<XLptsDBStatementCriteriaItemType> getCriteriaListItem()
           Returns a copy of the actual list.
 int getCriteriaListItemSize()
           Returns the size of the actual list.
 void removeCriteriaListItem(int index)
           Removes the statement parameter item type from the criteriaListItem list.
 void removeCriteriaListItem(XLptsDBStatementCriteriaItemType spit)
           Removes the statement parameter item type from the criteriaListItem list.
 
Methods inherited from class com.lapetus_ltd._2009.xml.types.XLptsDBStatementCriteriaType
getId, getStatementId, getType, isSubstituteDynamicIntoSQLString, setId, setStatementId, setSubstituteDynamicIntoSQLString, setType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TLptsDBStatementCriteriaType

public TLptsDBStatementCriteriaType()

This constructor initiates the Statement Parameter Type and initialize the criteriaListItem list.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : Never.

Notes : Default Constructor set defaults and initialize the criteriaListItem list .

Example :

 


TLptsDBStatementCriteriaType

public TLptsDBStatementCriteriaType(XLptsDBStatementCriteriaType spt)

This constructor copies the statement parameter type information from an XLptsDBStatementCriteriaType.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : Never.

Notes : Use this function every time you need to copy or instantiate a type XLptsDBStatementCriteriaType class.

Example :

 

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

addCriteriaListItem

public void addCriteriaListItem(XLptsDBStatementCriteriaItemType spit)

Adds the statement parameter item type to the criteriaListItem 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 getCriteriaListItem and
then adding does not have any affect.

Example :


 TLptsStatement itemsStatement = new TLptsStatement(connection, XLptsDBTypeOfStatementType.SELECT);
 itemsStatement.getTableItemByName("items").setSelected(true);
 itemsStatement.getColumnItemByName("items","iditems").setSelected(true);
 itemsStatement.getCriteriaType().setType(XLptsDBCriteriaType.STATIC);
 TLptsDBStatementCriteriaItemType spit = new TLptsDBStatementCriteriaItemType();
 spit.setColumnItem(itemsStatement.getColumnItemByName("items","iditems"));
 spit.setOperation(TLptsFactoryStatement.OPERATION_LESS_THAN);
 spit.addStaticStringListItem("100");
 ((TLptsDBStatementCriteriaType) itemsStatement.getCriteriaType()).addCriteriaListItem(spit);
 itemsStatement.setTitle("items");
 itemsStatement.setExecutable(false);
 itemsId = itemsStatement.getId();
 System.out.println("SQL Statement " + itemsStatement.getTitle() + ": " + itemsStatement.getSqlStatementFormatted());
 TLptsFactoryStatement.createNewStatement(connection,itemsStatement);

 

Parameters:
spit - the statement parameter item type to add in the list.

clearCriteriaListItem

public void clearCriteriaListItem()

Clears the criteriaListItem 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 getCriteriaListItem and
then clear does not have any affect.

Example :

 TLptsStatement statement;


 public void displayStatementParameter(TLptsStatement statement)
 {
   if(statement.getCriteriaType().getCriteriaListItemSize()>0)
     //Get the list with all the parameters to construct sql code or to display parameters on a table
     processStatementParameterItemType(statement.getCriteriaType().getCriteriaListItem());
 }
 ...
 private void clearParameterItemListActionPerformed()
 {
    statement.getCriteriaType().clearCriteriaListItem();
 }
 


equals

public boolean equals(java.lang.Object obj)

Check for equal TLptsDBStatementCriteriaType objects.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : n/a

Notes : Use this to compare two TLptsDBStatementCriteriaType objects by there id's.

Example :


 TLptsDBStatementCriteriaType spt1 = new TLptsDBStatementCriteriaType();
 TLptsDBStatementCriteriaType spt2 = new TLptsDBStatementCriteriaType();
 return spt1.equals(spt2);

 

Overrides:
equals in class java.lang.Object
Parameters:
obj - the statement parameter type
Returns:
true if they are equal, else false.

getCriteriaListItem

public java.util.List<XLptsDBStatementCriteriaItemType> getCriteriaListItem()

Returns a copy of the actual 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 addCriteriaListItem function.

Example :


 public void displayStatementParameter(TLptsStatement statement)
 {
   if(statement.getCriteriaType().getCriteriaListItemSize()>0)
     //Get the list with all the parameters to construct sql code or to display parameters on a table
     processStatementParameterItemType(statement.getCriteriaType().getCriteriaListItem());
 }

 

Overrides:
getCriteriaListItem in class XLptsDBStatementCriteriaType
Returns:
Returns a list of projects of this workspace.

getCriteriaListItemSize

public int getCriteriaListItemSize()

Returns the size of the actual list.

Thread Safe : Yes

Spawns its own Thread : No

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

Notes : Do not use getCriteriaListItem().size() as it is not efficient.

Example :


 public void displayStatementParameter(TLptsStatement statement)
 {
   if(statement.getCriteriaType().getCriteriaListItemSize()>0)
     //Get the list with all the parameters to construct sql code or to display parameters on a table
     processStatementParameterItemType(statement.getCriteriaType().getCriteriaListItem());
 }

 

Returns:
Returns the number of connections.

removeCriteriaListItem

public void removeCriteriaListItem(int index)

Removes the statement parameter item type from the criteriaListItem 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 getCriteriaListItem and
then removing does not have any affect.

Example :

 TLptsStatement statement;


 public void displayStatementParameter(TLptsStatement statement)
 {
   if(statement.getCriteriaType().getCriteriaListItemSize()>0)
     //Get the list with all the parameters to construct sql code or to display parameters on a table
     processStatementParameterItemType(statement.getCriteriaType().getCriteriaListItem());
 }
 ...
 private void removeParameterItemActionPerformed()
 {
    int selectedIndex;
    ...
    statement.getCriteriaType().removeCriteriaListItem(selectedIndex);
 }
 

Parameters:
index - the statement parameter item type index to remove from list.

removeCriteriaListItem

public void removeCriteriaListItem(XLptsDBStatementCriteriaItemType spit)

Removes the statement parameter item type from the criteriaListItem 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 getCriteriaListItem and
then removing does not have any affect.

Example :

 TLptsStatement statement;


 public void displayStatementParameter(TLptsStatement statement)
 {
   if(statement.getCriteriaType().getCriteriaListItemSize()>0)
     //Get the list with all the parameters to construct sql code or to display parameters on a table
     processStatementParameterItemType(statement.getCriteriaType().getCriteriaListItem());
 }
 ...
 private void removeParameterItemActionPerformed()
 {
    TLptsDBStatementCriteriaItemType selectedSpit;
    ...
    statement.getCriteriaType().removeCriteriaListItem(selectedSpit);
 }

 

Parameters:
spit - the statement parameter item type to remove from list.


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