|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfi.paatti.paattidatabaseutils.dbservice.querydelegates.PaattiQueryDelegate
public abstract class PaattiQueryDelegate
A base class for all other delegates. Has all the methods, fields etc. that are common in all other delegates.
This delegate does not implement RowIdChange-events, though it has its own implementation for informing about the acquired new row ID (see NewRowIdEvent).
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
static String |
ROWSTATUS_ACTIVE
The status for active row. |
static String |
ROWSTATUS_DELETED
The status for deleted row. |
| Constructor Summary | |
|---|---|
PaattiQueryDelegate(String tableName,
String idColumn,
String[] columnNames)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addNewiRowIdListener(NewRowIDListener listener)
Adds a NewRowIDListener to the list of listeners. |
protected void |
fireNewRowIdEvent(Object newRowId)
Fires an event after acquiring the new row ID from a succesful insert to the database. |
String |
getArrayAsStringWithAddedString(String[] array,
String fieldToBeLeftOut,
String stringToBeAdded,
boolean removeLastStringToBeAdded)
Creates a string from array adding the given string between arrays fields. |
String |
getArrayAsStringWithCommas(String[] allColumnNames)
Creates a String with all the column names from the given array. |
String |
getArrayAsStringWithCommasAndWithoutIdColumn(String[] allColumnNames,
String idColumn)
Creates a String with all the column names (except the id column) from the given array. |
String[] |
getColumnNames()
Returns the column names that are used in this delegate. |
com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper |
getContainsRowQueryStatement(Object... keys)
Inherited from FreeformStatementDelegate. |
String |
getContainsRowQueryString(Object... keys)
Inherited from FreeformStatementDelegate. |
String |
getCountQuery()
Inherited from FreeformStatementDelegate. |
com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper |
getCountStatement()
Returns the row count from the delegate's table. |
List<com.vaadin.data.Container.Filter> |
getFilters()
Returns the container filter list. |
String |
getFilterStringWithoutWhere(com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper sh,
boolean startWithAnd)
Creates a string from the list of filters, without the word 'WHERE'. |
String |
getIdColumn()
Returns the column name that is used as the main table's id column. |
String |
getInsertQueryString()
Uses the set tablename, id column and column names to create an insert string. |
String |
getInsertQueryString(String tableName,
String idColumn,
String[] allColumnNames)
Creates an insert query from the given parameters. |
List<com.vaadin.data.util.sqlcontainer.query.OrderBy> |
getOrderBys()
Returns the sorting rules (order by) list. |
String |
getQueryString(int offset,
int limit)
Inherited from FreeformStatementDelegate. |
String |
getTableName()
Returns the table name that is used as the delegate's "main" table. |
String |
getUpdateQueryString()
Uses the set tablename, id column and column names to create an update string. |
String |
getUpdateQueryString(String tableName,
String idColumn,
String[] allColumnNames)
Create an update String. |
String |
getValuesString(int numberOfValues)
Creates a string for inserting values. |
void |
removeNewRowIdListener(NewRowIDListener listener)
Removes a NewRowIDListener from the list of listeners. |
boolean |
removeRow(Connection conn,
com.vaadin.data.util.sqlcontainer.RowItem row)
Removes a row by setting its rowStatus to 'DELETED'. |
void |
setFilters(List<com.vaadin.data.Container.Filter> filters)
Sets the delegate's container filters. |
void |
setOrderBy(List<com.vaadin.data.util.sqlcontainer.query.OrderBy> orderBys)
Sets the delegate's OrderBys. |
protected abstract void |
setRowValues(PreparedStatement statement,
com.vaadin.data.util.sqlcontainer.RowItem row)
Sets the values for the row. |
abstract int |
storeRow(Connection conn,
com.vaadin.data.util.sqlcontainer.RowItem row)
Stores a row in the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.vaadin.data.util.sqlcontainer.query.FreeformStatementDelegate |
|---|
getQueryStatement |
| Field Detail |
|---|
public static final String ROWSTATUS_DELETED
public static final String ROWSTATUS_ACTIVE
| Constructor Detail |
|---|
public PaattiQueryDelegate(String tableName,
String idColumn,
String[] columnNames)
tableName - The name of the database table.idColumn - The name of the id column in the database table.columnNames - The column names.| Method Detail |
|---|
protected void fireNewRowIdEvent(Object newRowId)
newRowId - The new row ID.public void addNewiRowIdListener(NewRowIDListener listener)
listener - The listener to be added.public void removeNewRowIdListener(NewRowIDListener listener)
listener - The listener to be removed.public com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper getCountStatement()
getCountStatement in interface com.vaadin.data.util.sqlcontainer.query.FreeformStatementDelegate
public String getInsertQueryString(String tableName,
String idColumn,
String[] allColumnNames)
tableName - The name of the table.idColumn - The name of the table id column.allColumnNames - The column names.
public String getInsertQueryString()
getInsertQueryString()
public String getUpdateQueryString(String tableName,
String idColumn,
String[] allColumnNames)
tableName - The name of the table.idColumn - The name of the id column.allColumnNames - The array holding all the column names.
public String getUpdateQueryString()
getUpdateQueryString()
public abstract int storeRow(Connection conn,
com.vaadin.data.util.sqlcontainer.RowItem row)
throws SQLException
storeRow in interface com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegateconn - The database connection.row - The row where the values will be set.
SQLException
protected abstract void setRowValues(PreparedStatement statement,
com.vaadin.data.util.sqlcontainer.RowItem row)
throws SQLException
statement - The prepared statement where the values will be set.row - The row where the values will be taken from.
SQLException
public boolean removeRow(Connection conn,
com.vaadin.data.util.sqlcontainer.RowItem row)
throws SQLException
removeRow in interface com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegateconn - The database connectionrow - The row where the values will be set.
SQLExceptionpublic void setFilters(List<com.vaadin.data.Container.Filter> filters)
setFilters in interface com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegatefilters - The list of container filters.public void setOrderBy(List<com.vaadin.data.util.sqlcontainer.query.OrderBy> orderBys)
setOrderBy in interface com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegateorderBys - The list of sorting rules.public String getArrayAsStringWithCommas(String[] allColumnNames)
allColumnNames - The array of column names.
public String getArrayAsStringWithCommasAndWithoutIdColumn(String[] allColumnNames,
String idColumn)
allColumnNames - The array of column names.idColumn - The name of the id column.
public String getValuesString(int numberOfValues)
numberOfValues - The values count.
public String getArrayAsStringWithAddedString(String[] array,
String fieldToBeLeftOut,
String stringToBeAdded,
boolean removeLastStringToBeAdded)
array - The array.fieldToBeLeftOut - The field that will be left out. Set to null if
all the fields should be included.stringToBeAdded - The suffix for all the fields of the array.removeLastStringToBeAdded - Should the last added string be removed
or not.
public String getFilterStringWithoutWhere(com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper sh,
boolean startWithAnd)
sh - StatementHelperstartWithAnd - Whether the string should start with 'AND' or not.
public String getTableName()
public String getIdColumn()
public String[] getColumnNames()
public List<com.vaadin.data.Container.Filter> getFilters()
public List<com.vaadin.data.util.sqlcontainer.query.OrderBy> getOrderBys()
public com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper getContainsRowQueryStatement(Object... keys)
throws UnsupportedOperationException
getContainsRowQueryStatement in interface com.vaadin.data.util.sqlcontainer.query.FreeformStatementDelegateUnsupportedOperationException
public String getCountQuery()
throws UnsupportedOperationException
getCountQuery in interface com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegateUnsupportedOperationException
public String getContainsRowQueryString(Object... keys)
throws UnsupportedOperationException
getContainsRowQueryString in interface com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegateUnsupportedOperationException
public String getQueryString(int offset,
int limit)
throws UnsupportedOperationException
getQueryString in interface com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegateUnsupportedOperationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||