Package org.apache.juddi.portlets.client.service

Examples of org.apache.juddi.portlets.client.service.FindResponse


  public FindResponse getBusinesses(String nameStr, String[] findQualifyers)
  {
    HttpServletRequest request = this.getThreadLocalRequest();
    HttpSession session = request.getSession();
    String lang = request.getLocale().getLanguage();
    FindResponse response = new FindResponse();
    try {
      FindBusiness findBusiness = new FindBusiness();
      FindQualifiers findQualifiers = new FindQualifiers();
      for (String string : findQualifyers) {
        findQualifiers.getFindQualifier().add(string);
      }
      findBusiness.setFindQualifiers(findQualifiers);

      Name name = new Name();
      name.setValue(nameStr);
      findBusiness.getName().add(name);


      logger.debug("FindBusiness " + findBusiness + " sending findBusinesses request..");
      List<Business> businesses = new ArrayList<Business>();
     
      Transport transport = WebHelper.getTransport(session.getServletContext());
      UDDIInquiryPortType inquiryService = transport.getUDDIInquiryService();
      BusinessList businessList = inquiryService.findBusiness(findBusiness);
      for (BusinessInfo businessInfo : businessList.getBusinessInfos().getBusinessInfo()) {
        Business business = new Business(
            businessInfo.getBusinessKey(),
            EntityForLang.getName(businessInfo.getName(),lang).getValue(),
            EntityForLang.getDescription(businessInfo.getDescription(),lang).getValue());
        List<Service> services = new ArrayList<Service>();
        if (businessInfo.getServiceInfos()!=null) {
          for (ServiceInfo serviceInfo : businessInfo.getServiceInfos().getServiceInfo()) {
            Service service = new Service(
                serviceInfo.getServiceKey(),
                EntityForLang.getName(serviceInfo.getName(), lang).getValue());
            services.add(service);
          }
        }
        business.setServices(services);
        businesses.add(business);
      }
      response.setSuccess(true);
      response.setBusinesses(businesses);
    } catch (Exception e) {
      logger.error("Could not obtain token. " + e.getMessage(), e);
      response.setSuccess(false);
      response.setMessage(e.getMessage());
      response.setErrorCode("102");
    catch (Throwable t) {
      logger.error("Could not obtain token. " + t.getMessage(), t);
      response.setSuccess(false);
      response.setMessage(t.getMessage());
      response.setErrorCode("102");
    }
    return response;
  }
View Full Code Here

TOP

Related Classes of org.apache.juddi.portlets.client.service.FindResponse

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.