com.sas.dataselectors.filters.tree
Class LogicTreeToFilterItemTransform

com.sas.dataselectors.filters.tree.LogicTreeToFilterItemTransform
All Implemented Interfaces:
com.sas.util.transforms.TransformInterface, java.io.Serializable

public class LogicTreeToFilterItemTransform
implements com.sas.util.transforms.TransformInterface

This transform takes a FilterLogicTreeInterface object (or it's root node) and transforms it into the corresponding BIQ FilterItem tree model. New objects are created every time a BIQ model object is required.

See Also:
Serialized Form

Constructor Summary
LogicTreeToFilterItemTransform()
          Constructs a new transform without supplying a factory for BIQ model objects.
LogicTreeToFilterItemTransform(FilterObjectFactoryInterface factory)
          Constructs a new transform and supplies the factory for BIQ model objects.
 
Method Summary
protected  com.sas.iquery.metadata.expr.ConditionalRelationType convertLogicalCondition(ConditionalRelationType type)
           
protected  com.sas.iquery.metadata.business.CompoundFilter createCompoundFilter(LogicalConditionNodeInterface node)
           
protected  com.sas.iquery.metadata.business.FilterItem createFilterItem(FilterLogicBaseNodeInterface node, com.sas.iquery.metadata.expr.ExpressionInterface expr)
           
 FilterObjectFactoryInterface getFactory()
          Returns the factory used when creating new BIQ filter model objects.
protected  com.sas.iquery.metadata.business.CompoundFilter newCompoundFilter()
           
protected  com.sas.iquery.metadata.business.CompoundFilter newCompoundFilter(ConditionalRelationType relationship)
           
protected  com.sas.iquery.metadata.expr.ExpressionInterface newFilterExpression(FilterLogicTestNodeInterface testNode)
          Creates and returns a new ConditionalExpression object from the given test node.
protected  com.sas.iquery.metadata.business.FilterItem newFilterItem()
           
protected  com.sas.iquery.metadata.expr.MultipleConditionalExpression newMultipleConditionalExpression()
           
protected  com.sas.iquery.metadata.expr.MultipleConditionalExpression newMultipleConditionalExpression(ConditionalRelationType relationship)
           
protected  java.lang.Object processLogicalConditionNode(LogicalConditionNodeInterface root)
           
protected  java.lang.Object processNode(FilterLogicBaseNodeInterface root)
           
protected  java.lang.Object processNotNode(NotNodeInterface root)
           
protected  java.lang.Object processTestNode(FilterLogicTestNodeInterface testNode)
           
 void setFactory(FilterObjectFactoryInterface factory)
          Sets the BIQ filter model object factory.
 java.lang.Object transform(java.lang.Object source)
          Attempts to transform the given Object into a BIQ filter model object.
protected  boolean updateFilterItem(com.sas.iquery.metadata.business.FilterItem filterItem, FilterLogicTestNodeInterface testNode)
           
protected  void updateFilterItem(com.sas.iquery.metadata.business.FilterItem filterItem, java.lang.String name, java.lang.String description, com.sas.iquery.metadata.expr.ExpressionInterface expr)
           
 

Constructor Detail

LogicTreeToFilterItemTransform

public LogicTreeToFilterItemTransform()
Constructs a new transform without supplying a factory for BIQ model objects.


LogicTreeToFilterItemTransform

public LogicTreeToFilterItemTransform(FilterObjectFactoryInterface factory)
Constructs a new transform and supplies the factory for BIQ model objects.

Parameters:
factory - the factory to use when creating new BIQ model objects
Method Detail

getFactory

public FilterObjectFactoryInterface getFactory()
Returns the factory used when creating new BIQ filter model objects.

Returns:
the BIQ object factory

setFactory

public void setFactory(FilterObjectFactoryInterface factory)
Sets the BIQ filter model object factory.

Parameters:
factory - the factory to use when creating new BIQ filter model objects

transform

public java.lang.Object transform(java.lang.Object source)
                           throws com.sas.util.transforms.TransformException
Attempts to transform the given Object into a BIQ filter model object. The input object should be either a FilterLogicTreeInterface or a FilterLogicBaseNodeInterface.

Specified by:
transform in interface com.sas.util.transforms.TransformInterface
Parameters:
source - the object to transform
Returns:
the resulting FilterItem constructed from the source, or null
Throws:
com.sas.util.transforms.TransformException - in the event of any exception that halts the transformation
java.lang.IllegalArgumentException - if the source object is not a FilterLogicTreeInterface or FilterLogicBaseNodeInterface object

processNode

protected java.lang.Object processNode(FilterLogicBaseNodeInterface root)
                                throws com.sas.util.transforms.TransformException
Parameters:
root -
Returns:
Throws:
com.sas.util.transforms.TransformException

processNotNode

protected java.lang.Object processNotNode(NotNodeInterface root)
                                   throws com.sas.util.transforms.TransformException
Throws:
com.sas.util.transforms.TransformException

processLogicalConditionNode

protected java.lang.Object processLogicalConditionNode(LogicalConditionNodeInterface root)
                                                throws com.sas.util.transforms.TransformException
Throws:
com.sas.util.transforms.TransformException

createFilterItem

protected com.sas.iquery.metadata.business.FilterItem createFilterItem(FilterLogicBaseNodeInterface node,
                                                                       com.sas.iquery.metadata.expr.ExpressionInterface expr)
                                                                throws com.sas.util.transforms.TransformException
Throws:
com.sas.util.transforms.TransformException

createCompoundFilter

protected com.sas.iquery.metadata.business.CompoundFilter createCompoundFilter(LogicalConditionNodeInterface node)

processTestNode

protected java.lang.Object processTestNode(FilterLogicTestNodeInterface testNode)

convertLogicalCondition

protected com.sas.iquery.metadata.expr.ConditionalRelationType convertLogicalCondition(ConditionalRelationType type)
Parameters:
type - the data selectors model logical condition
Returns:
the BIQ model relation type

updateFilterItem

protected boolean updateFilterItem(com.sas.iquery.metadata.business.FilterItem filterItem,
                                   FilterLogicTestNodeInterface testNode)
Parameters:
filter -
testNode -
Returns:

updateFilterItem

protected void updateFilterItem(com.sas.iquery.metadata.business.FilterItem filterItem,
                                java.lang.String name,
                                java.lang.String description,
                                com.sas.iquery.metadata.expr.ExpressionInterface expr)
                         throws com.sas.iquery.metadata.MetadataException
Throws:
com.sas.iquery.metadata.MetadataException

newFilterItem

protected com.sas.iquery.metadata.business.FilterItem newFilterItem()
Returns:

newCompoundFilter

protected com.sas.iquery.metadata.business.CompoundFilter newCompoundFilter()
Returns:

newCompoundFilter

protected com.sas.iquery.metadata.business.CompoundFilter newCompoundFilter(ConditionalRelationType relationship)

newMultipleConditionalExpression

protected com.sas.iquery.metadata.expr.MultipleConditionalExpression newMultipleConditionalExpression()

newMultipleConditionalExpression

protected com.sas.iquery.metadata.expr.MultipleConditionalExpression newMultipleConditionalExpression(ConditionalRelationType relationship)

newFilterExpression

protected com.sas.iquery.metadata.expr.ExpressionInterface newFilterExpression(FilterLogicTestNodeInterface testNode)
Creates and returns a new ConditionalExpression object from the given test node.

Parameters:
testNode - the test node to process
Returns:
the derived expression



Copyright © 2009 SAS Institute Inc. All Rights Reserved.