Oracle Waveset 8.1.1 Web Services

Search Capability

Waveset supports the Search capabilities described in the following table.

Table 2–8 Search Capabilities

Capability 

Description 

OperationalAttributes

SearchRequest

Returns as many users as it can find that match the specified criteria within the allotted amount of time. If additional users exist, the request also returns a handle that can be used within an IterateRequest.

None 

IterateRequest

Continues an existing incomplete SearchRequest or IterateRequest.

None 

CloseIteratorRequest

Ends an IterateRequest. You may terminate an IterateRequest before it terminates.

None 

Search Filter Configuration

The DSML search filter is translated to a set of repository attribute conditions. A necessary part of the translation involves mapping the external DSML attribute name to a queryable repository attribute. A set of attribute mappings for each searchable type must be defined in the configuration.

The filter is analyzed and processed according to one of the following categories:

The SPML2 configuration object contains the following properties

The following capabilities are not supported:

Search Examples

The following examples illustrate how to perform searches.


Example 2–17 SearchRequest Example

ArrayList<PSO> psos = new ArrayList<PSO>();

SessionAwareSpml2Client client = new SessionAwareSpml2Client("http://example.com:8080
/idm/servlet/openspml2");
ListTargetsResponse loginInfo = client.login("Configurator", "configurator");

SearchRequest searchReq = new SearchRequest();
EqualityMatch acctIdTerm = new EqualityMatch("firstname", new DSMLValue("Marcus"));
Present emailTerm = new Present("emailAddress");
org.openspml.v2.profiles.dsml.And terms = new 
    org.openspml.v2.profiles.dsml.And(new FilterItem[] { acctIdTerm, emailTerm });
Filter filter = new Filter(terms);
Query q = new Query();
q.setScope(Scope.ONELEVEL);
q.addQueryClause(filter);

searchReq.setQuery(q);
searchReq.setReturnData(ReturnData.IDENTIFIER);
searchReq.setExecutionMode(ExecutionMode.SYNCHRONOUS);

SearchResponse searchRes = (SearchResponse) client.request(searchReq);
if (searchRes.getStatus().equals(StatusCode.SUCCESS)) {
    System.out.println("Received search response.");
    for (PSO pso : searchRes.getPSOs()) {
        psos.add(pso);
    }
    
    ResultsIterator iterator = searchRes.getIterator();

    while (iterator != null) {
        IterateRequest iterReq = new IterateRequest();
        iterReq.setIterator(iterator);
        iterReq.setExecutionMode(ExecutionMode.SYNCHRONOUS);
        IterateResponse iterRes = (IterateResponse) client.request(iterReq);
        if (iterRes.getStatus().equals(StatusCode.SUCCESS)) {
            System.out.println("Found an iterator.");
        }
        for (PSO pso : iterRes.getPSOs()) {
            psos.add(pso);
        }
        iterator = iterRes.getIterator();
    }
}


Example 2–18 CloseIterator Example

// Close iterator example
ArrayList<PSO> psos = new ArrayList<PSO>();

SessionAwareSpml2Client client = new 
SessionAwareSpml2Client("http://example.com:8080/idm/servlet/openspml2");
ListTargetsResponse loginInfo = client.login("Configurator", "configurator");

SearchRequest searchReq = new SearchRequest();

Present term = new Present("emailAddress");
Filter filter = new Filter(term);
Query q = new Query();
q.setScope(Scope.ONELEVEL);
q.addQueryClause(filter);

searchReq.setQuery(q);
searchReq.setReturnData(ReturnData.EVERYTHING);
searchReq.setExecutionMode(ExecutionMode.SYNCHRONOUS);

SearchResponse searchRes = (SearchResponse) client.request(searchReq);
if (searchRes.getStatus().equals(StatusCode.SUCCESS)) {
    System.out.println("Received search response.");
    for (PSO pso : searchRes.getPSOs()) {
        psos.add(pso);
    }
    
    ResultsIterator iterator = searchRes.getIterator();

    while (iterator != null) {
        IterateRequest iterReq = new IterateRequest();
        iterReq.setIterator(iterator);
        iterReq.setExecutionMode(ExecutionMode.SYNCHRONOUS);
        IterateResponse iterRes = (IterateResponse) client.request(iterReq);
        if (iterRes.getStatus().equals(StatusCode.SUCCESS)) {
            System.out.println("Found an iterator.");
        }
        for (PSO pso : iterRes.getPSOs()) {
            psos.add(pso);
        }
        iterator = iterRes.getIterator();
        
        // For this example, always close the iterator
        if (true) {
            CloseIteratorRequest closeIterReq = new CloseIteratorRequest();
            closeIterReq.setIterator(iterator);
            closeIterReq.setExecutionMode(ExecutionMode.SYNCHRONOUS);
            CloseIteratorResponse closeIterRes = (CloseIteratorResponse) 
                client.request(closeIterReq);
            if (closeIterRes.getStatus().equals(StatusCode.SUCCESS)) {
                System.out.println("Closed iterator.");
                break;
            }
        }
    }
}