public void deleteBusiness(String authToken, String businessName)
      throws TransportException, DispositionReportFaultMessage, RemoteException {

    UDDIInquiryPortType uddiInquiryService = transport.getUDDIInquiryService();

    Name name = new Name();
    name.setValue(businessName);

    FindBusiness fb = new FindBusiness();
    fb.setAuthInfo(authToken);
    fb.getName().add(name);
    fb.setMaxRows(999);

    BusinessList foundBusinesses = uddiInquiryService.findBusiness(fb);

    if (foundBusinesses.getBusinessInfos() != null) {
      for (BusinessInfo business : foundBusinesses.getBusinessInfos().getBusinessInfo()) {
        System.out.println(
            "delete business: " + business.getName() + " - " + business.getBusinessKey());
        org.uddi.api_v3.DeleteBusiness db = new org.uddi.api_v3.DeleteBusiness();
        db.setAuthInfo(authToken);
        db.getBusinessKey().add(business.getBusinessKey());
        transport.getUDDIPublishService().deleteBusiness(db);
      }
    } else {
      System.out.println("didn't found any business");
    }
  }
예제 #2
0
  /**
   * This method extracts the business key from the business info object.
   *
   * @param oBusInfo The business information object containing the data.
   * @return The key that was extracted.
   */
  private String extractBusinessKey(BusinessInfo oBusInfo) {
    String sKey = "";

    if ((oBusInfo != null)
        && (oBusInfo.getBusinessKey() != null)
        && (oBusInfo.getBusinessKey().length() > 0)) {
      sKey = oBusInfo.getBusinessKey();
    }

    return sKey;
  }
예제 #3
0
  /**
   * This method craetes a business entity by extracting the information from a business info
   * object.
   *
   * @param oBusInfo The business information that contains the information.
   * @return The translated information.
   */
  private CMBusinessEntity businessEntityFromBusinesInfo(BusinessInfo oBusInfo) {
    CMBusinessEntity oEntity = new CMBusinessEntity();
    boolean bHaveData = false;

    if (oBusInfo != null) {
      // Business Key
      // -------------
      if ((oBusInfo.getBusinessKey() != null) && (oBusInfo.getBusinessKey().length() > 0)) {
        oEntity.setBusinessKey(oBusInfo.getBusinessKey());
        bHaveData = true;
      }

      // Names
      // ------
      if ((oBusInfo.getName() != null) && (oBusInfo.getName().size() > 0)) {
        CMBusinessNames oNames = new CMBusinessNames();
        oEntity.setNames(oNames);
        for (Name oUDDIName : oBusInfo.getName()) {
          if ((oUDDIName.getValue() != null) && (oUDDIName.getValue().length() > 0)) {
            oNames.getBusinessName().add(oUDDIName.getValue());
          }
        }
        bHaveData = true;
      } // if ((oBusInfo.getName() != null) && ...

      // Description
      // ------------
      if ((oBusInfo.getDescription() != null) && (oBusInfo.getDescription().size() > 0)) {
        CMBusinessDescriptions oDescripts = new CMBusinessDescriptions();
        oEntity.setDescriptions(oDescripts);
        for (Description oUDDIDescript : oBusInfo.getDescription()) {
          if ((oUDDIDescript.getValue() != null) && (oUDDIDescript.getValue().length() > 0)) {
            oDescripts.getBusinessDescription().add(oUDDIDescript.getValue());
          }
        }
        bHaveData = true;
      }

      // Set up for the services.  - This pass will only put in the service key.
      // We will have to do another retrieval to get the rest of the service information.
      // ------------------------------------------------------------------------
      if ((oBusInfo.getServiceInfos() != null)
          && (oBusInfo.getServiceInfos().getServiceInfo() != null)
          && (oBusInfo.getServiceInfos().getServiceInfo().size() > 0)) {
        CMBusinessServices oServices = new CMBusinessServices();
        for (ServiceInfo oUDDIService : oBusInfo.getServiceInfos().getServiceInfo()) {
          boolean bHaveServiceData = false;
          CMBusinessService oService = new CMBusinessService();

          // Service Key
          // ------------
          if ((oUDDIService.getServiceKey() != null)
              && (oUDDIService.getServiceKey().length() > 0)) {
            oService.setServiceKey(oUDDIService.getServiceKey());
            bHaveServiceData = true;
          }

          oService.setInternalWebService(false); // If it is in UDDI - it is not internal

          // Service Name - We will pick this up on the detail.
          // ---------------------------------------------------

          if (bHaveServiceData) {
            oServices.getBusinessService().add(oService);
            bHaveData = true;
          }
        } // for (ServiceInfo oUDDIService : oBusInfo.getServiceInfos().getServiceInfo())

        if (oServices.getBusinessService().size() > 0) {
          oEntity.setBusinessServices(oServices);
        }
      }
    }

    if (bHaveData) {
      return oEntity;
    } else {
      return null;
    }
  }