FileDocCategorySizeDatePackage
MethodHelper.javaAPI DocGlassfish v2 API7597Fri May 04 22:34:48 BST 2007com.sun.jdo.spi.persistence.support.ejb.ejbc

MethodHelper

public class MethodHelper extends AbstractMethodHelper
This is a subclass of {@link AbstractMethodHelper} which provides overridden method implementations based on an SunONE implementation.
author
Rochelle Raccah

Fields Summary
private static final ResourceBundle
messages
I18N message handler
Constructors Summary
public MethodHelper(com.sun.enterprise.deployment.IASEjbCMPEntityDescriptor descriptor)
Creates a new instance of MethodHelper

param
ejbcmp the IASEjbCMPEntityDescriptor which defines the information for this bean.


	                  	 
	   
	
		super(descriptor);
	
Methods Summary
protected voidcategorizeMethods()
Reads all known methods and sorts them by name into specific Collections for further processing.

		IASEjbCMPEntityDescriptor cmpDescriptor = 
			(IASEjbCMPEntityDescriptor)getDescriptor();

		super.categorizeMethods();

		// replace the finders and selectors with ias specific info
		setFinders(getListForCollection(cmpDescriptor.getFinders()));
		setSelectors(getListForCollection(cmpDescriptor.getSelectors()));
	
private com.sun.enterprise.deployment.runtime.IASEjbCMPFindergetFinder(java.lang.reflect.Method method)

		IASEjbCMPEntityDescriptor cmpDescriptor = 
			(IASEjbCMPEntityDescriptor)getDescriptor();
		IASEjbCMPFinder finder = cmpDescriptor.getIASEjbCMPFinder(method);

		if (finder == null) {
			String methodSignature = cmpDescriptor.getName() + '." +
				method.getName() + 
				JavaClassWriterHelper.parenleft_ +
				JavaClassWriterHelper.getParameterTypesList(method) + 
				JavaClassWriterHelper.parenright_ ;
			String msg = I18NHelper.getMessage(messages, 
				"EXC_MissingCMP11Finder", methodSignature);//NOI18N
			throw new RuntimeException(msg);
		}

		return finder;
	
public java.lang.StringgetJDOFilterExpression(java.lang.reflect.Method method)
Gets the jdo filter expression associated with the specified method if it exists. Note that this method should only be used for CMP 1.1 - use {@link #getQueryString} for CMP 2.0.

param
method the java.lang.reflect.Method object used to find the query filter
return
the jdo filter expression

		IASEjbCMPFinder cmpFinder = getFinder(method);

		return ((cmpFinder != null) ? cmpFinder.getQueryFilter() : null);
	
public java.lang.StringgetJDOOrderingSpecification(java.lang.reflect.Method method)
Gets the jdo ordering specification associated with the specified method if it exists. Note that this method should only be used for CMP 1.1 - use {@link #getQueryString} for CMP 2.0.

param
method the java.lang.reflect.Method object used to find the parameter declaration
return
the jdo ordering specification

		IASEjbCMPFinder cmpFinder = getFinder(method);

		return ((cmpFinder != null) ? cmpFinder.getQueryOrdering() : null);
        
public java.lang.StringgetJDOParameterDeclaration(java.lang.reflect.Method method)
Gets the jdo parameter declaration associated with the specified method if it exists. Note that this method should only be used for CMP 1.1 - use {@link #getQueryString} for CMP 2.0.

param
method the java.lang.reflect.Method object used to find the parameter declaration
return
the jdo parameter declaration

		IASEjbCMPFinder cmpFinder = getFinder(method);

		return ((cmpFinder != null) ? 
			cmpFinder.getQueryParameterDeclaration() : null);
	
public java.lang.StringgetJDOVariableDeclaration(java.lang.reflect.Method method)
Gets the jdo variables declaration associated with the specified method if it exists. Note that this method should only be used for CMP 1.1 - use {@link #getQueryString} for CMP 2.0.

param
method the java.lang.reflect.Method object used to find the parameter declaration
return
the jdo variables declaration

		IASEjbCMPFinder cmpFinder = getFinder(method);

		return ((cmpFinder != null) ? cmpFinder.getQueryVariables() : null);
	
private static java.util.ArrayListgetListForCollection(java.util.Collection aCollection)

		return ((aCollection != null) ? 
			new ArrayList(aCollection) : new ArrayList());
	
public booleanisQueryPrefetchEnabled(java.lang.reflect.Method method)
Returns true if prefetch is enabled for the specified method, false otherwise. Prefetch is enabled by default.

param
method the java.lang.reflect.Method object used to find the prefetch setting.
return
a boolean representing the prefetch setting

		boolean enabled = true;
		QueryDescriptor queryDescriptor = getQueryDescriptor(method);

		if (queryDescriptor != null) 
		{
			IASEjbCMPEntityDescriptor cmpDescriptor = 
				(IASEjbCMPEntityDescriptor)getDescriptor();
			PrefetchDisabledDescriptor pdDescriptor = 
				cmpDescriptor.getPrefetchDisabledDescriptor();

			if (pdDescriptor != null)
			{
				MethodDescriptor methodDescriptor =
					queryDescriptor.getQueryMethodDescriptor();

				enabled = !pdDescriptor.isPrefetchDisabledFor(
					methodDescriptor);
			}
		}

		return enabled;