com.extentech.ExtenBean
Class DataObjectImpl

java.lang.Object
  extended by com.extentech.ExtenBean.DataObjectImpl
All Implemented Interfaces:
DataObject, RelationalObject, SimpleDataObject, SQLObject, Serializable, Runnable
Direct Known Subclasses:
ExtenBeanTreeNode, ExtenDataObject, NamedRangeDataObject, XMLDataObject

public abstract class DataObjectImpl
extends Object
implements DataObject, RelationalObject, Serializable, Runnable

A concrete implementation of DataObject and RelationalObject

Version:
1.1
Author:
John McMahon
See Also:
DataObjectFactory, DataObject, colinfo, Serialized Form

Field Summary
 Vector dataObjectActionListeners
           
 DataObject doparent
           
static String EXTENBEAN_LOADER_NAME
           
 com.extentech.toolkit.ResourceLoader props
           
 
Constructor Summary
DataObjectImpl()
           
 
Method Summary
 void addChildObject(RelationalObject o)
           
 void addDataObjectActionListener(DataObjectActionListener e)
          add a DataObjectActionListener
 void addOrderByItem(int idx, Object obj)
          Maintain a numeric lookup for this DataObject.
 boolean beginTrans()
          A simple roll-back mechanism copies the data to a backup hashtable, then waits for a commit from factory.
 void dumpNameVals()
          a convenience method for debugging which outputs all names and values for the data in this object.
 void dumpNameVals(PrintStream out)
           
 void fireDataObjectActionEvent(DataObject dob)
          fires a DataObjectAction event
 Vector getAllChildrenInHeirarchy()
          returns a vector containing all of the children of this object, as well as all of the children of the children objects, their children's children, and any other children hanging about.
 boolean getCascadeUpdates()
          get whether or not to cascade the updates to child dataobjects
 int getChangedRowCount()
           
 Object[] getChangedRows()
           
 DataObject getChildByName(String name)
          Find a child DataObject
 List getChildObjects()
          return a Listof all Child Objects
 List getChildrenByName(String name)
          Find all child DataObjects by name
 colinfo[] getColinfo()
          Returns the column metadata for this row of data.
 colinfo getColinfoByName(String colname)
           
 Vector getColnames()
           
 List getColNames()
          returns a list of the colnames
 int getColNumByName(String colname)
          Find the column number in the data array which contains the column represented by this columnname.
 Map getData()
           
 Object[] getDataArray()
          This returns only the first row of the data array as an array of objects.
 List getDataObjectActionListeners()
          retrurns all of the DataObjectActionListeners for this DataObject
 Object[] getDataRow(int idx)
          get the data Object Array at the specified index.
 String getDOLookupField()
           
 PersistenceEngine getFactory()
          provide a handle to the factory for EJB-style persistence.
 int getId()
           
 boolean getIsMultiKey()
           
 boolean getIsMultiple()
           
 boolean getIsNew()
           
 boolean getIsUpdateable()
           
 colinfo getKeyCol()
           
 String getKeyColName()
          get the key column name for this dataobject
 int getLevel()
           
 int getNumRows()
           
 Hashtable getOrderByHash()
           
 String getParentForeignKey()
           
 int getParentId()
          get the unique id of the parent object
 RelationalObject getParentObject()
           
 com.extentech.toolkit.ResourceLoader getProps()
           
 String getSQL()
           
 String getStringVal(int idx, String key)
          return the String value for the named column (field) at the row index specified ie: '0' for singleton DataObjects
 String getStringVal(String c)
           
 String getTableName()
          This returns the name of the table associated with the DataObject.
 Object getVal(int idx, String key)
          Look up the key value, return the String value of the first field.
 Object getVal(Object key, String field)
          Get value for field at the specified index.
 Object getVal(String key)
          Look up the key value, return the String value of the first field.
 boolean hasChildren()
           
 void initFromDataObject(DataObject dobj)
          init with an alternate DataObject type
 boolean isNew()
           
 boolean isPageable()
           
 void load()
          A container invokes this method to instruct the instance to synchronize its state by loading it state from the underlying database.
 void passivate()
          A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object.
 void remove()
          A container invokes this method before it removes the EJB object that is currently associated with the instance.
 void removeAll()
           
 void removeByKey(Object key)
           
 void removeChangedRow(Object o)
          removes a changed row identified by the Object index
 void removeChangedRows()
           
 void removeDataObjectActionListener(DataObjectActionListener e)
          remove a DataObjectActionListener
 void removeDataObjectActionListeners()
          remove a DataObjectActionListener
 boolean rollBack()
          A simple roll-back mechanism copies the data back from a backup hashtable, then waits for a DB update from factory.
 void run()
           
 void setCascadeUpdates(boolean b)
          set whether or not to cascade the updates to child dataobjects
 void setColinfo(colinfo[] c)
          set the array of colinfos for this DataObject
 void setData(Map d)
           
 void setDataRowChanged(int idx)
           
 void setDataRowChanged(Object idx)
           
 void setDEBUG(boolean b)
           
 void setDOLookupField(String s)
          set the lookup (unique id) field for this DataObject
 void setFactory(PersistenceEngine f)
          provide a handle to the factory for ejb-style persistence.
 void setHasChildren(boolean b)
           
 void setId(int d)
          set the Id for this DataObject
 void setIsMultiple(boolean b)
           
 void setIsNew(boolean n)
           
 void setIsUpdateable(boolean b)
           
 void setKeyCol(colinfo c)
           
 void setKeyCol(String c)
          Set the key column for this DataObject Manually
 void setLevel(int i)
          the level indicates the depth of this object in a Relational Heirarchy
 void setParent(RelationalObject par)
          set the parent DataObject for this child
 void setParentForeignKey(String fldname)
          set the key name of the parent DataObject
 void setProps(com.extentech.toolkit.ResourceLoader loader)
           
 void setSQL(String sql)
          set the SQL for this XDO
 void setTableName(String t)
           
 void setVal(int idx, String key, Object val)
          update the value in the data object array pointed to by the index value
 void setVal(Object idx, Object key, Object val)
          update the value in the data object array pointed to by the index value
 void setVal(String key, Object val)
          update the first value in the data object array pointed to by the index value
 void store()
          A container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.extentech.ExtenBean.DataObject
activate, init
 
Methods inherited from interface com.extentech.ExtenBean.SimpleDataObject
getDataObject
 

Field Detail

dataObjectActionListeners

public Vector dataObjectActionListeners

doparent

public DataObject doparent

props

public transient com.extentech.toolkit.ResourceLoader props

EXTENBEAN_LOADER_NAME

public static String EXTENBEAN_LOADER_NAME
Constructor Detail

DataObjectImpl

public DataObjectImpl()
Method Detail

getStringVal

public String getStringVal(String c)
Specified by:
getStringVal in interface SimpleDataObject

isNew

public boolean isNew()
Specified by:
isNew in interface SimpleDataObject

getColNames

public List getColNames()
Description copied from interface: SimpleDataObject
returns a list of the colnames

Specified by:
getColNames in interface SimpleDataObject
Returns:
See Also:
SimpleDataObject.getColNames()

run

public void run()
Specified by:
run in interface Runnable

toString

public String toString()
Overrides:
toString in class Object

getNumRows

public int getNumRows()
Specified by:
getNumRows in interface DataObject
Specified by:
getNumRows in interface SimpleDataObject

getChangedRowCount

public int getChangedRowCount()
Specified by:
getChangedRowCount in interface DataObject

setDEBUG

public void setDEBUG(boolean b)

addDataObjectActionListener

public void addDataObjectActionListener(DataObjectActionListener e)
Description copied from interface: DataObject
add a DataObjectActionListener

Specified by:
addDataObjectActionListener in interface DataObject

removeDataObjectActionListener

public void removeDataObjectActionListener(DataObjectActionListener e)
Description copied from interface: DataObject
remove a DataObjectActionListener

Specified by:
removeDataObjectActionListener in interface DataObject
Parameters:
e - - the dataobject to remvoe

removeDataObjectActionListeners

public void removeDataObjectActionListeners()
Description copied from interface: DataObject
remove a DataObjectActionListener

Specified by:
removeDataObjectActionListeners in interface DataObject

fireDataObjectActionEvent

public void fireDataObjectActionEvent(DataObject dob)
Description copied from interface: DataObject
fires a DataObjectAction event

Specified by:
fireDataObjectActionEvent in interface DataObject

setLevel

public void setLevel(int i)
the level indicates the depth of this object in a Relational Heirarchy

Specified by:
setLevel in interface RelationalObject

getLevel

public int getLevel()
Specified by:
getLevel in interface RelationalObject

hasChildren

public boolean hasChildren()
Specified by:
hasChildren in interface RelationalObject

setFactory

public void setFactory(PersistenceEngine f)
provide a handle to the factory for ejb-style persistence.

Specified by:
setFactory in interface DataObject

getFactory

public PersistenceEngine getFactory()
provide a handle to the factory for EJB-style persistence.

Specified by:
getFactory in interface DataObject

load

public void load()
          throws SQLException
A container invokes this method to instruct the instance to synchronize its state by loading it state from the underlying database.

Specified by:
load in interface DataObject
Specified by:
load in interface SimpleDataObject
Throws:
SQLException

passivate

public void passivate()
               throws SQLException
A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object.

Specified by:
passivate in interface DataObject
Throws:
SQLException

remove

public void remove()
            throws SQLException
A container invokes this method before it removes the EJB object that is currently associated with the instance.

Specified by:
remove in interface DataObject
Specified by:
remove in interface SimpleDataObject
Throws:
SQLException

setCascadeUpdates

public void setCascadeUpdates(boolean b)
set whether or not to cascade the updates to child dataobjects

Specified by:
setCascadeUpdates in interface DataObject

getCascadeUpdates

public boolean getCascadeUpdates()
get whether or not to cascade the updates to child dataobjects

Specified by:
getCascadeUpdates in interface DataObject

store

public void store()
           throws SQLException
A container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database.

Specified by:
store in interface DataObject
Specified by:
store in interface SimpleDataObject
Throws:
SQLException

getIsNew

public boolean getIsNew()
Specified by:
getIsNew in interface DataObject

setIsNew

public void setIsNew(boolean n)
Specified by:
setIsNew in interface DataObject

dumpNameVals

public void dumpNameVals()
a convenience method for debugging which outputs all names and values for the data in this object.


dumpNameVals

public void dumpNameVals(PrintStream out)

getStringVal

public String getStringVal(int idx,
                           String key)
Description copied from interface: DataObject
return the String value for the named column (field) at the row index specified ie: '0' for singleton DataObjects

Specified by:
getStringVal in interface DataObject
Specified by:
getStringVal in interface SimpleDataObject

getKeyColName

public String getKeyColName()
get the key column name for this dataobject

Specified by:
getKeyColName in interface SQLObject

setKeyCol

public void setKeyCol(colinfo c)
Specified by:
setKeyCol in interface SQLObject

setParentForeignKey

public void setParentForeignKey(String fldname)
set the key name of the parent DataObject

Specified by:
setParentForeignKey in interface SQLObject

getParentForeignKey

public String getParentForeignKey()
Specified by:
getParentForeignKey in interface SQLObject

getParentId

public int getParentId()
get the unique id of the parent object

Specified by:
getParentId in interface SQLObject

setParent

public void setParent(RelationalObject par)
set the parent DataObject for this child

Specified by:
setParent in interface RelationalObject

getParentObject

public RelationalObject getParentObject()
Specified by:
getParentObject in interface RelationalObject

setKeyCol

public void setKeyCol(String c)
Set the key column for this DataObject Manually

Specified by:
setKeyCol in interface SQLObject

getKeyCol

public colinfo getKeyCol()
Specified by:
getKeyCol in interface SQLObject

getIsMultiKey

public boolean getIsMultiKey()

rollBack

public boolean rollBack()
A simple roll-back mechanism copies the data back from a backup hashtable, then waits for a DB update from factory.

Specified by:
rollBack in interface SQLObject

beginTrans

public boolean beginTrans()
A simple roll-back mechanism copies the data to a backup hashtable, then waits for a commit from factory.

Specified by:
beginTrans in interface SQLObject

addOrderByItem

public void addOrderByItem(int idx,
                           Object obj)
Maintain a numeric lookup for this DataObject.

Specified by:
addOrderByItem in interface DataObject

getOrderByHash

public Hashtable getOrderByHash()
Specified by:
getOrderByHash in interface DataObject

getColinfo

public colinfo[] getColinfo()
Description copied from interface: DataObject
Returns the column metadata for this row of data.

Specified by:
getColinfo in interface DataObject
Specified by:
getColinfo in interface SimpleDataObject
Returns:
An array of colinfo objects containing

setColinfo

public void setColinfo(colinfo[] c)
Description copied from interface: DataObject
set the array of colinfos for this DataObject

Specified by:
setColinfo in interface DataObject

getColnames

public Vector getColnames()
Specified by:
getColnames in interface DataObject

getDataArray

public Object[] getDataArray()
This returns only the first row of the data array as an array of objects.


setDataRowChanged

public void setDataRowChanged(int idx)

setDataRowChanged

public void setDataRowChanged(Object idx)

getChangedRows

public Object[] getChangedRows()
Specified by:
getChangedRows in interface DataObject

removeChangedRow

public void removeChangedRow(Object o)
Description copied from interface: DataObject
removes a changed row identified by the Object index

Specified by:
removeChangedRow in interface DataObject

removeChangedRows

public void removeChangedRows()
Specified by:
removeChangedRows in interface DataObject

getTableName

public String getTableName()
This returns the name of the table associated with the DataObject. Used for update/insert/delete statements. SELECT * FROM LUMINET_CONFIG WHERE server_id = 0 ORDER BY PARAM_TYPE, DESCRIPTION

Specified by:
getTableName in interface SQLObject

setTableName

public void setTableName(String t)
Specified by:
setTableName in interface SQLObject

setIsUpdateable

public void setIsUpdateable(boolean b)
Specified by:
setIsUpdateable in interface SQLObject

getIsUpdateable

public boolean getIsUpdateable()
Specified by:
getIsUpdateable in interface SQLObject

setData

public void setData(Map d)
Specified by:
setData in interface SQLObject

initFromDataObject

public void initFromDataObject(DataObject dobj)
init with an alternate DataObject type


getData

public Map getData()
Specified by:
getData in interface DataObject

getSQL

public String getSQL()
Specified by:
getSQL in interface SQLObject

setSQL

public void setSQL(String sql)
set the SQL for this XDO

Specified by:
setSQL in interface SQLObject

getVal

public Object getVal(int idx,
                     String key)
Look up the key value, return the String value of the first field.

Specified by:
getVal in interface DataObject
Specified by:
getVal in interface SimpleDataObject

getVal

public Object getVal(String key)
Look up the key value, return the String value of the first field. String is the name of the field that you are getting. Look up the key value, then return the String value of the field at the named field.

Specified by:
getVal in interface DataObject
Specified by:
getVal in interface SimpleDataObject

getVal

public Object getVal(Object key,
                     String field)
Get value for field at the specified index. String is the name of the field that you are getting. Look up the key value, then return the String value of the field at the named field.

Specified by:
getVal in interface DataObject
Parameters:
key -
field -
Returns:

setVal

public void setVal(String key,
                   Object val)
update the first value in the data object array pointed to by the index value

Specified by:
setVal in interface DataObject
Specified by:
setVal in interface SimpleDataObject

setVal

public void setVal(int idx,
                   String key,
                   Object val)
update the value in the data object array pointed to by the index value

Specified by:
setVal in interface DataObject
Specified by:
setVal in interface SimpleDataObject

setVal

public void setVal(Object idx,
                   Object key,
                   Object val)
update the value in the data object array pointed to by the index value


getColinfoByName

public colinfo getColinfoByName(String colname)
Specified by:
getColinfoByName in interface DataObject
Specified by:
getColinfoByName in interface SimpleDataObject

getColNumByName

public int getColNumByName(String colname)
Find the column number in the data array which contains the column represented by this columnname.

Specified by:
getColNumByName in interface DataObject

getDataRow

public Object[] getDataRow(int idx)
get the data Object Array at the specified index.

Specified by:
getDataRow in interface DataObject
Specified by:
getDataRow in interface SimpleDataObject
Returns:
An array of values from a database

addChildObject

public void addChildObject(RelationalObject o)
Specified by:
addChildObject in interface RelationalObject

getChildObjects

public List getChildObjects()
Description copied from interface: RelationalObject
return a Listof all Child Objects

Specified by:
getChildObjects in interface RelationalObject
Returns:

getAllChildrenInHeirarchy

public Vector getAllChildrenInHeirarchy()
returns a vector containing all of the children of this object, as well as all of the children of the children objects, their children's children, and any other children hanging about.

Specified by:
getAllChildrenInHeirarchy in interface RelationalObject

getChildrenByName

public List getChildrenByName(String name)
Find all child DataObjects by name

Parameters:
name -
Returns:

getChildByName

public DataObject getChildByName(String name)
Find a child DataObject

Specified by:
getChildByName in interface DataObject
Parameters:
name -
Returns:

getIsMultiple

public boolean getIsMultiple()
Specified by:
getIsMultiple in interface DataObject
Specified by:
getIsMultiple in interface SimpleDataObject

removeAll

public void removeAll()

removeByKey

public void removeByKey(Object key)

getId

public int getId()
Specified by:
getId in interface DataObject

setId

public void setId(int d)
Description copied from interface: DataObject
set the Id for this DataObject

Specified by:
setId in interface DataObject

getDOLookupField

public String getDOLookupField()
Specified by:
getDOLookupField in interface DataObject

setDOLookupField

public void setDOLookupField(String s)
Description copied from interface: DataObject
set the lookup (unique id) field for this DataObject

Specified by:
setDOLookupField in interface DataObject

isPageable

public boolean isPageable()
Specified by:
isPageable in interface DataObject

setIsMultiple

public void setIsMultiple(boolean b)
Specified by:
setIsMultiple in interface DataObject

setHasChildren

public void setHasChildren(boolean b)

getProps

public com.extentech.toolkit.ResourceLoader getProps()
Returns:

setProps

public void setProps(com.extentech.toolkit.ResourceLoader loader)
Parameters:
loader -

getDataObjectActionListeners

public List getDataObjectActionListeners()
Description copied from interface: DataObject
retrurns all of the DataObjectActionListeners for this DataObject

Specified by:
getDataObjectActionListeners in interface DataObject
Returns:


Copyright © 2011 Extentech Inc. All Rights Reserved.