velosurf.model
Class Action

java.lang.Object
  extended by velosurf.model.Action
Direct Known Subclasses:
Transaction

public class Action
extends java.lang.Object

This class correspond to custom update and delete queries

Author:
Claude Brisson

Field Summary
protected  Database db
          the satabase connection
protected  Entity entity
          the entity this action belongs to
protected  java.lang.String name
          the name of this action
protected  java.util.List<java.lang.String> paramNames
          parameter names of this action
protected  java.lang.String query
          query of this action
 
Constructor Summary
Action(java.lang.String name, Entity entity)
          Constructor
 
Method Summary
 void addParamName(java.lang.String paramName)
           
 java.util.List buildArrayList(ReadOnlyMap source)
          get the list of values for all parameters
 Database getDB()
          get the database connection
 java.lang.String getName()
          get the name of the action
 int perform(ReadOnlyMap source)
          executes this action
 void setQuery(java.lang.String query)
           
 java.lang.String toString()
          for debugging purpose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

db

protected Database db
the satabase connection


entity

protected Entity entity
the entity this action belongs to


name

protected java.lang.String name
the name of this action


paramNames

protected java.util.List<java.lang.String> paramNames
parameter names of this action


query

protected java.lang.String query
query of this action

Constructor Detail

Action

public Action(java.lang.String name,
              Entity entity)
Constructor

Parameters:
name - name
entity - entity
Method Detail

addParamName

public void addParamName(java.lang.String paramName)

setQuery

public void setQuery(java.lang.String query)

perform

public int perform(ReadOnlyMap source)
            throws java.sql.SQLException
executes this action

Parameters:
source - the object on which apply the action
Returns:
number of impacted rows
Throws:
java.sql.SQLException - an SQL problem occurs

buildArrayList

public java.util.List buildArrayList(ReadOnlyMap source)
                              throws java.sql.SQLException
get the list of values for all parameters

Parameters:
source - the DataAccessor
Returns:
the list of values
Throws:
java.sql.SQLException - thrown by the DataAccessor

getName

public java.lang.String getName()
get the name of the action

Returns:
the name

toString

public java.lang.String toString()
for debugging purpose

Overrides:
toString in class java.lang.Object
Returns:
definition string

getDB

public Database getDB()
get the database connection

Returns:
the database connection


~ooOoo~