Apache CXF API

org.apache.cxf.jaxrs.ext.search
Class AbstractComplexCondition<T>

java.lang.Object
  extended by org.apache.cxf.jaxrs.ext.search.AbstractComplexCondition<T>
All Implemented Interfaces:
SearchCondition<T>
Direct Known Subclasses:
AndSearchCondition, OrSearchCondition

public abstract class AbstractComplexCondition<T>
extends Object
implements SearchCondition<T>


Field Summary
protected  List<SearchCondition<T>> conditions
           
 
Constructor Summary
protected AbstractComplexCondition(ConditionType cType)
           
protected AbstractComplexCondition(List<SearchCondition<T>> conditions, ConditionType cType)
           
 
Method Summary
 void accept(SearchConditionVisitor<T> visitor)
          Provides a visitor which will convert this SearchCondition into a custom expression, for example, into the SQL statement, etc
 List<T> findAll(Collection<T> pojos)
          Returns a list of pojos matching the condition
 T getCondition()
          Some SearchConditions may use instance of T to capture the actual search criteria thus making it simpler to implement isMet(T).
 ConditionType getConditionType()
          Returns the type of the condition this SearchCondition represents
 List<SearchCondition<T>> getSearchConditions()
          List of conditions this SearchCondition may represent.
 PrimitiveStatement getStatement()
          Primitive statement such a > b, i < 5, etc this condition may represent.
 void setConditions(List<SearchCondition<T>> conditions)
           
 String toSQL(String table, String... columns)
          This method is now deprecated and will be removed soon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cxf.jaxrs.ext.search.SearchCondition
isMet
 

Field Detail

conditions

protected List<SearchCondition<T>> conditions
Constructor Detail

AbstractComplexCondition

protected AbstractComplexCondition(ConditionType cType)

AbstractComplexCondition

protected AbstractComplexCondition(List<SearchCondition<T>> conditions,
                                   ConditionType cType)
Method Detail

setConditions

public void setConditions(List<SearchCondition<T>> conditions)

findAll

public List<T> findAll(Collection<T> pojos)
Description copied from interface: SearchCondition
Returns a list of pojos matching the condition

Specified by:
findAll in interface SearchCondition<T>
Parameters:
pojos - list of pojos
Returns:
list of the matching pojos or null if none have been found

getCondition

public T getCondition()
Description copied from interface: SearchCondition
Some SearchConditions may use instance of T to capture the actual search criteria thus making it simpler to implement isMet(T). In some cases, the code which is given SearchCondition may find it more efficient to directly deal with the captured state for a more efficient lookup of matching data/records as opposed to calling SearchCondition.isMet for every instance of T it knows about.

Specified by:
getCondition in interface SearchCondition<T>
Returns:
T the captured search criteria, can be null

getConditionType

public ConditionType getConditionType()
Description copied from interface: SearchCondition
Returns the type of the condition this SearchCondition represents

Specified by:
getConditionType in interface SearchCondition<T>
Returns:
condition type

getSearchConditions

public List<SearchCondition<T>> getSearchConditions()
Description copied from interface: SearchCondition
List of conditions this SearchCondition may represent. Composite SearchConditions will return a list of conditions they are composed from, primitive ones will return null

Specified by:
getSearchConditions in interface SearchCondition<T>
Returns:
list of conditions, can be null

getStatement

public PrimitiveStatement getStatement()
Description copied from interface: SearchCondition
Primitive statement such a > b, i < 5, etc this condition may represent. Complex conditions will return null.

Specified by:
getStatement in interface SearchCondition<T>
Returns:
primitive search statement, can be null

toSQL

public String toSQL(String table,
                    String... columns)
Description copied from interface: SearchCondition
This method is now deprecated and will be removed soon. Utility method for converting this condition into an SQL expression

Specified by:
toSQL in interface SearchCondition<T>
Parameters:
table - table name
columns - column names, a wildcard as in 'SELECT * from table' will be used if names are not provided
Returns:
SQL expression

accept

public void accept(SearchConditionVisitor<T> visitor)
Description copied from interface: SearchCondition
Provides a visitor which will convert this SearchCondition into a custom expression, for example, into the SQL statement, etc

Specified by:
accept in interface SearchCondition<T>

Apache CXF API

Apache CXF