fi.paatti.paattidatabaseutils.dbservice.querydelegates
Class TaskQueryDelegate

java.lang.Object
  extended by fi.paatti.paattidatabaseutils.dbservice.querydelegates.PaattiQueryDelegate
      extended by fi.paatti.paattidatabaseutils.dbservice.querydelegates.TaskQueryDelegate
All Implemented Interfaces:
com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegate, com.vaadin.data.util.sqlcontainer.query.FreeformStatementDelegate, Serializable

public class TaskQueryDelegate
extends PaattiQueryDelegate

A delegate for TASK table.

Since:
0.0.2
Author:
Lauri Satokangas, lauri.n.satokangas@student.jyu.fi
See Also:
Serialized Form
 

Field Summary
 
Fields inherited from class fi.paatti.paattidatabaseutils.dbservice.querydelegates.PaattiQueryDelegate
ROWSTATUS_ACTIVE, ROWSTATUS_DELETED
 
Constructor Summary
TaskQueryDelegate(Object eventId)
          Constructor.
 
Method Summary
 com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper getCountStatement()
          Returns the row count from the delegate's table.
 com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper getQueryStatement(int offset, int limit)
          Get the StatementHelper for the SELECT-query.
 void setRowValues(PreparedStatement statement, com.vaadin.data.util.sqlcontainer.RowItem row)
          Sets the values for the row.
 int storeRow(Connection conn, com.vaadin.data.util.sqlcontainer.RowItem row)
          Stores a row in the database.
 
Methods inherited from class fi.paatti.paattidatabaseutils.dbservice.querydelegates.PaattiQueryDelegate
addNewiRowIdListener, fireNewRowIdEvent, getArrayAsStringWithAddedString, getArrayAsStringWithCommas, getArrayAsStringWithCommasAndWithoutIdColumn, getColumnNames, getContainsRowQueryStatement, getContainsRowQueryString, getCountQuery, getFilters, getFilterStringWithoutWhere, getIdColumn, getInsertQueryString, getInsertQueryString, getOrderBys, getQueryString, getTableName, getUpdateQueryString, getUpdateQueryString, getValuesString, removeNewRowIdListener, removeRow, setFilters, setOrderBy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskQueryDelegate

public TaskQueryDelegate(Object eventId)
Constructor.

Parameters:
eventId - The ID of the event.
Method Detail

storeRow

public int storeRow(Connection conn,
                    com.vaadin.data.util.sqlcontainer.RowItem row)
             throws SQLException
Stores a row in the database.

Specified by:
storeRow in interface com.vaadin.data.util.sqlcontainer.query.FreeformQueryDelegate
Specified by:
storeRow in class PaattiQueryDelegate
Parameters:
conn - The database connection.
row - The row where the values will be set.
Returns:
The number of affected rows in the database.
Throws:
SQLException

setRowValues

public void setRowValues(PreparedStatement statement,
                         com.vaadin.data.util.sqlcontainer.RowItem row)
                  throws SQLException
Sets the values for the row.

The column order is (taken from the PaattiColumnNames:

TASK_rowStatus
TASK_TASKTYPE_taskTypeID
TASK_EVENT_eventID
TASK_sequence
TASK_url
TASK_content
TASK_description
TASK_taskID

Specified by:
setRowValues in class PaattiQueryDelegate
Parameters:
statement - The prepared statement where the values will be set.
row - The row where the values will be taken from.
Throws:
SQLException

getQueryStatement

public com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper getQueryStatement(int offset,
                                                                                           int limit)
Get the StatementHelper for the SELECT-query.

Parameters:
offset - Starting row
limit - Number of rows to get.
Returns:
@throws UnsupportedOperationException

getCountStatement

public com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper getCountStatement()
                                                                                    throws UnsupportedOperationException
Returns the row count from the delegate's table.

SELECT COUNT (*) FROM [table]

If the filters are set they are used in the query.

Specified by:
getCountStatement in interface com.vaadin.data.util.sqlcontainer.query.FreeformStatementDelegate
Overrides:
getCountStatement in class PaattiQueryDelegate
Returns:
@throws UnsupportedOperationException.
Throws:
UnsupportedOperationException


Copyright © 2012. All Rights Reserved.