{
RegistryService rs = connection.getRegistryService();
BusinessQueryManager bqm = rs.getBusinessQueryManager();
blm = rs.getBusinessLifeCycleManager();
Concept concept = blm.createConcept(null, CONCEPT_NAME, "");
InternationalString is = blm.createInternationalString("This is the concept for Apache Scout Test");
concept.setDescription(is);
//Lets provide a link to juddi registry
ExternalLink wslink =
blm.createExternalLink("http://to-rhaps4.toronto.redhat.com:9000/juddi",
"juddi");
concept.addExternalLink(wslink);
Classification cl = createClassificationForUDDI(bqm);
concept.addClassification(cl);
Collection<Concept> concepts = new ArrayList<Concept>();
concepts.add(concept);
Key key=null;
BulkResponse br = blm.saveConcepts(concepts);
if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
{
System.out.println("Concept Saved");
Collection coll = br.getCollection();
Iterator iter = coll.iterator();
while (iter.hasNext())
{
key = (Key) iter.next();
System.out.println("Saved Key=" + key.getId());
}//end while
} else
{
System.err.println("JAXRExceptions " +
"occurred during save:");
Collection exceptions = br.getExceptions();
Iterator iter = exceptions.iterator();
while (iter.hasNext())
{
Exception e = (Exception) iter.next();
System.err.println(e.toString());
fail(e.toString());
}
}
Concept savedConcept = (Concept)bqm.getRegistryObject(key.getId(),LifeCycleManager.CONCEPT);
System.out.println("Save concept=" + savedConcept);
} catch (JAXRException e)
{
e.printStackTrace();