| Author | Daniel Fisher |
| Date | 2005/05/02 |
| Updated By | Catherine Winfrey |
| Date | 2008/07/23 |
Especially for remote access, * There exists no programmatic way to query for entitlement data in the registry. * There exists no programmatic way to query for group data in the registry. * There exists no programmatic way to query for people data in the registry. * There exists no programmatic way to query for service data in the registry. * There exists no programmatic way to query for an arbitrary data object in the registry.
Functionality to query the Registry using session beans is provided both for the specific data objects:
and for abitrary data objects. Both types of query functionality provide at least one query search that is very flexible in terms of specifying the parameter(s) for the the search. These flexible searches are implemented using a SearchCriteria from the ed package to provide the search parameters. Each data object for which a specific query session bean is provided has a corresponding specific SearchCriteria:
The query session bean for searching an arbitrary data object uses the generic DirectSearchCriteria. This DirectSearchCriteria can also be used with any of the data-object specific query session beans. All of the SearchCriteria allow limitations to be imposed on the search, including
Note that specifying the need to load all data object fields (the lazy loading requirement) can increase the time the search takes significantly.
The easiest to use searching involves the use of the session bean and its corresponding SearchCriteria for one of the specific data object beans. The steps to perform this type of search are:
SearchCriteria.SearchCriteria to provide the search data.SearchCriteria.
A setter method is provided for each supported query field. If the query field allows wildcard searching, the wildcard(s) are included using an *. The search method handles all the details for building the EJBQL query from the supplied parameter values, including use of the wildcard characters, executing the search, and returning the collection of search results. The client requesting the search does not have to know anything about:
Example - retrieve all people with last name smith whose first name starts with a:
final PersonSearchCriteria psc = new PersonSearchCriteria(); psc.setFirstName("A*"); psc.setLastName("Smith"); List<Person> results = personQuery.searchPeople(psc);
Searching using the query session bean for an arbitrary data object allows searching of Registry entities for which a specific query session bean is not available, as well as searching of fields for which setter methods are not supported as query fields in the data-object specific query session beans. The client requesting the search is responsible for providing all the details for the search, including:
This can be quite simple:
final DirectSearchCriteria criteria = new DirectSearchCriteria(); criteria.setEjbQL("SELECT t FROM Ticket t WHERE t.uuid = :uuid"); criteria.setParameter("uuid", "ticketid"); final List<Ticket> tickets = query.search(Ticket.class, criteria);
However if the query needs to join multiple Registry entities, include wildcard searching, etc. the client must know how to specify all of that in the EJBQL passed to the setEjbQL method.
The data-object specific query session beans provide additional searches that do not make use of the SearchCriteria. For example, search method(s) are provided to retrieve an entity using an exact match on a single field to return the record snapshot in DSML format. Typically the exact match is peformed using the Registry UID or the entity identifier string. Sometimes additional searches are implemented that return something other than the entity data itself, such as the group method to retrieve group members.