com.vaadin.data.util.sqlcontainer.query
Interface FreeformQueryDelegate

All Superinterfaces:
Serializable
All Known Subinterfaces:
FreeformStatementDelegate

public interface FreeformQueryDelegate
extends Serializable


Method Summary
 String getContainsRowQueryString(Object... keys)
          Deprecated. Implement FreeformStatementDelegate instead of FreeformQueryDelegate
 String getCountQuery()
          Deprecated. Implement FreeformStatementDelegate instead of FreeformQueryDelegate
 String getQueryString(int offset, int limit)
          Deprecated. Implement FreeformStatementDelegate instead of FreeformQueryDelegate
 boolean removeRow(Connection conn, RowItem row)
          Removes the given RowItem from the database.
 void setFilters(List<Container.Filter> filters)
          Sets the filters to apply when performing the SQL query.
 void setOrderBy(List<OrderBy> orderBys)
          Sets the order in which to retrieve rows from the database.
 int storeRow(Connection conn, RowItem row)
          Stores a row in the database.
 

Method Detail

getQueryString

@Deprecated
String getQueryString(int offset,
                                 int limit)
                      throws UnsupportedOperationException
Deprecated. Implement FreeformStatementDelegate instead of FreeformQueryDelegate

Should return the SQL query string to be performed. This method is responsible for gluing together the select query from the filters and the order by conditions if these are supported.

Parameters:
offset - the first record (row) to fetch.
pagelength - the number of records (rows) to fetch. 0 means all records starting from offset.
Throws:
UnsupportedOperationException

getCountQuery

@Deprecated
String getCountQuery()
                     throws UnsupportedOperationException
Deprecated. Implement FreeformStatementDelegate instead of FreeformQueryDelegate

Generates and executes a query to determine the current row count from the DB. Row count will be fetched using filters that are currently set to the QueryDelegate.

Returns:
row count
Throws:
SQLException
UnsupportedOperationException

setFilters

void setFilters(List<Container.Filter> filters)
                throws UnsupportedOperationException
Sets the filters to apply when performing the SQL query. These are translated into a WHERE clause. Default filtering mode will be used.

Parameters:
filters - The filters to apply.
Throws:
UnsupportedOperationException - if the implementation doesn't support filtering.

setOrderBy

void setOrderBy(List<OrderBy> orderBys)
                throws UnsupportedOperationException
Sets the order in which to retrieve rows from the database. The result can be ordered by zero or more columns and each column can be in ascending or descending order. These are translated into an ORDER BY clause in the SQL query.

Parameters:
orderBys - A list of the OrderBy conditions.
Throws:
UnsupportedOperationException - if the implementation doesn't support ordering.

storeRow

int storeRow(Connection conn,
             RowItem row)
             throws UnsupportedOperationException,
                    SQLException
Stores a row in the database. The implementation of this interface decides how to identify whether to store a new row or update an existing one.

Parameters:
conn - the JDBC connection to use
row - RowItem to be stored or updated.
Throws:
UnsupportedOperationException - if the implementation is read only.
SQLException

removeRow

boolean removeRow(Connection conn,
                  RowItem row)
                  throws UnsupportedOperationException,
                         SQLException
Removes the given RowItem from the database.

Parameters:
conn - the JDBC connection to use
row - RowItem to be removed
Returns:
true on success
Throws:
UnsupportedOperationException
SQLException

getContainsRowQueryString

@Deprecated
String getContainsRowQueryString(Object... keys)
                                 throws UnsupportedOperationException
Deprecated. Implement FreeformStatementDelegate instead of FreeformQueryDelegate

Generates an SQL Query string that allows the user of the FreeformQuery class to customize the query string used by the FreeformQuery.containsRowWithKeys() method. This is useful for cases when the logic in the containsRowWithKeys method is not enough to support more complex free form queries.

Parameters:
keys - the values of the primary keys
Throws:
UnsupportedOperationException - to use the default logic in FreeformQuery


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