GetBusinessDetailExt request = (GetBusinessDetailExt)regObject;
String generic = request.getGeneric();
Vector businessKeyVector = request.getBusinessKeyVector();
// aquire a jUDDI datastore instance
DataStore dataStore = DataStoreFactory.getDataStore();
try
{
dataStore.beginTrans();
// verify
for (int i=0; i<businessKeyVector.size(); i++)
{
String businessKey = (String)businessKeyVector.elementAt(i);
// If the a BusinessEntity doesn't exist hrow an InvalidKeyPassedException.
if ((businessKey == null) || (businessKey.length() == 0) ||
(!dataStore.isValidBusinessKey(businessKey)))
throw new InvalidKeyPassedException(businessKey);
}
Vector businessEntityExtVector = new Vector();
for (int i=0; i<businessKeyVector.size(); i++)
{
String businessKey = (String)businessKeyVector.elementAt(i);
BusinessEntity business = dataStore.fetchBusiness(businessKey);
BusinessEntityExt businessExt = new BusinessEntityExt(business);
businessEntityExtVector.addElement(businessExt);
}
dataStore.commit();
// create a new BusinessDetailExt and stuff the Vector of
// new BusinessEntityExt instances into it.
BusinessDetailExt detailExt = new BusinessDetailExt();
detailExt.setGeneric(generic);
detailExt.setOperator(Config.getOperator());
detailExt.setBusinessEntityExtVector(businessEntityExtVector);
return detailExt;
}
catch(InvalidKeyPassedException keyex)
{
try { dataStore.rollback(); } catch(Exception e) { }
log.info(keyex.getMessage());
throw (RegistryException)keyex;
}
catch(RegistryException regex)
{
try { dataStore.rollback(); } catch(Exception e) { }
log.error(regex);
throw (RegistryException)regex;
}
catch(Exception ex)
{
try { dataStore.rollback(); } catch(Exception e) { }
log.error(ex);
throw new RegistryException(ex);
}
finally
{
if (dataStore != null)
dataStore.release();
}
}