net.sf.borg.model.db
Interface EntityDB<T extends KeyedEntity<T>>

All Known Subinterfaces:
AppointmentDB, LinkDB, TaskDB
All Known Implementing Classes:
AddrJdbcDB, ApptJdbcDB, LinkJdbcDB, TaskJdbcDB

public interface EntityDB<T extends KeyedEntity<T>>

Interface for a class that provides basic ORM mapping for a KeyedEntity


Method Summary
 void addObj(T entity)
          Adds a KeyedEntity to the database
 void delete(int key)
          Delete a KeyedEntity from the database
 T newObj()
          Return a new instance of the KeyedEntity
 int nextkey()
          get the next available key value for this entity type
 Collection<T> readAll()
          Read all KeyedEntities of a particular type from the database.
 T readObj(int key)
          Read a single KeyedEntity from the database by key
 void sync()
          Sync with the database (likely to just be a cache flush)
 void updateObj(T entity)
          Update a KeyedEntity in the database
 

Method Detail

readAll

Collection<T> readAll()
                                             throws Exception
Read all KeyedEntities of a particular type from the database.

Returns:
the collection of KeyedEntities
Throws:
Exception

readObj

T readObj(int key)
                                 throws Exception
Read a single KeyedEntity from the database by key

Parameters:
key - the key
Returns:
the KeyedEntity
Throws:
Exception

newObj

T newObj()
Return a new instance of the KeyedEntity

Returns:
the new KeyedEntity

addObj

void addObj(T entity)
            throws Exception
Adds a KeyedEntity to the database

Parameters:
entity - the KeyedEntity
Throws:
Exception

updateObj

void updateObj(T entity)
               throws Exception
Update a KeyedEntity in the database

Parameters:
entity - the KeyedEntity
Throws:
Exception

delete

void delete(int key)
            throws Exception
Delete a KeyedEntity from the database

Parameters:
key - the key of the entity
Throws:
Exception

nextkey

int nextkey()
            throws Exception
get the next available key value for this entity type

Returns:
the next available key
Throws:
Exception

sync

void sync()
Sync with the database (likely to just be a cache flush)



Generated September 24 2010 by mbb using Apache Ant version 1.7.1 compiled on June 27 2008 and Java version 1.6.0_20 from Sun Microsystems Inc. on Linux i386 2.6.24-28-generic