com.metamatrix.query.sql.visitor
Class CriteriaTranslatorVisitor

java.lang.Object
  extended by com.metamatrix.query.sql.LanguageVisitor
      extended by com.metamatrix.query.sql.visitor.ExpressionMappingVisitor
          extended by com.metamatrix.query.sql.visitor.CriteriaTranslatorVisitor

public class CriteriaTranslatorVisitor
extends ExpressionMappingVisitor

This class is used to translate criteria specified on the user's update command against the virtual group, the elements on this criteria are replaced by elements on the query transformation that defines the virtual group. Parts of the criteria are selectively translated if a CriteriaSelector is specified, also if the user explicty defines translations for some of the elements those translations override any symbol mappings.


Constructor Summary
CriteriaTranslatorVisitor()
           This constructor initialises the visitor
CriteriaTranslatorVisitor(java.util.Map symbolMap)
           This constructor initializes this object by setting the symbolMap.
 
Method Summary
 java.util.Map<ElementSymbol,Reference> getImplicitParams()
           
 Criteria getTranslatedCriteria()
          Gets the criteria translated by this visitor, differrent parts of the user's criteria are translated and they are combined as a CompoundCriteria using an AND operator.
 Expression replaceExpression(Expression obj)
           
 void setCriteriaSelector(CriteriaSelector selector)
          Set the criteria selector used to restrict the part of the criteria that needs to be translated.
 void setTranslations(java.util.Collection translations)
           Set the translations to be used to replace elements on the user's command against the virtual group.
 void visit(BetweenCriteria obj)
           This method updates the BetweenCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions.
 void visit(CompareCriteria obj)
           This method updates the CompareCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions.
 void visit(DependentSetCriteria obj)
           This method updates the SetCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions
 void visit(IsNullCriteria obj)
           This method updates the IsNullCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions.
 void visit(MatchCriteria obj)
           This method updates the MatchCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions
 void visit(SetCriteria obj)
           This method updates the SetCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions
 
Methods inherited from class com.metamatrix.query.sql.visitor.ExpressionMappingVisitor
createAliases, getVariableValues, mapExpressions, setVariableValues, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class com.metamatrix.query.sql.LanguageVisitor
setAbort, shouldAbort, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CriteriaTranslatorVisitor

public CriteriaTranslatorVisitor()

This constructor initialises the visitor


CriteriaTranslatorVisitor

public CriteriaTranslatorVisitor(java.util.Map symbolMap)

This constructor initializes this object by setting the symbolMap.

Parameters:
symbolMap - A map of virtual elements to their counterparts in transform defining the virtual group
Method Detail

setCriteriaSelector

public void setCriteriaSelector(CriteriaSelector selector)

Set the criteria selector used to restrict the part of the criteria that needs to be translated.

Parameters:
selector - The CriteriaSelector on the TranslateCriteria object

setTranslations

public void setTranslations(java.util.Collection translations)

Set the translations to be used to replace elements on the user's command against the virtual group.

Parameters:
translations - Collection of ComapreCriteria objects used to specify translations

visit

public void visit(BetweenCriteria obj)

This method updates the BetweenCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions.

Overrides:
visit in class ExpressionMappingVisitor
Parameters:
obj - The BetweenCriteria object to be updated with translated expressions
See Also:
LanguageVisitor.visit(BetweenCriteria)

visit

public void visit(CompareCriteria obj)

This method updates the CompareCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions.

Overrides:
visit in class ExpressionMappingVisitor
Parameters:
obj - The CompareCriteria object to be updated with translated expressions
See Also:
LanguageVisitor.visit(CompareCriteria)

visit

public void visit(IsNullCriteria obj)

This method updates the IsNullCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions.

Overrides:
visit in class ExpressionMappingVisitor
Parameters:
obj - The IsNullCriteria object to be updated with translated expressions
See Also:
LanguageVisitor.visit(IsNullCriteria)

visit

public void visit(MatchCriteria obj)

This method updates the MatchCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions

Overrides:
visit in class ExpressionMappingVisitor
Parameters:
obj - The SetCriteria object to be updated with translated expressions
See Also:
LanguageVisitor.visit(MatchCriteria)

visit

public void visit(SetCriteria obj)

This method updates the SetCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions

Overrides:
visit in class ExpressionMappingVisitor
Parameters:
obj - The SetCriteria object to be updated with translated expressions
See Also:
LanguageVisitor.visit(SetCriteria)

visit

public void visit(DependentSetCriteria obj)

This method updates the SetCriteria object it receives as an argument by replacing the virtual elements present in the expressions in the function with translated expressions

Overrides:
visit in class ExpressionMappingVisitor
Parameters:
obj - The SetCriteria object to be updated with translated expressions

replaceExpression

public Expression replaceExpression(Expression obj)
Overrides:
replaceExpression in class ExpressionMappingVisitor

getTranslatedCriteria

public Criteria getTranslatedCriteria()

Gets the criteria translated by this visitor, differrent parts of the user's criteria are translated and they are combined as a CompoundCriteria using an AND operator. Returns a null if no part of the user's criteria could be translated.

Returns:
The criteria after vistor completes translation of the criteria on the virtual group

getImplicitParams

public java.util.Map<ElementSymbol,Reference> getImplicitParams()


Copyright © 2009. All Rights Reserved.