Oracle® Beehive RESTful Web Services API Reference
  Release 2 (2.0.1.7)
  E16658-04
Oracle Beehive

Predicates

Predicates enable you to sort and fitter retrieved results.

Using Meta Predicates

The following example describes how to use Meta predicates, such as matchAll, matchNot, and matchAny. This example describes how to list all users with the name John Smith or Jane Smith, or where ((givenName = "John" OR givenName = "Jane") AND (familyName = "Smith")):

POST /comb/v1/d/user/list
{
"beeType":"predicateAndSortListParameters",
"predicate":{
"beeType":"matchAllPredicate",
"predicates":[
{
"beeType":"matchAnyPredicate",
"predicates":[
{
"beeType":"firstNamePredicate",
"match":"John",
},
{
"beeType":"firstNamePredicate",
"match":"Jane",
},
]
},
{
"beeType":"lastNamePredicate",
"match":"Smith",
}
]
}
}

The predicateAndSortListParameters resource enables you to specify filter criteria with an object that inherits from predicate and sort criteria of the list result with an object that inherits from sortCriteria. (Note that both predicate and sortCriteria are abstract types. They cannot directly be used; one of its subtypes must be used instead.)

Refer to "Client-Side Pagination" for an example of sorting list results with predicates.

You may use the percent sign (%) as a wild card. The following example returns all users whose first names start with "Jo" or "Ja" and last names start with "S":

POST /comb/v1/d/user/list
{
"beeType":"predicateAndSortListParameters",
"predicate":{
"beeType":"matchAllPredicate",
"predicates":[
{
"beeType":"matchAnyPredicate",
"predicates":[
{
"beeType":"firstNamePredicate",
"match":"Jo%",
},
{
"beeType":"firstNamePredicate",
"match":"Ja%",
},
]
},
{
"beeType":"lastNamePredicate",
"match":"S%",
}
]
}
}

The following example is the XML equivalent of the previous example:

<ns2:predicateAndSortListParameters xmlns:ns2="http://www.oracle.com/beehive">
<predicate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:matchAllPredicate">
<predicates xsi:type="ns2:matchAnyPredicate">
<predicates xsi:type="ns2:firstNamePredicate">
<caseSensitiveMatch>false</caseSensitiveMatch>
<match>Jo%</match>
<patternMatch>false</patternMatch>
</predicates>
<predicates xsi:type="ns2:firstNamePredicate">
<caseSensitiveMatch>false</caseSensitiveMatch>
<match>Ja%</match>
<patternMatch>false</patternMatch>
</predicates>
</predicates>
<predicates xsi:type="ns2:lastNamePredicate">
<caseSensitiveMatch>false</caseSensitiveMatch>
<match>S%</match>
<patternMatch>false</patternMatch>
</predicates>
</predicate>
</ns2:predicateAndSortListParameters>

Tip: To generate an XML representation of predicateAndSortListParameters resource, you may use JAXB. Refer to Oracle Beehive Development Kit Tutorial for information about generating Oracle Beehive RESTful Web services value objects with JAXB.


Oracle Logo
Copyright © 2008, 2011, Oracle and/or its affiliates. All rights reserved.
Legal Notices

Top