com.vaadin.data.util
Class QueryContainer

java.lang.Object
  extended by com.vaadin.data.util.QueryContainer
All Implemented Interfaces:
Container, Container.Indexed, Container.Ordered, Serializable

Deprecated. will be removed in the future, use the SQLContainer add-on

@Deprecated
public class QueryContainer
extends Object
implements Container, Container.Ordered, Container.Indexed

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:
Container, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.data.Container
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeEvent, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer
 
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
Deprecated. 
See Also:
Constant Field Values

DEFAULT_RESULTSET_CONCURRENCY

public static final int DEFAULT_RESULTSET_CONCURRENCY
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

QueryContainer

public QueryContainer(String queryStatement,
                      Connection connection,
                      int resultSetType,
                      int resultSetConcurrency)
               throws SQLException
Deprecated. 
Constructs new QueryContainer with the specified queryStatement.

Parameters:
queryStatement - Database query
connection - Connection object
resultSetType -
resultSetConcurrency -
Throws:
SQLException - when database operation fails

QueryContainer

public QueryContainer(String queryStatement,
                      Connection connection)
               throws SQLException
Deprecated. 
Constructs new QueryContainer with the specified queryStatement using the default resultset type and default resultset concurrency.

Parameters:
queryStatement - Database query
connection - Connection object
Throws:
SQLException - when database operation fails
See Also:
DEFAULT_RESULTSET_TYPE, DEFAULT_RESULTSET_CONCURRENCY
Method Detail

refresh

public void refresh()
             throws SQLException
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.

Throws:
SQLException - when database operation fails

close

public void close()
           throws SQLException
Deprecated. 
Releases and nullifies the statement.

Throws:
SQLException - when database operation fails

getItem

public Item getItem(Object id)
Deprecated. 
Gets the Item with the given Item ID from the Container.

Specified by:
getItem in interface Container
Parameters:
id - ID of the Item to retrieve
Returns:
Item Id.

getContainerPropertyIds

public Collection<String> getContainerPropertyIds()
Deprecated. 
Gets the collection of propertyId from the Container.

Specified by:
getContainerPropertyIds in interface Container
Returns:
Collection of Property ID.

getItemIds

public Collection<?> getItemIds()
Deprecated. 
Gets an collection of all the item IDs in the container.

Specified by:
getItemIds in interface Container
Returns:
collection of Item IDs

getContainerProperty

public Property<?> getContainerProperty(Object itemId,
                                        Object propertyId)
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.

Specified by:
getContainerProperty in interface Container
Parameters:
itemId - ID of the Item which contains the Property
propertyId - ID of the Property to retrieve
Returns:
Property with the given ID if exists; null otherwise.

getType

public Class<?> getType(Object id)
Deprecated. 
Gets the data type of all properties identified by the given type ID.

Specified by:
getType in interface Container
Parameters:
id - ID identifying the Properties
Returns:
data type of the Properties

size

public int size()
Deprecated. 
Gets the number of items in the container.

Specified by:
size in interface Container
Returns:
the number of items in the container.

containsId

public boolean containsId(Object id)
Deprecated. 
Tests if the list contains the specified Item.

Specified by:
containsId in interface Container
Parameters:
id - ID the of Item to be tested.
Returns:
true if given id is in the container; false otherwise.

addItem

public Item addItem(Object itemId)
             throws UnsupportedOperationException
Deprecated. 
Creates new Item with the given ID into the Container.

Specified by:
addItem in interface Container
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.

addItem

public Object addItem()
               throws UnsupportedOperationException
Deprecated. 
Creates a new Item into the Container, and assign it an ID.

Specified by:
addItem in interface Container
Returns:
ID of the newly created Item, or null if it fails.
Throws:
UnsupportedOperationException - if the addItem method is not supported.

removeItem

public boolean removeItem(Object itemId)
                   throws UnsupportedOperationException
Deprecated. 
Removes the Item identified by ItemId from the Container.

Specified by:
removeItem in interface Container
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.

addContainerProperty

public boolean addContainerProperty(Object propertyId,
                                    Class<?> type,
                                    Object defaultValue)
                             throws UnsupportedOperationException
Deprecated. 
Adds new Property to all Items in the Container.

Specified by:
addContainerProperty in interface Container
Parameters:
propertyId - ID of the Property
type - Data type of the new Property
defaultValue - 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.

removeContainerProperty

public boolean removeContainerProperty(Object propertyId)
                                throws UnsupportedOperationException
Deprecated. 
Removes a Property specified by the given Property ID from the Container.

Specified by:
removeContainerProperty in interface Container
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.

removeAllItems

public boolean removeAllItems()
                       throws UnsupportedOperationException
Deprecated. 
Removes all Items from the Container.

Specified by:
removeAllItems in interface Container
Returns:
true if the operation succeeded; false otherwise.
Throws:
UnsupportedOperationException - if the removeAllItems method is not supported.

addItemAfter

public Item addItemAfter(Object previousItemId,
                         Object newItemId)
                  throws UnsupportedOperationException
Deprecated. 
Adds new item after the given item.

Specified by:
addItemAfter in interface Container.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

addItemAfter

public Object addItemAfter(Object previousItemId)
                    throws UnsupportedOperationException
Deprecated. 
Adds new item after the given item.

Specified by:
addItemAfter in interface Container.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

firstItemId

public Object firstItemId()
Deprecated. 
Returns id of first item in the Container.

Specified by:
firstItemId in interface Container.Ordered
Returns:
ID of the first Item in the list.

isFirstId

public boolean isFirstId(Object id)
Deprecated. 
Returns true if given id is first id at first index.

Specified by:
isFirstId in interface Container.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

isLastId

public boolean isLastId(Object id)
Deprecated. 
Returns true if given id is last id at last index.

Specified by:
isLastId in interface Container.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

lastItemId

public Object lastItemId()
Deprecated. 
Returns id of last item in the Container.

Specified by:
lastItemId in interface Container.Ordered
Returns:
ID of the last Item.

nextItemId

public Object nextItemId(Object id)
Deprecated. 
Returns id of next item in container at next index.

Specified by:
nextItemId in interface Container.Ordered
Parameters:
id - ID of an Item in the Container.
Returns:
ID of the next Item or null.

prevItemId

public Object prevItemId(Object id)
Deprecated. 
Returns id of previous item in container at previous index.

Specified by:
prevItemId in interface Container.Ordered
Parameters:
id - ID of an Item in the Container.
Returns:
ID of the previous Item or null.

finalize

public void finalize()
Deprecated. 
Closes the statement.

Overrides:
finalize in class Object
See Also:
close()

addItemAt

public Item addItemAt(int index,
                      Object newItemId)
               throws UnsupportedOperationException
Deprecated. 
Adds the given item at the position of given index.

Specified by:
addItemAt in interface Container.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.

addItemAt

public Object addItemAt(int index)
                 throws UnsupportedOperationException
Deprecated. 
Adds item at the position of provided index in the container.

Specified by:
addItemAt in interface Container.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.

getIdByIndex

public Object getIdByIndex(int index)
Deprecated. 
Gets the Index id in the container.

Specified by:
getIdByIndex in interface Container.Indexed
Parameters:
index - Index Id.
Returns:
ID in the given index.

indexOfId

public int indexOfId(Object id)
Deprecated. 
Gets the index of the Item corresponding to id in the container.

Specified by:
indexOfId in interface Container.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


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.