org.kuali.rice.krad.service.impl
Class PersistenceServiceImpl

java.lang.Object
  extended by org.kuali.rice.krad.service.impl.PersistenceServiceStructureImplBase
      extended by org.kuali.rice.krad.service.impl.PersistenceServiceImplBase
          extended by org.kuali.rice.krad.service.impl.PersistenceServiceImpl
All Implemented Interfaces:
PersistenceService

@Transactional
public class PersistenceServiceImpl
extends PersistenceServiceImplBase
implements PersistenceService

This class is the service implementation for the Persistence structure. OjbRepositoryExplorer provides functions for extracting information from the OJB repository at runtime. This is the default implementation, that is delivered with Kuali.


Constructor Summary
PersistenceServiceImpl()
           
 
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)
           
 KualiModuleService getKualiModuleService()
           
 boolean isProxied(Object bo)
          Defers to the service for the given class
 void linkObjects(Object persistableObject)
          For each reference object to the parent persistableObject, sets the key values for that object.
 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)
           
 void setKualiModuleService(KualiModuleService kualiModuleService)
           
 void setPersistenceServiceJpa(PersistenceService persistenceServiceJpa)
           
 void setPersistenceServiceOjb(PersistenceService persistenceServiceOjb)
           
 
Methods inherited from class org.kuali.rice.krad.service.impl.PersistenceServiceImplBase
getPrimaryKeyFieldValues, getPrimaryKeyFieldValues
 
Methods inherited from class org.kuali.rice.krad.service.impl.PersistenceServiceStructureImplBase
getBusinessObjectAttributeClass, getClassDescriptor, getDescriptorRepository, isJpaEnabledForKradClass, listPrimaryKeyFieldNames
 
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.service.PersistenceService
getPrimaryKeyFieldValues, getPrimaryKeyFieldValues, isJpaEnabledForKradClass
 

Constructor Detail

PersistenceServiceImpl

public PersistenceServiceImpl()
Method Detail

setPersistenceServiceJpa

public void setPersistenceServiceJpa(PersistenceService persistenceServiceJpa)

setPersistenceServiceOjb

public void setPersistenceServiceOjb(PersistenceService persistenceServiceOjb)

clearCache

public void clearCache()
Specified by:
clearCache in interface PersistenceService

loadRepositoryDescriptor

public void loadRepositoryDescriptor(String ojbRepositoryFilePath)
Specified by:
loadRepositoryDescriptor in interface PersistenceService

resolveProxy

public Object resolveProxy(Object o)
Specified by:
resolveProxy in interface PersistenceService

retrieveNonKeyFields

public void retrieveNonKeyFields(Object persistableObject)
Specified by:
retrieveNonKeyFields in interface PersistenceService
Parameters:
persistableObject - object whose objects need to be filled in based on primary keys
See Also:
PersistenceService.retrieveNonKeyFields(java.lang.Object)

retrieveReferenceObject

public void retrieveReferenceObject(Object persistableObject,
                                    String referenceObjectName)
Specified by:
retrieveReferenceObject in interface PersistenceService
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
See Also:
PersistenceService.retrieveReferenceObject(java.lang.Object, String referenceObjectName)

retrieveReferenceObjects

public void retrieveReferenceObjects(Object persistableObject,
                                     List referenceObjectNames)
Specified by:
retrieveReferenceObjects in interface PersistenceService
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
See Also:
PersistenceService.retrieveReferenceObject(java.lang.Object, String referenceObjectName)

retrieveReferenceObjects

public void retrieveReferenceObjects(List persistableObjects,
                                     List referenceObjectNames)
Specified by:
retrieveReferenceObjects in interface PersistenceService
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
See Also:
PersistenceService.retrieveReferenceObject(java.lang.Object, String referenceObjectName)

getFlattenedPrimaryKeyFieldValues

public String getFlattenedPrimaryKeyFieldValues(Object persistableObject)
Specified by:
getFlattenedPrimaryKeyFieldValues in interface PersistenceService
Parameters:
persistableObject - object whose primary key field name,value pairs you want
Returns:
a String representation of the primary key fields and values for the given persistableObject
See Also:
PersistenceService.getFlattenedPrimaryKeyFieldValues(java.lang.Object)

linkObjects

public void linkObjects(Object persistableObject)
For each reference object to the parent persistableObject, sets the key values for that object. First, if the reference object already has a value for the key, the value is left unchanged. Otherwise, for non-anonymous keys, the value is taken from the parent object. For anonymous keys, all other persistableObjects are checked until a value for the key is found.

Specified by:
linkObjects in interface PersistenceService
Parameters:
persistableObject - object whose objects need to have keys filled
See Also:
org.kuali.rice.krad.service.PersistenceService#getReferencedObject(java.lang.Object, org.apache.ojb.broker.metadata.ObjectReferenceDescriptor)

allForeignKeyValuesPopulatedForReference

public boolean allForeignKeyValuesPopulatedForReference(PersistableBusinessObject bo,
                                                        String referenceName)
Description copied from interface: PersistenceService
This method examines whether all the foreign key fields for the specified reference contain values.

Specified by:
allForeignKeyValuesPopulatedForReference in interface PersistenceService
Returns:
true if they all are accessible and have values, false otherwise
See Also:
org.kuali.rice.krad.service.PersistenceService#allForeignKeyValuesPopulatedForReference(org.kuali.rice.krad.bo.BusinessObject, java.lang.String)

refreshAllNonUpdatingReferences

public void refreshAllNonUpdatingReferences(PersistableBusinessObject bo)
Description copied from interface: PersistenceService
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.

Specified by:
refreshAllNonUpdatingReferences in interface PersistenceService
Parameters:
bo - - the businessObject to be refreshed
See Also:
org.kuali.rice.krad.service.PersistenceService#refreshAllNonUpdatingReferences(org.kuali.rice.krad.bo.BusinessObject)

isProxied

public boolean isProxied(Object bo)
Defers to the service for the given class

Specified by:
isProxied in interface PersistenceService
Parameters:
bo - the object to determine if it is a proxy
Returns:
true if the object is an ORM proxy; false otherwise
See Also:
PersistenceService.isProxied(java.lang.Object)

getKualiModuleService

public KualiModuleService getKualiModuleService()

setKualiModuleService

public void setKualiModuleService(KualiModuleService kualiModuleService)


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