org.broadleafcommerce.common.util.dao
Class TQRestriction

java.lang.Object
  extended by org.broadleafcommerce.common.util.dao.TQRestriction

public class TQRestriction
extends Object

Utilized in conjunction with TypedQueryBuilder to generate TypedQueries programmatically.

Author:
Andre Azzolini (apazzolini)

Nested Class Summary
static class TQRestriction.Mode
           
 
Field Summary
protected  String expression
           
protected  TQRestriction.Mode joinMode
           
protected  String operation
           
protected  Object parameter
           
protected  List<TQRestriction> restrictions
           
 
Constructor Summary
TQRestriction(String expression, String operation)
          Creates a simple restriction.
TQRestriction(String expression, String operation, Object parameter)
          Creates a simple restriction.
TQRestriction(TQRestriction.Mode joinMode)
          Creates an empty restriction node with the specified join mode.
 
Method Summary
 TQRestriction addChildRestriction(TQRestriction r)
          Adds a child restriction to the restrictions list
 String toQl(String parameterName, Map<String,Object> paramMap)
          Recursively generates a query string representation of this restriction along with any child restrictions that this object may have.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expression

protected String expression

operation

protected String operation

parameter

protected Object parameter

joinMode

protected TQRestriction.Mode joinMode

restrictions

protected List<TQRestriction> restrictions
Constructor Detail

TQRestriction

public TQRestriction(String expression,
                     String operation)
Creates a simple restriction. As there is no value associated, it is expected that the operation does not require a parameter value, such as IS NULL.

Parameters:
expression -
operation -

TQRestriction

public TQRestriction(String expression,
                     String operation,
                     Object parameter)
Creates a simple restriction.

Parameters:
expression -
operation -
parameter -

TQRestriction

public TQRestriction(TQRestriction.Mode joinMode)
Creates an empty restriction node with the specified join mode. It is expected that this restriction would then have at least 2 items in the restrictions list.

Parameters:
joinMode -
Method Detail

addChildRestriction

public TQRestriction addChildRestriction(TQRestriction r)
Adds a child restriction to the restrictions list

Parameters:
r -
Returns:
this

toQl

public String toQl(String parameterName,
                   Map<String,Object> paramMap)
Recursively generates a query string representation of this restriction along with any child restrictions that this object may have. It will also populate the paramMap for the appropriate values as it's iterating through the restrictions.

Parameters:
parameterName -
paramMap -
Returns:
the query language string


Copyright © 2013. All Rights Reserved.