Package org.uddi.api_v3

Examples of org.uddi.api_v3.BusinessEntity


  /**
   * Copies the BusinessInformation from one UDDI to another UDDI. Note that no services are being
   * copied over by this service. Use xRegisterService to copy over services.
   */
  public void xRegisterBusiness() {
    BusinessEntity businessEntity;
    try {
      businessEntity = fromClerk.findBusiness(entityKey,fromClerk.getUDDINode().getApiNode());
      log.info("xregister business " + businessEntity.getName().get(0).getValue() + " + from "
          + fromClerk.getName() + " to " + toClerk.getName() + ".");
      //not bringing over the services. They need to be explicitly copied using xRegisterService.
      businessEntity.setBusinessServices(null);
      toClerk.register(businessEntity,toClerk.getUDDINode().getApiNode());
    } catch (Exception e) {
      log.error("Could not " + toString() + ". " + e.getMessage() + " " + e.getCause(),e);
    }
  }
View Full Code Here


 
  /**
   * Copies the BusinessInformation from one UDDI to another UDDI.
   */
  public void xRegisterBusinessAndServices() {
    BusinessEntity businessEntity;
    try {
      businessEntity = fromClerk.findBusiness(entityKey,fromClerk.getUDDINode().getApiNode());
      log.info("xregister business " + businessEntity.getName().get(0).getValue() + " + from "
          + fromClerk.getName() + " to " + toClerk.getName() + " including all services owned by this business.");
      toClerk.register(businessEntity,toClerk.getUDDINode().getApiNode());
    } catch (Exception e) {
      log.error("Could not " + toString() + ". " + e.getMessage() + " " + e.getCause(),e);
    }
View Full Code Here

      List<BusinessInfo> biList = bInfos.getBusinessInfo();
      if (biList == null || biList.size() == 0)
        Assert.fail("No result from find business operation");
      BusinessInfo biOut = biList.get(0);
     
      BusinessEntity beIn = (BusinessEntity)EntityCreator.buildFromDoc(TckBusiness.JOE_BUSINESS_XML, "org.uddi.api_v3");
     
      assertEquals(beIn.getBusinessKey(), biOut.getBusinessKey());
     
      TckValidator.checkNames(beIn.getName(), biOut.getName());
      TckValidator.checkDescriptions(beIn.getDescription(), biOut.getDescription());
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
    }
View Full Code Here

      if (busDetail == null)
        Assert.fail("No result from getSubscriptionResults operation");
      List<BusinessEntity> beList = busDetail.getBusinessEntity();
      if (beList == null || beList.size() == 0)
        Assert.fail("No result from getSubscriptionResults operation");
      BusinessEntity beOut = beList.get(0);
     
      BusinessEntity beIn = (BusinessEntity)EntityCreator.buildFromDoc(TckBusiness.SAM_BUSINESS_XML, "org.uddi.api_v3");

      assertEquals(beIn.getBusinessKey(), beOut.getBusinessKey());
     
      TckValidator.checkNames(beIn.getName(), beOut.getName());
      TckValidator.checkDescriptions(beIn.getDescription(), beOut.getDescription());
      TckValidator.checkDiscoveryUrls(beIn.getDiscoveryURLs(), beOut.getDiscoveryURLs());
      TckValidator.checkContacts(beIn.getContacts(), beOut.getContacts());
      TckValidator.checkCategories(beIn.getCategoryBag(), beOut.getCategoryBag());
     
      List<KeyBag> keyBagList = result.getKeyBag();
      if (keyBagList == null || keyBagList.size() == 0)
        Assert.fail("No keyBag from SamSyndicator getSubscriptionResults operation");
      KeyBag keyBag = keyBagList.get(0);
View Full Code Here

      deleteBusinesses(authInfoJoe, JOE_BUSINESS_XML, JOE_BUSINESS_KEY, numberOfCopies);
    }
  
  public void saveBusinesses(String authInfo, String businessXML, String businessKey, int numberOfCopies) {
    try {     
      BusinessEntity beIn = (BusinessEntity)EntityCreator.buildFromDoc(businessXML, "org.uddi.api_v3");
      String businessName = beIn.getName().get(0).getValue();
      for (int i=0; i<numberOfCopies; i++) {
        SaveBusiness sb = new SaveBusiness();
        sb.setAuthInfo(authInfo);
        beIn.getName().get(0).setValue(businessName + "-" + i);
        beIn.setBusinessKey(businessKey + "-" + i);
        sb.getBusinessEntity().add(beIn);
        publication.saveBusiness(sb);
        logger.debug("Saved business with key " + businessName + "-" + i);
      }
     
View Full Code Here

    try {
      SaveBusiness sb = new SaveBusiness();
      sb.setAuthInfo(authInfo);

     
      BusinessEntity beIn = (BusinessEntity)EntityCreator.buildFromDoc(businessXML, "org.uddi.api_v3");
      sb.getBusinessEntity().add(beIn);
      publication.saveBusiness(sb);
 
      // Now get the entity and check the values
      GetBusinessDetail gb = new GetBusinessDetail();
      gb.getBusinessKey().add(businessKey);
      BusinessDetail bd = inquiry.getBusinessDetail(gb);
      List<BusinessEntity> beOutList = bd.getBusinessEntity();
      BusinessEntity beOut = beOutList.get(0);

      assertEquals(beIn.getBusinessKey(), beOut.getBusinessKey());
     
      TckValidator.checkNames(beIn.getName(), beOut.getName());
      TckValidator.checkDescriptions(beIn.getDescription(), beOut.getDescription());
      TckValidator.checkDiscoveryUrls(beIn.getDiscoveryURLs(), beOut.getDiscoveryURLs());
      TckValidator.checkContacts(beIn.getContacts(), beOut.getContacts());
      TckValidator.checkCategories(beIn.getCategoryBag(), beOut.getCategoryBag());
     
    } catch(Throwable e) {
      logger.error(e.getMessage(),e);
      Assert.fail("No exception should be thrown");
    }
View Full Code Here

      // Now get the entity and check the values
      GetBusinessDetail gb = new GetBusinessDetail();
      gb.getBusinessKey().add(businessKey);
      BusinessDetail bd = inquiry.getBusinessDetail(gb);
      List<BusinessEntity> beOutList = bd.getBusinessEntity();
      BusinessEntity beOut = beOutList.get(0);
      //We are expecting 2 services
      assertEquals(2,beOut.getBusinessServices().getBusinessService().size());
     
      //Now updating the business by adding another description
      SaveBusiness sb = new SaveBusiness();
      sb.setAuthInfo(authInfo);
      BusinessEntity beIn = beOut;
      Description desc2= new Description();
      desc2.setLang("nl");
      desc2.setValue("Omschrijving");
      beIn.getDescription().add(desc2);
      sb.getBusinessEntity().add(beIn);
      publication.saveBusiness(sb);
 
      // Now get the entity and check the values
      BusinessDetail bdnew = inquiry.getBusinessDetail(gb);
      List<BusinessEntity> beOutListNew = bdnew.getBusinessEntity();
      BusinessEntity beOutNew = beOutListNew.get(0);

      assertEquals(beIn.getBusinessKey(), beOutNew.getBusinessKey());
      // After the update we still are supposed to see two services.
      assertNotNull(beOutNew.getBusinessServices());
      assertEquals(2,beOutNew.getBusinessServices().getBusinessService().size());
     
     
    } catch(Throwable e) {
      logger.error(e.getMessage(),e);
      Assert.fail("No exception should be thrown");
View Full Code Here

   * Register a service.
   *
   */
  public BusinessEntity register(BusinessEntity business, Node node) {
   
    BusinessEntity businessEntity=null;
    log.info("Registering business " + business.getName().get(0).getValue()
        + " with key " + business.getBusinessKey());
    try {
      String authToken = getAuthToken(node.getSecurityUrl());
      SaveBusiness saveBusiness = new SaveBusiness();
      saveBusiness.setAuthInfo(authToken);
      saveBusiness.getBusinessEntity().add(business);
      BusinessDetail businessDetail = getUDDINode().getTransport().getUDDIPublishService(node.getPublishUrl()).saveBusiness(saveBusiness);
      businessEntity = businessDetail.getBusinessEntity().get(0);
    } catch (Exception e) {
      log.error("Unable to register business " + business.getName().get(0).getValue()
          + " ." + e.getMessage(),e);
    } catch (Throwable t) {
      log.error("Unable to register business " + business.getName().get(0).getValue()
          + " ." + t.getMessage(),t);
    }
    log.info("Registering businessEntity " + businessEntity.getName().get(0).getValue() + " completed.");
    return businessEntity;
  }
View Full Code Here

    //SERVICE LIST
    if (list.getServiceList()!=null) {
      log.info("Subscription result for ServiceList with subscription key=" + list.getSubscription().getSubscriptionKey());
      for (ServiceInfo serviceInfo : list.getServiceList().getServiceInfos().getServiceInfo() ) {
       
        BusinessEntity existingBusinessEntity = null;
        try {
          if (existingBusinessEntity==null) {
            existingBusinessEntity = uddiToClerk.findBusiness(serviceInfo.getBusinessKey(), toClerk.getNode());
          }
          if (existingBusinessEntity!=null) {
            log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
          } else {
            log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(serviceInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
          }
          new XRegistration(serviceInfo.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceAndBindings();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
    //SERVICE DETAIL
    if (list.getServiceDetail()!=null) {
      log.info("Subscription result for ServiceDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      ServiceDetail serviceDetail = list.getServiceDetail();
      if (serviceDetail.isTruncated()) {
        log.info("The serviceDetail is truncated, the maxEntries must have been hit. The number of services is " + serviceDetail.getBusinessService().size());
      }
      for (BusinessService service : serviceDetail.getBusinessService()) {
        BusinessEntity existingBusinessEntity = null;
        try {
          if (existingBusinessEntity==null) {
            existingBusinessEntity = uddiToClerk.findBusiness(service.getBusinessKey(), toClerk.getNode());
          }
          if (existingBusinessEntity!=null) {
            log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
          } else {
            log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                + ", going to add it in.");
            new XRegistration(service.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
          }
          new XRegistration(service.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterServiceAndBindings();
        } catch (Exception e) {
          log.error(e.getMessage(),e)
        }
      }
    }
   
    //BUSINESS LIST
    if (list.getBusinessList()!=null) {
      log.info("Subscription result for BusinessList with subscription key=" + list.getSubscription().getSubscriptionKey());
      for (BusinessInfo businessInfo : list.getBusinessList().getBusinessInfos().getBusinessInfo()) {
        new XRegistration(businessInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusinessAndServices();
      }
    }
   
    //BUSINESS DETAIL
    if (list.getBusinessDetail()!=null) {
      log.info("Subscription result for BusinessDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BusinessDetail businessDetail = list.getBusinessDetail();
      if (businessDetail.isTruncated()) {
        log.info("The businessDetail is truncated, the maxEntries must have been hit. The number of businesses is " + businessDetail.getBusinessEntity().size());
      }
      for (BusinessEntity businessEntity : businessDetail.getBusinessEntity()) {
        new XRegistration(businessEntity.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusinessAndServices();
      }
    }
   
    //KEY BAG, NOT IMPLEMENTED
    if (list.getKeyBag()!=null) {
      log.info("Returning results when a 'brief' format is selected, please do not use 'brief' results when using the XRegistration functionality");
    }
   
    //BINDING DETAIL
    if (list.getBindingDetail()!=null) {
      log.info("Subscription result for BindingDetail with subscription key=" + list.getSubscription().getSubscriptionKey());
      BindingDetail bindingDetail = list.getBindingDetail();
      if (bindingDetail.isTruncated()) {
        log.info("The bindingDetail is truncated, the maxEntries must have been hit. The number of bindings is " + bindingDetail.getBindingTemplate().size());
      }
      for (BindingTemplate bindingTemplate : bindingDetail.getBindingTemplate()) {
        try {
          //check if the service exist
          BusinessService existingToService = uddiToClerk.findService(bindingTemplate.getServiceKey(), toClerk.getNode());
          if (existingToService!=null) {
            log.debug("Found service with key " +  existingToService.getServiceKey() + ". No need to add it again");
          } else {
            BusinessService fromService = uddiFromClerk.findService(bindingTemplate.getServiceKey(), fromClerk.getNode());
            fromService.getBusinessKey();
            //check if the business exist
            BusinessEntity existingBusinessEntity = uddiToClerk.findBusiness(fromService.getBusinessKey(), toClerk.getNode());
            if (existingBusinessEntity!=null) {
              log.debug("Found business with key " +  existingBusinessEntity.getBusinessKey() + ". No need to add it again");
            } else {
              log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
                  + ", going to add it in.");
              new XRegistration(fromService.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
            }
View Full Code Here

      List<BusinessInfo> biList = bInfos.getBusinessInfo();
      if (biList == null || biList.size() == 0)
        Assert.fail("No result from find business operation");
      BusinessInfo biOut = biList.get(0);
     
      BusinessEntity beIn = (BusinessEntity)EntityCreator.buildFromDoc(TckBusiness.JOE_BUSINESS_XML, "org.uddi.api_v3");
     
      assertEquals(beIn.getBusinessKey(), biOut.getBusinessKey());
     
      TckValidator.checkNames(beIn.getName(), biOut.getName());
      TckValidator.checkDescriptions(beIn.getDescription(), biOut.getDescription());
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
    }
View Full Code Here

TOP

Related Classes of org.uddi.api_v3.BusinessEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.