org.brains2b.data
Interface DataControl
- All Known Implementing Classes:
- OracleDC
- public interface DataControl
Interface DataControl
Used to implement DataControl for Data objects
Implementation has the specific information on how to write/read data with a data source
to a data store. The DataControl is used from a class which implements DataController
which takes the data object as parameter and has some mechanisme to find the DataControl implementation
belonging to the DataObject.
You would not refer to a DataControl directly in you code. You would just get and set the data object
to the general DataController
and leave it to the DataController
to invoke the
DataControl and handle the read/write of the data.
This interface is defined in general terms because no assumptions should be made about the
type of datastore. The most simple implementation would be using a JDBC connection, but you
could also use it for XML or flat file datastorage
Classes which implement this interface can be generated by Sql2Class project
TODO make a link to the Sql2Class
- Version:
- 0.10 [30-12-2001]
- Author:
- dennis@brains2b.nl
Method Summary |
int |
deleteOnPk()
Delete the data object from the datatore on primary key. |
int |
insert()
insert a data object |
java.util.Vector |
selectAll()
select all Records for de data object this data controller was created for |
java.util.Vector |
selectFromCondition(Condition con)
select all records meeting the values set in Condition . |
java.util.Vector |
selectOnParent(java.lang.Object o)
selects a collection of Objects which have a relation to a parent given by Object o
|
java.lang.Object |
selectOnPk(java.lang.Object o)
selects a data object on the basis of the primary key contained in Object o
|
int |
updateOnPk()
Update the data object on primary key. |
updateOnPk
public int updateOnPk()
throws java.lang.Exception
- Update the data object on primary key.
- Returns:
- int, the number of records updated, should alwyas return one
- Throws:
Exception,
- exception thrown from the specific data store controls, such
as a JDBC driver
java.lang.Exception
insert
public int insert()
throws java.lang.Exception
- insert a data object
- Returns:
- int, the number or records updated, should always return one
- Throws:
Exception,
- exception thrown from the specific data store controls, such
as a JDBC driver
java.lang.Exception
deleteOnPk
public int deleteOnPk()
throws java.lang.Exception
- Delete the data object from the datatore on primary key.
- Returns:
- int, the number or records deleted, should always return one
- Throws:
Exception,
- exception thrown from the specific data store controls, such
as a JDBC driver
java.lang.Exception
selectOnParent
public java.util.Vector selectOnParent(java.lang.Object o)
throws java.lang.Exception
- selects a collection of Objects which have a relation to a parent given by Object
o
This method should always be implemented manually while the relation cannot
be determined automatically.
- Parameters:
o
- Object, an Object representing the parent
- Returns:
- Vector a collection of Objects for which this DataControl was created.
- Throws:
Exception,
- exception thrown from the specific data store controls, such
as a JDBC driver
java.lang.Exception
selectOnPk
public java.lang.Object selectOnPk(java.lang.Object o)
throws java.lang.Exception
- selects a data object on the basis of the primary key contained in Object o
Keep in mind that a selectOnPk(Object)
expects an instance of the
Object you're retrieving and returning an Object you're retrieving which could only match
on the primary key
- Parameters:
o
- Object, a data object which contains the primary key to retrieve the
dataobject.
- Returns:
- Object, the data object which is retrieved from the primary key.
- Throws:
Exception,
- exception thrown from the specific data store controls, such
as a JDBC driver
java.lang.Exception
selectAll
public java.util.Vector selectAll()
throws java.lang.Exception
- select all Records for de data object this data controller was created for
- Returns:
- Vector, a collection of data objects
- Throws:
Exception,
- exception thrown from the specific data store controls, such
as a JDBC driver
java.lang.Exception
selectFromCondition
public java.util.Vector selectFromCondition(Condition con)
throws java.lang.Exception
- select all records meeting the values set in
Condition
. The order would
be the same as defined by the order by clause in the Condition
- Parameters:
con
- Condition, the condition to be used to retrieve the collection of data objects
- Returns:
- Vector, a collection of data objects
- Throws:
Exception,
- exception thrown from the specific data store controls, such
as a JDBC driver
java.lang.Exception
- See Also:
Condition