org.kuali.rice.krad.dao.impl
Class BusinessObjectDaoOjb

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport
          extended by org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb
              extended by org.kuali.rice.krad.dao.impl.BusinessObjectDaoOjb
All Implemented Interfaces:
PlatformAwareDao, BusinessObjectDao, OjbCollectionAware, org.springframework.beans.factory.InitializingBean

public class BusinessObjectDaoOjb
extends PlatformAwareDaoBaseOjb
implements BusinessObjectDao, OjbCollectionAware

This class is the OJB implementation of the BusinessObjectDao interface and should be used for generic business object unit tests.


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
BusinessObjectDaoOjb(PersistenceStructureService persistenceStructureService)
          This constructs a BusinessObjectDaoOjb
 
Method Summary
 int countMatching(Class clazz, Map<String,?> fieldValues)
          This is the default impl that comes with Kuali - uses OJB.
 int countMatching(Class clazz, Map<String,?> positiveFieldValues, Map<String,?> negativeFieldValues)
          This is the default impl that comes with Kuali - uses OJB.
 void delete(List<? extends PersistableBusinessObject> boList)
          Deletes each business object in the given List from the database.
 void delete(PersistableBusinessObject bo)
          Deletes the business object passed in.
 void deleteMatching(Class clazz, Map<String,?> fieldValues)
          Deletes the business objects matching the given fieldValues
<T extends BusinessObject>
Collection<T>
findAll(Class<T> clazz)
          Retrieves all of the records for a given class name.
<T extends BusinessObject>
Collection<T>
findAllActive(Class<T> clazz)
          Retrieves a collection of business objects populated with data, such that each record in the database populates a new object instance.
<T extends BusinessObject>
Collection<T>
findAllActiveOrderBy(Class<T> clazz, String sortField, boolean sortAscending)
          Retrieves a collection of business objects populated with data, such that each record in the database populates a new object instance.
<T extends BusinessObject>
Collection<T>
findAllInactive(Class<T> clazz)
           
<T extends BusinessObject>
Collection<T>
findAllOrderBy(Class<T> clazz, String sortField, boolean sortAscending)
          Retrieves a collection of business objects populated with data, such that each record in the database populates a new object instance.
<T extends BusinessObject>
T
findByPrimaryKey(Class<T> clazz, Map<String,?> primaryKeys)
          Retrieves an object instance identified bys it primary keys and values.
<T extends BusinessObject>
T
findByPrimaryKeyUsingKeyObject(Class<T> clazz, Object pkObject)
          OJB does not support this method
<T extends BusinessObject>
T
findBySinglePrimaryKey(Class<T> clazz, Object primaryKey)
          Retrieves an object instance identified by its primary key.
<T extends BusinessObject>
Collection<T>
findMatching(Class<T> clazz, Map<String,?> fieldValues)
          This is the default impl that comes with Kuali - uses OJB.
<T extends BusinessObject>
Collection<T>
findMatchingActive(Class<T> clazz, Map<String,?> fieldValues)
          This method retrieves a collection of business objects populated with data, such that each record in the database populates a new object instance.
<T extends BusinessObject>
Collection<T>
findMatchingOrderBy(Class<T> clazz, Map<String,?> fieldValues, String sortField, boolean sortAscending)
          This is the default impl that comes with Kuali - uses OJB.
protected  PersistenceStructureService getPersistenceStructureService()
          Gets the persistenceStructureService attribute.
 PersistableBusinessObject manageReadOnly(PersistableBusinessObject bo)
          No need to do anything - avoid saving and OJB will "manage read only"
 PersistableBusinessObject retrieve(PersistableBusinessObject object)
          Retrieves an object instance identified by the class of the given object and the object's primary key values.
 List<? extends PersistableBusinessObject> save(List businessObjects)
          Saves a business object.
 PersistableBusinessObject save(PersistableBusinessObject bo)
          Saves a business object.
 void setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
          Sets the persistenceStructureService attribute value.
 
Methods inherited from class org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb
getDbPlatform, setDbPlatform
 
Methods inherited from class org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport
checkDaoConfig, convertOjbAccessException, createPersistenceBrokerTemplate, getJcdAlias, getPersistenceBroker, getPersistenceBrokerTemplate, releasePersistenceBroker, setJcdAlias, setPersistenceBrokerTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.util.OjbCollectionAware
getPersistenceBrokerTemplate
 

Constructor Detail

BusinessObjectDaoOjb

public BusinessObjectDaoOjb(PersistenceStructureService persistenceStructureService)
This constructs a BusinessObjectDaoOjb

Method Detail

findBySinglePrimaryKey

public <T extends BusinessObject> T findBySinglePrimaryKey(Class<T> clazz,
                                                           Object primaryKey)
Description copied from interface: BusinessObjectDao
Retrieves an object instance identified by its primary key. For composite keys, use BusinessObjectDao.findByPrimaryKey(Class, Map)

Specified by:
findBySinglePrimaryKey in interface BusinessObjectDao
Returns:
See Also:
BusinessObjectDao.findBySinglePrimaryKey(java.lang.Class, java.lang.Object)

findByPrimaryKey

public <T extends BusinessObject> T findByPrimaryKey(Class<T> clazz,
                                                     Map<String,?> primaryKeys)
Description copied from interface: BusinessObjectDao
Retrieves an object instance identified bys it primary keys and values. This can be done by constructing a map where the key to the map entry is the primary key attribute and the value of the entry being the primary key value. For composite keys, pass in each primaryKey attribute and its value as a map entry.

Specified by:
findByPrimaryKey in interface BusinessObjectDao
Returns:
See Also:
BusinessObjectDao.findByPrimaryKey(java.lang.Class, java.util.Map)

findAll

public <T extends BusinessObject> Collection<T> findAll(Class<T> clazz)
Retrieves all of the records for a given class name.

Specified by:
findAll in interface BusinessObjectDao
Parameters:
clazz - - the name of the object being used, either KualiCodeBase or a subclass
Returns:
Collection
See Also:
BusinessObjectDao.findAll(java.lang.Class)

findAllOrderBy

public <T extends BusinessObject> Collection<T> findAllOrderBy(Class<T> clazz,
                                                               String sortField,
                                                               boolean sortAscending)
Description copied from interface: BusinessObjectDao
Retrieves a collection of business objects populated with data, such that each record in the database populates a new object instance. This will only retrieve business objects by class type. Orders the results by the given field.

Specified by:
findAllOrderBy in interface BusinessObjectDao
Returns:
See Also:
BusinessObjectDao.findAllOrderBy(java.lang.Class, java.lang.String, boolean)

findMatching

public <T extends BusinessObject> Collection<T> findMatching(Class<T> clazz,
                                                             Map<String,?> fieldValues)
This is the default impl that comes with Kuali - uses OJB.

Specified by:
findMatching in interface BusinessObjectDao
Returns:
See Also:
BusinessObjectDao.findMatching(java.lang.Class, java.util.Map)

findAllActive

public <T extends BusinessObject> Collection<T> findAllActive(Class<T> clazz)
Description copied from interface: BusinessObjectDao
Retrieves a collection of business objects populated with data, such that each record in the database populates a new object instance. This will only retrieve business objects by class type. Adds criteria on active column to return only active records. Assumes there exist a mapping for PropertyConstants.Active

Specified by:
findAllActive in interface BusinessObjectDao
Returns:
See Also:
BusinessObjectDao.findAllActive(java.lang.Class)

findAllInactive

public <T extends BusinessObject> Collection<T> findAllInactive(Class<T> clazz)
Specified by:
findAllInactive in interface BusinessObjectDao
See Also:
BusinessObjectDao.findAllActive(java.lang.Class)

findAllActiveOrderBy

public <T extends BusinessObject> Collection<T> findAllActiveOrderBy(Class<T> clazz,
                                                                     String sortField,
                                                                     boolean sortAscending)
Description copied from interface: BusinessObjectDao
Retrieves a collection of business objects populated with data, such that each record in the database populates a new object instance. This will only retrieve business objects by class type. Orders the results by the given field. Adds criteria on active column to return only active records. Assumes there exist a mapping for PropertyConstants.Active

Specified by:
findAllActiveOrderBy in interface BusinessObjectDao
Returns:
See Also:
BusinessObjectDao.findAllActiveOrderBy(java.lang.Class, java.lang.String, boolean)

findMatchingActive

public <T extends BusinessObject> Collection<T> findMatchingActive(Class<T> clazz,
                                                                   Map<String,?> fieldValues)
Description copied from interface: BusinessObjectDao
This method retrieves a collection of business objects populated with data, such that each record in the database populates a new object instance. This will retrieve business objects by class type and also by criteria passed in as key-value pairs, specifically attribute name-expected value. Adds criteria on active column to return only active records. Assumes there exist a mapping for PropertyConstants.Active

Specified by:
findMatchingActive in interface BusinessObjectDao
Returns:
See Also:
BusinessObjectDao.findMatchingActive(java.lang.Class, java.util.Map)

countMatching

public int countMatching(Class clazz,
                         Map<String,?> fieldValues)
This is the default impl that comes with Kuali - uses OJB.

Specified by:
countMatching in interface BusinessObjectDao
Returns:
count of BusinessObjects of the given class whose fields match the values in the given Map.
See Also:
BusinessObjectDao.countMatching(java.lang.Class, java.util.Map)

countMatching

public int countMatching(Class clazz,
                         Map<String,?> positiveFieldValues,
                         Map<String,?> negativeFieldValues)
This is the default impl that comes with Kuali - uses OJB.

Specified by:
countMatching in interface BusinessObjectDao
positiveFieldValues - Map of fields and values for positive criteria
negativeFieldValues - Map of fields and values for negative criteria
Returns:
See Also:
BusinessObjectDao.countMatching(java.lang.Class, java.util.Map, java.util.Map)

findMatchingOrderBy

public <T extends BusinessObject> Collection<T> findMatchingOrderBy(Class<T> clazz,
                                                                    Map<String,?> fieldValues,
                                                                    String sortField,
                                                                    boolean sortAscending)
This is the default impl that comes with Kuali - uses OJB.

Specified by:
findMatchingOrderBy in interface BusinessObjectDao
Returns:
See Also:
BusinessObjectDao.findMatching(java.lang.Class, java.util.Map)

save

public PersistableBusinessObject save(PersistableBusinessObject bo)
                               throws org.springframework.dao.DataAccessException
Saves a business object.

Specified by:
save in interface BusinessObjectDao
Throws:
org.springframework.dao.DataAccessException
See Also:
BusinessObjectDao.save(org.kuali.rice.krad.bo.PersistableBusinessObject)

save

public List<? extends PersistableBusinessObject> save(List businessObjects)
                                               throws org.springframework.dao.DataAccessException
Saves a business object.

Specified by:
save in interface BusinessObjectDao
Throws:
org.springframework.dao.DataAccessException
See Also:
BusinessObjectDao.save(org.kuali.rice.krad.bo.PersistableBusinessObject)

delete

public void delete(PersistableBusinessObject bo)
Deletes the business object passed in.

Specified by:
delete in interface BusinessObjectDao
Parameters:
bo -
Throws:
org.springframework.dao.DataAccessException
See Also:
BusinessObjectDao.delete(org.kuali.rice.krad.bo.PersistableBusinessObject)

delete

public void delete(List<? extends PersistableBusinessObject> boList)
Description copied from interface: BusinessObjectDao
Deletes each business object in the given List from the database.

Specified by:
delete in interface BusinessObjectDao
See Also:
BusinessObjectDao.delete(java.util.List)

deleteMatching

public void deleteMatching(Class clazz,
                           Map<String,?> fieldValues)
Description copied from interface: BusinessObjectDao
Deletes the business objects matching the given fieldValues

Specified by:
deleteMatching in interface BusinessObjectDao
See Also:
BusinessObjectDao.deleteMatching(java.lang.Class, java.util.Map)

retrieve

public PersistableBusinessObject retrieve(PersistableBusinessObject object)
Description copied from interface: BusinessObjectDao
Retrieves an object instance identified by the class of the given object and the object's primary key values.

Specified by:
retrieve in interface BusinessObjectDao
Returns:
See Also:
BusinessObjectDao.retrieve(org.kuali.rice.krad.bo.PersistableBusinessObject)

findByPrimaryKeyUsingKeyObject

public <T extends BusinessObject> T findByPrimaryKeyUsingKeyObject(Class<T> clazz,
                                                                   Object pkObject)
OJB does not support this method

Specified by:
findByPrimaryKeyUsingKeyObject in interface BusinessObjectDao
Parameters:
clazz - the class of the object to retrieve
pkObject - the value of the primary key
Returns:
the retrieved PersistableBusinessObject
See Also:
org.kuali.rice.krad.dao.BusinessObjectDao#findByPrimaryKey(java.lang.Class, java.lang.Object)

manageReadOnly

public PersistableBusinessObject manageReadOnly(PersistableBusinessObject bo)
No need to do anything - avoid saving and OJB will "manage read only"

Specified by:
manageReadOnly in interface BusinessObjectDao
Parameters:
bo - the business object to managed
Returns:
the managed copied of the business object
See Also:
BusinessObjectDao.manageReadOnly(org.kuali.rice.krad.bo.PersistableBusinessObject)

getPersistenceStructureService

protected PersistenceStructureService getPersistenceStructureService()
Gets the persistenceStructureService attribute.

Returns:
Returns the persistenceStructureService.

setPersistenceStructureService

public void setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
Sets the persistenceStructureService attribute value.

Parameters:
persistenceStructureService - The persistenceStructureService to set.


Copyright © 2005-2011 The Kuali Foundation. All Rights Reserved.