com.gisgraphy.dao
Interface UniversalDao

All Known Subinterfaces:
LookupDao
All Known Implementing Classes:
LookupDaoHibernate, UniversalDaoHibernate

public interface UniversalDao

Data Access Object (DAO) interface.

Author:
Matt Raible Modifications and comments by Bryan Noll This thing used to be named simply 'GenericDao' in versions of appfuse prior to 2.0. It was renamed in an attempt to distinguish and describe it as something different than GenericDao. GenericDao is intended for subclassing, and was named Generic because 1) it has very general functionality and 2) is 'generic' in the Java 5 sense of the word... aka... it uses Generics. Implementations of this class are not intended for subclassing. You most likely would want to subclass GenericDao. The only real difference is that instances of java.lang.Class are passed into the methods in this class, and they are part of the constructor in the GenericDao, hence you'll have to do some casting if you use this one.
See Also:
GenericDao

Method Summary
 java.lang.Object get(java.lang.Class<?> clazz, java.io.Serializable id)
          Generic method to get an object based on class and identifier.
 java.util.List<?> getAll(java.lang.Class<?> clazz)
          Generic method used to get all objects of a particular type.
 void remove(java.lang.Class<?> clazz, java.io.Serializable id)
          Generic method to delete an object based on class and id
 java.lang.Object save(java.lang.Object o)
          Generic method to save an object - handles both update and insert.
 

Method Detail

getAll

java.util.List<?> getAll(java.lang.Class<?> clazz)
Generic method used to get all objects of a particular type. This is the same as lookup up all rows in a table.

Parameters:
clazz - the type of objects (a.k.a. while table) to get data from
Returns:
List of populated objects

get

java.lang.Object get(java.lang.Class<?> clazz,
                     java.io.Serializable id)
Generic method to get an object based on class and identifier. An ObjectRetrievalFailureException Runtime Exception is thrown if nothing is found.

Parameters:
clazz - model class to lookup
id - the identifier (primary key) of the class
Returns:
a populated object
See Also:
ObjectRetrievalFailureException

save

java.lang.Object save(java.lang.Object o)
Generic method to save an object - handles both update and insert.

Parameters:
o - the object to save
Returns:
a populated object

remove

void remove(java.lang.Class<?> clazz,
            java.io.Serializable id)
Generic method to delete an object based on class and id

Parameters:
clazz - model class to lookup
id - the identifier (primary key) of the class


Copyright © 2010. All Rights Reserved.