To find all objects of a specified type, specify only the first argument of the BusinessQueryManagerImpl.findObjects method and, optionally, a collection of FindQualifier objects. For example, if typeString is a string whose value is LifeCycleManager.SERVICE, the following code fragment finds all services in the Registry and sorts them in alphabetical order.
Collection findQualifiers = new ArrayList(); findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC); BulkResponse response = bqm.findObjects(typeString, findQualifiers, null, null, null, null, null);
You cannot use wildcards in the first argument to findObjects.
For an example of finding objects by type, see JAXRSearchByObjectType.java in the directory install/registry-samples/search-object-type/src.
Go to the directory install/registry-samples/search-object-type.
Type the following command, specifying a string value:
Ant-base/ant run -Dtype=type-name |
Specify the exact name of the type, not a wildcard, as in the following command line:
Ant-base/ant run -Dtype=federation |
The JAXRSearchByObjectType program passes the object type as a string argument to QueryManager.findObjects in order to accept user input as simply as possible. However, developers should use the constants defined by the LifeCycleManager interface.
The program performs a case-insensitive search, returning all objects whose type is type-name and displaying their names, descriptions, and unique identifiers. At the end, it displays the number of objects found.
For example, if you specify the argument federation, the output of the run target looks something like this:
run: [java] Type requested is federation [java] Query URL is http://localhost:6480/soar/registry/soap [java] Created connection to registry [java] Got registry service and query manager [java] Searching for objects of type federation [java] Object type is Federation [java] Object name: freebXMLRegistryFederation [java] Object description: freebXML Registry Federation [java] Object identifier: urn:uuid:cb5039c1-85b2-4512-839a-893cb882c981 [java] --- [java] Total: 1 object(s) |