org.tentackle.appworx
Class DefaultQbfPlugin

java.lang.Object
  extended by org.tentackle.appworx.DefaultQbfPlugin
All Implemented Interfaces:
QbfPlugin

public class DefaultQbfPlugin
extends Object
implements QbfPlugin

The default implementation of a QbfPlugin.

Author:
harald

Field Summary
protected  DbCursor<? extends AppDbObject> cursor
           
protected  Collection<? extends AppDbObject> list
           
protected  QbfParameter parameter
           
protected  int rowCount
           
 
Constructor Summary
DefaultQbfPlugin(Class<? extends AppDbObject> clazz, ContextDb contextDb)
          Creates a plugin for a class and database context
DefaultQbfPlugin(QbfParameter parameter)
          Creates a plugin from a parameter.
 
Method Summary
 void cleanup()
          Closes the plugin and release all ressources (esp.
 boolean executeQuery()
          Executes the query.
 DbCursor<? extends AppDbObject> getCursor()
           
 Collection<? extends AppDbObject> getObjects()
          Gets the query result as a collection of objects.
 QbfPanel getPanel()
          Determines the panel to enter the search criteria.
 QbfParameter getParameter()
          Gets the search criteria (usually entered by the user).
 int getRowCount()
          Gets the number of objects.
 boolean isParameterValid()
          Performs a validation of the search criteria.
 boolean isResultDisplayable()
          Checks whether the result is displayable, i.e.
 AppDbObject newAppDbObject()
          Creates a new object in the database context of the plugin.
 String notFoundMessage()
          Returns a message for "no such data found..." or whatever.
 void setCursor(DbCursor<? extends AppDbObject> cursor)
          Sets the cursor.
 void setObjects(Collection<? extends AppDbObject> objects)
          Sets the objects.
 void setParameter(QbfParameter parameter)
          Initializes the search criteria.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameter

protected QbfParameter parameter

cursor

protected DbCursor<? extends AppDbObject> cursor

list

protected Collection<? extends AppDbObject> list

rowCount

protected int rowCount
Constructor Detail

DefaultQbfPlugin

public DefaultQbfPlugin(QbfParameter parameter)
Creates a plugin from a parameter.

Parameters:
parameter - the qbf parameter

DefaultQbfPlugin

public DefaultQbfPlugin(Class<? extends AppDbObject> clazz,
                        ContextDb contextDb)
Creates a plugin for a class and database context

Parameters:
clazz - the data object class
contextDb - the database context
Method Detail

cleanup

public void cleanup()
Description copied from interface: QbfPlugin
Closes the plugin and release all ressources (esp. the cursor, if any)

Specified by:
cleanup in interface QbfPlugin

executeQuery

public boolean executeQuery()
Description copied from interface: QbfPlugin
Executes the query.

Specified by:
executeQuery in interface QbfPlugin
Returns:
true if some records found, false if nothing found

getCursor

public DbCursor<? extends AppDbObject> getCursor()
Specified by:
getCursor in interface QbfPlugin

setCursor

public void setCursor(DbCursor<? extends AppDbObject> cursor)
Sets the cursor.

Parameters:
cursor - the cursor

getObjects

public Collection<? extends AppDbObject> getObjects()
Description copied from interface: QbfPlugin
Gets the query result as a collection of objects.

Specified by:
getObjects in interface QbfPlugin
Returns:
the collection, never null

setObjects

public void setObjects(Collection<? extends AppDbObject> objects)
Sets the objects.

Parameters:
objects - the collection

getPanel

public QbfPanel getPanel()
Description copied from interface: QbfPlugin
Determines the panel to enter the search criteria.

Specified by:
getPanel in interface QbfPlugin
Returns:
the search panel

setParameter

public void setParameter(QbfParameter parameter)
Description copied from interface: QbfPlugin
Initializes the search criteria.

Specified by:
setParameter in interface QbfPlugin
Parameters:
parameter - the qbf parameter

getParameter

public QbfParameter getParameter()
Description copied from interface: QbfPlugin
Gets the search criteria (usually entered by the user).

Specified by:
getParameter in interface QbfPlugin
Returns:
the qbf parameter

isParameterValid

public boolean isParameterValid()
Description copied from interface: QbfPlugin
Performs a validation of the search criteria.

Specified by:
isParameterValid in interface QbfPlugin
Returns:
true if running the query is ok

isResultDisplayable

public boolean isResultDisplayable()
Description copied from interface: QbfPlugin
Checks whether the result is displayable, i.e. will not cause any further problems if displayed.

Specified by:
isResultDisplayable in interface QbfPlugin
Returns:
true if result is displayable

newAppDbObject

public AppDbObject newAppDbObject()
Description copied from interface: QbfPlugin
Creates a new object in the database context of the plugin.

Specified by:
newAppDbObject in interface QbfPlugin
Returns:
the newly created object

notFoundMessage

public String notFoundMessage()
Description copied from interface: QbfPlugin
Returns a message for "no such data found..." or whatever.

Specified by:
notFoundMessage in interface QbfPlugin
Returns:
the message

getRowCount

public int getRowCount()
Description copied from interface: QbfPlugin
Gets the number of objects. Keep in mind that using this method on a cursor based query will read all objects to determine the size of the result set.

Specified by:
getRowCount in interface QbfPlugin
Returns:
the number of objects


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de