*
*/
public BusinessEntity fetchBusiness(String businessKey)
throws org.apache.juddi.error.RegistryException
{
BusinessEntity business = null;
try
{
if ((businessKey != null) && (connection != null))
{
business = BusinessEntityTable.select(businessKey,connection);
business.setNameVector(BusinessNameTable.select(businessKey,connection));
business.setDescriptionVector(BusinessDescTable.select(businessKey,connection));
Vector idVector = BusinessIdentifierTable.select(businessKey,connection);
if (idVector.size() > 0)
{
IdentifierBag identifierBag = new IdentifierBag();
identifierBag.setKeyedReferenceVector(idVector);
business.setIdentifierBag(identifierBag);
}
Vector catVector = BusinessCategoryTable.select(businessKey,connection);
if (catVector.size() > 0)
{
CategoryBag categoryBag = new CategoryBag();
categoryBag.setKeyedReferenceVector(catVector);
business.setCategoryBag(categoryBag);
}
DiscoveryURLs discoveryURLs = new DiscoveryURLs();
discoveryURLs.setDiscoveryURLVector(DiscoveryURLTable.select(businessKey,connection));
business.setDiscoveryURLs(discoveryURLs);
// 'select' the BusinessEntity's Contact objects
Vector contactList = ContactTable.select(businessKey,connection);
for (int contactID=0; contactID<contactList.size(); contactID++)
{
Contact contact = (Contact)contactList.elementAt(contactID);
contact.setPhoneVector(PhoneTable.select(businessKey,contactID,connection));
contact.setEmailVector(EmailTable.select(businessKey,contactID,connection));
Vector addressList = AddressTable.select(businessKey,contactID,connection);
for (int addressID=0; addressID<addressList.size(); addressID++)
{
Address address = (Address)addressList.elementAt(addressID);
address.setAddressLineVector(AddressLineTable.select(businessKey,contactID,addressID,connection));
}
contact.setAddressVector(addressList);
}
Contacts contacts = new Contacts();
contacts.setContactVector(contactList);
business.setContacts(contacts);
// 'fetch' the BusinessEntity's BusinessService objects
Vector serviceVector = fetchServiceByBusinessKey(businessKey);
BusinessServices services = new BusinessServices();
services.setBusinessServiceVector(serviceVector);
business.setBusinessServices(services);
}
}
catch(java.sql.SQLException sqlex)
{
throw new RegistryException(sqlex);