org.apache.ojb.broker.query
Class SelectionCriteria

java.lang.Object
  extended by org.apache.ojb.broker.query.SelectionCriteria
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ExistsCriteria, FieldCriteria, SqlCriteria, ValueCriteria

public abstract class SelectionCriteria
extends Object
implements Serializable

abstract baseclass of all criteria classes, can't be instantiated. This code is based on stuff from COBRA - Java Object Persistence Layer Copyright (C) 1997, 1998 DB Harvey-George eMail: cobra@lowrent.org

Version:
$Id: SelectionCriteria.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $
Author:
DB Harvey-George, Thomas Mahler, Jakob Braeuchi
See Also:
Serialized Form

Field Summary
protected static String BETWEEN
           
protected static String EQUAL
           
protected static String GREATER
           
protected static String IN
           
protected static String IS_NULL
           
protected static String LESS
           
protected static String LIKE
           
protected static String NOT_BETWEEN
           
protected static String NOT_EQUAL
           
protected static String NOT_GREATER
           
protected static String NOT_IN
           
protected static String NOT_IS_NULL
           
protected static String NOT_LESS
           
protected static String NOT_LIKE
           
 
Method Summary
 void bind(Object newValue)
          sets the value of the criteria to newValue.
 String getAlias()
           
 Object getAttribute()
          Answer the attribute
 List getClassesForPath(String aPath)
          Get the a List of Class objects used as hints for a path
abstract  String getClause()
          Answer the SQL compare-clause for this criteria
 Criteria getCriteria()
           
 int getNumberOfExtentsToBind()
          Returns the numberOfExtentsToBind.
 Map getPathClasses()
          Gets the pathClasses from the parent Criteria.
 QueryByCriteria getQuery()
           
 UserAlias getUserAlias()
           
 Object getValue()
          Answer the value
protected  boolean isBindable()
          answer true if the selection criteria is bindable BRJ: value null is bindable
 boolean isBound()
          BRJ : Used by the ODMG OQLQuery.bind() operation
 boolean isTranslateAttribute()
           
 void setAlias(String alias)
          Sets the alias.
 void setAlias(String alias, String aliasPath)
          Sets the alias.
 void setAlias(UserAlias userAlias)
          Sets the alias using a userAlias object.
protected  void setBound(boolean bound)
          Sets the bound.
 void setNumberOfExtentsToBind(int numberOfExtentsToBind)
          Sets the numberOfExtentsToBind.
protected  void setValue(Object value)
          Sets the value.
 String toString()
          String representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUAL

protected static final String EQUAL
See Also:
Constant Field Values

NOT_EQUAL

protected static final String NOT_EQUAL
See Also:
Constant Field Values

GREATER

protected static final String GREATER
See Also:
Constant Field Values

NOT_GREATER

protected static final String NOT_GREATER
See Also:
Constant Field Values

LESS

protected static final String LESS
See Also:
Constant Field Values

NOT_LESS

protected static final String NOT_LESS
See Also:
Constant Field Values

LIKE

protected static final String LIKE
See Also:
Constant Field Values

NOT_LIKE

protected static final String NOT_LIKE
See Also:
Constant Field Values

IS_NULL

protected static final String IS_NULL
See Also:
Constant Field Values

NOT_IS_NULL

protected static final String NOT_IS_NULL
See Also:
Constant Field Values

BETWEEN

protected static final String BETWEEN
See Also:
Constant Field Values

NOT_BETWEEN

protected static final String NOT_BETWEEN
See Also:
Constant Field Values

IN

protected static final String IN
See Also:
Constant Field Values

NOT_IN

protected static final String NOT_IN
See Also:
Constant Field Values
Method Detail

getClause

public abstract String getClause()
Answer the SQL compare-clause for this criteria


bind

public void bind(Object newValue)
sets the value of the criteria to newValue. Used by the ODMG OQLQuery.bind() operation


getValue

public Object getValue()
Answer the value


getAttribute

public Object getAttribute()
Answer the attribute


toString

public String toString()
String representation

Overrides:
toString in class Object

isBound

public boolean isBound()
BRJ : Used by the ODMG OQLQuery.bind() operation

Returns:
Returns a boolean indicator

setBound

protected void setBound(boolean bound)
Sets the bound.

Parameters:
bound - The bound to set

setValue

protected void setValue(Object value)
Sets the value.

Parameters:
value - The value to set

isBindable

protected boolean isBindable()
answer true if the selection criteria is bindable BRJ: value null is bindable


getNumberOfExtentsToBind

public int getNumberOfExtentsToBind()
Returns the numberOfExtentsToBind.

Returns:
int

setNumberOfExtentsToBind

public void setNumberOfExtentsToBind(int numberOfExtentsToBind)
Sets the numberOfExtentsToBind.

Parameters:
numberOfExtentsToBind - The numberOfExtentsToBind to set

getAlias

public String getAlias()
Returns:
String

setAlias

public void setAlias(String alias)
Sets the alias. By default the entire attribute path participates in the alias

Parameters:
alias - The name of the alias to set

setAlias

public void setAlias(String alias,
                     String aliasPath)
Sets the alias.

Parameters:
alias - The alias to set

setAlias

public void setAlias(UserAlias userAlias)
Sets the alias using a userAlias object.

Parameters:
userAlias - The alias to set

getUserAlias

public UserAlias getUserAlias()

isTranslateAttribute

public boolean isTranslateAttribute()
Returns:
true if attribute name should be translated into column name

getCriteria

public Criteria getCriteria()
Returns:

getQuery

public QueryByCriteria getQuery()

getPathClasses

public Map getPathClasses()
Gets the pathClasses from the parent Criteria. A Map containing hints about what Class to be used for what path segment

Returns:
Returns a Map

getClassesForPath

public List getClassesForPath(String aPath)
Get the a List of Class objects used as hints for a path

Parameters:
aPath - the path segment ie: allArticlesInGroup
Returns:
a List o Class objects to be used in SqlStatment
See Also:
org.apache.ojb.broker.QueryTest#testInversePathExpression()


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.