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
  public BusinessList findBusiness(FindBusiness body) throws DispositionReportFaultMessage {
    long startTime = System.nanoTime();
    try {
      new ValidateInquiry(null).validateFindBusiness(body);
    } catch (DispositionReportFaultMessage drfm) {
      long procTime = System.nanoTime() - startTime;
      serviceCounter.update(InquiryQuery.FIND_BUSINESS, QueryStatus.FAILED, procTime);
      throw drfm;
    }

    EntityManager em = PersistenceManager.getEntityManager();
    EntityTransaction tx = em.getTransaction();
    try {
      tx.begin();

      if (isAuthenticated()) this.getEntityPublisher(em, body.getAuthInfo());

      org.apache.juddi.query.util.FindQualifiers findQualifiers =
          new org.apache.juddi.query.util.FindQualifiers();
      findQualifiers.mapApiFindQualifiers(body.getFindQualifiers());

      List<?> keysFound = InquiryHelper.findBusiness(body, findQualifiers, em);

      BusinessList result =
          InquiryHelper.getBusinessListFromKeys(body, findQualifiers, em, keysFound);

      tx.rollback();
      long procTime = System.nanoTime() - startTime;
      serviceCounter.update(InquiryQuery.FIND_BUSINESS, QueryStatus.SUCCESS, procTime);

      return result;
    } finally {
      if (tx.isActive()) {
        tx.rollback();
      }
      em.close();
    }
  }