|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
FilterFactory is the interface that dictates the methods needed by factories to hand out filters
Field Summary | |
static int |
CONTAINS
|
static int |
ENDS_WITH
|
static int |
EQUALS
|
static int |
GREATER_THAN
|
static int |
GREATER_THAN_EQUALS
|
static int |
LESS_THAN
|
static int |
LESS_THAN_EQUALS
|
static int |
NOT_EQUALS
|
static int |
STARTS_WITH
|
static String |
versionId
|
Method Summary | |
CompoundFilter |
and()
This creates and returns a filter that can be used to AND existing filters together. |
Filter |
compare(String expressionOne,
int comparator,
String expressionTwo)
This method is used to compare two expressions to each other. |
Filter |
contains(String attribute,
String value,
boolean trueForAllIfValueIsNull)
This creates the appropriate SQL for the given attribute and passed in value. |
Filter |
endsWith(String attribute,
String value,
boolean trueForAllIfValueIsNull)
This creates the appropriate SQL for the given attribute and passed in value. |
Filter |
equals(String attribute,
Object value)
This creates the appropriate SQL for the given attribute and passed in value. |
Filter |
greaterThan(String attribute,
Object value,
boolean trueForAllIfValueIsNull)
This creates the appropriate SQL for the given attribute and passed in value. |
Filter |
greaterThanEquals(String attribute,
Object value,
boolean trueForAllIfValueIsNull)
This creates the appropriate SQL for the given attribute and passed in value. |
Filter |
in(String propertyName,
String queryName)
This creates a filter that constructs an "in" style subquery with the given property and subquery. |
Filter |
in(String property,
String subQueryProperty,
String queryName)
This creates a filter that constructs an "in" style subquery with the given property to be filtered on and subquery. |
Filter |
lessThan(String attribute,
Object value,
boolean trueForAllIfValueIsNull)
This creates the appropriate SQL for the given attribute and passed in value. |
Filter |
lessThanEquals(String attribute,
Object value,
boolean trueForAllIfValueIsNull)
This creates the appropriate SQL for the given attribute and passed in value. |
Filter |
notEquals(String attribute,
Object value)
This creates the appropriate SQL for the given attribute and passed in value. |
Filter |
notIn(String propertyName,
String queryName)
This creates a filter that constructs a "not in" style subquery with the given property and subquery. |
CompoundFilter |
or()
This creates and returns a filter that can be used to OR existing filters together. |
Filter |
simple(String sql)
|
Filter |
startsWith(String attribute,
String value,
boolean trueForAllIfValueIsNull)
This creates the appropriate SQL for the given attribute and passed in value. |
Field Detail |
public static final String versionId
public static final int EQUALS
public static final int NOT_EQUALS
public static final int GREATER_THAN
public static final int LESS_THAN
public static final int GREATER_THAN_EQUALS
public static final int LESS_THAN_EQUALS
public static final int STARTS_WITH
public static final int ENDS_WITH
public static final int CONTAINS
Method Detail |
public Filter simple(String sql)
sql
- The conditions for the filter. This is a string
that should represent part of a SQL "where" clause. Specifically,
it should normally take the form of
<column_name> <condition> <attribute bind variable>
where the "condition" is something like "=", "<", ">", or
"!=". The "bind variable" should be a colon followed by
some attribute name that will later be set with a call to
Filter.set(java.lang.String,
java.lang.Object)
It is possible to set multiple conditions with a single addFilter statement by combining the conditions with an "and" or an "or". Conditions may be grouped by using parentheses. Consecutive calls to addFilter append the filters using "and".
public Filter equals(String attribute, Object value)
attributeName
= 'value.toString()'
" unless the value is an integer
(in which case it creates "attributeName =
value.toString()") or the developer is using oracle and
the value is null. In this case, it would create
"attributeName is null
".
attribute
- The name of the attribute to bind with the valuevalue
- The value for the specified attributepublic Filter notEquals(String attribute, Object value)
attributeName
!= 'value.toString()'
" unless the value is an integer
(in which case it creates "attributeName !=
value.toString()") or the developer is using oracle and
the value is null. In this case, it would create
"attributeName is not null
".
attribute
- The name of the attribute to bind with the valuevalue
- The value for the specified attributepublic Filter lessThan(String attribute, Object value, boolean trueForAllIfValueIsNull)
attributeName
< value
" unless the developer is using oracle and
the value is null. In this case, it uses the parameter
trueForAllIfValueIsNull
to determine how to change
the query to work.
attribute
- The name of the attribute to bind with the valuevalue
- The value for the specified attributetrueForAllIfValueIsNull
- This specifies whether a value
of null should be the equivalent of 1==1 (true)
or 1==2 (false)public Filter lessThanEquals(String attribute, Object value, boolean trueForAllIfValueIsNull)
attributeName
<= value
" unless the developer is using oracle and
the value is null. In this case, it uses the parameter
trueForAllIfValueIsNull
to determine how to change
the query to work.
attribute
- The name of the attribute to bind with the valuevalue
- The value for the specified attributetrueForAllIfValueIsNull
- This specifies whether a value
of null should be the equivalent of 1==1 (true)
or 1==2 (false)public Filter greaterThan(String attribute, Object value, boolean trueForAllIfValueIsNull)
attributeName
> value
" unless the developer is using oracle and
the value is null. In this case, it uses the parameter
trueForAllIfValueIsNull
to determine how to change
the query to work.
attribute
- The name of the attribute to bind with the valuevalue
- The value for the specified attributetrueForAllIfValueIsNull
- This specifies whether a value
of null should be the equivalent of 1==1 (true)
or 1==2 (false)public Filter greaterThanEquals(String attribute, Object value, boolean trueForAllIfValueIsNull)
attributeName
>= value
" unless the developer is using oracle and
the value is null. In this case, it uses the parameter
trueForAllIfValueIsNull
to determine how to change
the query to work.
attribute
- The name of the attribute to bind with the valuevalue
- The value for the specified attributetrueForAllIfValueIsNull
- This specifies whether a value
of null should be the equivalent of 1==1 (true)
or 1==2 (false)public Filter startsWith(String attribute, String value, boolean trueForAllIfValueIsNull)
attributeName
like 'value%'
" unless the developer is using oracle and
the value is null. In this case, it uses the parameter
trueForAllIfValueIsNull
to determine how to change
the query to work.
attribute
- The name of the attribute to bind with the valuevalue
- The value for the specified attributetrueForAllIfValueIsNull
- This specifies whether a value
of null should be the equivalent of 1==1 (true)
or 1==2 (false)public Filter endsWith(String attribute, String value, boolean trueForAllIfValueIsNull)
attributeName
like '%value'
" unless the developer is using oracle and
the value is null. In this case, it uses the parameter
trueForAllIfValueIsNull
to determine how to change
the query to work.
attribute
- The name of the attribute to bind with the valuevalue
- The value for the specified attributetrueForAllIfValueIsNull
- This specifies whether a value
of null should be the equivalent of 1==1 (true)
or 1==2 (false)public Filter contains(String attribute, String value, boolean trueForAllIfValueIsNull)
attributeName
like '%value%'
" unless the developer is using oracle and
the value is null. In this case, it uses the parameter
trueForAllIfValueIsNull
to determine how to change
the query to work.
attribute
- The name of the attribute to bind with the valuevalue
- The value for the specified attributetrueForAllIfValueIsNull
- This specifies whether a value
of null should be the equivalent of 1==1 (true)
or 1==2 (false)public Filter compare(String expressionOne, int comparator, String expressionTwo)
((<expressionOne> <comparator> <expressionTwo>)
or
(<expressionOne> is [not] null
and <expressionTwo> is [not] null))
This method is useful when code needs to use PL/SQL functions
within the filter (e.g. nvl
or upper
or
lower
expressionOne
- This is the first expression for the comparrison.
One typical use for it is to pass in something
like "upper(<attribute name>)"comparator
- This is the "int" that is used to represent
how to compare the two expressions. The int
should be one of the "int"s specified by the
constants within FilterFactoryexpressionTwo
- This is the second expression. This could
be something as simple as a bind variable or
as complex as a call to a PL/SQL function.public Filter in(String propertyName, String queryName)
public Filter in(String property, String subQueryProperty, String queryName)
public Filter notIn(String propertyName, String queryName)
public CompoundFilter and()
public CompoundFilter or()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |