org.LexGrid.LexBIG.caCore.client.proxy
Class DataServiceProxyHelperImpl

java.lang.Object
  extended by gov.nih.nci.system.client.proxy.ProxyHelperImpl
      extended by org.LexGrid.LexBIG.caCore.client.proxy.DataServiceProxyHelperImpl
All Implemented Interfaces:
gov.nih.nci.system.client.proxy.ProxyHelper

public class DataServiceProxyHelperImpl
extends gov.nih.nci.system.client.proxy.ProxyHelperImpl

Object proxy implementation for EVS. Certain methods are overridden to provide EVS-specific proxying functionality.

Author:
Shaziya Muhsin, Konrad Rokicki

Field Summary
private static org.apache.log4j.Logger log
           
private static String[] NON_LAZY_LOAD_METHODS
           
 
Constructor Summary
DataServiceProxyHelperImpl()
           
 
Method Summary
protected  Object accountForCastorMethods(List result, org.aopalliance.intercept.MethodInvocation methodInvocation)
          Account for all the extra methods Castor puts in its beans.
protected  Object convertLexEVSListProxyToProxy(gov.nih.nci.system.applicationservice.ApplicationService as, LexEVSListProxy proxy)
           
protected  Object convertObjectToProxy(gov.nih.nci.system.applicationservice.ApplicationService as, Object obj)
           
 Object convertToProxy(gov.nih.nci.system.applicationservice.ApplicationService as, Object obj)
           
protected  String getPropertyNameFromMethodName(org.aopalliance.intercept.MethodInvocation invocation)
          Determine the property within the bean that is being referenced by the method called.
protected  boolean isFieldHibernateInit(Object obj, String fieldName)
          Determine whether or not a Field has been initialized by Hibernate or not.
 boolean isInitialized(org.aopalliance.intercept.MethodInvocation invocation)
          Returns true if the object is initialized
protected  boolean isLazyLoadableMethod(Method method)
           
protected  boolean isMethodInitialized(org.aopalliance.intercept.MethodInvocation invocation)
          Determine whether or not this method call has been fully initialized by Hibernate.
 Object lazyLoad(gov.nih.nci.system.applicationservice.ApplicationService as, org.aopalliance.intercept.MethodInvocation invocation)
          Implements the LazyLoading
protected  String makeFirstLetterLowerCase(String searchString)
           
 
Methods inherited from class gov.nih.nci.system.client.proxy.ProxyHelperImpl
convertArrayToProxy, convertCollectionToProxy, convertListProxyToProxy, convertToObject, createClone, getAllFields, getField, getMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.log4j.Logger log

NON_LAZY_LOAD_METHODS

private static final String[] NON_LAZY_LOAD_METHODS
Constructor Detail

DataServiceProxyHelperImpl

public DataServiceProxyHelperImpl()
Method Detail

convertToProxy

public Object convertToProxy(gov.nih.nci.system.applicationservice.ApplicationService as,
                             Object obj)
Specified by:
convertToProxy in interface gov.nih.nci.system.client.proxy.ProxyHelper
Overrides:
convertToProxy in class gov.nih.nci.system.client.proxy.ProxyHelperImpl

convertLexEVSListProxyToProxy

protected Object convertLexEVSListProxyToProxy(gov.nih.nci.system.applicationservice.ApplicationService as,
                                               LexEVSListProxy proxy)

convertObjectToProxy

protected Object convertObjectToProxy(gov.nih.nci.system.applicationservice.ApplicationService as,
                                      Object obj)
Overrides:
convertObjectToProxy in class gov.nih.nci.system.client.proxy.ProxyHelperImpl

isInitialized

public boolean isInitialized(org.aopalliance.intercept.MethodInvocation invocation)
                      throws Exception
Returns true if the object is initialized

Specified by:
isInitialized in interface gov.nih.nci.system.client.proxy.ProxyHelper
Overrides:
isInitialized in class gov.nih.nci.system.client.proxy.ProxyHelperImpl
Throws:
Exception

isLazyLoadableMethod

protected boolean isLazyLoadableMethod(Method method)

getPropertyNameFromMethodName

protected String getPropertyNameFromMethodName(org.aopalliance.intercept.MethodInvocation invocation)
                                        throws Exception
Determine the property within the bean that is being referenced by the method called. This is due to Castor's naming conventions -- for example: The method 'getPresentationCount' May reference '_presentationList' in the bean. We need to know the specific name of the property associated with each method call so that we know what property Hibernate needs to lazy load. This also needs to take into account that Castor may assign multiple methods to a property, for example, it may return a count of the property (getPresentationCount), or an Iterator (IteratePresentation)... and so on. All these methods in the end reference the same property in the bean, '_presentationList'.

Parameters:
invocation - The Method Invocation.
Returns:
The property name within the bean that will be referenced by this MethodInvocation.
Throws:
Exception

makeFirstLetterLowerCase

protected String makeFirstLetterLowerCase(String searchString)

isMethodInitialized

protected boolean isMethodInitialized(org.aopalliance.intercept.MethodInvocation invocation)
                               throws Exception
Determine whether or not this method call has been fully initialized by Hibernate. If not, it will need to be lazy-loaded.

Parameters:
invocation - The MethodInvocation to check.
Returns:
Whether or not it has been fully initialized by Hibernate.
Throws:
Exception

isFieldHibernateInit

protected boolean isFieldHibernateInit(Object obj,
                                       String fieldName)
                                throws Exception
Determine whether or not a Field has been initialized by Hibernate or not.

Parameters:
obj - The object to check.
fieldName - The field name.
Returns:
If the given field has been initialized or not.
Throws:
Exception

lazyLoad

public Object lazyLoad(gov.nih.nci.system.applicationservice.ApplicationService as,
                       org.aopalliance.intercept.MethodInvocation invocation)
                throws Throwable
Implements the LazyLoading

Specified by:
lazyLoad in interface gov.nih.nci.system.client.proxy.ProxyHelper
Overrides:
lazyLoad in class gov.nih.nci.system.client.proxy.ProxyHelperImpl
Throws:
Throwable

accountForCastorMethods

protected Object accountForCastorMethods(List result,
                                         org.aopalliance.intercept.MethodInvocation methodInvocation)
Account for all the extra methods Castor puts in its beans. This needs to be done because the properties themselves may not be initialized by Hibernate (lazy loaded), but calling one of these methods on a Castor bean will try to invoke the un-initialized property. So, we have to determine what method is being called and process the result accordingly.

Parameters:
result - The right result given the Method being called.
methodInvocation - The method being invoked.
Returns: