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:
ProxyHelper

public class DataServiceProxyHelperImpl
extends ProxyHelperImpl

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

Author:
Shaziya Muhsin, Konrad Rokicki

Constructor Summary
DataServiceProxyHelperImpl()
           
 
Method Summary
protected  java.lang.Object accountForCastorMethods(java.util.List result, MethodInvocation methodInvocation)
          Account for all the extra methods Castor puts in its beans.
protected  java.lang.Object convertLexEVSListProxyToProxy(ApplicationService as, LexEVSListProxy proxy)
           
protected  java.lang.Object convertObjectToProxy(ApplicationService as, java.lang.Object obj)
           
 java.lang.Object convertToProxy(ApplicationService as, java.lang.Object obj)
           
protected  java.lang.String getPropertyNameFromMethodName(MethodInvocation invocation)
          Determine the property within the bean that is being referenced by the method called.
protected  boolean isFieldHibernateInit(java.lang.Object obj, java.lang.String fieldName)
          Determine whether or not a Field has been initialized by Hibernate or not.
 boolean isInitialized(MethodInvocation invocation)
          Returns true if the object is initialized
protected  boolean isLazyLoadableMethod(java.lang.reflect.Method method)
           
protected  boolean isMethodInitialized(MethodInvocation invocation)
          Determine whether or not this method call has been fully initialized by Hibernate.
 java.lang.Object lazyLoad(ApplicationService as, MethodInvocation invocation)
          Implements the LazyLoading
protected  java.lang.String makeFirstLetterLowerCase(java.lang.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
 

Constructor Detail

DataServiceProxyHelperImpl

public DataServiceProxyHelperImpl()
Method Detail

convertToProxy

public java.lang.Object convertToProxy(ApplicationService as,
                                       java.lang.Object obj)
Specified by:
convertToProxy in interface ProxyHelper
Overrides:
convertToProxy in class ProxyHelperImpl

convertLexEVSListProxyToProxy

protected java.lang.Object convertLexEVSListProxyToProxy(ApplicationService as,
                                                         LexEVSListProxy proxy)

convertObjectToProxy

protected java.lang.Object convertObjectToProxy(ApplicationService as,
                                                java.lang.Object obj)
Overrides:
convertObjectToProxy in class ProxyHelperImpl

isInitialized

public boolean isInitialized(MethodInvocation invocation)
                      throws java.lang.Exception
Returns true if the object is initialized

Specified by:
isInitialized in interface ProxyHelper
Overrides:
isInitialized in class ProxyHelperImpl
Throws:
java.lang.Exception

isLazyLoadableMethod

protected boolean isLazyLoadableMethod(java.lang.reflect.Method method)

getPropertyNameFromMethodName

protected java.lang.String getPropertyNameFromMethodName(MethodInvocation invocation)
                                                  throws java.lang.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:
java.lang.Exception

makeFirstLetterLowerCase

protected java.lang.String makeFirstLetterLowerCase(java.lang.String searchString)

isMethodInitialized

protected boolean isMethodInitialized(MethodInvocation invocation)
                               throws java.lang.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:
java.lang.Exception

isFieldHibernateInit

protected boolean isFieldHibernateInit(java.lang.Object obj,
                                       java.lang.String fieldName)
                                throws java.lang.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:
java.lang.Exception

lazyLoad

public java.lang.Object lazyLoad(ApplicationService as,
                                 MethodInvocation invocation)
                          throws java.lang.Throwable
Implements the LazyLoading

Specified by:
lazyLoad in interface ProxyHelper
Overrides:
lazyLoad in class ProxyHelperImpl
Throws:
java.lang.Throwable

accountForCastorMethods

protected java.lang.Object accountForCastorMethods(java.util.List result,
                                                   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: