velosurf.model
Class Action

java.lang.Object
  |
  +--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  DBConnection mDB
          the satabase connection
protected  java.lang.String mName
          the name of this action
protected  java.util.List mParamNames
          parameter names of this action
protected  java.lang.String mQuery
          query of this action
 
Constructor Summary
Action(DBConnection inDB, org.jdom.Element inJDOMAction)
          Constructor
 
Method Summary
 java.util.List buildArrayList(DataAccessor inSource)
          get the list of values for all parameters
protected  void defineQuery(org.jdom.Element inJDOMAction)
          define the query from the XML tree
 DBConnection getDB()
          get the database connection
 java.lang.String getName()
          get the name of the action
static boolean isTransaction(org.jdom.Element inElement)
          checks whether the action defined by this XML tree is a simple action or a transaction
 int perform(DataAccessor inSource)
          executes this action
 java.lang.String toString()
          for debugging purpose
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

mDB

protected DBConnection mDB
the satabase connection

mName

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

mParamNames

protected java.util.List mParamNames
parameter names of this action

mQuery

protected java.lang.String mQuery
query of this action
Constructor Detail

Action

public Action(DBConnection inDB,
              org.jdom.Element inJDOMAction)
Constructor
Parameters:
inDB - database connection
inJDOMAction - the XML tree for this action
Method Detail

defineQuery

protected void defineQuery(org.jdom.Element inJDOMAction)
define the query from the XML tree
Parameters:
inJDOMAction - the XML tree

perform

public int perform(DataAccessor inSource)
            throws java.sql.SQLException
executes this action
Parameters:
inSource - 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(DataAccessor inSource)
                              throws java.sql.SQLException
get the list of values for all parameters
Parameters:
inSource - 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 DBConnection getDB()
get the database connection
Returns:
the database connection

isTransaction

public static boolean isTransaction(org.jdom.Element inElement)
checks whether the action defined by this XML tree is a simple action or a transaction
Parameters:
inElement - XML tree defining an action
Returns:
true if the action is a transaction


ooOoo