org.kuali.kfs.module.purap.util
Class PurApObjectUtils

java.lang.Object
  extended by org.kuali.kfs.module.purap.util.PurApObjectUtils

public class PurApObjectUtils
extends Object

Purap Object Utils. Similar to the nervous system ObjectUtils this class contains methods to reflectively set and get values on BusinessObjects that are passed in.


Constructor Summary
PurApObjectUtils()
           
 
Method Summary
protected static void attemptCopyOfFieldName(String baseClassName, String fieldName, org.kuali.rice.kns.bo.BusinessObject sourceObject, org.kuali.rice.kns.bo.BusinessObject targetObject, Map supplementalUncopyable)
          Attempts to copy a field
protected static void copyCollection(String fieldName, org.kuali.rice.kns.bo.BusinessObject targetObject, Object propertyValue, Map supplementalUncopyable)
          Copies a collection
protected static Object createNewObjectFromClass(Class clazz)
          This method safely creates a object from a class Convenience method to create new object and throw a runtime exception if it cannot If the class is an ExternalizableBusinessObject, this method will determine the interface for the EBO and query the appropriate module service to create a new instance.
static boolean equalByKeys(org.kuali.rice.kns.bo.BusinessObject bo1, org.kuali.rice.kns.bo.BusinessObject bo2)
          Compares two business objects for equality of type and key values.
protected static boolean isProcessableField(Class baseClass, String fieldName, Map excludedFieldNames)
          True if a field is processable
static void populateFromBaseClass(Class base, org.kuali.rice.kns.bo.BusinessObject src, org.kuali.rice.kns.bo.BusinessObject target)
          Copies based on a class template it does not copy fields in Known Uncopyable Fields
static void populateFromBaseClass(Class base, org.kuali.rice.kns.bo.BusinessObject src, org.kuali.rice.kns.bo.BusinessObject target, Map supplementalUncopyable)
          Populates a class using a base class to determine fields
static void populateFromBaseWithSuper(org.kuali.rice.kns.bo.BusinessObject sourceObject, org.kuali.rice.kns.bo.BusinessObject targetObject, Map supplementalUncopyableFieldNames, Set<Class> classesToExclude)
          Populates from a base class traversing up the object hierarchy.
static org.kuali.rice.kns.bo.BusinessObject retrieveObjectWithIdentitcalKey(Collection controlList, org.kuali.rice.kns.bo.BusinessObject bo)
          Compares a business object with a List of BOs to determine if an object with the same key as the BO exists in the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PurApObjectUtils

public PurApObjectUtils()
Method Detail

populateFromBaseClass

public static void populateFromBaseClass(Class base,
                                         org.kuali.rice.kns.bo.BusinessObject src,
                                         org.kuali.rice.kns.bo.BusinessObject target,
                                         Map supplementalUncopyable)
Populates a class using a base class to determine fields

Parameters:
base - the class to determine what fields to copy
src - the source class
target - the target class
supplementalUncopyable - a list of fields to never copy

isProcessableField

protected static boolean isProcessableField(Class baseClass,
                                            String fieldName,
                                            Map excludedFieldNames)
True if a field is processable

Parameters:
baseClass - the base class
fieldName - the field name to detrmine if processable
excludedFieldNames - field names to exclude
Returns:
true if a field is processable

attemptCopyOfFieldName

protected static void attemptCopyOfFieldName(String baseClassName,
                                             String fieldName,
                                             org.kuali.rice.kns.bo.BusinessObject sourceObject,
                                             org.kuali.rice.kns.bo.BusinessObject targetObject,
                                             Map supplementalUncopyable)
Attempts to copy a field

Parameters:
baseClass - the base class
fieldName - the field name to determine if processable
sourceObject - source object
targetObject - target object
supplementalUncopyable -

copyCollection

protected static void copyCollection(String fieldName,
                                     org.kuali.rice.kns.bo.BusinessObject targetObject,
                                     Object propertyValue,
                                     Map supplementalUncopyable)
                              throws org.kuali.rice.kns.web.format.FormatException,
                                     IllegalAccessException,
                                     InvocationTargetException,
                                     NoSuchMethodException
Copies a collection

Parameters:
fieldName - field to copy
targetObject - the object of the collection
propertyValue - value to copy
supplementalUncopyable - uncopyable fields
Throws:
org.kuali.rice.kns.web.format.FormatException
IllegalAccessException
InvocationTargetException
NoSuchMethodException

createNewObjectFromClass

protected static Object createNewObjectFromClass(Class clazz)
This method safely creates a object from a class Convenience method to create new object and throw a runtime exception if it cannot If the class is an ExternalizableBusinessObject, this method will determine the interface for the EBO and query the appropriate module service to create a new instance.

Parameters:
boClass -
Returns:
a newInstance() of clazz

populateFromBaseClass

public static void populateFromBaseClass(Class base,
                                         org.kuali.rice.kns.bo.BusinessObject src,
                                         org.kuali.rice.kns.bo.BusinessObject target)
Copies based on a class template it does not copy fields in Known Uncopyable Fields

Parameters:
base - the base class
src - source
target - target

populateFromBaseWithSuper

public static void populateFromBaseWithSuper(org.kuali.rice.kns.bo.BusinessObject sourceObject,
                                             org.kuali.rice.kns.bo.BusinessObject targetObject,
                                             Map supplementalUncopyableFieldNames,
                                             Set<Class> classesToExclude)
Populates from a base class traversing up the object hierarchy.

Parameters:
sourceObject - object to copy from
targetObject - object to copy to
supplementalUncopyableFieldNames - fields to exclude
classesToExclude - classes to exclude

retrieveObjectWithIdentitcalKey

public static org.kuali.rice.kns.bo.BusinessObject retrieveObjectWithIdentitcalKey(Collection controlList,
                                                                                   org.kuali.rice.kns.bo.BusinessObject bo)
Compares a business object with a List of BOs to determine if an object with the same key as the BO exists in the list. If it does, the item is returned.

Parameters:
controlList - - The list of items to check
bo - - The BO whose keys we are looking for in the controlList

equalByKeys

public static boolean equalByKeys(org.kuali.rice.kns.bo.BusinessObject bo1,
                                  org.kuali.rice.kns.bo.BusinessObject bo2)
Compares two business objects for equality of type and key values.

Parameters:
bo1 -
bo2 -
Returns:
boolean indicating whether the two objects are equal.


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