com.metamatrix.query.sql.visitor
Class CriteriaTranslatorVisitor

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

public class CriteriaTranslatorVisitor
extends LanguageVisitor

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 initialises this object by setting the symbolMap.
 
Method Summary
protected  Symbol getMappedSymbol(Symbol symbol)
          Get the symbol map between virtual group elements and the expressions that define them on the query transform of the virtual group.
 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.
 void setCriteriaSelector(CriteriaSelector selector)
          Set the criteria selector used to restrict the part of the criteria that needs to be translated.
 void setSymbolMap(java.util.Map symbolMap)
          Set the symbol map between virtual group elements and the expressions that define them on the query transform of the virtual group.
 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(CaseExpression obj)
           This method updates the CaseExpression 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(Function obj)
           This method updates the Function 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(SearchedCaseExpression obj)
           This method updates the SearchedCaseExpression 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.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, 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 initialises this object by setting the symbolMap.

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

getMappedSymbol

protected Symbol getMappedSymbol(Symbol symbol)

Get the symbol map between virtual group elements and the expressions that define them on the query transform of the virtual group.

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

setSymbolMap

public void setSymbolMap(java.util.Map symbolMap)

Set the symbol map between virtual group elements and the expressions that define them on the query transform of the virtual group.

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

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 LanguageVisitor
Parameters:
obj - The BetweenCriteria object to be updated with translated expressions

visit

public void visit(CaseExpression obj)

This method updates the CaseExpression 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 LanguageVisitor
Parameters:
obj - The CaseExpression object to be updated with translated expressions

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 LanguageVisitor
Parameters:
obj - The CompareCriteria object to be updated with translated expressions

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 LanguageVisitor
Parameters:
obj - The IsNullCriteria object to be updated with translated expressions

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 LanguageVisitor
Parameters:
obj - The SetCriteria object to be updated with translated expressions

visit

public void visit(SearchedCaseExpression obj)

This method updates the SearchedCaseExpression 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 LanguageVisitor
Parameters:
obj - The SearchedCaseExpression object to be updated with translated expressions

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 LanguageVisitor
Parameters:
obj - The SetCriteria object to be updated with translated expressions

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 LanguageVisitor
Parameters:
obj - The SetCriteria object to be updated with translated expressions

visit

public void visit(Function obj)

This method updates the Function 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 LanguageVisitor
Parameters:
obj - The Function object to be updated with translated expressions

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


Copyright © 2009. All Rights Reserved.