velosurf.model
Class Attribute

java.lang.Object
  |
  +--velosurf.model.Attribute

public class Attribute
extends java.lang.Object

This class represents an attribute in the object model

Author:
Claude Brisson

Field Summary
protected  DBConnection mDB
          database connection
protected  Entity mEntity
          parent entity
protected  java.lang.String mName
          name
protected  java.util.List mParamNames
          list of the parameter names
protected  java.lang.String mQuery
          attribute query
protected  Entity mResultEntity
          for row and rowset attributes, the resulting entity (if specified)
protected  int mType
          attribute type
static int ROW
          constant meaning the result is a single row
static int ROWSET
          constant meaning the result is a rowset
static int SCALAR
          constant meaning the result is a scalar
static int UNDEFINED
          constant meaning the return type is undefined
 
Constructor Summary
Attribute(DBConnection inDB, java.lang.String inDefinition)
          Deprecated. builds a new Attribute
Attribute(Entity inEntity, org.jdom.Element inJDOMAttribute)
          builds a new attribute
 
Method Summary
 java.util.List buildArrayList(DataAccessor inSource)
          builds the list of parameter values - do not use directly
 java.lang.Object evaluate(DataAccessor inSource)
          evaluate this scalar attribute
 java.lang.Object fetch(DataAccessor inSource)
          fetch the row result of this attribute
 DBConnection getDB()
          gets the database connection
 java.lang.String getName()
          gets the name of the attribute
 int getType()
          gets the type of this attribute
 RowIterator query(DataAccessor inSource)
          query the resultset for this multivalued attribute
 RowIterator query(DataAccessor inSource, java.util.List inRefineCriteria, java.lang.String inOrder)
          query the rowset for this attribute
 java.lang.String toString()
          debug method
 int update(DataAccessor inSource)
          do an update via this attribute : deprecated, prefer to use an action instead
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
constant meaning the return type is undefined

ROW

public static final int ROW
constant meaning the result is a single row

ROWSET

public static final int ROWSET
constant meaning the result is a rowset

SCALAR

public static final int SCALAR
constant meaning the result is a scalar

mDB

protected DBConnection mDB
database connection

mName

protected java.lang.String mName
name

mEntity

protected Entity mEntity
parent entity

mResultEntity

protected Entity mResultEntity
for row and rowset attributes, the resulting entity (if specified)

mParamNames

protected java.util.List mParamNames
list of the parameter names

mQuery

protected java.lang.String mQuery
attribute query

mType

protected int mType
attribute type
Constructor Detail

Attribute

public Attribute(DBConnection inDB,
                 java.lang.String inDefinition)
          throws java.io.IOException,
                 java.sql.SQLException
Deprecated. builds a new Attribute

Parameters:
inDB - database connection
inDefinition - string definition for this attribute
Throws:
java.io.IOException - the definition is not valid
java.sql.SQLException - thrown by the database

Attribute

public Attribute(Entity inEntity,
                 org.jdom.Element inJDOMAttribute)
builds a new attribute
Parameters:
inEntity - parent entity
inJDOMAttribute - XML tree for this attribute
Method Detail

fetch

public java.lang.Object fetch(DataAccessor inSource)
                       throws java.sql.SQLException
fetch the row result of this attribute
Parameters:
inSource - source object
Returns:
instance fetched
Throws:
java.sql.SQLException - when thrown by the database

query

public RowIterator query(DataAccessor inSource)
                  throws java.sql.SQLException
query the resultset for this multivalued attribute
Parameters:
inSource - the source object
Returns:
the resulting row iterator
Throws:
java.sql.SQLException - when thrown from the database

query

public RowIterator query(DataAccessor inSource,
                         java.util.List inRefineCriteria,
                         java.lang.String inOrder)
                  throws java.sql.SQLException
query the rowset for this attribute
Parameters:
inSource - source object
inRefineCriteria - refine criteria
inOrder - order clause
Returns:
the resulting row iterator
Throws:
java.sql.SQLException - when thrown by the database

evaluate

public java.lang.Object evaluate(DataAccessor inSource)
                          throws java.sql.SQLException
evaluate this scalar attribute
Parameters:
inSource - source object
Returns:
the resulting scalar
Throws:
java.sql.SQLException - when thrown from the database

update

public int update(DataAccessor inSource)
           throws java.sql.SQLException
do an update via this attribute : deprecated, prefer to use an action instead
Parameters:
inSource - source object
Returns:
the numer of affected rows
Throws:
java.sql.SQLException - when thrown from the database

getType

public int getType()
gets the type of this attribute
Returns:
this attribute's type

buildArrayList

public java.util.List buildArrayList(DataAccessor inSource)
                              throws java.sql.SQLException
builds the list of parameter values - do not use directly
Parameters:
inSource - source object
Returns:
the built list
Throws:
java.sql.SQLException - thrown by the database engine

getName

public java.lang.String getName()
gets the name of the attribute
Returns:
name of the attribute

toString

public java.lang.String toString()
debug method
Overrides:
toString in class java.lang.Object
Returns:
the definition string of this attribute

getDB

public DBConnection getDB()
gets the database connection
Returns:
database connection


ooOoo