background image

Removing Data from the Registry

<< response.getExceptions() Method | Using Taxonomies in JAXR Clients >>
<< response.getExceptions() Method | Using Taxonomies in JAXR Clients >>
M
ANAGING
R
EGISTRY
D
ATA
193
Classification (page 183), except that you also create a collection of name pat-
terns and include that in your search. Here is an example:
// Define name pattern
Collection namePatterns = new ArrayList();
namePatterns.add("HelloConcept");
BulkResponse br = bqm.findConcepts(null, namePatterns,
classifications, null, null);
Removing Data from the Registry
A registry allows you to remove from it any data that you have submitted to it.
You use the key returned by the registry as an argument to one of the
Business-
LifeCycleManager
delete methods:
deleteOrganizations
,
deleteServices
,
deleteServiceBindings
,
deleteConcepts
, and others.
The
JAXRDelete
sample program deletes the organization created by the
JAXR-
Publish
program. It deletes the organization that corresponds to a specified key
string and then displays the key again so that the user can confirm that it has
deleted the correct one.
String id = key.getId();
System.out.println("Deleting organization with id " + id);
Collection<Key> keys = new ArrayList<Key>();
keys.add(key);
BulkResponse response = blcm.deleteOrganizations(keys);
Collection exceptions = response.getException();
if (exceptions == null) {
System.out.println("Organization deleted");
Collection retKeys = response.getCollection();
Iterator keyIter = retKeys.iterator();
Key orgKey = null;
if (keyIter.hasNext()) {
orgKey = (Key) keyIter.next();
id = orgKey.getId();
System.out.println("Organization key was " + id);
}
}
A client can use a similar mechanism to delete concepts, services, and service
bindings.