Service Registry 3 2005Q4 Developer's Guide

Finding Objects by External Identifier

Finding objects by external identifier is similar to finding objects by classification. You first find the classification scheme, then create an ExternalIdentifier object to be used as an argument to the BusinessQueryManagerImpl.findObjects method or another finder method.

The following code fragment finds all registry objects that contain the Sun Microsystems stock ticker symbol as an external identifier. You need to create an external classification scheme named NASDAQ for this example to work. See Adding External Identifiers to Objects for details on how to perform this task.

The collection of external identifiers is supplied as the next-to-last argument of the findObjects method.

ClassificationScheme cScheme = null;
cScheme =
     bqm.findClassificationSchemeByName(null, "NASDAQ");

ExternalIdentifier extId =
     blcm.createExternalIdentifier(cScheme, "%Sun%",
        "SUNW");
Collection extIds = new ArrayList();
extIds.add(extId);
// perform search
BulkResponse response = bqm.findObjects("RegistryObject",
     null, null, null, null, extIds, null);
Collection objects = response.getCollection();

Finding Objects by External Identifier: Example

For an example of finding objects by external identifier, see JAXRSearchByExternalIdentifier.java in the directory <INSTALL>/registry/samples/search-external-identifier/src, which searches for objects that use the NASDAQ classification scheme.

ProcedureTo Run the JAXRSearchByExternalIdentifier Example

Before You Begin

To obtain results from this example, first run the publish-object example described in Adding Classifications: Example.

Steps
  1. Go to the directory <INSTALL>/registry/samples/search-external-identifier.

  2. Type the following command:


    asant run