ConnectionImpl con = ((RegistryServiceImpl)getRegistryService()).getConnection();
AuthToken auth = this.getAuthToken(con,registry);
LinkedHashSet<Organization> orgs = null;
try
{
RegisteredInfo ri = null;
try {
ri = registry.getRegisteredInfo(auth.getAuthInfo());
} catch (RegistryException rve) {
String username = getUsernameFromCredentials(con.getCredentials());
if (AuthTokenSingleton.getToken(username) != null) {
AuthTokenSingleton.deleteAuthToken(username);
}
auth = getAuthToken(con, registry);
ri = registry.getRegisteredInfo(auth.getAuthInfo());
}
if (ri != null && ri.getBusinessInfos()!=null) {
List<BusinessInfo> bizInfoList = ri.getBusinessInfos().getBusinessInfo();
orgs = new LinkedHashSet<Organization>();
for (BusinessInfo businessInfo : bizInfoList) {
BusinessDetail detail = registry.getBusinessDetail(businessInfo.getBusinessKey());
orgs.add(((BusinessLifeCycleManagerImpl)registryService.getLifeCycleManagerImpl()).createOrganization(detail));
}