public abstract class Filter extends sailpoint.tools.xml.AbstractXmlObject implements java.io.Serializable, sailpoint.tools.xml.IXmlEqualable<Filter>
Filter.toExpression()
can be fed back into
Filter.compile(String)
to reconstruct a filter.
The inner classes are public, but are typically only used in an SPI to convert Filters into consumer-specific queries (for example - an LDAP filter string).
Modifier and Type | Class and Description |
---|---|
static class |
Filter.BaseFilterVisitor
Base implementation of a FilterVisitor that throws unsupported exceptions
for all operations.
|
static class |
Filter.BooleanOperation |
static class |
Filter.CompositeFilter |
static class |
Filter.FilterCompiler
A compiler that can create a Filter from a string representation using the
following grammar (note the Java-like syntax):
|
static interface |
Filter.FilterVisitor
Visitor interface that is accepted by filters to perform various
operations.
|
static class |
Filter.LeafFilter |
static class |
Filter.LogicalOperation |
static class |
Filter.MatchMode
An enumeration that describes how to match strings in a 'like' filter.
|
static class |
Filter.ValueEscapeStyle |
Constructor and Description |
---|
Filter() |
Modifier and Type | Method and Description |
---|---|
abstract void |
accept(Filter.FilterVisitor visitor) |
static Filter |
and(Filter... children)
Combine the given filters with an AND conjunction.
|
static Filter |
and(Filter filter1,
Filter filter2)
Combine the given filters with an AND conjunction.
|
static Filter |
and(java.util.List<Filter> children)
Combine the given filters with an AND conjunction.
|
static Filter |
clone(Filter src)
Perform a shallow copy of a filter.
|
static Filter |
collectionCondition(java.lang.String collectionProperty,
Filter compoundFilter)
Check that the given collection (multi-valued) property has elements that
match the given compoundFilter.
|
static Filter |
compile(java.lang.String filter)
Compile a filter from its String representation.
|
static Filter |
containsAll(java.lang.String propertyName,
java.util.Collection value)
Check that the given multi-valued property contains all of the given
values.
|
boolean |
contentEquals(Filter other) |
static Filter |
eq(java.lang.String propertyName,
java.lang.Object value)
Check that the given property is equal to the given value.
|
boolean |
equals(java.lang.Object o) |
static Filter |
fromExample(java.lang.Object o)
Create a Filter from an example object.
|
static Filter |
ge(java.lang.String propertyName,
java.lang.Object value)
Check that the given property is greater than or equal to the given value.
|
abstract java.lang.String |
getExpression() |
java.lang.String |
getExpression(boolean readable) |
Filter.ValueEscapeStyle |
getValueEscapeStyle() |
static Filter |
gt(java.lang.String propertyName,
java.lang.Object value)
Check that the given property is greater than the given value.
|
int |
hashCode() |
static Filter |
ignoreCase(Filter filter)
Apply case-insensitivity to the given filter.
|
static Filter |
in(java.lang.String propertyName,
java.util.Collection<?> value)
Check that the given single-valued property has a value within the given
set of values.
|
static Filter |
isempty(java.lang.String propertyName)
Check that the given multi-valued property is empty.
|
static Filter |
isnull(java.lang.String propertyName)
Check that the given property is null.
|
static Filter |
join(java.lang.String property,
java.lang.String joinProperty)
Join the given property to the requested fully-qualified join property.
|
static Filter |
le(java.lang.String propertyName,
java.lang.Object value)
Check that the given property is less than or equal to the given value.
|
static Filter |
like(java.lang.String propertyName,
java.lang.Object value)
Check that the given string property contains the given value as a
substring.
|
static Filter |
like(java.lang.String propertyName,
java.lang.Object value,
Filter.MatchMode matchMode)
Check that the given string property contains the given value according
to the given match mode.
|
static Filter |
lt(java.lang.String propertyName,
java.lang.Object value)
Check that the given property is less than the given value.
|
static Filter |
ne(java.lang.String propertyName,
java.lang.Object value)
Check that the given property is not equal to the given value.
|
static Filter |
not(Filter filter)
Negate the given filter.
|
static Filter |
notnull(java.lang.String propertyName)
Check that the given property is not null.
|
static Filter |
or(Filter... children)
Combine the given filters with an OR conjunction.
|
static Filter |
or(Filter filter1,
Filter filter2)
Combine the given filters with an OR conjunction.
|
static Filter |
or(java.util.List<Filter> children)
Combine the given filters with an OR conjunction.
|
void |
setValueEscapeStyle(Filter.ValueEscapeStyle valueEscapeStyle) |
static Filter |
subquery(java.lang.String property,
java.lang.Class<?> subqueryClass,
java.lang.String subqueryProperty,
Filter subqueryFilter)
Perform a subquery where the given property on the current class is found
in a subquery over the given subquery class/property/filter.
|
public static Filter clone(Filter src)
public static Filter compile(java.lang.String filter) throws sailpoint.tools.Parser.ParseException
filter
- The filter string.Parser.ParseException
- If the format of the filter is incorrect.Filter.FilterCompiler
public static Filter fromExample(java.lang.Object o) throws sailpoint.tools.GeneralException
o
- The object for which to create the Filter.sailpoint.tools.GeneralException
- If there is a problem reading the properties
from the given object.public static Filter eq(java.lang.String propertyName, java.lang.Object value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static Filter ne(java.lang.String propertyName, java.lang.Object value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static Filter lt(java.lang.String propertyName, java.lang.Object value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static Filter gt(java.lang.String propertyName, java.lang.Object value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static Filter le(java.lang.String propertyName, java.lang.Object value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static Filter ge(java.lang.String propertyName, java.lang.Object value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static Filter in(java.lang.String propertyName, java.util.Collection<?> value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static Filter containsAll(java.lang.String propertyName, java.util.Collection value)
public static Filter like(java.lang.String propertyName, java.lang.Object value)
public static Filter like(java.lang.String propertyName, java.lang.Object value, Filter.MatchMode matchMode)
public static Filter notnull(java.lang.String propertyName)
public static Filter isnull(java.lang.String propertyName)
public static Filter isempty(java.lang.String propertyName)
public static Filter join(java.lang.String property, java.lang.String joinProperty)
Filter engineJoin = Filter.join("car.engineModel", "Engine.model");
Filter engineSize = Filter.gt("Engine.size", 289);
Filter engineCheck = Filter.and(engineJoin, engineSize);
property
- The property on entity being filter to join through.
For example, "identity".joinProperty
- The fully-qualified property name to join to. For
example, "Identity.name".public static Filter collectionCondition(java.lang.String collectionProperty, Filter compoundFilter)
Example 1: Check to see if a Car's front doors both have power locks.
// Note that these properties assume that they are rooted at the "doors"
// property rather than the Car.
Filter driverSide =
Filter.and(Filter.eq("position", "frontDriver"),
Filter.eq("powerLock", true));
Filter passengerSide =
Filter.and(Filter.eq("position", "frontPassenger"),
Filter.eq("powerLock", true));
Filter.collectionCondition("doors", Filter.and(driverSide, passengerSide));
Example 2: Check to see if either of a Car's front doors have power locks.
// Note that these properties assume that they are rooted at the "doors"
// property rather than the Car.
Filter driverSide =
Filter.and(Filter.eq("position", "frontDriver"),
Filter.eq("powerLock", true));
Filter passengerSide =
Filter.and(Filter.eq("position", "frontPassenger"),
Filter.eq("powerLock", true));
Filter.collectionCondition("doors", Filter.or(driverSide, passengerSide));
collectionProperty
- The collection (multi-valued) property to
check the elements on.compoundFilter
- The composite filter (for example - AND or OR) that
will filter the elements.java.lang.IllegalArgumentException
- If the compoundFilter is not an AND or OR.public static Filter subquery(java.lang.String property, java.lang.Class<?> subqueryClass, java.lang.String subqueryProperty, Filter subqueryFilter)
Filter.subquery("firstname", Bundle.class, "name", Filter.gt("riskScoreWeight", 500));
This turns into a query looking for Identities with a first name in the
result set of role names with risk scores greater than 500. In pseudo
SQL, this would look like:
select * from Identity where firstname in (select name from Bundle where riskScoreWeight > 500)Note that a similar effect can be achieved by using Filter.join(), but this allows performing multiple subqueries on the same table, whereas a joined table can only be joined once.
property
- The property on the query class to compared in
against the results of the subquery.subqueryClass
- The class to query over in the subquery.subqueryProperty
- The property on the subquery class to compare
against.subqueryFilter
- The possibly-null filter to apply to the
subquery.public static Filter and(Filter filter1, Filter filter2)
public static Filter and(java.util.List<Filter> children)
public static Filter or(Filter filter1, Filter filter2)
public static Filter or(java.util.List<Filter> children)
public static Filter ignoreCase(Filter filter)
public Filter.ValueEscapeStyle getValueEscapeStyle()
public void setValueEscapeStyle(Filter.ValueEscapeStyle valueEscapeStyle)
public abstract void accept(Filter.FilterVisitor visitor) throws sailpoint.tools.GeneralException
sailpoint.tools.GeneralException
public abstract java.lang.String getExpression()
public java.lang.String getExpression(boolean readable)
readable
- Specify expression for machine for human readable languagepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean contentEquals(Filter other)
contentEquals
in interface sailpoint.tools.xml.IXmlEqualable<Filter>
public int hashCode()
hashCode
in class java.lang.Object