Class Filter
- All Implemented Interfaces:
Serializable,sailpoint.tools.xml.IXmlEqualable<Filter>,sailpoint.tools.xml.PersistentXmlObject
- Direct Known Subclasses:
Filter.CompositeFilter,Filter.LeafFilter
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).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBase implementation of a FilterVisitor that throws unsupported exceptions for all operations.static enumstatic classstatic classA compiler that can create a Filter from a string representation using the following grammar (note the Java-like syntax):static interfaceVisitor interface that is accepted by filters to perform various operations.static classstatic enumstatic enumAn enumeration that describes how to match strings in a 'like' filter.static enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaccept(Filter.FilterVisitor visitor) static FilterCombine the given filters with an AND conjunction.static FilterCombine the given filters with an AND conjunction.static FilterCombine the given filters with an AND conjunction.static FilterPerform a shallow copy of a filter.static FiltercollectionCondition(String collectionProperty, Filter compoundFilter) Check that the given collection (multi-valued) property has elements that match the given compoundFilter.static FilterCompile a filter from its String representation.static FiltercontainsAll(String propertyName, Collection value) Check that the given multi-valued property contains all of the given values.booleancontentEquals(Filter other) static FilterCheck that the given property is equal to the given value.booleanstatic FilterCreate a Filter from an example object.static FilterCheck that the given property is greater than or equal to the given value.abstract StringgetExpression(boolean readable) static FilterCheck that the given property is greater than the given value.inthashCode()static FilterignoreCase(Filter filter) Apply case-insensitivity to the given filter.static Filterin(String propertyName, Collection<?> value) Check that the given single-valued property has a value within the given set of values.static FilterCheck that the given multi-valued property is empty.static FilterCheck that the given property is null.static FilterJoin the given property to the requested fully-qualified join property.static FilterCheck that the given property is less than or equal to the given value.static FilterCheck that the given string property contains the given value as a substring.static Filterlike(String propertyName, Object value, Filter.MatchMode matchMode) Check that the given string property contains the given value according to the given match mode.static FilterCheck that the given property is less than the given value.static FilterCheck that the given property is not equal to the given value.static FilterNegate the given filter.static FilterCheck that the given property is not null.static FilterCombine the given filters with an OR conjunction.static FilterCombine the given filters with an OR conjunction.static FilterCombine the given filters with an OR conjunction.voidsetValueEscapeStyle(Filter.ValueEscapeStyle valueEscapeStyle) static FilterPerform a subquery where the given property on the current class is found in a subquery over the given subquery class/property/filter.Methods inherited from class sailpoint.tools.xml.AbstractXmlObject
deepCopy, getOriginalXml, parseXml, parseXml, parseXml, setOriginalXml, toXml, toXml, toXml, writeXml
-
Constructor Details
-
Filter
public Filter()
-
-
Method Details
-
clone
Perform a shallow copy of a filter. Here "shallow" means that the structure of the filter is cloned, but not the values used in the leaf filters. This is intended for use by query optimizers that might need to change the structure of the filter as well as do name mapping, but do not need to touch the values. Some values used in filters are not currently XML serializable but even if it were, cloning the values to do query optimization is expensive and best avoided. -
compile
Compile a filter from its String representation.- Parameters:
filter- The filter string.- Returns:
- The Filter that is compiled from the given string.
- Throws:
sailpoint.tools.Parser.ParseException- If the format of the filter is incorrect.- See Also:
-
fromExample
Create a Filter from an example object. This will return an AND filter that compares equality for each non-null property on the given object. Null is returned if the given object does not have any non-null properties.- Parameters:
o- The object for which to create the Filter.- Returns:
- An AND filter that compares equality for each non-null property on the given object. Null is returned if the given object does not have any non-null properties.
- Throws:
sailpoint.tools.GeneralException- If there is a problem reading the properties from the given object.
-
eq
Check that the given property is equal to the given value.- Throws:
IllegalArgumentException
-
ne
Check that the given property is not equal to the given value.- Throws:
IllegalArgumentException
-
lt
Check that the given property is less than the given value.- Throws:
IllegalArgumentException
-
gt
Check that the given property is greater than the given value.- Throws:
IllegalArgumentException
-
le
Check that the given property is less than or equal to the given value.- Throws:
IllegalArgumentException
-
ge
Check that the given property is greater than or equal to the given value.- Throws:
IllegalArgumentException
-
in
Check that the given single-valued property has a value within the given set of values.- Throws:
IllegalArgumentException
-
containsAll
Check that the given multi-valued property contains all of the given values. -
like
Check that the given string property contains the given value as a substring. -
like
Check that the given string property contains the given value according to the given match mode. -
notnull
Check that the given property is not null. -
isnull
Check that the given property is null. -
isempty
Check that the given multi-valued property is empty. -
join
Join the given property to the requested fully-qualified join property. As an example, if you are filtering Cars based on engine size but do not have a direct reference to the engine, the filter might look like this:Filter engineJoin = Filter.join("car.engineModel", "Engine.model"); Filter engineSize = Filter.gt("Engine.size", 289); Filter engineCheck = Filter.and(engineJoin, engineSize);- Parameters:
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".
-
collectionCondition
Check that the given collection (multi-valued) property has elements that match the given compoundFilter. The property names in the compound filter should be rooted from the collectionProperty.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));- Parameters:
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.- Returns:
- A Filter that checks that the given collection property has elements that match the given compoundFilter.
- Throws:
IllegalArgumentException- If the compoundFilter is not an AND or OR.
-
subquery
public static Filter subquery(String property, Class<?> subqueryClass, 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. For example, if you want to find all Identities that have risky roles named after them, you would do the following: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.- Parameters:
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.- Returns:
- A subquery filter.
-
and
Combine the given filters with an AND conjunction. -
and
Combine the given filters with an AND conjunction. -
and
Combine the given filters with an AND conjunction. -
or
Combine the given filters with an OR conjunction. -
or
Combine the given filters with an OR conjunction. -
or
Combine the given filters with an OR conjunction. -
not
Negate the given filter. -
ignoreCase
Apply case-insensitivity to the given filter. -
getValueEscapeStyle
-
setValueEscapeStyle
-
accept
- Throws:
sailpoint.tools.GeneralException
-
getExpression
-
getExpression
- Parameters:
readable- Specify expression for machine for human readable language- Returns:
- String expression
-
equals
-
contentEquals
- Specified by:
contentEqualsin interfacesailpoint.tools.xml.IXmlEqualable<Filter>
-
hashCode
public int hashCode()
-