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
 int count(java.lang.Class clazz, com.trg.search.IMutableSearch search)
          Returns the total number of results that would be returned using the given ISearch if there were no paging or maxResult limits.
 boolean exists(java.lang.Class clazz, java.io.Serializable id)
          Checks for existence of an object of type T using the id arg.
 java.util.List 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
 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.
 java.lang.Object merge(java.lang.Object object)
           
 java.lang.Object persist(java.lang.Object object)
           
 void remove(java.lang.Class clazz, java.io.Serializable id)
          Generic method to delete an object based on class and id
 void removeAll(java.lang.Class clazz, java.util.List ids)
          Generic method to delete all object based on class and ids list
 void removeAll(java.util.List objects)
           
 java.lang.Object save(java.lang.Object o)
          Generic method to save an object - handles both update and insert.
 java.lang.Object saveOnly(java.lang.Object object)
           
 java.util.List search(java.lang.Class clazz, com.trg.search.IMutableSearch search)
          Search for objects based on the search parameters in the specified ISearch object.
 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.).
 com.trg.search.SearchResult searchAndCount(java.lang.Class clazz, com.trg.search.IMutableSearch search)
          Returns a SearchResult object that includes the list of results like search() and the total length like searchLength.
 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 SearchableBaseObject> searchORMResult(java.lang.String[] criteria, java.lang.String[] searchedProperties, java.lang.Class<? extends SearchableBaseObject> clazz)
          This method allows to search Objects on String properties, fitting search criteria.
 java.util.List<? extends SearchableBaseObject> searchORMResult(java.lang.String[] criteria, java.lang.String[] searchedProperties, java.lang.Class<? extends SearchableBaseObject> clazz, RequestOptions requestOptions)
          This method allows to search Objects on String properties, fitting search criteria.
 java.util.List<? extends SearchableBaseObject> searchORMResult(java.lang.String query, java.lang.Class<? extends SearchableBaseObject> 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 SearchableBaseObject> searchORMResult(java.lang.String query, java.lang.Class<? extends SearchableBaseObject> 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.
 java.lang.Object searchUnique(java.lang.Class clazz, com.trg.search.IMutableSearch search)
          Search for a single result using the given parameters.
 void setUniversalORMDAO(UniversalORMDAO universalORMDAO)
           
 void setUniversalOSEMDAO(UniversalOSEMDAO universalOSEMDAO)
           
 java.lang.Object updateOnly(java.lang.Object object)
           
 
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.

Specified by:
get in interface UniversalUnifiedDAO
Parameters:
clazz - model class to lookup
id - the identifier (primary key) of the class
Returns:
a populated object or null if not found

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 SearchableBaseObject> searchORMResult(java.lang.String query,
                                                                      java.lang.Class<? extends SearchableBaseObject> 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 SearchableBaseObject> searchORMResult(java.lang.String[] criteria,
                                                                      java.lang.String[] searchedProperties,
                                                                      java.lang.Class<? extends SearchableBaseObject> 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)
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)
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)
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 SearchableBaseObject> searchORMResult(java.lang.String query,
                                                                      java.lang.Class<? extends SearchableBaseObject> 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.). 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 SearchableBaseObject> searchORMResult(java.lang.String[] criteria,
                                                                      java.lang.String[] searchedProperties,
                                                                      java.lang.Class<? extends SearchableBaseObject> clazz)
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)
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)
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.

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

count

public int count(java.lang.Class clazz,
                 com.trg.search.IMutableSearch search)
Returns the total number of results that would be returned using the given ISearch if there were no paging or maxResult limits.

Specified by:
count in interface UniversalUnifiedDAO
See Also:
ISearch

search

public java.util.List search(java.lang.Class clazz,
                             com.trg.search.IMutableSearch search)
Search for objects based on the search parameters in the specified ISearch object.

Specified by:
search in interface UniversalUnifiedDAO
See Also:
ISearch

searchAndCount

public com.trg.search.SearchResult searchAndCount(java.lang.Class clazz,
                                                  com.trg.search.IMutableSearch search)
Returns a SearchResult object that includes the list of results like search() and the total length like searchLength.

Specified by:
searchAndCount in interface UniversalUnifiedDAO
See Also:
ISearch

searchUnique

public java.lang.Object searchUnique(java.lang.Class clazz,
                                     com.trg.search.IMutableSearch search)
                              throws org.hibernate.NonUniqueResultException
Search for a single result using the given parameters.

Specified by:
searchUnique in interface UniversalUnifiedDAO
Throws:
org.hibernate.NonUniqueResultException

exists

public boolean exists(java.lang.Class clazz,
                      java.io.Serializable id)
Checks for existence of an object of type T using the id arg.

Specified by:
exists in interface UniversalUnifiedDAO
id - the id of the entity
Returns:
- true if it exists, false if it doesn't

findByNamedQuery

public java.util.List 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

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

merge

public java.lang.Object merge(java.lang.Object object)
Specified by:
merge in interface UniversalUnifiedDAO

persist

public java.lang.Object persist(java.lang.Object object)
Specified by:
persist in interface UniversalUnifiedDAO

saveOnly

public java.lang.Object saveOnly(java.lang.Object object)
Specified by:
saveOnly in interface UniversalUnifiedDAO

updateOnly

public java.lang.Object updateOnly(java.lang.Object object)
Specified by:
updateOnly in interface UniversalUnifiedDAO

removeAll

public void removeAll(java.lang.Class clazz,
                      java.util.List ids)
Generic method to delete all object based on class and ids list

Specified by:
removeAll in interface UniversalUnifiedDAO
Parameters:
clazz - model class to lookup
ids - the identifiers (primary key) of object to delete

removeAll

public void removeAll(java.util.List objects)
Specified by:
removeAll in interface UniversalUnifiedDAO


Copyright © 2008-2009 eBMWebsourcing. All Rights Reserved.