org.LexGrid.LexBIG.caCore.web.util
Class LexEVSSearchUtils

java.lang.Object
  extended by org.LexGrid.LexBIG.caCore.web.util.LexEVSSearchUtils

public class LexEVSSearchUtils
extends Object

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

Author:
SDK Team

Field Summary
private  gov.nih.nci.system.util.ClassCache classCache
           
private static org.apache.log4j.Logger log
           
 
Constructor Summary
LexEVSSearchUtils(gov.nih.nci.system.util.ClassCache classCache)
           
 
Method Summary
 Object buildSearchCriteria(String packageName, List criteriaList)
          Generates nested search criteria
 Object convertValues(Field field, Object value)
          Converts the specified value to the field class type
 Method[] getAllMethods(Class resultClass)
          Gets all the methods for a given class
private  List getAttributeCollection(String attString)
          Returns list of search attributes
private  Object getAttributeCriteria(String att, Object critObject, String packageName)
          Generates a criteria object
private  Method getAttributeSetMethodName(Object attObject, String attName)
          Returns a Method for a given attribute in the specified class
private  Object getCriteria(String criteriaString, String packageName)
          Generates Search Criteria
 Object getCriteriaValue(Object assObject, Object critObject)
          Returns the criteria value
 Field getField(Class className, String attributeName)
          Returns the field for a given attribute name
private  Object getFieldValue(Field field, String attValue)
          Returns a value for the specified field
private  Method getMethod(Class critClass, String methodName)
          Returns the method specified by the method name
 String getRoleClassName(String attRole)
          Returns the class name for a given role
private  Method getRoleMethod(Object criteriaObject, Object assObject)
          Returns the get method for the given association
 String getRoleName(Class searchClass, Object criterion)
          Returns the role name for the specified class and object
 String getTargetClassName(String className, String roleName)
          Returns the target class name for the specified class and role names
private  boolean isCollectionType(Class inputClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Logger log

classCache

private gov.nih.nci.system.util.ClassCache classCache
Constructor Detail

LexEVSSearchUtils

public LexEVSSearchUtils(gov.nih.nci.system.util.ClassCache classCache)
Method Detail

getRoleName

public String getRoleName(Class searchClass,
                          Object criterion)
                   throws 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:
Exception

isCollectionType

private boolean isCollectionType(Class inputClass)

getCriteriaValue

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

Parameters:
assObject -
critObject -
Returns:
Throws:
Exception

buildSearchCriteria

public Object buildSearchCriteria(String packageName,
                                  List criteriaList)
                           throws WebQueryException
Generates nested search criteria

Parameters:
packageName -
criteriaList -
Returns:
Throws:
Exception
WebQueryException

getCriteria

private Object getCriteria(String criteriaString,
                           String packageName)
                    throws WebQueryException
Generates Search Criteria

Parameters:
criteriaString -
packageName -
Returns:
Throws:
Exception
WebQueryException

getRoleMethod

private Method getRoleMethod(Object criteriaObject,
                             Object assObject)
                      throws Exception
Returns the get method for the given association

Parameters:
criteriaObject -
assObject -
Returns:
Throws:
Exception

getMethod

private Method getMethod(Class critClass,
                         String methodName)
Returns the method specified by the method name

Parameters:
critClass -
methodName -
Returns:

getAttributeCollection

private List getAttributeCollection(String attString)
                             throws Exception
Returns list of search attributes

Parameters:
attString -
Returns:
Throws:
Exception

getAttributeCriteria

private Object getAttributeCriteria(String att,
                                    Object critObject,
                                    String packageName)
                             throws Exception
Generates a criteria object

Parameters:
att - - specifies the attribute
critObject - - specifies the criteria
packageName - - specifies the package name
Returns:
Throws:
Exception

getField

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

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

getAttributeSetMethodName

private Method getAttributeSetMethodName(Object attObject,
                                         String attName)
Returns a Method for a given attribute in the specified class

Parameters:
attObject -
attName -
Returns:

getFieldValue

private Object getFieldValue(Field field,
                             String attValue)
                      throws Exception
Returns a value for the specified field

Parameters:
field -
attValue -
Returns:
Throws:
Exception

convertValues

public Object convertValues(Field field,
                            Object value)
                     throws 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:
Exception

getRoleClassName

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

Parameters:
attRole -
Returns:

getAllMethods

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

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

getTargetClassName

public String getTargetClassName(String className,
                                 String roleName)
                          throws 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:
Exception