planetj.database.sql
Class SQLComparison

java.lang.Object
  |
  +--planetj.database.sql.SQLComparison
All Implemented Interfaces:
IParameterSource, Serializable
Direct Known Subclasses:
InsertComparison, SQLBasicComparison, SQLBetweenComparison, SQLSetComparison

public abstract class SQLComparison
extends Object
implements IParameterSource, Serializable

Represents an SQL comparison, such as "PLANETJ.BALANCE <= 100" or "NAME IS NOT NULL"

Author:
Justin Epstein, PlanetJ Corp.
See Also:
Serialized Form

Constructor Summary
SQLComparison(OperatorToken opToken)
          SQLComparision constructor
 
Method Summary
 void addValueToken(ColumnToken colToken, ValueToken valToken)
           
 ColumnToken getColumn(int index)
          Gets this comparison's column token.
 IDisplayParameter getDisplayParameter()
          Gets a display parameter out of this context.
 Field getField(int index)
          Deprecated. (6/11/2003 8:11:05 AM) This method will not allow setting the Field's default value from a user property. Replaced by getField(int, ExecutingContext)
 Field getField(int index, ExecutingContext ec)
          Gets this Field corresponding to one of this comparison's parameters.
 FieldDescriptorRow getFieldDescriptor(int valueIndex, String systemAlias)
          Gets the FD for the specified value.
 List getFields()
          Deprecated. (6/11/2003 8:12:04 AM) This method will not allow setting the Field's default value from a user property. Replaced by getField(ExecutingContext)
 List getFields(ExecutingContext ec)
          Gets the display fields contained in the parameters of this SQLComparison.
 int getNumberOfValueParameters()
          Gets this comparison's number of value token.
 int getNumberOfValues()
          Gets this comparison's number of value token.
 OperatorToken getOperator()
          Gets this comparison's operator token.
 IParameter getParameter(int index)
          Gets one of this comparison's parameters, based by index.
 FieldDescriptorRow getTargetFieldDescriptor()
          Gets the field descriptor for the field this SQLComparison is comparing.
 ValueToken getValue(int index)
          Gets this comparison's value token.
 boolean isContainsDisplayParameters()
          Tests if this comparison has a display parameter for one or more of its values
 boolean isContainsParameters()
          Tests if this comparison has a parameter for one or more of its values
 boolean isValueDisplayParameter(int index)
          Tests if this comparison has a display parameter for a value.
 boolean isValueParameter(int index)
          Tests if this comparison has a parameter for a value.
 void postAddValueToken(ColumnToken colToken, ValueToken valToken)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLComparison

public SQLComparison(OperatorToken opToken)
SQLComparision constructor

Method Detail

addValueToken

public void addValueToken(ColumnToken colToken,
                          ValueToken valToken)

getColumn

public final ColumnToken getColumn(int index)
Gets this comparison's column token. For the comparison "PLANETJ.BALANCE <= 100" the column token is "PLANETJ.BALANCE". For "NAME IS NOT NULL" the column token is "NAME".


getDisplayParameter

public IDisplayParameter getDisplayParameter()
Gets a display parameter out of this context. If this context has multiple display parameters, only one is returned. If there are no display parameters, null is returned.


getField

public final Field getField(int index)
                     throws CMException
Deprecated. (6/11/2003 8:11:05 AM) This method will not allow setting the Field's default value from a user property. Replaced by getField(int, ExecutingContext)

Gets this Field corresponding to one of this comparison's parameters. If this comparison does not have a display parameter at its specified value, null is returned.

Parameters:
index - parameter index of display Field to retrieve.
Returns:
display Field in this comparison.
CMException

getField

public final Field getField(int index,
                            ExecutingContext ec)
                     throws CMException
Gets this Field corresponding to one of this comparison's parameters. If this comparison does not have a display parameter at its specified value, null is returned.

Parameters:
index - parameter index of display Field to retrieve.
ec - context in which code is executing.
Returns:
display Field in this comparison.
CMException

getFieldDescriptor

public FieldDescriptorRow getFieldDescriptor(int valueIndex,
                                             String systemAlias)
                                      throws CMException
Gets the FD for the specified value. If the specified value does not have a FD associated with it then a default one for the specified system alias is returned

CMException

getFields

public List getFields()
               throws CMException
Deprecated. (6/11/2003 8:12:04 AM) This method will not allow setting the Field's default value from a user property. Replaced by getField(ExecutingContext)

Gets the display fields contained in the parameters of this SQLComparison.

Returns:
List of display Fields in this comparison.
CMException

getFields

public List getFields(ExecutingContext ec)
               throws CMException
Gets the display fields contained in the parameters of this SQLComparison.

Parameters:
ec - context in which code is executing.
Returns:
List of display Fields in this comparison.
CMException

getNumberOfValueParameters

public final int getNumberOfValueParameters()
Gets this comparison's number of value token.


getNumberOfValues

public final int getNumberOfValues()
Gets this comparison's number of value token.


getOperator

public final OperatorToken getOperator()
Gets this comparison's operator token. For the comparison "PLANETJ.BALANCE <= 100" the operator token is "<=". For "NAME IS NOT NULL" the operator token is "IS NOT".


getParameter

public IParameter getParameter(int index)
Gets one of this comparison's parameters, based by index. If the value at the given index is not a parameter, null is returned


getTargetFieldDescriptor

public FieldDescriptorRow getTargetFieldDescriptor()
                                            throws CMException
Gets the field descriptor for the field this SQLComparison is comparing. This may be different than the field descriptor for this comparison's values

Specified by:
getTargetFieldDescriptor in interface IParameterSource
CMException

getValue

public final ValueToken getValue(int index)
Gets this comparison's value token. For the comparison "PLANETJ.BALANCE <= 100" the value token is "100". For "NAME IS NOT NULL" the value token is "NULL". In some cases, the value token may begin and end with a quotation mark.


isContainsDisplayParameters

public boolean isContainsDisplayParameters()
Tests if this comparison has a display parameter for one or more of its values


isContainsParameters

public boolean isContainsParameters()
Tests if this comparison has a parameter for one or more of its values


isValueDisplayParameter

public boolean isValueDisplayParameter(int index)
Tests if this comparison has a display parameter for a value.


isValueParameter

public boolean isValueParameter(int index)
Tests if this comparison has a parameter for a value. The parameter may already it's value set (i.e. it may not require user interaction to set its value)


postAddValueToken

public void postAddValueToken(ColumnToken colToken,
                              ValueToken valToken)