Package adams.db
Interface DataProvider<T extends DataContainer>
-
- Type Parameters:
T
- the type of data
- All Superinterfaces:
DatabaseConnectionProvider
,DatabaseConnectionUser
- All Known Subinterfaces:
FilteredDataProvider<T>
public interface DataProvider<T extends DataContainer> extends DatabaseConnectionProvider
Interface for table classes that return the base data type used in a project.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
AbstractIndexedTable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Integer
add(T cont)
Adds a data container to the database.boolean
exists(int id)
Checks whether the container exists in the database.boolean
exists(String id)
Checks whether the container exists in the database.T
load(int id)
Load a data container with given database ID.T
load(String id)
Load a data container with given ID.boolean
remove(int id, boolean keepReport)
Removes the data container from the database (and the associated report, if any).boolean
remove(String id, boolean keepReport)
Removes the data container from the database (and the associated report, if any).-
Methods inherited from interface adams.db.DatabaseConnectionProvider
getDatabaseConnection
-
-
-
-
Method Detail
-
add
Integer add(T cont)
Adds a data container to the database. Returns the created auto-id, and sets it in the data container as well.- Parameters:
cont
- the container to store in the database- Returns:
- new ID, or null if fail
-
exists
boolean exists(int id)
Checks whether the container exists in the database.- Parameters:
id
- the database ID of the data container- Returns:
- true if the container exists
-
exists
boolean exists(String id)
Checks whether the container exists in the database.- Parameters:
id
- the ID of the data container- Returns:
- true if the container exists
-
load
T load(int id)
Load a data container with given database ID.- Parameters:
id
- the database ID- Returns:
- the data container, or null if not found
-
load
T load(String id)
Load a data container with given ID.- Parameters:
id
- the ID- Returns:
- the data container, or null if not found
-
remove
boolean remove(int id, boolean keepReport)
Removes the data container from the database (and the associated report, if any).- Parameters:
id
- the database ID of the container to remove from the databasekeepReport
- if true does not delete associated report- Returns:
- true if no error
-
remove
boolean remove(String id, boolean keepReport)
Removes the data container from the database (and the associated report, if any).- Parameters:
id
- the ID of the container to remove from the databasekeepReport
- if true does not delete associated report- Returns:
- true if no error
-
-