org.kuali.rice.kns.service
Interface PersistenceService

All Known Implementing Classes:
PersistenceServiceImpl, PersistenceServiceJpaImpl, PersistenceServiceOjbImpl

public interface PersistenceService


Method Summary
 boolean allForeignKeyValuesPopulatedForReference(PersistableBusinessObject bo, String referenceName)
          This method examines whether all the foreign key fields for the specified reference contain values.
 void clearCache()
           
 String getFlattenedPrimaryKeyFieldValues(Object persistableObject)
           
 Map getPrimaryKeyFieldValues(Object persistableObject)
           
 Map getPrimaryKeyFieldValues(Object persistableObject, boolean sortFieldNames)
           
 boolean isJpaEnabledForKnsClass(Class clazz)
          Determines if JPA is enabled for the KNS and for the given class
 boolean isProxied(Object object)
          Determines if the given object is proxied by the ORM or not
 void linkObjects(Object persistableObject)
           
 void loadRepositoryDescriptor(String ojbRepositoryFilePath)
           
 void refreshAllNonUpdatingReferences(PersistableBusinessObject bo)
          This method refreshes all reference objects to this main object that are 'non-updateable'.
 Object resolveProxy(Object o)
           
 void retrieveNonKeyFields(Object persistableObject)
           
 void retrieveReferenceObject(Object persistableObject, String referenceObjectName)
           
 void retrieveReferenceObjects(List persistableObjects, List referenceObjectNames)
           
 void retrieveReferenceObjects(Object persistableObject, List referenceObjectNames)
           
 

Method Detail

loadRepositoryDescriptor

void loadRepositoryDescriptor(String ojbRepositoryFilePath)

clearCache

void clearCache()

resolveProxy

Object resolveProxy(Object o)

getPrimaryKeyFieldValues

Map getPrimaryKeyFieldValues(Object persistableObject)
Parameters:
persistableObject - object whose primary key field name,value pairs you want
Returns:
a Map containing the names and values of fields specified the given class which are designated as key fields in the OJB repository file
Throws:
IllegalArgumentException - if the given Object is null
ClassNotPersistableException - if the given object is of a type not described in the OJB repository

getPrimaryKeyFieldValues

Map getPrimaryKeyFieldValues(Object persistableObject,
                             boolean sortFieldNames)
Parameters:
persistableObject - object whose primary key field name,value pairs you want
sortFieldNames - if true, the returned Map will iterate through its entries sorted by fieldName
Returns:
a Map containing the names and values of fields specified the given class which are designated as key fields in the OJB repository file
Throws:
IllegalArgumentException - if the given Object is null
ClassNotPersistableException - if the given object is of a type not described in the OJB repository

retrieveNonKeyFields

void retrieveNonKeyFields(Object persistableObject)
Parameters:
persistableObject - object whose objects need to be filled in based on primary keys
Throws:
IllegalArgumentException - if the given Object is null
ClassNotPersistableException - if the given object is of a type not described in the OJB repository

retrieveReferenceObject

void retrieveReferenceObject(Object persistableObject,
                             String referenceObjectName)
Parameters:
persistableObject - object whose specified reference object needs to be filled in based on primary keys
referenceObjectName - the name of the reference object that will be filled in based on primary key values
Throws:
IllegalArgumentException - if the given Object is null
ClassNotPersistableException - if the given object is of a type not described in the OJB repository

retrieveReferenceObjects

void retrieveReferenceObjects(Object persistableObject,
                              List referenceObjectNames)
Parameters:
persistableObject - object whose specified reference objects need to be filled in based on primary keys
referenceObjectNames - the names of the reference objects that will be filled in based on primary key values
Throws:
IllegalArgumentException - if either of the given lists is null or empty, or if any of the referenceObjectNames is blank
ClassNotPersistableException - if the given object is of a type not described in the OJB repository

retrieveReferenceObjects

void retrieveReferenceObjects(List persistableObjects,
                              List referenceObjectNames)
Parameters:
persistableObjects - objects whose specified reference objects need to be filled in based on primary keys
referenceObjectNames - the names of the reference objects that will be filled in based on primary key values
Throws:
IllegalArgumentException - if either of the given lists is null or empty, or if any of the referenceObjectNames is blank
ClassNotPersistableException - if the given object is of a type not described in the OJB repository

linkObjects

void linkObjects(Object persistableObject)
Parameters:
persistableObject - object whose objects need to have keys filled
Throws:
IllegalArgumentException - if the given Object is null
ClassNotPersistableException - if the given object is of a type not described in the OJB repository

getFlattenedPrimaryKeyFieldValues

String getFlattenedPrimaryKeyFieldValues(Object persistableObject)
Parameters:
persistableObject - object whose primary key field name,value pairs you want
bounded - - whether to restrict the number of rows returned
Returns:
a String representation of the primary key fields and values for the given persistableObject
Throws:
IllegalArgumentException - if the given Object is null
ClassNotPersistableException - if the given object is of a type not described in the OJB repository

allForeignKeyValuesPopulatedForReference

boolean allForeignKeyValuesPopulatedForReference(PersistableBusinessObject bo,
                                                 String referenceName)
This method examines whether all the foreign key fields for the specified reference contain values.

Parameters:
bo -
referenceName -
Returns:
true if they all are accessible and have values, false otherwise

refreshAllNonUpdatingReferences

void refreshAllNonUpdatingReferences(PersistableBusinessObject bo)
This method refreshes all reference objects to this main object that are 'non-updateable'. In general, this means that if a reference object is configured to not be updated when the parent document is saved, then they are non-updated. This will not refresh updateable objects, which can cause problems when you're creating new objects. See PersistenceServiceImpl.isUpdateableReference() for the full logic.

Parameters:
bo - - the businessObject to be refreshed

isProxied

boolean isProxied(Object object)
Determines if the given object is proxied by the ORM or not

Parameters:
object - the object to determine if it is a proxy
Returns:
true if the object is an ORM proxy; false otherwise

isJpaEnabledForKnsClass

boolean isJpaEnabledForKnsClass(Class clazz)
Determines if JPA is enabled for the KNS and for the given class

Parameters:
clazz - the class to check for JPA enabling of
Returns:
true if JPA is enabled for the class, false otherwise


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