|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.itmill.toolkit.data.util.QueryContainer
public class QueryContainer
The QueryContainer is the specialized form of Container which
is Ordered and Indexed. This is used to represent the contents of relational
database tables accessed through the JDBC Connection in the Toolkit Table.
This creates Items based on the queryStatement provided to the container.
The QueryContainer can be visualized as a representation of a
relational database table.Each Item in the container represents the row
fetched by the query.All cells in a column have same data type and the data
type information is retrieved from the metadata of the resultset.
Note : If data in the tables gets modified, Container will not get reflected
with the updates, we have to explicity invoke QueryContainer.refresh method.
refresh()
Container| Field Summary | |
|---|---|
static int |
DEFAULT_RESULTSET_CONCURRENCY
|
static int |
DEFAULT_RESULTSET_TYPE
|
| Constructor Summary | |
|---|---|
QueryContainer(String queryStatement,
Connection connection)
Constructs new QueryContainer with the specified
queryStatement using the default resultset type and default resultset
concurrency. |
|
QueryContainer(String queryStatement,
Connection connection,
int resultSetType,
int resultSetConcurrency)
Constructs new QueryContainer with the specified
queryStatement. |
|
| Method Summary | |
|---|---|
boolean |
addContainerProperty(Object propertyId,
Class type,
Object defaultValue)
Adds new Property to all Items in the Container. |
Object |
addItem()
Creates a new Item into the Container, and assign it an ID. |
Item |
addItem(Object itemId)
Creates new Item with the given ID into the Container. |
Object |
addItemAfter(Object previousItemId)
Adds new item after the given item. |
Item |
addItemAfter(Object previousItemId,
Object newItemId)
Adds new item after the given item. |
Object |
addItemAt(int index)
Adds item at the position of provided index in the container. |
Item |
addItemAt(int index,
Object newItemId)
Adds the given item at the position of given index. |
void |
close()
Releases and nullifies the statement. |
boolean |
containsId(Object id)
Tests if the list contains the specified Item. |
void |
finalize()
Closes the statement. |
Object |
firstItemId()
Returns id of first item in the Container. |
Property |
getContainerProperty(Object itemId,
Object propertyId)
Gets the property identified by the given itemId and propertyId from the container. |
Collection |
getContainerPropertyIds()
Gets the collection of propertyId from the Container. |
Object |
getIdByIndex(int index)
Gets the Index id in the container. |
Item |
getItem(Object id)
Gets the Item with the given Item ID from the Container. |
Collection |
getItemIds()
Gets an collection of all the item IDs in the container. |
Class |
getType(Object id)
Gets the data type of all properties identified by the given type ID. |
int |
indexOfId(Object id)
Gets the index of the Item corresponding to id in the container. |
boolean |
isFirstId(Object id)
Returns true if given id is first id at first index. |
boolean |
isLastId(Object id)
Returns true if given id is last id at last index. |
Object |
lastItemId()
Returns id of last item in the Container. |
Object |
nextItemId(Object id)
Returns id of next item in container at next index. |
Object |
prevItemId(Object id)
Returns id of previous item in container at previous index. |
void |
refresh()
Restores items in the container. |
boolean |
removeAllItems()
Removes all Items from the Container. |
boolean |
removeContainerProperty(Object propertyId)
Removes a Property specified by the given Property ID from the Container. |
boolean |
removeItem(Object itemId)
Removes the Item identified by ItemId from the Container. |
int |
size()
Gets the number of items in the container. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_RESULTSET_TYPE
public static final int DEFAULT_RESULTSET_CONCURRENCY
| Constructor Detail |
|---|
public QueryContainer(String queryStatement,
Connection connection,
int resultSetType,
int resultSetConcurrency)
throws SQLException
QueryContainer with the specified
queryStatement.
queryStatement - Database queryconnection - Connection objectresultSetType - resultSetConcurrency -
SQLException - when database operation fails
public QueryContainer(String queryStatement,
Connection connection)
throws SQLException
QueryContainer with the specified
queryStatement using the default resultset type and default resultset
concurrency.
queryStatement - Database queryconnection - Connection object
SQLException - when database operation failsDEFAULT_RESULTSET_TYPE,
DEFAULT_RESULTSET_CONCURRENCY| Method Detail |
|---|
public void refresh()
throws SQLException
Restores items in the container. This method will update the latest data to the container.
Note: This method should be used to update the container with the latest items.
SQLException - when database operation fails
public void close()
throws SQLException
statement.
SQLException - when database operation failspublic Item getItem(Object id)
getItem in interface Containerid - ID of the Item to retrieve
public Collection getContainerPropertyIds()
getContainerPropertyIds in interface Containerpublic Collection getItemIds()
getItemIds in interface Container
public Property getContainerProperty(Object itemId,
Object propertyId)
null is returned.
getContainerProperty in interface ContaineritemId - ID of the Item which contains the PropertypropertyId - ID of the Property to retrieve
null
otherwise.public Class getType(Object id)
getType in interface Containerid - ID identifying the Properties
public int size()
size in interface Containerpublic boolean containsId(Object id)
containsId in interface Containerid - ID the of Item to be tested.
true if given id is in the container;
false otherwise.
public Item addItem(Object itemId)
throws UnsupportedOperationException
addItem in interface ContaineritemId - ID of the Item to be created.
null if it fails.
UnsupportedOperationException - if the addItem method is not supported.
public Object addItem()
throws UnsupportedOperationException
addItem in interface Containernull if it fails.
UnsupportedOperationException - if the addItem method is not supported.
public boolean removeItem(Object itemId)
throws UnsupportedOperationException
removeItem in interface ContaineritemId - ID of the Item to remove.
true if the operation succeeded;
false otherwise.
UnsupportedOperationException - if the removeItem method is not supported.
public boolean addContainerProperty(Object propertyId,
Class type,
Object defaultValue)
throws UnsupportedOperationException
addContainerProperty in interface ContainerpropertyId - ID of the Propertytype - Data type of the new PropertydefaultValue - The value all created Properties are initialized to.
true if the operation succeeded;
false otherwise.
UnsupportedOperationException - if the addContainerProperty method is not supported.
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException
removeContainerProperty in interface ContainerpropertyId - ID of the Property to remove
true if the operation succeeded;
false otherwise.
UnsupportedOperationException - if the removeContainerProperty method is not supported.
public boolean removeAllItems()
throws UnsupportedOperationException
removeAllItems in interface Containertrue if the operation succeeded;
false otherwise.
UnsupportedOperationException - if the removeAllItems method is not supported.
public Item addItemAfter(Object previousItemId,
Object newItemId)
throws UnsupportedOperationException
addItemAfter in interface Container.OrderedpreviousItemId - Id of the previous item in ordered container.newItemId - Id of the new item to be added.
null if the operation fails.
UnsupportedOperationException - if the addItemAfter method is not supported.
public Object addItemAfter(Object previousItemId)
throws UnsupportedOperationException
addItemAfter in interface Container.OrderedpreviousItemId - Id of the previous item in ordered container.
null if the
operation fails.
UnsupportedOperationException - if the addItemAfter method is not supported.public Object firstItemId()
firstItemId in interface Container.Orderedpublic boolean isFirstId(Object id)
true if given id is first id at first index.
isFirstId in interface Container.Orderedid - ID of an Item in the Container.
true if the Item is first in the Container,
false if notpublic boolean isLastId(Object id)
true if given id is last id at last index.
isLastId in interface Container.Orderedid - ID of an Item in the Container
true if the Item is last in the Container,
false if notpublic Object lastItemId()
lastItemId in interface Container.Orderedpublic Object nextItemId(Object id)
nextItemId in interface Container.Orderedid - ID of an Item in the Container.
public Object prevItemId(Object id)
prevItemId in interface Container.Orderedid - ID of an Item in the Container.
public void finalize()
finalize in class Objectclose()
public Item addItemAt(int index,
Object newItemId)
throws UnsupportedOperationException
addItemAt in interface Container.Indexedindex - Index to add the new item.newItemId - Id of the new item to be added.
null if the operation fails.
UnsupportedOperationException - if the addItemAt is not supported.
public Object addItemAt(int index)
throws UnsupportedOperationException
addItemAt in interface Container.Indexedindex - Index to add the new item.
null if the operation
fails.
UnsupportedOperationException - if the addItemAt is not supported.public Object getIdByIndex(int index)
getIdByIndex in interface Container.Indexedindex - Index Id.
public int indexOfId(Object id)
indexOfId in interface Container.Indexedid - ID of an Item in the Container
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||