org.ow2.dragon.persistence.dao
Interface GenericUnifiedDAO<T,PK extends java.io.Serializable>

All Known Implementing Classes:
GenericHibernateCompassDAOImpl

public interface GenericUnifiedDAO<T,PK extends java.io.Serializable>

Author:
ofabre - eBM Websourcing

Method Summary
 boolean exists(PK id)
          Checks for existence of an object of type T using the id arg.
 java.util.List<T> findByNamedQuery(java.lang.String queryName, java.util.Map<java.lang.String,java.lang.Object> queryParams)
          Find a list of records by using a named query
 T get(PK id)
          Generic method to get an object based on class and identifier.
 java.util.List<T> getAll()
          Generic method used to get all objects of a particular type.
 java.util.List<T> getAll(java.util.List<PK> ids)
          Retrieve a List of entities matching given ids
 java.util.List<T> getAll(java.util.List<PK> ids, RequestOptions requestOptions)
          Retrieve a List of entities matching given ids, sorted and paginated according to the given request options
 java.util.List<T> getAll(RequestOptions requestOptions)
          Generic method used to get all objects of a particular type, sorted and paginated according to the given request options.
 java.util.List<T> getAllDistinct()
          Gets all records without duplicates.
 void remove(PK id)
          Generic method to delete an object based on class and id
 T save(T object)
          Generic method to save an object - handles both update and insert.
 java.util.List<T> search(java.lang.String query)
          Return a List of entity managed by the Full Text Search Engine (Compass etc.).
 java.util.List<T> searchEquals(java.lang.String[] criteria, java.lang.String[] properties, RequestOptions requestOptions)
          This method allows to search Objects on String properties, fitting search criteria.
 java.util.List<T> searchLike(java.lang.String[] criteria, java.lang.String[] properties, RequestOptions requestOptions)
          This method allows to search Objects on String properties, fitting search criteria.
 java.util.List<T> searchORMResult(java.lang.String query)
          Process a research on Full Text Search Engine (Compass etc.) index and return a List of entity managed by the ORM engine (Hibernate, iBatis etc.).
 java.util.List<T> searchORMResult(java.lang.String[] criteria, java.lang.String[] searchedProperties)
          This method allows to search Objects on String properties, fitting search criteria.
 java.util.List<T> searchORMResult(java.lang.String[] criteria, java.lang.String[] searchedProperties, RequestOptions requestOptions)
          This method allows to search Objects on String properties, fitting search criteria.
 java.util.List<T> searchORMResult(java.lang.String query, RequestOptions requestOptions)
          Process a research on Full Text Search Engine (Compass etc.) index and return a List of entity managed by the ORM engine (Hibernate, iBatis etc.), sorted and paginated according to the given request options.
 

Method Detail

getAll

java.util.List<T> getAll(RequestOptions requestOptions)
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:
requestOptions - include sort order and pagination information
Returns:
List of populated objects

getAll

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

Returns:
List of populated objects

get

T get(PK id)
Generic method to get an object based on class and identifier. An ObjectRetrievalFailureException Runtime Exception is thrown if nothing is found.

Parameters:
id - the identifier (primary key) of the object to get
Returns:
a populated object
See Also:
ObjectRetrievalFailureException

exists

boolean exists(PK id)
Checks for existence of an object of type T using the id arg.

Parameters:
id - the id of the entity
Returns:
- true if it exists, false if it doesn't

save

T save(T object)
Generic method to save an object - handles both update and insert.

Parameters:
object - the object to save
Returns:
the persisted object

remove

void remove(PK id)
Generic method to delete an object based on class and id

Parameters:
id - the identifier (primary key) of the object to remove

getAllDistinct

java.util.List<T> getAllDistinct()
Gets all records without duplicates.

Note that if you use this method, it is imperative that your model classes correctly implement the hashcode/equals methods

Returns:
List of populated objects

findByNamedQuery

java.util.List<T> findByNamedQuery(java.lang.String queryName,
                                   java.util.Map<java.lang.String,java.lang.Object> queryParams)
Find a list of records by using a named query

Parameters:
queryName - query name of the named query
queryParams - a map of the query names and the values
Returns:
a list of the records found

searchLike

java.util.List<T> searchLike(java.lang.String[] criteria,
                             java.lang.String[] properties,
                             RequestOptions requestOptions)
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:
criteria - the search criteria
properties - the searched properties
requestOptions - include sort order and pagination information
Returns:
a list of object matching the different criteria sorted and paginated

searchEquals

java.util.List<T> searchEquals(java.lang.String[] criteria,
                               java.lang.String[] properties,
                               RequestOptions requestOptions)
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:
criteria - the search criteria
properties - the searched properties
requestOptions - include sort order and pagination information
Returns:
a list of object matching the different criteria sorted and paginated

search

java.util.List<T> search(java.lang.String query)
Return a List of entity managed by the Full Text Search Engine (Compass etc.). Only the search engine managed attributes of these entities are populated

Parameters:
query - a Lucene String query
Returns:
a List of entity managed by the Full Text Search Engine.

searchORMResult

java.util.List<T> searchORMResult(java.lang.String query)
Process a research on Full Text Search Engine (Compass etc.) index and return a List of entity managed by the ORM engine (Hibernate, iBatis etc.). All ORM managed attributes of these entities are populated.

Parameters:
query - a Lucene String query
Returns:
a List of entity managed by the ORM engine.

searchORMResult

java.util.List<T> searchORMResult(java.lang.String query,
                                  RequestOptions requestOptions)
Process a research on Full Text Search Engine (Compass etc.) index and return a List of entity managed by the ORM engine (Hibernate, iBatis etc.), sorted and paginated according to the given request options. All ORM managed attributes of these entities are populated.

Parameters:
query - a Lucene String query
requestOptions - include sort order and pagination information
Returns:
a List of entity managed by the ORM engine.

searchORMResult

java.util.List<T> searchORMResult(java.lang.String[] criteria,
                                  java.lang.String[] searchedProperties)
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"). Process a research on Full Text Search Engine (Compass etc.) index and return a List of entity managed by the ORM engine (Hibernate, iBatis etc.). All ORM managed attributes of these entities are populated.

Parameters:
criteria - the search criteria
properties - the searched properties
Returns:
a List of entity managed by the ORM engine.

searchORMResult

java.util.List<T> searchORMResult(java.lang.String[] criteria,
                                  java.lang.String[] searchedProperties,
                                  RequestOptions requestOptions)
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"). Process a research on Full Text Search Engine (Compass etc.) index and return a List of entity managed by the ORM engine (Hibernate, iBatis etc.), sorted and paginated according to the given request options. All ORM managed attributes of these entities are populated.

Parameters:
criteria - the search criteria
properties - the searched properties
requestOptions - include sort order and pagination information
Returns:
a List of entity managed by the ORM engine.

getAll

java.util.List<T> getAll(java.util.List<PK> ids)
Retrieve a List of entities matching given ids

Parameters:
ids - a List of ids
Returns:
a List of entities matching ids, must be non null, could be empty

getAll

java.util.List<T> getAll(java.util.List<PK> ids,
                         RequestOptions requestOptions)
Retrieve a List of entities matching given ids, sorted and paginated according to the given request options

Parameters:
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


Copyright © 2008 eBMWebsourcing. All Rights Reserved.