com.sas.dataselectors.filters
Class DefaultFilterCondition

com.sas.dataselectors.filters.DefaultFilterCondition
All Implemented Interfaces:
FilterConditionInterface
Direct Known Subclasses:
DefaultAdvancedFilterCondition

public class DefaultFilterCondition
implements FilterConditionInterface

The DefaultFilterCondition is the default implementation of the interface FilterConditionInterface.


Field Summary
protected  boolean _allowSelected
           
protected  boolean _allowTyped
           
protected  int _argumentCount
           
protected  java.util.List _argumentLabels
           
protected  java.lang.String _conditionLabel
           
protected  java.lang.String _conditionMessageFormat
           
protected  java.lang.Object _conditionObject
           
protected  boolean _isConditionObjectNegated
           
static FilterConditionInterface IS_AFTER
           
static FilterConditionInterface IS_AFTER_OR_EQUAL
           
static FilterConditionInterface IS_BEFORE
           
static FilterConditionInterface IS_BEFORE_OR_EQUAL
           
static FilterConditionInterface IS_BETWEEN
          The "is in between" filter condition.
static FilterConditionInterface IS_EQUALS
          The "is equal to" filter condition.
static FilterConditionInterface IS_GREATER_THAN
          The "is greater than" filter condition.
static FilterConditionInterface IS_GREATER_THAN_OR_EQUAL
          The "is greater than or equal to" filter condition.
static FilterConditionInterface IS_IN_LIST
          The "is in list" filter condition.
static FilterConditionInterface IS_LESS_THAN
          The "is less than" filter condition.
static FilterConditionInterface IS_LESS_THAN_OR_EQUAL
          The "is less than or equal to" filter condition.
static FilterConditionInterface IS_MISSING_VALUE
          The "is missing value" filter condition.
static FilterConditionInterface IS_NOT_BETWEEN
          The "is not in between" filter condition.
static FilterConditionInterface IS_NOT_EQUALS
          The "is not equal to" filter condition.
static FilterConditionInterface IS_NOT_IN_LIST
          The "is not in list" filter condition.
static FilterConditionInterface IS_NOT_MISSING_VALUE
          The "is not missing value" filter condition.
static FilterConditionInterface IS_NOT_NULL
          The "is not null" filter condition.
static FilterConditionInterface IS_NULL
          The "is null" filter condition.
static java.lang.String RB_KEY
          The prefix used for resource properties associated with this class.
 
Constructor Summary
DefaultFilterCondition()
          Creates a new DefaultFilterCondition instance with only the default values.
DefaultFilterCondition(FilterConditionInterface conditionToCopy)
          Constructs a new instance that is a copy of the given condition.
DefaultFilterCondition(FilterConditionInterface conditionToCopy, java.lang.Object newConditionObject, boolean isNegated)
          Constructs a new instance that is a copy of the given condition but with the additional specified properties.
DefaultFilterCondition(java.lang.String label, java.lang.String format, int parmCount, java.lang.String[] parmLabels)
          Constructs a new instance from the given properties.
DefaultFilterCondition(java.lang.String label, java.lang.String format, int parmCount, java.lang.String[] parmLabels, java.lang.Object conditionObject)
          Constructs a new instance from the given properties.
DefaultFilterCondition(java.lang.String label, java.lang.String format, int parmCount, java.lang.String[] parmLabels, java.lang.Object conditionObject, boolean isConditionObjectNegated)
          Constructs a new instance from the given properties.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
static java.lang.String format(FilterItemInterface item, FilterConditionInterface condition, java.util.List values)
          Static function to format a condition using a simple message format.
static java.lang.String format(java.lang.String item, FilterConditionInterface condition, java.util.List values)
           
static java.lang.String format(java.lang.String item, FilterConditionInterface condition, java.util.List values, java.text.Format formatter)
          Static function to format a condition using a simple message format.
 java.lang.String format(java.lang.String item, java.util.List values)
          Formats this condition using its message format and the given arguments.
 java.lang.Object getCondition()
          Returns the native condition object this object represents.
 int getConditionArgumentCount()
          Returns the number of parameters required to fulfill this condition.
 java.lang.String getConditionArgumentLabel(int index)
          Gets the label for the condition parameter at the given index.
 java.lang.String[] getConditionArgumentLabels()
          Returns the individual labels for each parameter required by this condition.
static FilterConditionInterface getConditionFromRB(java.lang.String key)
          Creates a new FilterConditionInterface object based on the values found in the resources for this package at the given key.
static FilterConditionInterface getConditionFromRB(java.lang.String key, java.lang.Object conditionObject, boolean isNegated)
          Creates a new FilterConditionInterface object based on the given values and those found in the resources for this package at the given key.
static FilterConditionInterface getConditionFromRB(java.lang.String key, java.lang.Object conditionObject, boolean isNegated, java.util.Locale locale)
           
 java.lang.String getConditionLabel()
          Returns the text to use when displaying this condition to a user.
 java.lang.String getConditionLabel(java.util.Locale locale)
          Returns the text to use when displaying this condition to a user.
 java.lang.String getConditionMessageFormat()
          Returns the condition message format used by this condition.
 boolean isConditionObjectNegated()
          Should the normal meaning of the condition object be negated when evaluated
 boolean isExpressionValueAllowed()
          Returns TRUE if users are allowed to edit value expressions, false otherwise.
 boolean isPromptValueAllowed()
          Returns TRUE if users are allowed to create a prompt value, false otherwise.
 boolean isUserValueAllowed()
          Returns TRUE if users are allowed to specify their own values, false otherwise.
 boolean isValueListAllowed()
          Returns TRUE if users are allowed to select a value from a list (if the list is available).
 void setCondition(java.lang.Object conditionObject)
          Specifies the native condition object this object should represent.
 void setConditionArgumentCount(int argumentCount)
          Sets the number of parameters required to fulfill this condition.
 void setConditionArgumentLabels(java.lang.String[] argumentLabels)
          Sets the individual labels for the parameters required by this condition.
 void setConditionLabel(java.lang.String conditionLabel)
          Sets the text to use when displaying this condition to a user.
 void setConditionMessageFormat(java.lang.String messageFormat)
          Sets the condition message format used by this condition.
 void setConditionObjectNegated(boolean isConditionObjectNegated)
          Sets the boolean flag used to specify if the normal meaning of the condition object be negated when evaluated.
 void setLocale(java.util.Locale locale)
          Sets the locale for this condition, used when returning the condition label.
 void setUserValueAllowed(boolean value)
          Sets the flag to specify whether a user defined value can be given to satisfy this condition.
 void setValueListAllowed(boolean value)
          Sets the flag to specify whether a pick list should be presented when one is available.
 java.lang.String toString()
          Gives the text representation of this condition.
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
The prefix used for resource properties associated with this class.

See Also:
Constant Field Values

_conditionObject

protected transient java.lang.Object _conditionObject

_conditionLabel

protected transient java.lang.String _conditionLabel

_argumentCount

protected transient int _argumentCount

_argumentLabels

protected transient java.util.List _argumentLabels

_conditionMessageFormat

protected transient java.lang.String _conditionMessageFormat

_isConditionObjectNegated

protected transient boolean _isConditionObjectNegated

_allowTyped

protected transient boolean _allowTyped

_allowSelected

protected transient boolean _allowSelected

IS_EQUALS

public static final FilterConditionInterface IS_EQUALS
The "is equal to" filter condition.


IS_NOT_EQUALS

public static final FilterConditionInterface IS_NOT_EQUALS
The "is not equal to" filter condition.


IS_IN_LIST

public static final FilterConditionInterface IS_IN_LIST
The "is in list" filter condition.


IS_NOT_IN_LIST

public static final FilterConditionInterface IS_NOT_IN_LIST
The "is not in list" filter condition.


IS_LESS_THAN

public static final FilterConditionInterface IS_LESS_THAN
The "is less than" filter condition.


IS_LESS_THAN_OR_EQUAL

public static final FilterConditionInterface IS_LESS_THAN_OR_EQUAL
The "is less than or equal to" filter condition.


IS_GREATER_THAN

public static final FilterConditionInterface IS_GREATER_THAN
The "is greater than" filter condition.


IS_GREATER_THAN_OR_EQUAL

public static final FilterConditionInterface IS_GREATER_THAN_OR_EQUAL
The "is greater than or equal to" filter condition.


IS_BETWEEN

public static final FilterConditionInterface IS_BETWEEN
The "is in between" filter condition.


IS_NOT_BETWEEN

public static final FilterConditionInterface IS_NOT_BETWEEN
The "is not in between" filter condition.


IS_NULL

public static final FilterConditionInterface IS_NULL
The "is null" filter condition.


IS_NOT_NULL

public static final FilterConditionInterface IS_NOT_NULL
The "is not null" filter condition.


IS_MISSING_VALUE

public static final FilterConditionInterface IS_MISSING_VALUE
The "is missing value" filter condition.


IS_NOT_MISSING_VALUE

public static final FilterConditionInterface IS_NOT_MISSING_VALUE
The "is not missing value" filter condition.


IS_BEFORE

public static final FilterConditionInterface IS_BEFORE

IS_BEFORE_OR_EQUAL

public static final FilterConditionInterface IS_BEFORE_OR_EQUAL

IS_AFTER

public static final FilterConditionInterface IS_AFTER

IS_AFTER_OR_EQUAL

public static final FilterConditionInterface IS_AFTER_OR_EQUAL
Constructor Detail

DefaultFilterCondition

public DefaultFilterCondition()
Creates a new DefaultFilterCondition instance with only the default values.


DefaultFilterCondition

public DefaultFilterCondition(FilterConditionInterface conditionToCopy)
Constructs a new instance that is a copy of the given condition.

Parameters:
conditionToCopy - the FilterConditionInterface instance to copy

DefaultFilterCondition

public DefaultFilterCondition(FilterConditionInterface conditionToCopy,
                              java.lang.Object newConditionObject,
                              boolean isNegated)
Constructs a new instance that is a copy of the given condition but with the additional specified properties. After the properties of the passed in condition are copied, the new native condition object is set as well as the negation flag.

Parameters:
conditionToCopy - the FilterConditionInterface instance to copy
newConditionObject - the new native condition object this instance should represent
isNegated - the boolean flag to specify if this condition is negated

DefaultFilterCondition

public DefaultFilterCondition(java.lang.String label,
                              java.lang.String format,
                              int parmCount,
                              java.lang.String[] parmLabels)
Constructs a new instance from the given properties.

Parameters:
label - the text to use when displaying this condition to a user
format - the format describing how to represent this condition with parameters applied
parmCount - the number of parameters required to fulfill this condition
parmLabels - the individual labels for each parameter

DefaultFilterCondition

public DefaultFilterCondition(java.lang.String label,
                              java.lang.String format,
                              int parmCount,
                              java.lang.String[] parmLabels,
                              java.lang.Object conditionObject)
Constructs a new instance from the given properties.

Parameters:
label - the text to use when displaying this condition to a user
format - the format describing how to represent this condition with parameters applied
parmCount - the number of parameters required to fulfill this condition
parmLabels - the individual labels for each parameter
conditionObject - the native condition object this instance should represent

DefaultFilterCondition

public DefaultFilterCondition(java.lang.String label,
                              java.lang.String format,
                              int parmCount,
                              java.lang.String[] parmLabels,
                              java.lang.Object conditionObject,
                              boolean isConditionObjectNegated)
Constructs a new instance from the given properties.

Parameters:
label - the text to use when displaying this condition to a user
format - the format describing how to represent this condition with parameters applied
parmCount - the number of parameters required to fulfill this condition
parmLabels - the individual labels for each parameter
conditionObject - the native condition object this instance should represent
isConditionObjectNegated - the boolean flag to specify if this condition is negated
Method Detail

isConditionObjectNegated

public boolean isConditionObjectNegated()
Should the normal meaning of the condition object be negated when evaluated

Specified by:
isConditionObjectNegated in interface FilterConditionInterface
Returns:
boolean

setConditionObjectNegated

public void setConditionObjectNegated(boolean isConditionObjectNegated)
Sets the boolean flag used to specify if the normal meaning of the condition object be negated when evaluated.

Parameters:
isConditionObjectNegated - specify TRUE if this condition should be negated when evaluated

toString

public java.lang.String toString()
Gives the text representation of this condition.

Overrides:
toString in class java.lang.Object
Returns:
the label for this condition

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getCondition

public java.lang.Object getCondition()
Returns the native condition object this object represents. If no native object has been specified, the returned value will be this DefaultFilterCondition instance.

Specified by:
getCondition in interface FilterConditionInterface
Returns:
Object

setCondition

public void setCondition(java.lang.Object conditionObject)
Specifies the native condition object this object should represent.

Parameters:
conditionObject - the native condition object

getConditionLabel

public java.lang.String getConditionLabel()
Returns the text to use when displaying this condition to a user.

Specified by:
getConditionLabel in interface FilterConditionInterface
Returns:
String

getConditionLabel

public java.lang.String getConditionLabel(java.util.Locale locale)
Returns the text to use when displaying this condition to a user.

Specified by:
getConditionLabel in interface FilterConditionInterface
Returns:
the plain text label that will be shown to the user.

setConditionLabel

public void setConditionLabel(java.lang.String conditionLabel)
Sets the text to use when displaying this condition to a user.

Parameters:
conditionLabel - the text label for this condition

getConditionArgumentCount

public int getConditionArgumentCount()
Returns the number of parameters required to fulfill this condition.

Specified by:
getConditionArgumentCount in interface FilterConditionInterface
Returns:
int

setConditionArgumentCount

public void setConditionArgumentCount(int argumentCount)
Sets the number of parameters required to fulfill this condition. Valid values are greater than or equal to -1, 0, and any positive integer. A value of -1 signifies that any number of parameters will be accepted.

Parameters:
argumentCount - the number of parameters required by this condition

getConditionArgumentLabels

public java.lang.String[] getConditionArgumentLabels()
Returns the individual labels for each parameter required by this condition.

Specified by:
getConditionArgumentLabels in interface FilterConditionInterface
Returns:
String[]

getConditionArgumentLabel

public java.lang.String getConditionArgumentLabel(int index)
Gets the label for the condition parameter at the given index.

Specified by:
getConditionArgumentLabel in interface FilterConditionInterface
Parameters:
index - the index of the condition parameter
Returns:
String

setConditionArgumentLabels

public void setConditionArgumentLabels(java.lang.String[] argumentLabels)
Sets the individual labels for the parameters required by this condition.

Parameters:
argumentLabels - the new labels to use

getConditionMessageFormat

public java.lang.String getConditionMessageFormat()
Returns the condition message format used by this condition.

Specified by:
getConditionMessageFormat in interface FilterConditionInterface
Returns:
String

setConditionMessageFormat

public void setConditionMessageFormat(java.lang.String messageFormat)
Sets the condition message format used by this condition.

Specified by:
setConditionMessageFormat in interface FilterConditionInterface

format

public java.lang.String format(java.lang.String item,
                               java.util.List values)
Formats this condition using its message format and the given arguments.

Specified by:
format in interface FilterConditionInterface
Parameters:
item - the text intended for the left-hand-side of the conditional expression
values - the list of values intended for the right-hand-side of the conditional expression
Returns:
formatted message

format

public static java.lang.String format(FilterItemInterface item,
                                      FilterConditionInterface condition,
                                      java.util.List values)
Static function to format a condition using a simple message format. This routine will use the format stored on the condition or generate a simple standard format if the condition is null or its format is null or an empty string.

Parameters:
item - the FilterItemInterface to derive the item text from
condition - the condition object to derive the format from
values - the list of values intended for the right-hand-side of the conditional expression
Returns:
the formatted message

format

public static java.lang.String format(java.lang.String item,
                                      FilterConditionInterface condition,
                                      java.util.List values)

format

public static java.lang.String format(java.lang.String item,
                                      FilterConditionInterface condition,
                                      java.util.List values,
                                      java.text.Format formatter)
Static function to format a condition using a simple message format. This routine will use the format stored on the condition or generate a simple standard format if the condition is null or its format is null or an empty string.

Parameters:
item - the text intended for the left-hand-side of the conditional expression
condition - the condition object to derive the format from
values - the list of values intended for the right-hand-side of the conditional expression
Returns:
the formatted message

getConditionFromRB

public static FilterConditionInterface getConditionFromRB(java.lang.String key)
Creates a new FilterConditionInterface object based on the values found in the resources for this package at the given key.

Parameters:
key - the key in the resource bundle for this package for the property containing the visual text and condition parameters.
Returns:
a new FilterConditionInterface instance

getConditionFromRB

public static FilterConditionInterface getConditionFromRB(java.lang.String key,
                                                          java.lang.Object conditionObject,
                                                          boolean isNegated)
Creates a new FilterConditionInterface object based on the given values and those found in the resources for this package at the given key.

Parameters:
key - the key in the resource bundle for this package for the property containing the visual text and condition parameters.
conditionObject - the native object the new condition object will represent
isNegated - a boolean flag to indicate whether this condition is negated
Returns:
a new FilterConditionInterface instance

getConditionFromRB

public static FilterConditionInterface getConditionFromRB(java.lang.String key,
                                                          java.lang.Object conditionObject,
                                                          boolean isNegated,
                                                          java.util.Locale locale)

setValueListAllowed

public void setValueListAllowed(boolean value)
Sets the flag to specify whether a pick list should be presented when one is available.

Parameters:
value -

setUserValueAllowed

public void setUserValueAllowed(boolean value)
Sets the flag to specify whether a user defined value can be given to satisfy this condition.


isUserValueAllowed

public boolean isUserValueAllowed()
Returns TRUE if users are allowed to specify their own values, false otherwise.

Specified by:
isUserValueAllowed in interface FilterConditionInterface

isValueListAllowed

public boolean isValueListAllowed()
Returns TRUE if users are allowed to select a value from a list (if the list is available).

Specified by:
isValueListAllowed in interface FilterConditionInterface

isExpressionValueAllowed

public boolean isExpressionValueAllowed()
Returns TRUE if users are allowed to edit value expressions, false otherwise.

Specified by:
isExpressionValueAllowed in interface FilterConditionInterface

isPromptValueAllowed

public boolean isPromptValueAllowed()
Returns TRUE if users are allowed to create a prompt value, false otherwise.

Specified by:
isPromptValueAllowed in interface FilterConditionInterface

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale for this condition, used when returning the condition label.

Specified by:
setLocale in interface FilterConditionInterface
Parameters:
locale - the new locale for this condition



Copyright © 2009 SAS Institute Inc. All Rights Reserved.