This document describes specification of filter strings and Filter objects. Filters restrict the results of queries or constrain system actions to sets of objects that meet the filter criteria. the article show the basic features, for wider view on subject and queryObject see link : Filters and Filter Strings - Compass (sailpoint.com)


example:

Basic Operators

 

Object attributes can be evaluated against a specified value (or another field) using the basic equality/inequality operators, expressed like Java equality/inequality statements:

 

OperationOperator SymbolExample
Equal==department == "Accounting"
Not equal!=region != "Europe"
Less than<scorecard.compositeScore < 300
Greater than>scorecard.compositeScore > 900
Less than or equal to<=tenure <= 10
Greater than or equal to>=tenure >= 1

 


Operator MethodDescriptionExample
eq ()Checks that the given property is equal to the given valueFilter.eq("name", myName)
ne()Checks that the given property is not equal to the given valueFilter.ne("owner", myIdentity)
lt(), le()Checks that the given property is less than / less than or equal to the given valueFilter.lt("scorecard.compositeScore", maxRiskThreshold)
gt(), ge()Checks that the given property is greater than / greater than or equal to the given valueFilter.ge("scorecard.compositeScore", riskTolerance)

like(propertyName, value)

or

like(propertyName, value, matchMode)

Checks that the given property contains the value as a substring; location in the string is restricted by matchMode if provided.

 

Possible matchModes are START, END, EXACT (equivalent to equals), and ANYWHERE (default if omitted)

Filter.like("region", "America")

 

Filter.like("application.name", "Enterprise", Filter.MatchMode.START)

 


Adding a Filter to QueryOptions

 

Filters can be added to QueryOptions through its addFilter() method.

 

QueryOptions ops = new QueryOptions();

ops.addFilter(Filter.eq("application.name", myApp));

 

The filter can be built as it is added to the QueryOptions object, as shown above, or it can be built first and added after it is complete.

 

Filter myFilter = Filter.and(Filter.eq("application.name", myApp),

Filter.eq("referenceAttribute", myRefAttr));

QueryOptions ops = new QueryOptions();

ops.addFilter(myFilter);

 

When multiple separate filters are added to one QueryOptions object, they are “anded” together when the query runs.

 

QueryOptions qo = new QueryOptions();

qo.addFilter(Filter.eq("application.name", myApp));

qo.addFilter(Filter.eq("referenceAttribute", myRefAttr));

 

Custom Java code can use the QueryOptions constructor or its add() method to add one or more filters. Rules cannot use these because beanshell cannot process variable arguments.

 

QueryOptions ops = new QueryOptions(Filter.eq("application.name", myApp));

 

or

 

QueryOptions qo = new QueryOptions();

qo.add(Filter.eq("application.name", myApp), Filter.eq("referenceAttribute", myRefAttr));

 

Multiple filters can be added at one time to a QueryOptions object in beanshell by building a list of filters and using the setFilters() method. This replaces any existing filters in the QueryOptions object.

 

List filters = new ArrayList();

filters.add(Filter.eq("application.name", myApp));

filters.add(Filter.eq("referenceAttribute", myRefAttr));

QueryOptions qo = new QueryOptions();

qo.setFilters(filters);