org.ow2.dragon.persistence.dao
Class UniversalCompassHibernateDAOImpl

java.lang.Object
  extended by org.ow2.dragon.persistence.dao.UniversalCompassHibernateDAOImpl
All Implemented Interfaces:
UniversalUnifiedDAO

public class UniversalCompassHibernateDAOImpl
extends java.lang.Object
implements UniversalUnifiedDAO

Author:
ofabre - eBM Websourcing

Constructor Summary
UniversalCompassHibernateDAOImpl()
           
 
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 search(java.lang.String query, java.lang.Class clazz)
          Return a List of entity managed by the Full Text Search Engine (Compass etc.).
 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.
 java.util.List<? extends BaseObject> searchORMResult(java.lang.String[] criteria, java.lang.String[] searchedProperties, java.lang.Class<? extends BaseObject> clazz)
          This method allows to search Objects on String properties, fitting search criteria.
 java.util.List<? extends BaseObject> searchORMResult(java.lang.String[] criteria, java.lang.String[] searchedProperties, java.lang.Class<? extends BaseObject> clazz, RequestOptions requestOptions)
          This method allows to search Objects on String properties, fitting search criteria.
 java.util.List<? extends BaseObject> searchORMResult(java.lang.String query, java.lang.Class<? extends BaseObject> clazz)
          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<? extends BaseObject> searchORMResult(java.lang.String query, java.lang.Class<? extends BaseObject> clazz, 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.
 void setUniversalORMDAO(UniversalORMDAO universalORMDAO)
           
 void setUniversalOSEMDAO(UniversalOSEMDAO universalOSEMDAO)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniversalCompassHibernateDAOImpl

public UniversalCompassHibernateDAOImpl()
Method Detail

get

public 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.

Specified by:
get in interface UniversalUnifiedDAO
Parameters:
clazz - model class to lookup
id - the identifier (primary key) of the class
Returns:
a populated object
See Also:
ObjectRetrievalFailureException

getAll

public 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.

Specified by:
getAll in interface UniversalUnifiedDAO
Parameters:
clazz - the type of objects (a.k.a. while table) to get data from
Returns:
List of populated objects

remove

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

Specified by:
remove in interface UniversalUnifiedDAO
Parameters:
clazz - model class to lookup
id - the identifier (primary key) of the class

save

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

Specified by:
save in interface UniversalUnifiedDAO
Parameters:
o - the object to save
Returns:
a populated object

search

public java.util.List search(java.lang.String query,
                             java.lang.Class clazz)
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

Specified by:
search in interface UniversalUnifiedDAO
Parameters:
query - a Lucene String query
clazz - model class to lookup
Returns:
a List of entity managed by the Full Text Search Engine.

searchORMResult

public java.util.List<? extends BaseObject> searchORMResult(java.lang.String query,
                                                            java.lang.Class<? extends BaseObject> clazz,
                                                            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.

Specified by:
searchORMResult in interface UniversalUnifiedDAO
Parameters:
query - a Lucene String query
clazz - model class to lookup
requestOptions - include sort order and pagination information
Returns:
a List of entity managed by the ORM engine.

searchORMResult

public java.util.List<? extends BaseObject> searchORMResult(java.lang.String[] criteria,
                                                            java.lang.String[] searchedProperties,
                                                            java.lang.Class<? extends BaseObject> clazz,
                                                            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.

Specified by:
searchORMResult in interface UniversalUnifiedDAO
Parameters:
criteria - the search criteria
clazz - model class to lookup
requestOptions - include sort order and pagination information
Returns:
a List of entity managed by the ORM engine.

setUniversalORMDAO

public void setUniversalORMDAO(UniversalORMDAO universalORMDAO)

setUniversalOSEMDAO

public void setUniversalOSEMDAO(UniversalOSEMDAO universalOSEMDAO)

getAll

public java.util.List getAll(java.lang.Class clazz,
                             java.util.List ids)
Description copied from interface: UniversalUnifiedDAO
Retrieve a List of entities matching given ids

Specified by:
getAll in interface UniversalUnifiedDAO
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

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

Specified by:
getAll in interface UniversalUnifiedDAO
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

public java.util.List getAll(java.lang.Class clazz,
                             RequestOptions requestOptionsTO)
Description copied from interface: UniversalUnifiedDAO
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.

Specified by:
getAll in interface UniversalUnifiedDAO
Parameters:
clazz - model class to lookup
requestOptionsTO - include sort order and pagination information
Returns:
List of populated objects

searchORMResult

public java.util.List<? extends BaseObject> searchORMResult(java.lang.String query,
                                                            java.lang.Class<? extends BaseObject> clazz)
Description copied from interface: UniversalUnifiedDAO
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.

Specified by:
searchORMResult in interface UniversalUnifiedDAO
Parameters:
query - a Lucene String query
clazz - model class to lookup
Returns:
a List of entity managed by the ORM engine.

searchORMResult

public java.util.List<? extends BaseObject> searchORMResult(java.lang.String[] criteria,
                                                            java.lang.String[] searchedProperties,
                                                            java.lang.Class<? extends BaseObject> clazz)
Description copied from interface: UniversalUnifiedDAO
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.

Specified by:
searchORMResult in interface UniversalUnifiedDAO
Parameters:
criteria - the search criteria
clazz - model class to lookup
Returns:
a List of entity managed by the ORM engine.

searchEquals

public java.util.List searchEquals(java.lang.Class clazz,
                                   java.lang.String[] criteria,
                                   java.lang.String[] properties,
                                   RequestOptions requestOptionsTO)
Description copied from interface: UniversalUnifiedDAO
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.

Specified by:
searchEquals in interface UniversalUnifiedDAO
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

searchLike

public java.util.List searchLike(java.lang.Class clazz,
                                 java.lang.String[] criteria,
                                 java.lang.String[] properties,
                                 RequestOptions requestOptionsTO)
Description copied from interface: UniversalUnifiedDAO
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"

Specified by:
searchLike in interface UniversalUnifiedDAO
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.