com.sas.dataselectors.filters
Class DefaultFilterItem

com.sas.dataselectors.filters.DefaultFilterItem
All Implemented Interfaces:
FilterItemInterface
Direct Known Subclasses:
OLAPFilterItem

public class DefaultFilterItem
implements FilterItemInterface

The default implementation of the FilterItemInterface, this class contains lists of supported conditionals and values. The label is displayed to the user for selection but when this item is selected for creating a filter, only the object returned by getItem() is stored in the SelectionLogicNode result. This also supports a list of 'subitems' for an item. If getSubitemIsRequired() returns true the dialog will enforce the picking of at lease one of the subitems. At this time, the subitems are not evaluated for over-riding the active condition and values lists, this is a possible future enhancement. Actual values are derived from data while possible values come from SAS formats or predefined lists of values.


Field Summary
 
Fields inherited from interface com.sas.dataselectors.filters.FilterItemInterface
ITEMTYPE_ALPHANUMERIC, ITEMTYPE_BITSTRING, ITEMTYPE_BOOLEAN, ITEMTYPE_CURRENCY, ITEMTYPE_DATE, ITEMTYPE_DATETIME, ITEMTYPE_INTERVAL_DT, ITEMTYPE_INTERVAL_YM, ITEMTYPE_NUMERIC, ITEMTYPE_TIME, ITEMTYPE_UNKNOWN
 
Constructor Summary
DefaultFilterItem()
          Constructs a new filter item with the default properties.
DefaultFilterItem(java.lang.String itemLabel)
          Constructs a new filter item with the given label.
DefaultFilterItem(java.lang.String itemLabel, FilterConditionListInterface itemConditions, boolean allowUserValues)
          Constructs a new filter item with the given properties.
DefaultFilterItem(java.lang.String itemLabel, FilterConditionListInterface itemConditions, boolean allowUserValues, java.util.List itemPossibleValues, java.util.List itemActualValues)
          Constructs a new filter item with the given properties.
DefaultFilterItem(java.lang.String itemLabel, FilterConditionListInterface itemConditions, boolean allowUserValues, java.util.List itemPossibleValues, java.util.List itemActualValues, FilterItemListInterface itemSubitems, boolean subitemsRequired)
          Constructs a new filter item with the given properties.
DefaultFilterItem(java.lang.String itemLabel, FilterConditionListInterface itemConditions, boolean allowUserValues, java.util.List itemPossibleValues, java.util.List itemActualValues, FilterQualifierListInterface itemQualfiers, boolean qualifiersRequired)
          Constructs a new filter item with the given properties.
DefaultFilterItem(java.lang.String itemLabel, FilterConditionListInterface itemConditions, boolean allowUserValues, java.util.List itemPossibleValues, java.util.List itemActualValues, FilterQualifierListInterface itemQualfiers, boolean qualifiersRequired, FilterItemListInterface itemSubitems, boolean subitemsRequired)
          Constructs a new filter item with the given properties.
DefaultFilterItem(java.lang.String itemLabel, FilterConditionListInterface itemConditions, boolean allowUserValues, java.lang.Object[] itemPossibleValues, java.lang.Object[] itemActualValues)
          Constructs a new filter item with the given properties.
DefaultFilterItem(java.lang.String itemLabel, FilterConditionListInterface itemConditions, boolean allowUserValues, java.lang.Object[] itemPossibleValues, java.lang.Object[] itemActualValues, FilterItemListInterface itemSubitems, boolean subitemsRequired)
          Constructs a new filter item with the given properties.
DefaultFilterItem(java.lang.String itemLabel, FilterConditionListInterface itemConditions, boolean allowUserValues, java.lang.Object[] itemPossibleValues, java.lang.Object[] itemActualValues, FilterQualifierListInterface itemQualfiers, boolean qualifiersRequired)
          Constructs a new filter item with the given properties.
DefaultFilterItem(java.lang.String itemLabel, FilterConditionListInterface itemConditions, boolean allowUserValues, java.lang.Object[] itemPossibleValues, java.lang.Object[] itemActualValues, FilterQualifierListInterface itemQualfiers, boolean qualifiersRequired, FilterItemListInterface itemSubitems, boolean subitemsRequired)
          Constructs a new filter item with the given properties.
 
Method Summary
 java.lang.Object createUserValue(java.lang.String valueTyped)
          Returns a new object that the Client will understand as a user typed value This should throw an IllegalArgument exception if the valueTyped is NOT valid for this Item.
 boolean equals(java.lang.Object o)
          Compares for equality this object with the specified other object.
 FilterValuesInterface getActualValues()
          Gets an interface that can be used to incrementally retrieve and iterate just the actual values to be used for equivelance tests in the filter.
 FilterConditionListInterface getConditionList()
          Gets an interface to the list of conditional operators supported for this item.
 java.lang.Object getItem()
          This object is defined by the adaptor implementor and will be returned as part of the completed filter data structure.
 java.lang.String getItemLabel()
          This is the label to display to the user for the item object when it is being used to build a filter.
 long getItemType()
          A type value that is used to determine value checking when user typed values allowed.
 FilterValuesInterface getPossibleValues()
          Gets an interface that can be used to incrementally retrieve and iterate all the possible values to be used for equivelance tests in the filter.
 FilterItemInterface getQualifiedItem(java.util.List qualifiers)
          When an item is qualified, it's value lists, conditions and user values allowed may change.
 FilterQualifierListInterface getQualifierList()
          If this item allows or requires additional items to be selected to refine the selection then return them here.
 FilterItemListInterface getSubitemList()
          This is provided if the items are actually to be represented by a tree rather than a linear list The Item returned by the selection logic interface will actually be the subitem selected.
 java.text.Format getUserValueFormatter()
          Returns the Format object used to parse the typed string into an object returned by createUserValue(); If null returned, then the object from createUserValue was created by "new String( value )" where value is the String object passed into the method.
 boolean isQualifierRequired()
          If this item is not sufficient to define the filter, then it may be neccessary to 'add definition' to the item.
 boolean isSubitemRequired()
          If this item is not sufficient to define the filter, then it may be neccessary to 'drill down' to the item.
 boolean isUserValueAllowed()
          Returns TRUE is users are allowed to type in their own values in addition to any values from the Actual or Possible Values Interfaces;
 void setActualValues(java.util.Collection valuesCollection)
          Sets the list of values to return from a call to getActualValues.
 void setActualValues(FilterValuesInterface valueInterface)
          Sets the list of values to return from a call to getActualValues.
 void setActualValues(java.lang.Object[] valuesArray)
          Sets the list of values to return from a call to getActualValues.
 void setConditionList(FilterConditionInterface[] itemConditionArray)
          Sets the list of conditions available for this filter item.
 void setConditionList(FilterConditionListInterface itemConditions)
          Sets the list of conditions available for this item.
 void setConditionList(java.util.List itemConditionList)
          Sets the list of conditions available for this filter item.
 void setItem(java.lang.Object itemObject)
          Sets the native model object this filter item represents.
 void setItemLabel(java.lang.String itemLabel)
          Sets the label for this filter item.
 void setItemType(long itemType)
          Assigns the type of data this item represents.
 void setPossibleValues(java.util.Collection valuesCollection)
          Sets the list of values to return from a call to getPossibleValues.
 void setPossibleValues(FilterValuesInterface valueInterface)
          Sets the list of values to return from a call to getPossibleValues.
 void setPossibleValues(java.lang.Object[] valuesArray)
          Sets the list of values to return from a call to getPossibleValues.
 void setQualifiedItem(FilterItemInterface qualifiedItem)
          Sets the default qualified item that will be returned by any calls to getQualifiedItem.
 void setQualifierList(FilterQualifierListInterface qualifiers)
          Sets the list of qualifiers available for this filter item.
 void setQualifierRequired(boolean qualifierRequired)
          Sets the flag for whether a qualifier is required to complete a filter for this item or not.
 void setSubitemList(FilterItemInterface[] subitemArray)
          Sets the list of sub-items available for this item.
 void setSubitemList(FilterItemListInterface subitems)
          Sests the list of sub-items available for this item.
 void setSubitemList(java.util.List subitemList)
          Sets the list of sub-items available for this item.
 void setSubitemRequired(boolean subitemRequired)
          Sets the flag for whether a sub-item is required to complete a filter for this item or not.
 void setUserValueAllowed(boolean allowed)
          Sets the flag for allowing users to type in their own values to complete a conditional filter.
 void setUserValueFormatter(java.text.Format formatter)
          Sets the format object used when parsing user entered text and converting it to usable value objects.
 java.lang.String toString()
          Returns a String representation of this filter item.
 

Constructor Detail

DefaultFilterItem

public DefaultFilterItem()
Constructs a new filter item with the default properties.


DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel)
Constructs a new filter item with the given label.

Parameters:
itemLabel - the label for this item

DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel,
                         FilterConditionListInterface itemConditions,
                         boolean allowUserValues)
Constructs a new filter item with the given properties.

Parameters:
itemLabel - the label for this item
itemConditions - the list of conditions available for this item
allowUserValues - TRUE if users may supply typed-in values, FALSE otherwise

DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel,
                         FilterConditionListInterface itemConditions,
                         boolean allowUserValues,
                         java.lang.Object[] itemPossibleValues,
                         java.lang.Object[] itemActualValues)
Constructs a new filter item with the given properties.

Parameters:
itemLabel - the label for this item
itemConditions - the list of conditions available for this item
allowUserValues - TRUE if users may supply typed-in values, FALSE otherwise
itemPossibleValues - the list of possible values for this item
itemActualValues - the list of actual values for this item

DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel,
                         FilterConditionListInterface itemConditions,
                         boolean allowUserValues,
                         java.lang.Object[] itemPossibleValues,
                         java.lang.Object[] itemActualValues,
                         FilterItemListInterface itemSubitems,
                         boolean subitemsRequired)
Constructs a new filter item with the given properties.

Parameters:
itemLabel - the label for this item
itemConditions - the list of conditions available for this item
allowUserValues - TRUE if users may supply typed-in values, FALSE otherwise
itemPossibleValues - the list of possible values for this item
itemActualValues - the list of actual values for this item
itemSubitems - the list of sub-items available for this item
subitemsRequired - TRUE if a sub-item must be selected to completely define a filter using this item, FALSE otherwise

DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel,
                         FilterConditionListInterface itemConditions,
                         boolean allowUserValues,
                         java.util.List itemPossibleValues,
                         java.util.List itemActualValues)
Constructs a new filter item with the given properties.

Parameters:
itemLabel - the label for this item
itemConditions - the list of conditions available for this item
allowUserValues - TRUE if users may supply typed-in values, FALSE otherwise
itemPossibleValues - the list of possible values for this item
itemActualValues - the list of actual values for this item

DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel,
                         FilterConditionListInterface itemConditions,
                         boolean allowUserValues,
                         java.util.List itemPossibleValues,
                         java.util.List itemActualValues,
                         FilterItemListInterface itemSubitems,
                         boolean subitemsRequired)
Constructs a new filter item with the given properties.

Parameters:
itemLabel - the label for this item
itemConditions - the list of conditions available for this item
allowUserValues - TRUE if users may supply typed-in values, FALSE otherwise
itemPossibleValues - the list of possible values for this item
itemActualValues - the list of actual values for this item
itemSubitems - the list of sub-items available for this item
subitemsRequired - TRUE if a sub-item must be selected to completely define a filter using this item, FALSE otherwise

DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel,
                         FilterConditionListInterface itemConditions,
                         boolean allowUserValues,
                         java.lang.Object[] itemPossibleValues,
                         java.lang.Object[] itemActualValues,
                         FilterQualifierListInterface itemQualfiers,
                         boolean qualifiersRequired)
Constructs a new filter item with the given properties.

Parameters:
itemLabel - the label for this item
itemConditions - the list of conditions available for this item
allowUserValues - TRUE if users may supply typed-in values, FALSE otherwise
itemPossibleValues - the list of possible values for this item
itemActualValues - the list of actual values for this item
itemQualfiers - the list of qualifiers available for this item
qualifiersRequired - TRUE if a qualifier must be selected to completely define a filter using this item, FALSE otherwise

DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel,
                         FilterConditionListInterface itemConditions,
                         boolean allowUserValues,
                         java.lang.Object[] itemPossibleValues,
                         java.lang.Object[] itemActualValues,
                         FilterQualifierListInterface itemQualfiers,
                         boolean qualifiersRequired,
                         FilterItemListInterface itemSubitems,
                         boolean subitemsRequired)
Constructs a new filter item with the given properties.

Parameters:
itemLabel - the label for this item
itemConditions - the list of conditions available for this item
allowUserValues - TRUE if users may supply typed-in values, FALSE otherwise
itemPossibleValues - the list of possible values for this item
itemActualValues - the list of actual values for this item
itemQualfiers - the list of qualifiers available for this item
qualifiersRequired - TRUE if a qualifier must be selected to completely define a filter using this item, FALSE otherwise
itemSubitems - the list of sub-items available for this item
subitemsRequired - TRUE if a sub-item must be selected to completely define a filter using this item, FALSE otherwise

DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel,
                         FilterConditionListInterface itemConditions,
                         boolean allowUserValues,
                         java.util.List itemPossibleValues,
                         java.util.List itemActualValues,
                         FilterQualifierListInterface itemQualfiers,
                         boolean qualifiersRequired)
Constructs a new filter item with the given properties.

Parameters:
itemLabel - the label for this item
itemConditions - the list of conditions available for this item
allowUserValues - TRUE if users may supply typed-in values, FALSE otherwise
itemPossibleValues - the list of possible values for this item
itemActualValues - the list of actual values for this item
itemQualfiers - the list of qualifiers available for this item
qualifiersRequired - TRUE if a qualifier must be selected to completely define a filter using this item, FALSE otherwise

DefaultFilterItem

public DefaultFilterItem(java.lang.String itemLabel,
                         FilterConditionListInterface itemConditions,
                         boolean allowUserValues,
                         java.util.List itemPossibleValues,
                         java.util.List itemActualValues,
                         FilterQualifierListInterface itemQualfiers,
                         boolean qualifiersRequired,
                         FilterItemListInterface itemSubitems,
                         boolean subitemsRequired)
Constructs a new filter item with the given properties.

Parameters:
itemLabel - the label for this item
itemConditions - the list of conditions available for this item
allowUserValues - TRUE if users may supply typed-in values, FALSE otherwise
itemPossibleValues - the list of possible values for this item
itemActualValues - the list of actual values for this item
itemQualfiers - the list of qualifiers available for this item
qualifiersRequired - TRUE if a qualifier must be selected to completely define a filter using this item, FALSE otherwise
itemSubitems - the list of sub-items available for this item
subitemsRequired - TRUE if a sub-item must be selected to completely define a filter using this item, FALSE otherwise
Method Detail

getItem

public java.lang.Object getItem()
This object is defined by the adaptor implementor and will be returned as part of the completed filter data structure.

Specified by:
getItem in interface FilterItemInterface
Returns:
the native filter object

setItem

public void setItem(java.lang.Object itemObject)
Sets the native model object this filter item represents.

Parameters:
itemObject - the native model object for this item

getItemLabel

public java.lang.String getItemLabel()
This is the label to display to the user for the item object when it is being used to build a filter.

Specified by:
getItemLabel in interface FilterItemInterface
Returns:
the label for this item

setItemLabel

public void setItemLabel(java.lang.String itemLabel)
Sets the label for this filter item.

Parameters:
itemLabel - the new label

toString

public java.lang.String toString()
Returns a String representation of this filter item.

Overrides:
toString in class java.lang.Object
Returns:
a text representation of this item

equals

public boolean equals(java.lang.Object o)
Compares for equality this object with the specified other object.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare with this one
Returns:
TRUE if this filter item is equal to the given object, FALSE otherwise

isSubitemRequired

public boolean isSubitemRequired()
If this item is not sufficient to define the filter, then it may be neccessary to 'drill down' to the item. Folders that cannot themselves be choosen as items should have this flag set YES. Returns TRUE if this Item MUST have a subitem picked.

Specified by:
isSubitemRequired in interface FilterItemInterface
Returns:
boolean

setSubitemRequired

public void setSubitemRequired(boolean subitemRequired)
Sets the flag for whether a sub-item is required to complete a filter for this item or not.

Parameters:
subitemRequired - TRUE if a sub-item is required for this item, FALSE otherwise

getSubitemList

public FilterItemListInterface getSubitemList()
This is provided if the items are actually to be represented by a tree rather than a linear list The Item returned by the selection logic interface will actually be the subitem selected. This should return null if there are NO subitems.

Specified by:
getSubitemList in interface FilterItemInterface
Returns:
the list of sub-items for this item

setSubitemList

public void setSubitemList(FilterItemListInterface subitems)
Sests the list of sub-items available for this item.

Parameters:
subitems - the new list of sub-items

isQualifierRequired

public boolean isQualifierRequired()
If this item is not sufficient to define the filter, then it may be neccessary to 'add definition' to the item. This is primarily of use for the Measures type filter in MDX where that measure doesn't have a meaning in a vacuum and further information (the 'applies to') is needed. This could be used by other DBases that require additional information by changing the QualifierLabel and showing the appropriate labelling for the qualfier pick box. Returns TRUE if this Item MUST have a qualfier picked.

Specified by:
isQualifierRequired in interface FilterItemInterface
Returns:
true if this item musthave a qualifier to be complete

setQualifierRequired

public void setQualifierRequired(boolean qualifierRequired)
Sets the flag for whether a qualifier is required to complete a filter for this item or not.

Parameters:
qualifierRequired - TRUE if a qualifier is required for this item, FALSE otherwise

getQualifierList

public FilterQualifierListInterface getQualifierList()
If this item allows or requires additional items to be selected to refine the selection then return them here. SubItems represent the ability to say that an item requires some additional item to be selected to distinguish the final selection. This should return null if there are NO qualifiers.

Specified by:
getQualifierList in interface FilterItemInterface
Returns:
the filter qualifier list for this item

setQualifierList

public void setQualifierList(FilterQualifierListInterface qualifiers)
Sets the list of qualifiers available for this filter item.

Parameters:
qualifiers - the new list of qualifiers

getConditionList

public FilterConditionListInterface getConditionList()
Gets an interface to the list of conditional operators supported for this item. Returns null if there are no conditionals supported by the item.

Specified by:
getConditionList in interface FilterItemInterface
Returns:
the filter condition list for this item

setConditionList

public void setConditionList(FilterConditionListInterface itemConditions)
Sets the list of conditions available for this item.

Parameters:
itemConditions - the new condition list

isUserValueAllowed

public boolean isUserValueAllowed()
Returns TRUE is users are allowed to type in their own values in addition to any values from the Actual or Possible Values Interfaces;

Specified by:
isUserValueAllowed in interface FilterItemInterface
Returns:
true if users are allowed to type in their own values, false otherwise

setUserValueAllowed

public void setUserValueAllowed(boolean allowed)
Sets the flag for allowing users to type in their own values to complete a conditional filter.

Parameters:
allowed - TRUE if users are allowed to type in their own values, FALSE otherwise

setPossibleValues

public void setPossibleValues(FilterValuesInterface valueInterface)
Sets the list of values to return from a call to getPossibleValues.

Parameters:
valueInterface - the new list of values

setPossibleValues

public void setPossibleValues(java.lang.Object[] valuesArray)
Sets the list of values to return from a call to getPossibleValues.

Parameters:
valuesArray - the new list of values

setPossibleValues

public void setPossibleValues(java.util.Collection valuesCollection)
Sets the list of values to return from a call to getPossibleValues.

Parameters:
valuesCollection - the new list of values

getPossibleValues

public FilterValuesInterface getPossibleValues()
Gets an interface that can be used to incrementally retrieve and iterate all the possible values to be used for equivelance tests in the filter. Returns null if iteration of possible values is NOT supported by the datasource.

Specified by:
getPossibleValues in interface FilterItemInterface
Returns:
FilterValuesInterface

setActualValues

public void setActualValues(FilterValuesInterface valueInterface)
Sets the list of values to return from a call to getActualValues.

Parameters:
valuesInterface - the new list of values

setActualValues

public void setActualValues(java.lang.Object[] valuesArray)
Sets the list of values to return from a call to getActualValues.

Parameters:
valuesArray - the new list of values

setActualValues

public void setActualValues(java.util.Collection valuesCollection)
Sets the list of values to return from a call to getActualValues.

Parameters:
valuesCollection - the new list of values

getActualValues

public FilterValuesInterface getActualValues()
Gets an interface that can be used to incrementally retrieve and iterate just the actual values to be used for equivelance tests in the filter. Returns null if iteration of actual values is NOT supported by the datasource.

Specified by:
getActualValues in interface FilterItemInterface
Returns:
FilterValuesInterface

setSubitemList

public void setSubitemList(FilterItemInterface[] subitemArray)
Sets the list of sub-items available for this item.

Parameters:
subitemArray - an array of the sub-items to make available for this item

setSubitemList

public void setSubitemList(java.util.List subitemList)
Sets the list of sub-items available for this item. Only objects that implement FilterItemInterface will be utilized from the input list.

Parameters:
subitemList - the new list of available sub-items
See Also:
FilterItemInterface

setConditionList

public void setConditionList(FilterConditionInterface[] itemConditionArray)
Sets the list of conditions available for this filter item.

Parameters:
itemConditionArray - the array of conditions to make available for this item

setConditionList

public void setConditionList(java.util.List itemConditionList)
Sets the list of conditions available for this filter item. Only objects that implement the FilterConditionInterface will be utilized.

Parameters:
itemConditionList - the new list of conditions
See Also:
FilterConditionInterface

getItemType

public long getItemType()
A type value that is used to determine value checking when user typed values allowed.

Specified by:
getItemType in interface FilterItemInterface
Returns:
the type of this item

setItemType

public void setItemType(long itemType)
Assigns the type of data this item represents.

Parameters:
itemType - the new type to assign to this item

setUserValueFormatter

public void setUserValueFormatter(java.text.Format formatter)
Sets the format object used when parsing user entered text and converting it to usable value objects.

Parameters:
formatter - the new user value formatter

getUserValueFormatter

public java.text.Format getUserValueFormatter()
Returns the Format object used to parse the typed string into an object returned by createUserValue(); If null returned, then the object from createUserValue was created by "new String( value )" where value is the String object passed into the method.

Specified by:
getUserValueFormatter in interface FilterItemInterface
Returns:
the Format object for this item

createUserValue

public java.lang.Object createUserValue(java.lang.String valueTyped)
Returns a new object that the Client will understand as a user typed value This should throw an IllegalArgument exception if the valueTyped is NOT valid for this Item.

Specified by:
createUserValue in interface FilterItemInterface
Parameters:
valueTyped - the text as entered by the user
Returns:
the new user value object

getQualifiedItem

public FilterItemInterface getQualifiedItem(java.util.List qualifiers)
When an item is qualified, it's value lists, conditions and user values allowed may change. Return an item that reflects changes to those properties. This qualified item SHOULD NOT be stored in the filter logic. It may not exist in the real dictionary of items (ie its transient). The original item and qualifiers should be stored instead.

Specified by:
getQualifiedItem in interface FilterItemInterface
Parameters:
qualifiers - the list of any objects that can affect the returned filter item (unused here)
Returns:
the resulting filter item

setQualifiedItem

public void setQualifiedItem(FilterItemInterface qualifiedItem)
Sets the default qualified item that will be returned by any calls to getQualifiedItem.

Parameters:
qualifiedItem - the new default qualified item



Copyright © 2009 SAS Institute Inc. All Rights Reserved.