gov.nih.nci.system.web.util
Class SearchUtils

java.lang.Object
  extended by gov.nih.nci.system.web.util.SearchUtils

public class SearchUtils
extends java.lang.Object

SearchUtils presents various methods to build and modify a hibernate criteria.

Author:
SDK Team

Constructor Summary
SearchUtils(ClassCache classCache)
           
 
Method Summary
 java.lang.Object buildSearchCriteria(java.lang.String packageName, java.util.List criteriaList)
          Generates nested search criteria
 java.lang.Object convertValues(java.lang.reflect.Field field, java.lang.Object value)
          Converts the specified value to the field class type
 java.lang.reflect.Method[] getAllMethods(java.lang.Class resultClass)
          Gets all the methods for a given class
 java.lang.Object getCriteriaValue(java.lang.Object assObject, java.lang.Object critObject)
          Returns the criteria value
 java.lang.reflect.Field getField(java.lang.Class className, java.lang.String attributeName)
          Returns the field for a given attribute name
 java.lang.String getRoleClassName(java.lang.String attRole)
          Returns the class name for a given role
 java.lang.String getRoleName(java.lang.Class searchClass, java.lang.Object criterion)
          Returns the role name for the specified class and object
 java.lang.String getTargetClassName(java.lang.String className, java.lang.String roleName)
          Returns the target class name for the specified class and role names
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchUtils

public SearchUtils(ClassCache classCache)
Method Detail

getRoleName

public java.lang.String getRoleName(java.lang.Class searchClass,
                                    java.lang.Object criterion)
                             throws java.lang.Exception
Returns the role name for the specified class and object

Parameters:
searchClass - Specifies a class
criterion - Specifies an object return Returns the role between the specified class and object
Throws:
java.lang.Exception

getCriteriaValue

public java.lang.Object getCriteriaValue(java.lang.Object assObject,
                                         java.lang.Object critObject)
                                  throws java.lang.Exception
Returns the criteria value

Parameters:
assObject -
critObject -
Returns:
Throws:
java.lang.Exception

buildSearchCriteria

public java.lang.Object buildSearchCriteria(java.lang.String packageName,
                                            java.util.List criteriaList)
                                     throws java.lang.Exception
Generates nested search criteria

Parameters:
packageName -
criteriaList -
Returns:
Throws:
java.lang.Exception

getField

public java.lang.reflect.Field getField(java.lang.Class className,
                                        java.lang.String attributeName)
                                 throws java.lang.Exception
Returns the field for a given attribute name

Parameters:
className - specifies the class name
attributeName - - specifies the attribute name
Returns:
Throws:
java.lang.Exception

convertValues

public java.lang.Object convertValues(java.lang.reflect.Field field,
                                      java.lang.Object value)
                               throws java.lang.Exception
Converts the specified value to the field class type

Parameters:
field - Specifies the field
value - Specifies the values that needs to be stored
Returns:
returns an object with the new value
Throws:
java.lang.Exception

getRoleClassName

public java.lang.String getRoleClassName(java.lang.String attRole)
Returns the class name for a given role

Parameters:
attRole -
Returns:

getAllMethods

public java.lang.reflect.Method[] getAllMethods(java.lang.Class resultClass)
Gets all the methods for a given class

Parameters:
resultClass - - Specifies the class name
Returns:
- Returns all the methods

getTargetClassName

public java.lang.String getTargetClassName(java.lang.String className,
                                           java.lang.String roleName)
                                    throws java.lang.Exception
Returns the target class name for the specified class and role names

Parameters:
className - specifies the class name
roleName - specifies role name
Returns:
Throws:
java.lang.Exception