org.ow2.dragon.persistence.dao
Interface UniversalORMDAO

All Known Implementing Classes:
UniversalHibernateDAOImpl

public interface UniversalORMDAO

Data Access Object (DAO) interface.

Author:
Matt Raible, ofabre - eBM Websourcing 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:
org.appfuse.dao.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.
 java.util.List getAll(java.lang.Class clazz, java.util.List ids)
          Retrieve a List of entities matching given ids
 java.util.List getAll(java.lang.Class clazz, java.util.List ids, RequestOptions requestOptions)
          Retrieve a List of entities matching given ids, sorted and paginated according to the given request options
 java.util.List getAll(java.lang.Class clazz, RequestOptions requestOptionsTO)
          Generic method used to get all objects of a particular type, sorted and paginated according to the given request options.
 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.
 java.util.List searchEquals(java.lang.Class clazz, java.lang.String[] criteria, java.lang.String[] properties, RequestOptions requestOptionsTO)
          This method allows to search Objects on String properties, fitting search criteria.
 java.util.List searchLike(java.lang.Class clazz, java.lang.String[] criteria, java.lang.String[] properties, RequestOptions requestOptionsTO)
          This method allows to search Objects on String properties, fitting search criteria.
 

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

getAll

java.util.List getAll(java.lang.Class clazz,
                      java.util.List ids)
Retrieve a List of entities matching given ids

Parameters:
clazz - model class to lookup
ids - a List of ids
Returns:
a List of entities matching ids, must be non null, could be empty

getAll

java.util.List getAll(java.lang.Class clazz,
                      java.util.List ids,
                      RequestOptions requestOptions)
Retrieve a List of entities matching given ids, sorted and paginated according to the given request options

Parameters:
clazz - model class to lookup
ids - a List of ids
requestOptions - include sort order and pagination information
Returns:
a sorted/paginated List of entities matching ids, must be non null, could be empty

getAll

java.util.List getAll(java.lang.Class clazz,
                      RequestOptions requestOptionsTO)
Generic method used to get all objects of a particular type, sorted and paginated according to the given request options. This is the same as lookup up all rows in a table.

Parameters:
clazz - model class to lookup
requestOptionsTO - include sort order and pagination information
Returns:
List of populated objects

searchLike

java.util.List searchLike(java.lang.Class clazz,
                          java.lang.String[] criteria,
                          java.lang.String[] properties,
                          RequestOptions requestOptionsTO)
This method allows to search Objects on String properties, fitting search criteria. Properties can be direct object fields or fields of included objects (in this case, fields must be referenced by the doted notation like "foo.bar"). Use a like statement for each criteria on each property. Results are sorted and paginated in respect of the given request options.
Limitations: this method can have some troubles if two or more doted properties contains the same field like "aaa.bbb" and "ccc.ddd. bbb"

Parameters:
clazz - model class to lookup
criteria - the search criteria
properties - the searched properties
requestOptionsTO - include sort order and pagination information
Returns:
a list of object matching the different criteria sorted and paginated

searchEquals

java.util.List searchEquals(java.lang.Class clazz,
                            java.lang.String[] criteria,
                            java.lang.String[] properties,
                            RequestOptions requestOptionsTO)
This method allows to search Objects on String properties, fitting search criteria. Properties can be direct object fields or fields of included objects (in this case, fields must be referenced by the doted notation like "foo.bar"). Use a equality statement for each criteria on each property. Results are sorted and paginated in respect of the given request options.

Parameters:
clazz - model class to lookup
criteria - the search criteria
properties - the searched properties
requestOptionsTO - include sort order and pagination information
Returns:
a list of object matching the different criteria sorted and paginated


Copyright © 2008 eBMWebsourcing. All Rights Reserved.