org.kuali.rice.krad.service
Interface BusinessObjectService

All Known Implementing Classes:
BusinessObjectServiceImpl

public interface BusinessObjectService

This interface defines methods that a BusinessObjectService must provide.


Method Summary
 int countMatching(Class clazz, Map<String,?> fieldValues)
          This method retrieves a count of the business objects populated with data which match the criteria in the given Map.
 int countMatching(Class clazz, Map<String,?> positiveFieldValues, Map<String,?> negativeFieldValues)
          This method retrieves a count of the business objects populated with data which match both the positive criteria and the negative criteria in the given Map.
 void delete(List<? extends PersistableBusinessObject> boList)
          Deletes each business object in the given List.
 void delete(PersistableBusinessObject bo)
          Deletes a business object from the database.
 void deleteMatching(Class clazz, Map<String,?> fieldValues)
          Deletes the object(s) matching the given field values
<T extends BusinessObject>
Collection<T>
findAll(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>
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 by its primary keys and values.
<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 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 method retrieves a collection of business objects populated with data, such that each record in the database populates a new object instance.
 BusinessObject getReferenceIfExists(BusinessObject bo, String referenceName)
          This method attempts to retrieve the reference from a BO if it exists.
 List<? extends PersistableBusinessObject> linkAndSave(List<? extends PersistableBusinessObject> businessObjects)
          Links up any contained objects, and Saves the businessObjects on the list via the persistence layer.
 PersistableBusinessObject linkAndSave(PersistableBusinessObject bo)
          Links up any contained objects, and then Saves the passed in object via the persistence layer.
 void linkUserFields(List<PersistableBusinessObject> bos)
          Updates all KualiUser or Person objects contained within this BO, based on the UserID as the authoritative key.
 void linkUserFields(PersistableBusinessObject bo)
          Updates all KualiUser or Person objects contained within this BO, based on the UserID as the authoritative key.
 PersistableBusinessObject manageReadOnly(PersistableBusinessObject bo)
          Merges the given business object, but tells the ORM that the object is to be treated as Read Only, and even if it has changes, it will not be persisted to the database
 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<? extends PersistableBusinessObject> businessObjects)
          Saves the businessObjects on the list via the persistence layer.
<T extends PersistableBusinessObject>
T
save(T bo)
          Saves the passed in object via the persistence layer.
 

Method Detail

save

<T extends PersistableBusinessObject> T save(T bo)
Saves the passed in object via the persistence layer. This will throw an IllegalArgumentException (runtime exception) if the object passed in is not a descendent of BusinessObject.

Parameters:
bo - A BusinessObject instance or descendent that you wish to be stored.

save

List<? extends PersistableBusinessObject> save(List<? extends PersistableBusinessObject> businessObjects)
Saves the businessObjects on the list via the persistence layer. This will throw an IllegalArgumentException (runtime exception) if any of the objects passed in is not a descendent of BusinessObject.

Parameters:
businessObjects - A List of objects to persist.

linkAndSave

PersistableBusinessObject linkAndSave(PersistableBusinessObject bo)
Links up any contained objects, and then Saves the passed in object via the persistence layer. This will throw an IllegalArgumentException (runtime exception) if the object passed in is not a descendent of BusinessObject.

Parameters:
bo - A BusinessObject instance or descendent that you wish to be stored.

linkAndSave

List<? extends PersistableBusinessObject> linkAndSave(List<? extends PersistableBusinessObject> businessObjects)
Links up any contained objects, and Saves the businessObjects on the list via the persistence layer. This will throw an IllegalArgumentException (runtime exception) if any of the objects passed in is not a descendent of BusinessObject.

Parameters:
businessObjects - A List of objects to persist.

findBySinglePrimaryKey

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

Parameters:
clazz -
primaryKey -
Returns:

findByPrimaryKey

<T extends BusinessObject> T findByPrimaryKey(Class<T> clazz,
                                              Map<String,?> primaryKeys)
Retrieves an object instance identified by its 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.

Parameters:
clazz -
primaryKeys -
Returns:

retrieve

PersistableBusinessObject retrieve(PersistableBusinessObject object)
Retrieves an object instance identified by the class of the given object and the object's primary key values.

Parameters:
object -
Returns:

findAll

<T extends BusinessObject> Collection<T> findAll(Class<T> clazz)
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.

Parameters:
clazz -
Returns:

findAllOrderBy

<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. This will only retrieve business objects by class type.

Parameters:
clazz -
Returns:

findMatching

<T extends BusinessObject> Collection<T> findMatching(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. This will retrieve business objects by class type and also by criteria passed in as key-value pairs, specifically attribute name and its expected value.

Parameters:
clazz -
fieldValues -
Returns:

countMatching

int countMatching(Class clazz,
                  Map<String,?> fieldValues)
This method retrieves a count of the business objects populated with data which match the criteria in the given Map.

Parameters:
clazz -
fieldValues -
Returns:
number of businessObjects of the given class whose fields match the values in the given expected-value Map

countMatching

int countMatching(Class clazz,
                  Map<String,?> positiveFieldValues,
                  Map<String,?> negativeFieldValues)
This method retrieves a count of the business objects populated with data which match both the positive criteria and the negative criteria in the given Map.

Parameters:
clazz -
positiveFieldValues -
negativeFieldValues -
Returns:
number of businessObjects of the given class whose fields match the values in the given expected-value Maps

findMatchingOrderBy

<T extends BusinessObject> Collection<T> findMatchingOrderBy(Class<T> clazz,
                                                             Map<String,?> fieldValues,
                                                             String sortField,
                                                             boolean sortAscending)
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 and its expected value. Performs an order by on sort field.

Parameters:
clazz -
fieldValues -
Returns:

delete

void delete(PersistableBusinessObject bo)
Deletes a business object from the database.

Parameters:
bo -

delete

void delete(List<? extends PersistableBusinessObject> boList)
Deletes each business object in the given List.

Parameters:
boList -

deleteMatching

void deleteMatching(Class clazz,
                    Map<String,?> fieldValues)
Deletes the object(s) matching the given field values

Parameters:
clazz -
fieldValues -

getReferenceIfExists

BusinessObject getReferenceIfExists(BusinessObject bo,
                                    String referenceName)
This method attempts to retrieve the reference from a BO if it exists.

Parameters:
bo - - populated BusinessObject instance that includes the referenceName property
referenceName - - name of the member/property to load
Returns:
A populated object from the DB, if it exists

linkUserFields

void linkUserFields(PersistableBusinessObject bo)
Updates all KualiUser or Person objects contained within this BO, based on the UserID as the authoritative key. The appropriate foreign-key field in the BO itself is also updated. This allows UserIDs to be entered on forms, and the back-end will link up correctly based on this non-key field.

Parameters:
bo - The populated BO (or descendent) instance to be linked & updated

linkUserFields

void linkUserFields(List<PersistableBusinessObject> bos)
Updates all KualiUser or Person objects contained within this BO, based on the UserID as the authoritative key. The appropriate foreign-key field in the BO itself is also updated. This allows UserIDs to be entered on forms, and the back-end will link up correctly based on this non-key field.

Parameters:
bos - A List of populated BusinessObject (or descendent) instances to be linked & updated.

manageReadOnly

PersistableBusinessObject manageReadOnly(PersistableBusinessObject bo)
Merges the given business object, but tells the ORM that the object is to be treated as Read Only, and even if it has changes, it will not be persisted to the database

Parameters:
bo - the business object to managed
Returns:
the managed copied of the business object


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