Software AG Products 10.5 | CentraSite for Developers | Application Framework | Querying the Registry | Application Framework Simple Search | Invoking the Search
 
Invoking the Search
After adding the necessary predicates and orders to the search object, the search can be executed by invoking the result() method on the search object. It returns a list of all RegistryBean objects in the registry that applied the predicate conditions in the specified order. The result is lazy loading compatible.
Here is an example of a Search lifecycle:
List searchTypes = new ArrayList();
searchTypes.add(ReviewRequestOutcome.class);
searchTypes.add(ServiceInterfaceVersion.class);
 
Search search = beanPool.createSearch(searchTypes);
 
Predicate predicate1 = Predicates.eq("ExternalLink.URI",
"http://www.softwareag.com");
Predicate predicate2 = Predicates.eq("name","somePropertyname2");
Predicate orPredicate = Predicates.or(predicate1, predicate2);
 
Search.addPredicate(orPredicate);
 
search.addOrder("name");
 
List<RegistryBean> result = (List<RegistryBean>) search.result();
This means that all ReviewRequestOutcomes and ServiceInterfaceVersions are searched and the ones that have name equal to “somePropertyname2” or ExternalLink with URI equal to “http://www.softwareag.com” is returned in the resulting List of RegistryBean objects ordered by name.