com.sas.dataselectors.filters
Class DefaultAdvancedFilterModelAdapter

com.sas.dataselectors.filters.DefaultAdvancedFilterModelAdapter
All Implemented Interfaces:
AdvancedFilterDefinitionModelInterface, AdvancedFilterModelInterface, PersistentFilterProviderModelInterface, com.sas.dataselectors.filters.PromptValueProviderModelInterface, com.sas.dataselectors.filters.SearchValueProviderModelInterface, SimpleFilterDefinitionModelInterface, SimpleFilterListEditorModelInterface, com.sas.dataselectors.filters.SystemVariableProviderInterface
Direct Known Subclasses:
BusinessModelToAdvancedFilterModelAdapter, BusinessQueryToAdvancedFilterModelAdapter

public class DefaultAdvancedFilterModelAdapter
implements AdvancedFilterModelInterface, PersistentFilterProviderModelInterface, com.sas.dataselectors.filters.SystemVariableProviderInterface, com.sas.dataselectors.filters.SearchValueProviderModelInterface, com.sas.dataselectors.filters.PromptValueProviderModelInterface

The DefaultAdvancedFilterModelAdapter ideally will be a unified adapter that will work for both BusinessModel (build-time) and BusinessQuery (run-time) instances for both relational and OLAP data sources. For now, it acts as the base class for any of the filter models for the advanced dialogs.


Field Summary
protected  com.sas.iquery.metadata.business.BusinessModel _businessModel
          The BusinessModel this adapter will use as the source of the filter model.
protected  com.sas.iquery.metadata.business.BusinessQuery _businessQuery
          The BusinessQuery that (if it exists) will give additional information for the filter model.
protected  com.sas.swing.dataselectors.editors.ExpressionValueEditorInterface _expressionValueEditor
          The editor used to create/modify/assign expressions for use as values in filters.
protected  java.lang.String _filterDescription
          The description to assign the final filter.
protected  com.sas.swing.dataselectors.editors.FilterItemEditorInterface _filterItemEditor
          The editor used to create/modify/assign expressions for use as items in filters.
protected  java.lang.String _filterLabel
          The label to assign the final filter.
protected  FilterObjectFactoryInterface _filterObjectFactory
          The factory object used to convert between native objects and filter model objects.
protected  com.sas.swing.dataselectors.editors.QualifiersEditorInterface _filterQualifierEditor
          The editor used to create/modify/assign qualifiers that further subset data.
protected  java.lang.Object _initialFilterObject
          The initial state of the filter being created/modified.
protected  java.util.Locale _locale
          The current Locale in use by the filter model.
protected  SimpleFilterLogicTreeInterface _logicTree
          The filter selection model.
protected  boolean _newFilter
          A flag to specify whether the model is creating a new filter or modifying an existing one.
protected  java.util.Map _promptMap
          The prompt map holds all prompts found in the BusinessModel keyed by their names.
protected  com.sas.swing.dataselectors.editors.PromptValueEditorInterface _promptValueEditor
          The editor used to create/modify/assign prompts for use as values in filters.
protected  java.lang.Object _revertToFilterObject
          The filter object used to restore the selection model to the state it was in when editing the filter began.
protected  java.util.Map _systemVariableMap
          The system variable map holds all system variable prompts found in the BusinessModel keyed by their names.
protected  int environment
           
protected  java.lang.Object rootFilterObject
          The last root filter object resulting from a call to commitChanges.
 
Fields inherited from class com.sas.dataselectors.filters.SimpleFilterListEditorModelBase
_adapter, _filterLogicList, _selectionIndex, _selectionModel
 
Constructor Summary
DefaultAdvancedFilterModelAdapter()
          Constructs a new adapter with default properties.
DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessModel businessModel)
          Constructs a new adapter based on the given BusinessModel object.
DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessModel businessModel, java.lang.Object initialFilter)
          Constructs a new adapter using the given BusinessModel as the data source.
DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessQuery businessQuery)
          Constructs a new adapter from the given model.
DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessQuery businessQuery, java.lang.Object initialFilter)
          Constructs a new adapter from the given model.
DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessQuery businessQuery, java.lang.Object initialFilter, int environment)
          Constructs a new adapter from the given model.
DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessQuery businessQuery, java.lang.Object initialFilter, java.util.Locale locale)
          Constructs a new adapter from the given model.
 
Method Summary
 boolean addSelection(FilterLogicTestNodeInterface value)
          adds a new selection to the end of the FilterLogicList (cursor position unchanged after an add)
 FilterValueInterface applyExpressionValueEditorChanges(FilterLogicTestNodeInterface testNode, int valueIndex)
          Applies any changes made by the user in the expression value editor to the current selection model.
protected  void applyFilterDescription()
          Applies the filter description to the native filter model.
 FilterItemInterface applyFilterItemEditorChanges(FilterLogicTestNodeInterface testNode)
          Processes the data from the filter item editor and updates the given test node with the results.
protected  void applyFilterLabel()
          Applies the desired label to the root filter object.
 FilterQualifierInterface applyFilterQualifierEditorChanges(FilterLogicTestNodeInterface testNode)
          Applies any changes made by the user in the qualifier editor to the current selection model.
 FilterQualifierInterface applyFilterQualifierEditorChanges(FilterLogicTestNodeInterface testNode, java.util.Map selectedQualifierMap)
          Applies any changes made by the user in the qualifier editor to the current selection model.
 FilterValueInterface applyPromptValueEditorChanges(FilterLogicTestNodeInterface testNode, int valueIndex)
          Applies any changes made by the user in the prompt value editor to the current selection model.
 FilterValueInterface applyPromptValueEditorChanges(com.sas.swing.dataselectors.editors.PromptValueEditorInterface promptValueEditor, FilterLogicTestNodeInterface testNode, int valueIndex)
          Applies any changes made by the user in the prompt value editor to the current selection model.
 void cancel()
          Reverts the filter logic tree to the original state of the native filter model.
 void clear()
          Clears the current filter logic but does not modify the native filter model.
 void clear(boolean commit)
          Clears the current filter logic and optionally commits the change to the native filter model.
 boolean commitChanges()
          Commit changes to the native filter model.
protected  FilterBaseModelData getBaseModel()
           
 com.sas.iquery.metadata.business.BusinessModel getBusinessModel()
          Returns the BusinessModel object used throughout the adapter.
 com.sas.iquery.metadata.business.BusinessQuery getBusinessQuery()
          Returns the BusinessQuery object used throughout the adapter.
 int getEnvironment()
          Returns the current operating environment, if defined, otherwise the environment is investigated and an appropriate value is returned.
 com.sas.swing.dataselectors.editors.ExpressionValueEditorInterface getExpressionValueEditor()
          Returns the editor to use to edit an expression value.
static com.sas.iquery.metadata.business.step.StepInterface getFilterableStep(com.sas.iquery.metadata.business.DataItem item)
          Determines the appropriate step-model filter to get/set based on the given DataItem.
 java.lang.String getFilterDescription()
          Returns the current description for the filter.
protected  AttributeTypeInterface getFilterItemAttributeType(FilterItemInterface item)
           
 com.sas.swing.dataselectors.editors.FilterItemEditorInterface getFilterItemEditor()
          Returns the editor to use to edit a filter item.
protected  int getFilterItemSQLType(FilterItemInterface item)
           
 java.lang.String getFilterLabel()
          Gets the current desired label or the label of the root filter object if it has not been changed.
 FilterObjectFactoryInterface getFilterObjectFactory()
          Returns the filter object factory used by the adapter to convert between native and filter model objects.
 com.sas.swing.dataselectors.editors.QualifiersEditorInterface getFilterQualifierEditor()
          Returns the editor to use to edit a filter qualifier.
protected  java.lang.String getFilterQualifierSkipID(java.lang.Object nativeItem)
          Returns the identifier for the given native object that the filter qualifier editor will expect to receive to properly display and function.
 java.util.Locale getLocale()
          Returns the Locale currently used throughout the filter model.
 int getMaxOutputObservations()
          Returns the maximum number of values returned by the query for a DataItem when gathering a the list of values a user may choose from to complete a filter expression.
 java.util.List getPersistentFilterList()
           
 FilterValueInterface getPromptedValueByName(java.lang.String name)
          Returns the FilterValueInterface wrapper that contains the prompt object matching the specified name.
 java.util.List getPromptRangeValueList(java.lang.Object item)
          Returns a List containing all known range prompts filter values.
 com.sas.swing.dataselectors.editors.PromptValueEditorInterface getPromptValueEditor()
          Returns the editor to use to edit a prompt value.
 java.util.List getPromptValueList(java.lang.Object item)
          Returns a List containing all known prompt filter values valid for the specified item.
 java.util.Map getPromptValueMap()
          Provides a Map with all available Prompts keyed to their names.
 java.lang.Object getRootFilterObject()
          Returns the root filter object in the native model.
 SimpleFilterLogicTreeInterface getSelectionTree()
          Returns the filter logic tree that represents the overall filter selection.
 SimpleFilterLogicTreeInterface getSelectionTree(PersistentFilterInterface pFilter)
           
 com.sas.swing.dataselectors.editors.PromptValueEditorInterface getSharedPromptSelector()
          Returns the selector used to obtain a shared prompt definition.
 java.util.List getSystemVariableValueList(java.lang.Object item)
          Returns a List of applicable system variable values.
 com.sas.storage.valueprovider.ValueProviderInterface getValueProvider(FilterLogicTestNodeInterface testNode, int valueIndex)
          Return the ValueProviderInterface object appropriate for the given test node and indicated value index.
 int isCascadable()
           
 boolean isCascadingPrompts()
           
 boolean isEditedExpressionValue(java.lang.Object value)
          Returns TRUE if the given object represents an edited expression, FALSE otherwise.
 boolean isEnforcingPromptCascades()
           
protected  boolean isFilterImportable(com.sas.iquery.metadata.business.FilterItem item)
           
protected  boolean isFilterImportable(java.util.List testNodeList)
           
 boolean isOLAP()
          Returns TRUE if the native filter model is based on OLAP data, FALSE otherwise.
 boolean isPromptedRangeValue(java.lang.Object value)
          Returns TRUE if the given object represents a prompted range value, FALSE otherwise.
 boolean isPromptedValue(java.lang.Object value)
          Returns TRUE if the given object represents a prompted value, FALSE otherwise.
static boolean isPromptMultipleSelection(com.sas.iquery.metadata.business.Prompt prompt)
           
 boolean isQuotedValue(java.lang.Object value)
          Returns TRUE if the given object represents a value that will be quoted during query generation.
 boolean isSystemVariableValue(java.lang.Object value)
          Determine if the given object represents a system variable value.
 boolean isUserCreatedValue(java.lang.Object value)
          Returns TRUE if the given object represents a value that was created by a user entering a String expression value in the filter selector.
 boolean isValidFilter(FilterLogicTestNodeInterface testNode)
          Attempts to validate the filter represented by the given test node.
protected  boolean isValidPromptType(FilterItemInterface filterItem, com.sas.datatypes.DataTypeInterface promptDataType)
           
protected  void refreshPromptValueMap()
          Examines the business model and constructs a map from all prompt objects found within based on their names.
 void removeSelection()
          removes the current selection from the FilterLogicList (cursor position is undefined after remove)
 void setApplicationData(java.lang.Object data)
          Used to store application specific data.
 void setBusinessModel(com.sas.iquery.metadata.business.BusinessModel model)
          Sets the BusinessModel object used in various roles of the adapter.
 void setBusinessQuery(com.sas.iquery.metadata.business.BusinessQuery model)
          Sets the BusinessQuery object used in various roles of the adapter.
 void setEnforcePromptCascades(boolean cascadePrompts)
           
 void setEnvironment(int environment)
          Sets the operating environment to the specified value.
 void setExpressionValueEditor(com.sas.swing.dataselectors.editors.ExpressionValueEditorInterface expressionValueEditor)
          Sets the editor to use to edit an expression value.
 void setExpressionValueEditorInfo(FilterLogicTestNodeInterface testNode, int valueIndex)
          Prepares the expression value editor for use based on the values contained in the given test node.
 void setFilterDescription(java.lang.String value)
          Sets the description to use if/when persisting this filter model.
 void setFilterItemEditor(com.sas.swing.dataselectors.editors.FilterItemEditorInterface filterItemEditor)
          Sets the editor to use to edit a filter item.
 void setFilterItemEditorInfo(FilterLogicTestNodeInterface testNode)
          Prepares the filter item editor for use based on the values contained in the given test node.
 void setFilterLabel(java.lang.String label)
          Set the label the root filter object should have.
 void setFilterObjectFactory(FilterObjectFactoryInterface factory)
          Sets the filter object factory that is to be used by the adapter to convert between native and filter model objects.
 void setFilterQualifierEditor(com.sas.swing.dataselectors.editors.QualifiersEditorInterface filterQualifierEditor)
          Sets the editor to use to edit a filter qualifier.
 void setFilterQualifierEditorInfo(FilterLogicTestNodeInterface testNode)
          Prepares the filter qualifier editor with values from the given test node.
 void setLocale(java.util.Locale locale)
          Sets the Locale for the model.
 void setMaxOutputObservations(int max)
          Sets the maximum number of distinct values to return for a DataItem whose properties allow filter values to be assigned from a list of possible values created from a query.
 void setModel(com.sas.iquery.metadata.business.BusinessModel businessModel)
          Sets the model for this adapter.
 void setModel(com.sas.iquery.metadata.business.BusinessQuery businessQuery)
          Sets the model for this adapter.
 void setPromptValueEditor(com.sas.swing.dataselectors.editors.PromptValueEditorInterface promptValueEditor)
          Sets the editor to use to edit a prompt value.
 void setPromptValueEditorInfo(FilterLogicTestNodeInterface testNode, int valueIndex)
          Prepares the prompt value editor for use based on the values contained in the given test node.
 void setPromptValueEditorInfo(FilterLogicTestNodeInterface testNode, int valueIndex, boolean isRangePrompt)
          Prepares the PromptValueEditor to edit the current filter value based on the given FilterLogicTestNodeInterface.
 void setPromptValueEditorInfo(com.sas.swing.dataselectors.editors.PromptValueEditorInterface promptValueEditor, FilterLogicTestNodeInterface testNode, int valueIndex, boolean isRangePrompt)
           
 void setSelection(FilterLogicTestNodeInterface value)
          Sets the selection model for the adapter.
 void setSelectionCursor(int index)
          Move the model cursor to a new selection index.
 void setSharedPromptSelector(com.sas.swing.dataselectors.editors.PromptValueEditorInterface sharedPromptSelector)
          Sets the selector used to obtain a shared prompt definition.
 
Methods inherited from class com.sas.dataselectors.filters.SimpleFilterListEditorModelBase
getApplicationData, getChangableSelectionModel, getDataSource, getFilterLogicList, getSelection, getSelectionCount, getSelectionCursor, setAdapter
 
Methods inherited from interface com.sas.dataselectors.filters.AdvancedFilterModelInterface
getFilterLogicList, getSelectionCount, getSelectionCursor
 
Methods inherited from interface com.sas.dataselectors.filters.SimpleFilterDefinitionModelInterface
getApplicationData, getDataSource, getSelection
 

Field Detail

_businessModel

protected com.sas.iquery.metadata.business.BusinessModel _businessModel
The BusinessModel this adapter will use as the source of the filter model.


_businessQuery

protected com.sas.iquery.metadata.business.BusinessQuery _businessQuery
The BusinessQuery that (if it exists) will give additional information for the filter model.


_initialFilterObject

protected java.lang.Object _initialFilterObject
The initial state of the filter being created/modified.


_logicTree

protected SimpleFilterLogicTreeInterface _logicTree
The filter selection model. This model holds the various expressions used in the overall filter along with data about their relationships and groupings.


_filterObjectFactory

protected FilterObjectFactoryInterface _filterObjectFactory
The factory object used to convert between native objects and filter model objects.


_promptValueEditor

protected com.sas.swing.dataselectors.editors.PromptValueEditorInterface _promptValueEditor
The editor used to create/modify/assign prompts for use as values in filters.


_expressionValueEditor

protected com.sas.swing.dataselectors.editors.ExpressionValueEditorInterface _expressionValueEditor
The editor used to create/modify/assign expressions for use as values in filters.


_filterItemEditor

protected com.sas.swing.dataselectors.editors.FilterItemEditorInterface _filterItemEditor
The editor used to create/modify/assign expressions for use as items in filters.


_filterQualifierEditor

protected com.sas.swing.dataselectors.editors.QualifiersEditorInterface _filterQualifierEditor
The editor used to create/modify/assign qualifiers that further subset data.


_promptMap

protected java.util.Map _promptMap
The prompt map holds all prompts found in the BusinessModel keyed by their names.


_systemVariableMap

protected java.util.Map _systemVariableMap
The system variable map holds all system variable prompts found in the BusinessModel keyed by their names.


_filterLabel

protected java.lang.String _filterLabel
The label to assign the final filter.


_filterDescription

protected java.lang.String _filterDescription
The description to assign the final filter.


_newFilter

protected boolean _newFilter
A flag to specify whether the model is creating a new filter or modifying an existing one.


_locale

protected java.util.Locale _locale
The current Locale in use by the filter model. If null, the default Locale will be used.


_revertToFilterObject

protected java.lang.Object _revertToFilterObject
The filter object used to restore the selection model to the state it was in when editing the filter began.


rootFilterObject

protected java.lang.Object rootFilterObject
The last root filter object resulting from a call to commitChanges.


environment

protected int environment
Constructor Detail

DefaultAdvancedFilterModelAdapter

public DefaultAdvancedFilterModelAdapter()
Constructs a new adapter with default properties.


DefaultAdvancedFilterModelAdapter

public DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessModel businessModel)
Constructs a new adapter based on the given BusinessModel object. Any filter objects produced by the adapter will be new to the business model.

Parameters:
businessModel - the data source for the filter model

DefaultAdvancedFilterModelAdapter

public DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessModel businessModel,
                                         java.lang.Object initialFilter)
Constructs a new adapter using the given BusinessModel as the data source. The initial filter, if specified, will be used to construct the initial selection model.

Parameters:
businessModel - the data source for the filter model
initialFilter - the initial filter to view/modify

DefaultAdvancedFilterModelAdapter

public DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessQuery businessQuery)
Constructs a new adapter from the given model. The BusinessModel will be extracted from the model and may be used at times.

Parameters:
businessQuery - the data source for the filter model

DefaultAdvancedFilterModelAdapter

public DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessQuery businessQuery,
                                         java.lang.Object initialFilter)
Constructs a new adapter from the given model. The BusinessModel will be extracted from the model and may be used at times. The initial filter, if specified, will be used to construct the initial selection model.

Parameters:
businessQuery - the data source for the filter model
initialFilter - the initial filter to view/modify

DefaultAdvancedFilterModelAdapter

public DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessQuery businessQuery,
                                         java.lang.Object initialFilter,
                                         java.util.Locale locale)
Constructs a new adapter from the given model. The BusinessModel will be extracted from the model and may be used at times. The initial filter, if specified, will be used to construct the initial selection model.

Parameters:
businessQuery - the data source for the filter model
initialFilter - the initial filter to view/modify
locale - the Locale to use to format values

DefaultAdvancedFilterModelAdapter

public DefaultAdvancedFilterModelAdapter(com.sas.iquery.metadata.business.BusinessQuery businessQuery,
                                         java.lang.Object initialFilter,
                                         int environment)
Constructs a new adapter from the given model. The BusinessModel will be extracted from the model and may be used at times. The initial filter, if specified, will be used to construct the initial selection model.

Parameters:
businessQuery - the data source for the filter model
initialFilter - the initial filter to view/modify
environment - the operating environment (e.g. Swing,JSP)
Method Detail

getBaseModel

protected FilterBaseModelData getBaseModel()

setModel

public void setModel(com.sas.iquery.metadata.business.BusinessModel businessModel)
Sets the model for this adapter. If not null, a filter model is derived from the given native model. This method includes and goes beyond the setBusinessModel method.

Parameters:
businessModel - the new model

setModel

public void setModel(com.sas.iquery.metadata.business.BusinessQuery businessQuery)
Sets the model for this adapter. If not null, a filter model is derived from the given native model. This method includes and goes beyond the setBusinessQuery method.

Parameters:
businessQuery - the new model

setApplicationData

public void setApplicationData(java.lang.Object data)
Description copied from class: SimpleFilterListEditorModelBase
Used to store application specific data.

Specified by:
setApplicationData in interface SimpleFilterDefinitionModelInterface
Overrides:
setApplicationData in class SimpleFilterListEditorModelBase
Parameters:
data - to be stored with this object for application use
See Also:
SimpleFilterDefinitionModelInterface.setApplicationData(Object)

getFilterableStep

public static com.sas.iquery.metadata.business.step.StepInterface getFilterableStep(com.sas.iquery.metadata.business.DataItem item)
Determines the appropriate step-model filter to get/set based on the given DataItem.

Parameters:
item - the DataItem to be searched
Returns:
the current filterable StepInterface instance or null if none were found/appropriate

setBusinessModel

public void setBusinessModel(com.sas.iquery.metadata.business.BusinessModel model)
Sets the BusinessModel object used in various roles of the adapter.

Parameters:
model - the new BusinessModel object to use or null if none is to be used

getBusinessModel

public com.sas.iquery.metadata.business.BusinessModel getBusinessModel()
Returns the BusinessModel object used throughout the adapter.

Returns:
the current BusinessModel

setBusinessQuery

public void setBusinessQuery(com.sas.iquery.metadata.business.BusinessQuery model)
Sets the BusinessQuery object used in various roles of the adapter.

Parameters:
model - the new BusinessQuery object to use or null if none is to be used

getBusinessQuery

public com.sas.iquery.metadata.business.BusinessQuery getBusinessQuery()
Returns the BusinessQuery object used throughout the adapter.

Returns:
the current BusinessQuery

setSelection

public void setSelection(FilterLogicTestNodeInterface value)
Sets the selection model for the adapter.

Specified by:
setSelection in interface SimpleFilterDefinitionModelInterface
Overrides:
setSelection in class SimpleFilterListEditorModelBase
Parameters:
value - the new selection
See Also:
SimpleFilterDefinitionModelInterface.setSelection(FilterLogicTestNodeInterface)

setSelectionCursor

public void setSelectionCursor(int index)
Move the model cursor to a new selection index.

Specified by:
setSelectionCursor in interface AdvancedFilterModelInterface
Specified by:
setSelectionCursor in interface SimpleFilterListEditorModelInterface
Overrides:
setSelectionCursor in class SimpleFilterListEditorModelBase
Parameters:
index - the target index for the cursor
See Also:
SimpleFilterListEditorModelInterface.setSelectionCursor(int)

commitChanges

public boolean commitChanges()
Commit changes to the native filter model.

Specified by:
commitChanges in interface SimpleFilterDefinitionModelInterface
Overrides:
commitChanges in class SimpleFilterListEditorModelBase
Returns:
TRUE if everything succeeds, FALSE otherwise
See Also:
SimpleFilterDefinitionModelInterface.commitChanges()

getRootFilterObject

public java.lang.Object getRootFilterObject()
Returns the root filter object in the native model.

Specified by:
getRootFilterObject in interface SimpleFilterDefinitionModelInterface
Overrides:
getRootFilterObject in class SimpleFilterListEditorModelBase
Parameters:
the - root filter object in the native model
Returns:
the root filter object (a single filter item or a List)

cancel

public void cancel()
Reverts the filter logic tree to the original state of the native filter model.

Specified by:
cancel in interface AdvancedFilterModelInterface

setFilterLabel

public void setFilterLabel(java.lang.String label)
Set the label the root filter object should have.

Specified by:
setFilterLabel in interface AdvancedFilterModelInterface
Parameters:
label - the new filter label
See Also:
AdvancedFilterModelInterface.setFilterLabel(String label)

applyFilterLabel

protected void applyFilterLabel()
Applies the desired label to the root filter object.


getFilterLabel

public java.lang.String getFilterLabel()
Gets the current desired label or the label of the root filter object if it has not been changed.

Specified by:
getFilterLabel in interface AdvancedFilterModelInterface
Returns:
the label intended for the root filter object
See Also:
AdvancedFilterModelInterface.getFilterLabel()

setFilterDescription

public void setFilterDescription(java.lang.String value)
Sets the description to use if/when persisting this filter model.

Specified by:
setFilterDescription in interface AdvancedFilterModelInterface
Parameters:
value - the new description

applyFilterDescription

protected void applyFilterDescription()
Applies the filter description to the native filter model.


getFilterDescription

public java.lang.String getFilterDescription()
Returns the current description for the filter. If none has been applied locally, the default value comes from the native filter object.

Specified by:
getFilterDescription in interface AdvancedFilterModelInterface
Returns:
the description of this filter

addSelection

public boolean addSelection(FilterLogicTestNodeInterface value)
adds a new selection to the end of the FilterLogicList (cursor position unchanged after an add)

Specified by:
addSelection in interface AdvancedFilterModelInterface
Specified by:
addSelection in interface SimpleFilterListEditorModelInterface
Overrides:
addSelection in class SimpleFilterListEditorModelBase
Parameters:
FilterLogicTestNodeInterface - logic test node values to make up the new object
Returns:
boolean true if successful
See Also:
SimpleFilterListEditorModelInterface.addSelection(FilterLogicTestNodeInterface)

removeSelection

public void removeSelection()
removes the current selection from the FilterLogicList (cursor position is undefined after remove)

Specified by:
removeSelection in interface AdvancedFilterModelInterface
Specified by:
removeSelection in interface SimpleFilterListEditorModelInterface
Overrides:
removeSelection in class SimpleFilterListEditorModelBase
See Also:
SimpleFilterListEditorModelInterface.removeSelection()

getSelectionTree

public SimpleFilterLogicTreeInterface getSelectionTree()
Returns the filter logic tree that represents the overall filter selection.

Specified by:
getSelectionTree in interface AdvancedFilterModelInterface
Returns:
the filter logic tree
See Also:
FilterLogicTestNodeInterface, FilterLogicBaseNodeInterface, FilterLogicAndNodeInterface, FilterLogicOrNodeInterface, FilterLogicNotNodeInterface

getSelectionTree

public SimpleFilterLogicTreeInterface getSelectionTree(PersistentFilterInterface pFilter)
Specified by:
getSelectionTree in interface PersistentFilterProviderModelInterface

isOLAP

public boolean isOLAP()
Returns TRUE if the native filter model is based on OLAP data, FALSE otherwise.

Specified by:
isOLAP in interface AdvancedFilterDefinitionModelInterface
Returns:
TRUE if the native filter model is based on OLAP data, FALSE otherwise

isCascadingPrompts

public boolean isCascadingPrompts()
Specified by:
isCascadingPrompts in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface

isCascadable

public int isCascadable()
Specified by:
isCascadable in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface

setEnforcePromptCascades

public void setEnforcePromptCascades(boolean cascadePrompts)
Specified by:
setEnforcePromptCascades in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface

isEnforcingPromptCascades

public boolean isEnforcingPromptCascades()

getSharedPromptSelector

public com.sas.swing.dataselectors.editors.PromptValueEditorInterface getSharedPromptSelector()
Description copied from interface: PromptValueProviderModelInterface
Returns the selector used to obtain a shared prompt definition.

Specified by:
getSharedPromptSelector in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface
Returns:
the selector used to obtain a shared prompt definition

setSharedPromptSelector

public void setSharedPromptSelector(com.sas.swing.dataselectors.editors.PromptValueEditorInterface sharedPromptSelector)
Sets the selector used to obtain a shared prompt definition.

Specified by:
setSharedPromptSelector in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface
Parameters:
sharedPromptSelector - the new shared prompt definition selector

getPromptValueEditor

public com.sas.swing.dataselectors.editors.PromptValueEditorInterface getPromptValueEditor()
Returns the editor to use to edit a prompt value.

Specified by:
getPromptValueEditor in interface AdvancedFilterModelInterface
Returns:
the prompt editor

setPromptValueEditor

public void setPromptValueEditor(com.sas.swing.dataselectors.editors.PromptValueEditorInterface promptValueEditor)
Sets the editor to use to edit a prompt value.

Specified by:
setPromptValueEditor in interface AdvancedFilterModelInterface
Parameters:
promptValueEditor - the new prompt editor

getExpressionValueEditor

public com.sas.swing.dataselectors.editors.ExpressionValueEditorInterface getExpressionValueEditor()
Returns the editor to use to edit an expression value.

Specified by:
getExpressionValueEditor in interface AdvancedFilterModelInterface
Returns:
the expression editor

setExpressionValueEditor

public void setExpressionValueEditor(com.sas.swing.dataselectors.editors.ExpressionValueEditorInterface expressionValueEditor)
Sets the editor to use to edit an expression value.

Specified by:
setExpressionValueEditor in interface AdvancedFilterModelInterface
Parameters:
expressionValueEditor - the new expression value editor

getFilterItemEditor

public com.sas.swing.dataselectors.editors.FilterItemEditorInterface getFilterItemEditor()
Returns the editor to use to edit a filter item.

Specified by:
getFilterItemEditor in interface AdvancedFilterModelInterface
Returns:
the filter item editor

setFilterItemEditor

public void setFilterItemEditor(com.sas.swing.dataselectors.editors.FilterItemEditorInterface filterItemEditor)
Sets the editor to use to edit a filter item.

Specified by:
setFilterItemEditor in interface AdvancedFilterModelInterface
Parameters:
the - new filter item editor

getFilterQualifierEditor

public com.sas.swing.dataselectors.editors.QualifiersEditorInterface getFilterQualifierEditor()
Returns the editor to use to edit a filter qualifier.

Specified by:
getFilterQualifierEditor in interface AdvancedFilterModelInterface
Returns:
the qualifier editor

getFilterQualifierSkipID

protected java.lang.String getFilterQualifierSkipID(java.lang.Object nativeItem)
                                             throws FilterException
Returns the identifier for the given native object that the filter qualifier editor will expect to receive to properly display and function. The native object should be the object wrapped in the currently selected filter item.

Parameters:
nativeItem - the item to process
Returns:
the identifier for the qualifier editor
Throws:
FilterException - for any errors encountered while deriving the identifier

setFilterQualifierEditorInfo

public void setFilterQualifierEditorInfo(FilterLogicTestNodeInterface testNode)
Prepares the filter qualifier editor with values from the given test node. Once prepared, the editor can be accurately used to modify the qualifier values for the test node.

Specified by:
setFilterQualifierEditorInfo in interface AdvancedFilterModelInterface
Parameters:
testNode - the test node that contains the current qualifier values

applyFilterQualifierEditorChanges

public FilterQualifierInterface applyFilterQualifierEditorChanges(FilterLogicTestNodeInterface testNode)
Applies any changes made by the user in the qualifier editor to the current selection model.

Specified by:
applyFilterQualifierEditorChanges in interface AdvancedFilterModelInterface
Parameters:
testNode - the selection model to update
Returns:
the filter qualifier object created for the user's selection

applyFilterQualifierEditorChanges

public FilterQualifierInterface applyFilterQualifierEditorChanges(FilterLogicTestNodeInterface testNode,
                                                                  java.util.Map selectedQualifierMap)
Applies any changes made by the user in the qualifier editor to the current selection model.

Parameters:
testNode - the selection model to update
selectedQualifierMap -
Returns:
the filter qualifier object created for the user's selection

setPromptValueEditorInfo

public void setPromptValueEditorInfo(FilterLogicTestNodeInterface testNode,
                                     int valueIndex)
Prepares the prompt value editor for use based on the values contained in the given test node.

Specified by:
setPromptValueEditorInfo in interface AdvancedFilterModelInterface
Parameters:
testNode - the test node used to prepare the filter item editor
valueIndex - the index of the value to edit

setPromptValueEditorInfo

public void setPromptValueEditorInfo(FilterLogicTestNodeInterface testNode,
                                     int valueIndex,
                                     boolean isRangePrompt)
Description copied from interface: PromptValueProviderModelInterface
Prepares the PromptValueEditor to edit the current filter value based on the given FilterLogicTestNodeInterface.

Specified by:
setPromptValueEditorInfo in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface
Parameters:
testNode - the test node to examine
valueIndex - the index in the value list of the value to edit
isRangePrompt - indicates if a range prompt definition should be used

setPromptValueEditorInfo

public void setPromptValueEditorInfo(com.sas.swing.dataselectors.editors.PromptValueEditorInterface promptValueEditor,
                                     FilterLogicTestNodeInterface testNode,
                                     int valueIndex,
                                     boolean isRangePrompt)
Specified by:
setPromptValueEditorInfo in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface

applyPromptValueEditorChanges

public FilterValueInterface applyPromptValueEditorChanges(FilterLogicTestNodeInterface testNode,
                                                          int valueIndex)
Applies any changes made by the user in the prompt value editor to the current selection model.

Specified by:
applyPromptValueEditorChanges in interface AdvancedFilterModelInterface
Parameters:
testNode - the selection model to update
valueIndex - the index of the value to update
Returns:
the filter value created for the user's expression

applyPromptValueEditorChanges

public FilterValueInterface applyPromptValueEditorChanges(com.sas.swing.dataselectors.editors.PromptValueEditorInterface promptValueEditor,
                                                          FilterLogicTestNodeInterface testNode,
                                                          int valueIndex)
Applies any changes made by the user in the prompt value editor to the current selection model.

Specified by:
applyPromptValueEditorChanges in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface
Parameters:
testNode - the selection model to update
valueIndex - the index of the value to update
Returns:
the filter value created for the user's expression

setExpressionValueEditorInfo

public void setExpressionValueEditorInfo(FilterLogicTestNodeInterface testNode,
                                         int valueIndex)
Prepares the expression value editor for use based on the values contained in the given test node.

Specified by:
setExpressionValueEditorInfo in interface AdvancedFilterModelInterface
Parameters:
testNode - the test node used to prepare the filter item editor
valueIndex - the index of the value to edit

applyExpressionValueEditorChanges

public FilterValueInterface applyExpressionValueEditorChanges(FilterLogicTestNodeInterface testNode,
                                                              int valueIndex)
Applies any changes made by the user in the expression value editor to the current selection model.

Specified by:
applyExpressionValueEditorChanges in interface AdvancedFilterModelInterface
Parameters:
testNode - the selection model to update
valueIndex - the index of the value to update
Returns:
the filter value created for the user's expression

setFilterItemEditorInfo

public void setFilterItemEditorInfo(FilterLogicTestNodeInterface testNode)
Prepares the filter item editor for use based on the values contained in the given test node.

Specified by:
setFilterItemEditorInfo in interface AdvancedFilterModelInterface
Parameters:
testNode - the test node used to prepare the filter item editor

applyFilterItemEditorChanges

public FilterItemInterface applyFilterItemEditorChanges(FilterLogicTestNodeInterface testNode)
Processes the data from the filter item editor and updates the given test node with the results.

Specified by:
applyFilterItemEditorChanges in interface AdvancedFilterModelInterface
Parameters:
testNode - the test node to apply the changes to
Returns:
the FilterItemInterface representing the user's selection

setFilterQualifierEditor

public void setFilterQualifierEditor(com.sas.swing.dataselectors.editors.QualifiersEditorInterface filterQualifierEditor)
Sets the editor to use to edit a filter qualifier.

Specified by:
setFilterQualifierEditor in interface AdvancedFilterModelInterface
Parameters:
filterQualifierEditor - the new filter qualifier editor

clear

public void clear()
Clears the current filter logic but does not modify the native filter model.

Specified by:
clear in interface AdvancedFilterModelInterface

clear

public void clear(boolean commit)
Clears the current filter logic and optionally commits the change to the native filter model.

Specified by:
clear in interface AdvancedFilterModelInterface
Parameters:
commit - flag for specifying if the native filter model should be updated

isEditedExpressionValue

public boolean isEditedExpressionValue(java.lang.Object value)
Returns TRUE if the given object represents an edited expression, FALSE otherwise.

Specified by:
isEditedExpressionValue in interface AdvancedFilterModelInterface
Parameters:
the - object to check
Returns:
TRUE if the value is an edited expression

isUserCreatedValue

public boolean isUserCreatedValue(java.lang.Object value)
Returns TRUE if the given object represents a value that was created by a user entering a String expression value in the filter selector.

Specified by:
isUserCreatedValue in interface AdvancedFilterModelInterface
Parameters:
value - the Object to examine
Returns:
TRUE if the given object was created by a user entering a String expression value in the filter selector

isQuotedValue

public boolean isQuotedValue(java.lang.Object value)
Returns TRUE if the given object represents a value that will be quoted during query generation.

Specified by:
isQuotedValue in interface AdvancedFilterModelInterface
Parameters:
value - the Object to examine
Returns:
TRUE if the given object represents a value that will be quoted during query generation

isPromptedValue

public boolean isPromptedValue(java.lang.Object value)
Returns TRUE if the given object represents a prompted value, FALSE otherwise.

Specified by:
isPromptedValue in interface AdvancedFilterModelInterface
Parameters:
value - the object to check
Returns:
TRUE if the object is a prompted value

isPromptedRangeValue

public boolean isPromptedRangeValue(java.lang.Object value)
Returns TRUE if the given object represents a prompted range value, FALSE otherwise.

Specified by:
isPromptedRangeValue in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface
Parameters:
value - the object to check
Returns:
TRUE if the object is a prompted range value

getPromptValueMap

public java.util.Map getPromptValueMap()
Provides a Map with all available Prompts keyed to their names. The Objects stored in the Map should be instances of FilterValueInterface that contain Prompt instances as their "data" and/or "unformatted value" property.

Specified by:
getPromptValueMap in interface AdvancedFilterModelInterface
Returns:
the prompt value map

refreshPromptValueMap

protected void refreshPromptValueMap()
Examines the business model and constructs a map from all prompt objects found within based on their names.


isPromptMultipleSelection

public static boolean isPromptMultipleSelection(com.sas.iquery.metadata.business.Prompt prompt)

getPromptValueList

public java.util.List getPromptValueList(java.lang.Object item)
Returns a List containing all known prompt filter values valid for the specified item.

Specified by:
getPromptValueList in interface AdvancedFilterModelInterface
Parameters:
item - the object to return the list of prompts for
Returns:
a List of FilterValueInterface objects containing all known prompts filter values

getPromptRangeValueList

public java.util.List getPromptRangeValueList(java.lang.Object item)
Description copied from interface: PromptValueProviderModelInterface
Returns a List containing all known range prompts filter values.

Specified by:
getPromptRangeValueList in interface com.sas.dataselectors.filters.PromptValueProviderModelInterface
Parameters:
item - the object to return range prompts for
Returns:
a List of FilterValueInterface objects containing all known prompts filter values

isValidPromptType

protected boolean isValidPromptType(FilterItemInterface filterItem,
                                    com.sas.datatypes.DataTypeInterface promptDataType)

getFilterItemSQLType

protected int getFilterItemSQLType(FilterItemInterface item)

getFilterItemAttributeType

protected AttributeTypeInterface getFilterItemAttributeType(FilterItemInterface item)

getPromptedValueByName

public FilterValueInterface getPromptedValueByName(java.lang.String name)
Returns the FilterValueInterface wrapper that contains the prompt object matching the specified name. If no matching value can be found, null is returned.

Parameters:
name - the prompt name to search for
Returns:
the value containing the named prompt, or null if none could be found

getFilterObjectFactory

public FilterObjectFactoryInterface getFilterObjectFactory()
Returns the filter object factory used by the adapter to convert between native and filter model objects.

Returns:
the filter object factory

setFilterObjectFactory

public void setFilterObjectFactory(FilterObjectFactoryInterface factory)
Sets the filter object factory that is to be used by the adapter to convert between native and filter model objects.

Parameters:
factory - the new factory object to use

getMaxOutputObservations

public int getMaxOutputObservations()
Returns the maximum number of values returned by the query for a DataItem when gathering a the list of values a user may choose from to complete a filter expression.

Specified by:
getMaxOutputObservations in interface AdvancedFilterModelInterface
Returns:
the maximum number of distinct values that will be listed

setMaxOutputObservations

public void setMaxOutputObservations(int max)
Sets the maximum number of distinct values to return for a DataItem whose properties allow filter values to be assigned from a list of possible values created from a query.

Specified by:
setMaxOutputObservations in interface AdvancedFilterModelInterface
Parameters:
max - the maximum number of distinct values to list
See Also:
Governing

getLocale

public java.util.Locale getLocale()
Returns the Locale currently used throughout the filter model. If the value is null, the default locale is in use.

Specified by:
getLocale in interface AdvancedFilterModelInterface
Returns:
the current locale used by the filter model

setLocale

public void setLocale(java.util.Locale locale)
Sets the Locale for the model. Several text strings visible to the user are scattered throughout the filter model and if the Locale changes or is different from the default, the correct Locale must be supplied to the model. If null is given as the parameter value, the default locale will be used.

Specified by:
setLocale in interface AdvancedFilterModelInterface
Parameters:
locale - the desired locale

isValidFilter

public boolean isValidFilter(FilterLogicTestNodeInterface testNode)
                      throws FilterException
Attempts to validate the filter represented by the given test node. The return value will be TRUE if the test succeeds and FALSE otherwise. Any errors that occur during the validation will be rethrown as a FilterException.

Specified by:
isValidFilter in interface AdvancedFilterModelInterface
Parameters:
testNode - the test node representing the filter to validate
Returns:
TRUE if the filter is valid, FALSE otherwise
Throws:
FilterException - as a wrapper for any errors encountered while testing the filter

getPersistentFilterList

public java.util.List getPersistentFilterList()
Specified by:
getPersistentFilterList in interface PersistentFilterProviderModelInterface
Returns:

isFilterImportable

protected boolean isFilterImportable(com.sas.iquery.metadata.business.FilterItem item)

isFilterImportable

protected boolean isFilterImportable(java.util.List testNodeList)
Parameters:
testNodeList - the list of test nodes representing the candidate filter
Returns:
true if the filter is importable after examining the given list of test nodes, false otherwise

isSystemVariableValue

public boolean isSystemVariableValue(java.lang.Object value)
Determine if the given object represents a system variable value.

Specified by:
isSystemVariableValue in interface com.sas.dataselectors.filters.SystemVariableProviderInterface
Parameters:
value - the Object to examine
Returns:
TRUE if the given object represents a system variable, FALSE otherwise

getSystemVariableValueList

public java.util.List getSystemVariableValueList(java.lang.Object item)
                                          throws FilterException
Returns a List of applicable system variable values.

Specified by:
getSystemVariableValueList in interface com.sas.dataselectors.filters.SystemVariableProviderInterface
Parameters:
testNode - if not null, then subsets the list to system variables compatible with the node
Returns:
a List of FilterValueInterface objects for the applicable system variables.
Throws:
FilterException

setEnvironment

public void setEnvironment(int environment)
Sets the operating environment to the specified value.

Parameters:
environment - The environment to set. Valid values are ENVIRONMENT_SWING or ENVIRONMENT_JSP.

getEnvironment

public int getEnvironment()
Returns the current operating environment, if defined, otherwise the environment is investigated and an appropriate value is returned.

Returns:
The current environment. Valid values are ENVIRONMENT_SWING or ENVIRONMENT_JSP.

getValueProvider

public com.sas.storage.valueprovider.ValueProviderInterface getValueProvider(FilterLogicTestNodeInterface testNode,
                                                                             int valueIndex)
Description copied from interface: SearchValueProviderModelInterface
Return the ValueProviderInterface object appropriate for the given test node and indicated value index. The simplest selection of ValueProvider may be based solely on the selected DataItem found in the test node, but could be expanded to consider other elements of the test node or the index of the value being examined.

Specified by:
getValueProvider in interface com.sas.dataselectors.filters.SearchValueProviderModelInterface
Parameters:
testNode - the test node that contains the currently selected elements of a single filter expression
valueIndex - the index (if applicable) of the value in the test node this provider will be for
Returns:
the appropriate ValueProviderInterface object for the given criteria or null if none could be determined.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.