FileDocCategorySizeDatePackage
QueryDescriptor.javaAPI DocGlassfish v2 API6862Fri May 04 22:31:22 BST 2007com.sun.enterprise.deployment

QueryDescriptor

public final class QueryDescriptor extends Descriptor
This class contains information about EJB-QL queries for finder/selector methods of EJB2.0 CMP EntityBeans. It represents the XML element.
author
Sanjeev Krishnan

Fields Summary
private String
query
private String
sql
private MethodDescriptor
methodDescriptor
private transient Method
method
private static final int
NO_RETURN_TYPE_MAPPING
private static final int
RETURN_LOCAL_TYPES
private static final int
RETURN_REMOTE_TYPES
private int
returnTypeMapping
static Logger
_logger
Constructors Summary
public QueryDescriptor()

	
     
    
        this.query = null;
        this.sql = null;
        this.returnTypeMapping = NO_RETURN_TYPE_MAPPING;
    
public QueryDescriptor(QueryDescriptor otherQuery, Method m)

        this.query = otherQuery.query;
        this.sql   = otherQuery.sql;
        this.method = m;
        this.returnTypeMapping = otherQuery.returnTypeMapping;
    
Methods Summary
public booleangetHasLocalReturnTypeMapping()

        return (returnTypeMapping == RETURN_LOCAL_TYPES);
    
public booleangetHasNoReturnTypeMapping()

        return (returnTypeMapping == NO_RETURN_TYPE_MAPPING);
    
public booleangetHasRemoteReturnTypeMapping()

        return (returnTypeMapping == RETURN_REMOTE_TYPES);
    
public booleangetHasSQL()

        return (this.sql != null);
    
public booleangetIsEjbQl()

        return (query != null);
    
public java.lang.StringgetQuery()
Get the EJB-QL query (ejb-ql XML element)

	return query;
    
public java.lang.reflect.MethodgetQueryMethod()

	return method;
    
public MethodDescriptorgetQueryMethodDescriptor()

        return methodDescriptor;
    
public intgetReturnTypeMapping()

        return returnTypeMapping;
    
public java.lang.StringgetSQL()

	return sql;
    
public voidprint(java.lang.StringBuffer toStringBuffer)

        toStringBuffer.append("Query ");
        if(getQueryMethodDescriptor()  != null)
            getQueryMethodDescriptor().print(toStringBuffer);
        toStringBuffer.append("\n");
        if (getHasSQL()) {
            toStringBuffer.append("SQL : ").append(getSQL());
            return;
        } 
        if (getIsEjbQl()) {
            toStringBuffer.append("EJB QL: ").append(query);
            return;
        }
        toStringBuffer.append(" No query associated");
    
public voidsetHasLocalReturnTypeMapping()

        returnTypeMapping = RETURN_LOCAL_TYPES;
    
public voidsetHasNoReturnTypeMapping()

        returnTypeMapping = NO_RETURN_TYPE_MAPPING;
    
public voidsetHasRemoteReturnTypeMapping()

        returnTypeMapping = RETURN_REMOTE_TYPES;
    
public voidsetQuery(java.lang.String query)
Set the EJB-QL query (ejb-ql XML element). If query parameter is null, or has no content, getIsEjbQl will return false. Otherwise, getIsEjbQl will return true.

         _logger.log(Level.FINE,"input query = '" + query + "'");
 
        String newQuery = (query != null) ? query.trim() : null;
        if( (newQuery != null) && newQuery.equals("") ) {
            newQuery = null;
        }
		if( newQuery == null ) {
			_logger.log(Level.FINE,"query has no content -- setting to NULL");
		} else {
			_logger.log(Level.FINE,"setting query to '" + newQuery + "'");
        }
        this.query = newQuery;
    
public voidsetQueryMethod(java.lang.reflect.Method m)
public void setQueryMethod(MethodDescriptor md) { this.methodDescriptor = md; } public MethodDescriptor getQueryMethod() { return methodDescriptor; }

	this.method = m;
    
public voidsetQueryMethodDescriptor(MethodDescriptor m)

        methodDescriptor = m;
    
public voidsetSQL(java.lang.String sql)

	this.sql = sql;