Skip to end of metadata
Go to start of metadata

This page is outdated. Please see Updated Query API instead.

MidPoint Query API can be used to construct queries and different filters used by search method. With current implementation it is possible to construct following filters:

  • logical filters : and, or, not
  • value filters: equals, like, in, greater, less

Logical filters

Logical filters can be simply created using factory methods. You can create and, or or not filter in the following way:

And filter:

or

where filter1, filter2 and filter3 can represent another logical or value filter. 

Or filter:

or

where filter1, filter2 and filter3 can represent another logical or value filter.

Not filter:

where filter can represent another logical or value filter.

 

Value filters

Supported value filters in midPoint are equal, like, in, greater and less. Value filters consist of:

  • fullPath – path to the property. It is required to use full property path. Examples: UserType.F_NAME – path to the name property, new ItemPath(ShadowType.F_ATTRIBUTES, attributeName.
  • itemDefinition – definition of the property (reference), e.g. user.getDefinition().findPropertyDefinition(UserType.F_NAME)
  • prismContext
  • matchingRule – matching rule to use by querying objects. Following matching rules are supported in midPoint:

    NameDescription
    PolyStringNormMatchingRulenormalized value will be used in query
    PolyStringOrigMatchingRuleoriginal value will be used in query
    PolyStringStrictMatchingRuleboth, normalized and original value will be used in query
    StringIgnoreCaseMatchingRulethe query will be constructed as case insensitive
    DefaultMatchingRuleused by default
  • values – possible values which the object's property should have. It can be null and instead of concrete value the expression may be used.
  • expression (e.g. script) – the values will be evaluated from the expression.

 

For greater and less filter there is one more property

  • isEqual - tells if the query will be represented as greaterEquals or simple greater (lessEqual or simple less).

 

Each of the filters can be also simply created using factory methods. The usage is as follows:

Equals filter

MidPoint representation for equal filter is EqualsFilter for properties and RefFilter for references. Different factory methods can be used to construct equals filter. It depends on programmer choice which factory method is the most suitable. Some examples are described bellow:

or

or

or

or

or

Like filter

Like filter can be created usig SubstringFilter class and its factory methods. Different factory methods are provided and the choise is left on the programmer. Bellow are some examples how to use midPoint's Substring filter:

or

In filter

If you need to compare property agains some collection of values, use in filter. Its representation in midpoint is InFilter.  Example usage for InFilter: 

or

 

One speciality in midPoint is InOidFilter which can be used for „multi-get“ operation. InOidFilter can be used when you want to select more than one object at the same time and you know identifier of these objects. Example usage of InOidFilter is listed bellow:

Greater filter

Factory methods in GreaterFilter class are used to construct greater filter. The example usage of these factory methods are bellow:

or

Less filter

Less filter can be simply constructed using factory methods in LessFilter class. There are similar methods like in the GreaterFilter class and the usage is almost the same. For example:

or

 

Constructing Query

After the filter is successfully created following facotry method can be used to construct query.

 

 

TODO paging

External links

 

  • No labels