try
{
// Get registry service and business query manager
RegistryService rs = connection.getRegistryService();
BusinessQueryManager bqm = rs.getBusinessQueryManager();
System.out.println("We have the Business Query Manager");
// Define find qualifiers and name patterns
Collection findQualifiers = new ArrayList();
findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
Collection namePatterns = new ArrayList();
namePatterns.add("%" + queryString + "%");
// Find based upon qualifier type and values
System.out.println("\n-- searching the registry --\n");
BulkResponse response =
bqm.findOrganizations(findQualifiers,
namePatterns,
null,
null,
null,
null);