com.vaadin.data.util.
Class QueryContainer
java.lang.Object
com.vaadin.data.util.QueryContainer
All Implemented Interfaces:
Container, Container.Indexed, Container.Ordered, Serializable
- extends Object
- implements Container, Container.Ordered, Container.Indexed
@Deprecated
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 Vaadin 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()
Since:
4.0
Version:
Author:
Vaadin Ltd.
See Also:
Field Summary | |
---|---|
static int |
DEFAULT_RESULTSET_CONCURRENCY
Deprecated. |
static int |
DEFAULT_RESULTSET_TYPE
Deprecated. |
Constructor Summary | |
---|---|
QueryContainer(String queryStatement,
Connection connection)
Deprecated. 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)
Deprecated. Constructs new QueryContainer with the specified
queryStatement . |
Method Summary | |
---|---|
boolean |
addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
Deprecated. Adds new Property to all Items in the Container. |
Object |
addItem()
Deprecated. Creates a new Item into the Container, and assign it an ID. |
Item |
addItem(Object itemId)
Deprecated. Creates new Item with the given ID into the Container. |
Object |
addItemAfter(Object previousItemId)
Deprecated. Adds new item after the given item. |
Item |
addItemAfter(Object previousItemId,
Object newItemId)
Deprecated. Adds new item after the given item. |
Object |
addItemAt(int index)
Deprecated. Adds item at the position of provided index in the container. |
Item |
addItemAt(int index,
Object newItemId)
Deprecated. Adds the given item at the position of given index. |
void |
close()
Deprecated. Releases and nullifies the statement . |
boolean |
containsId(Object id)
Deprecated. Tests if the list contains the specified Item. |
void |
finalize()
Deprecated. Closes the statement. |
Object |
firstItemId()
Deprecated. Returns id of first item in the Container. |
Property |
getContainerProperty(Object itemId,
Object propertyId)
Deprecated. Gets the property identified by the given itemId and propertyId from the container. |
Collection<String> |
getContainerPropertyIds()
Deprecated. Gets the collection of propertyId from the Container. |
Object |
getIdByIndex(int index)
Deprecated. Gets the Index id in the container. |
Item |
getItem(Object id)
Deprecated. Gets the Item with the given Item ID from the Container. |
Collection<?> |
getItemIds()
Deprecated. Gets an collection of all the item IDs in the container. |
Class<?> |
getType(Object id)
Deprecated. Gets the data type of all properties identified by the given type ID. |
int |
indexOfId(Object id)
Deprecated. Gets the index of the Item corresponding to id in the container. |
boolean |
isFirstId(Object id)
Deprecated. Returns true if given id is first id at first index. |
boolean |
isLastId(Object id)
Deprecated. Returns true if given id is last id at last index. |
Object |
lastItemId()
Deprecated. Returns id of last item in the Container. |
Object |
nextItemId(Object id)
Deprecated. Returns id of next item in container at next index. |
Object |
prevItemId(Object id)
Deprecated. Returns id of previous item in container at previous index. |
void |
refresh()
Deprecated. Restores items in the container. |
boolean |
removeAllItems()
Deprecated. Removes all Items from the Container. |
boolean |
removeContainerProperty(Object propertyId)
Deprecated. Removes a Property specified by the given Property ID from the Container. |
boolean |
removeItem(Object itemId)
Deprecated. Removes the Item identified by ItemId from the Container. |
int |
size()
Deprecated. 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 |
---|
DEFAULT_RESULTSET_TYPE
public static final int DEFAULT_RESULTSET_TYPE
- See Also:
- Constant Field Values
Deprecated.
DEFAULT_RESULTSET_CONCURRENCY
public static final int DEFAULT_RESULTSET_CONCURRENCY
- See Also:
- Constant Field Values
Deprecated.
Constructor Detail |
---|
QueryContainer
public QueryContainer(String queryStatement,
Connection connection,
int resultSetType,
int resultSetConcurrency)
throws SQLException
- Parameters:
queryStatement
- Database queryconnection
- Connection objectresultSetType
-resultSetConcurrency
-- Throws:
SQLException
- when database operation fails
Deprecated.
Constructs new QueryContainer
with the specified
queryStatement
.
QueryContainer
public QueryContainer(String queryStatement,
Connection connection)
throws SQLException
- Parameters:
queryStatement
- Database queryconnection
- Connection object- Throws:
SQLException
- when database operation fails- See Also:
DEFAULT_RESULTSET_TYPE
,DEFAULT_RESULTSET_CONCURRENCY
Deprecated.
Constructs new QueryContainer
with the specified
queryStatement using the default resultset type and default resultset
concurrency.
Method Detail |
---|
refresh
public void refresh()
throws SQLException
- Throws:
SQLException
- when database operation fails
Deprecated.
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.
close
public void close()
throws SQLException
- Throws:
SQLException
- when database operation fails
Deprecated.
Releases and nullifies the statement
.
getItem
public Item getItem(Object id)
- Parameters:
id
- ID of the Item to retrieve- Returns:
- Item Id.
Deprecated.
Gets the Item with the given Item ID from the Container.
getContainerPropertyIds
public Collection<String> getContainerPropertyIds()
- Specified by:
getContainerPropertyIds
in interfaceContainer
- Returns:
- Collection of Property ID.
Deprecated.
Gets the collection of propertyId from the Container.
getItemIds
public Collection<?> getItemIds()
- Specified by:
getItemIds
in interfaceContainer
- Returns:
- collection of Item IDs
Deprecated.
Gets an collection of all the item IDs in the container.
getContainerProperty
public Property getContainerProperty(Object itemId,
Object propertyId)
- Specified by:
getContainerProperty
in interfaceContainer
- Parameters:
itemId
- ID of the Item which contains the PropertypropertyId
- ID of the Property to retrieve- Returns:
- Property with the given ID if exists;
null
otherwise.
Deprecated.
Gets the property identified by the given itemId and propertyId from the
container. If the container does not contain the property
null
is returned.
getType
public Class<?> getType(Object id)
- Parameters:
id
- ID identifying the Properties- Returns:
- data type of the Properties
Deprecated.
Gets the data type of all properties identified by the given type ID.
size
public int size()
- Returns:
- the number of items in the container.
Deprecated.
Gets the number of items in the container.
containsId
public boolean containsId(Object id)
- Specified by:
containsId
in interfaceContainer
- Parameters:
id
- ID the of Item to be tested.- Returns:
true
if given id is in the container;false
otherwise.
Deprecated.
Tests if the list contains the specified Item.
addItem
public Item addItem(Object itemId)
throws UnsupportedOperationException
- Parameters:
itemId
- ID of the Item to be created.- Returns:
- Created new Item, or
null
if it fails. - Throws:
UnsupportedOperationException
- if the addItem method is not supported.
Deprecated.
Creates new Item with the given ID into the Container.
addItem
public Object addItem()
throws UnsupportedOperationException
- Returns:
- ID of the newly created Item, or
null
if it fails. - Throws:
UnsupportedOperationException
- if the addItem method is not supported.
Deprecated.
Creates a new Item into the Container, and assign it an ID.
removeItem
public boolean removeItem(Object itemId)
throws UnsupportedOperationException
- Specified by:
removeItem
in interfaceContainer
- Parameters:
itemId
- ID of the Item to remove.- Returns:
true
if the operation succeeded;false
otherwise.- Throws:
UnsupportedOperationException
- if the removeItem method is not supported.
Deprecated.
Removes the Item identified by ItemId from the Container.
addContainerProperty
public boolean addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
throws UnsupportedOperationException
- Specified by:
addContainerProperty
in interfaceContainer
- Parameters:
propertyId
- ID of the Propertytype
- Data type of the new PropertydefaultValue
- The value all created Properties are initialized to.- Returns:
true
if the operation succeeded;false
otherwise.- Throws:
UnsupportedOperationException
- if the addContainerProperty method is not supported.
Deprecated.
Adds new Property to all Items in the Container.
removeContainerProperty
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException
- Specified by:
removeContainerProperty
in interfaceContainer
- Parameters:
propertyId
- ID of the Property to remove- Returns:
true
if the operation succeeded;false
otherwise.- Throws:
UnsupportedOperationException
- if the removeContainerProperty method is not supported.
Deprecated.
Removes a Property specified by the given Property ID from the Container.
removeAllItems
public boolean removeAllItems()
throws UnsupportedOperationException
- Specified by:
removeAllItems
in interfaceContainer
- Returns:
true
if the operation succeeded;false
otherwise.- Throws:
UnsupportedOperationException
- if the removeAllItems method is not supported.
Deprecated.
Removes all Items from the Container.
addItemAfter
public Item addItemAfter(Object previousItemId,
Object newItemId)
throws UnsupportedOperationException
- Specified by:
addItemAfter
in interfaceContainer.Ordered
- Parameters:
previousItemId
- Id of the previous item in ordered container.newItemId
- Id of the new item to be added.- Returns:
- Returns new item or
null
if the operation fails. - Throws:
UnsupportedOperationException
- if the addItemAfter method is not supported.- See Also:
Ordered: adding items in filtered or sorted containers
Deprecated.
Adds new item after the given item.
addItemAfter
public Object addItemAfter(Object previousItemId)
throws UnsupportedOperationException
- Specified by:
addItemAfter
in interfaceContainer.Ordered
- Parameters:
previousItemId
- Id of the previous item in ordered container.- Returns:
- Returns item id created new item or
null
if the operation fails. - Throws:
UnsupportedOperationException
- if the addItemAfter method is not supported.- See Also:
Ordered: adding items in filtered or sorted containers
Deprecated.
Adds new item after the given item.
firstItemId
public Object firstItemId()
- Specified by:
firstItemId
in interfaceContainer.Ordered
- Returns:
- ID of the first Item in the list.
Deprecated.
Returns id of first item in the Container.
isFirstId
public boolean isFirstId(Object id)
- Specified by:
isFirstId
in interfaceContainer.Ordered
- Parameters:
id
- ID of an Item in the Container.- Returns:
true
if the Item is first visible item in the Container,false
if not
Deprecated.
Returns true
if given id is first id at first index.
isLastId
public boolean isLastId(Object id)
- Specified by:
isLastId
in interfaceContainer.Ordered
- Parameters:
id
- ID of an Item in the Container- Returns:
true
if the Item is last visible item in the Container,false
if not
Deprecated.
Returns true
if given id is last id at last index.
lastItemId
public Object lastItemId()
- Specified by:
lastItemId
in interfaceContainer.Ordered
- Returns:
- ID of the last Item.
Deprecated.
Returns id of last item in the Container.
nextItemId
public Object nextItemId(Object id)
- Specified by:
nextItemId
in interfaceContainer.Ordered
- Parameters:
id
- ID of an Item in the Container.- Returns:
- ID of the next Item or null.
Deprecated.
Returns id of next item in container at next index.
prevItemId
public Object prevItemId(Object id)
- Specified by:
prevItemId
in interfaceContainer.Ordered
- Parameters:
id
- ID of an Item in the Container.- Returns:
- ID of the previous Item or null.
Deprecated.
Returns id of previous item in container at previous index.
finalize
public void finalize()
addItemAt
public Item addItemAt(int index,
Object newItemId)
throws UnsupportedOperationException
- Specified by:
addItemAt
in interfaceContainer.Indexed
- Parameters:
index
- Index to add the new item.newItemId
- Id of the new item to be added.- Returns:
- new item or
null
if the operation fails. - Throws:
UnsupportedOperationException
- if the addItemAt is not supported.
Deprecated.
Adds the given item at the position of given index.
addItemAt
public Object addItemAt(int index)
throws UnsupportedOperationException
- Specified by:
addItemAt
in interfaceContainer.Indexed
- Parameters:
index
- Index to add the new item.- Returns:
- item id created new item or
null
if the operation fails. - Throws:
UnsupportedOperationException
- if the addItemAt is not supported.
Deprecated.
Adds item at the position of provided index in the container.
getIdByIndex
public Object getIdByIndex(int index)
- Specified by:
getIdByIndex
in interfaceContainer.Indexed
- Parameters:
index
- Index Id.- Returns:
- ID in the given index.
Deprecated.
Gets the Index id in the container.
indexOfId
public int indexOfId(Object id)
- Specified by:
indexOfId
in interfaceContainer.Indexed
- Parameters:
id
- ID of an Item in the Container- Returns:
- index of the Item, or -1 if the Container does not include the Item
Deprecated.
Gets the index of the Item corresponding to id in the container.