{
RegistryService rs = connection.getRegistryService();
BusinessQueryManager bqm = rs.getBusinessQueryManager();
blm = rs.getBusinessLifeCycleManager();
Printer printer = new Printer();
Remover remover = new Remover(blm);
Collection<String> findQualifiers = new ArrayList<String>();
findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
Collection<String> namePatterns = new ArrayList<String>();
namePatterns.add("%" + CONCEPT_NAME + "%");
BulkResponse br = bqm.findConcepts(findQualifiers, namePatterns, null, null, null);
// check how many organisation we have matched
Collection concepts = br.getCollection();
if (concepts == null)
{
System.out.println("\n-- Matched 0 orgs");
} else
{
System.out.println("\n-- Matched " + concepts.size() + " concepts --\n");
// then step through them
for (Iterator conceptIter = concepts.iterator(); conceptIter.hasNext();)
{
Concept c = (Concept) conceptIter.next();
System.out.println("Id: " + c.getKey().getId());
System.out.println("Name: " + c.getName().getValue());
// Links are not yet implemented in scout -- so concepts
// created via scout won't have links
printer.printExternalLinks(c);
// Print spacer between messages
System.out.println(" --- ");
remover.removeConcept(c);
System.out.println(" === ");
}
}//end else
} catch (JAXRException e)