Package org.apache.ws.scout.model.uddi.v2

Examples of org.apache.ws.scout.model.uddi.v2.BusinessList


    /**
     * Create an instance of {@link BusinessList }
     *
     */
    public BusinessList createBusinessList() {
        return new BusinessList();
    }
View Full Code Here


            if (catBag!=null) {
                bs.setCategoryBag(catBag);
            }

            //Add the ServiceBinding information
            BindingTemplates bt = getBindingTemplates(service.getServiceBindings());
            if (bt != null) {
                bs.setBindingTemplates(bt);
            }
          
            log.debug("BusinessService=" + bs.toString());
View Full Code Here

           return od;
       }

    private static BindingTemplates getBindingTemplates(Collection serviceBindings)
        throws JAXRException {
        BindingTemplates bt = null;
        if(serviceBindings != null && serviceBindings.size() > 0) {
            bt = objectFactory.createBindingTemplates();
            Iterator iter = serviceBindings.iterator();
            int currLoc = 0;
            BindingTemplate[] bindingTemplateArray = new BindingTemplate[serviceBindings.size()];
            while(iter.hasNext()) {
                ServiceBinding sb = (ServiceBinding)iter.next();
                bindingTemplateArray[currLoc] = getBindingTemplateFromJAXRSB(sb);
                currLoc++;
            }
            if (bindingTemplateArray != null) {
                bt.getBindingTemplate().addAll(Arrays.asList(bindingTemplateArray));
            }
        }
        return bt;
    }
View Full Code Here

        }
    }

    public static BusinessEntity getBusinessEntityFromJAXROrg(Organization organization)
      throws JAXRException {
    BusinessEntity biz = objectFactory.createBusinessEntity();
    BusinessServices bss = objectFactory.createBusinessServices();
    BusinessService[] barr = new BusinessService[0];

    try {
      // It may just be an update
            Key key = organization.getKey();
      if (key != null && key.getId() != null) {
        biz.setBusinessKey(key.getId());
            } else {
                biz.setBusinessKey("");
            }
      // Lets get the Organization attributes at the top level
     
      InternationalString iname = organization.getName();
     
      if (iname != null) {
                addNames(biz.getName(), iname);
      }
     
      InternationalString idesc = organization.getDescription();
     
            addDescriptions(biz.getDescription(), idesc);

      if (organization.getPrimaryContact() != null &&
        organization.getPrimaryContact().getPersonName()!= null &&
        organization.getPrimaryContact().getPersonName().getFullName() != null) {

        biz.setAuthorizedName(organization.getPrimaryContact().getPersonName()
            .getFullName());
      }

            Collection<Service> s = organization.getServices();
            log.debug("?Org has services=" + s.isEmpty());

      barr = new BusinessService[s.size()];

            Iterator<Service> iter = s.iterator();
      int barrPos = 0;
      while (iter.hasNext()) {
        BusinessService bs = ScoutJaxrUddiHelper
            .getBusinessServiceFromJAXRService((Service) iter
                .next());
        barr[barrPos] = bs;
        barrPos++;
            }

            /*
             * map users : JAXR has concept of 'primary contact', which is a
             * special designation for one of the users, and D6.1 seems to say
             * that the first UDDI user is the primary contact
             */

      Contacts cts = objectFactory.createContacts();
      Contact[] carr = new Contact[0];

            User primaryContact = organization.getPrimaryContact();
            Collection<User> users = organization.getUsers();

            // Expand array to necessary size only (xmlbeans does not like
            // null items in cases like this)

            int carrSize = 0;

            if (primaryContact != null) {
                carrSize += 1;
            }

            // TODO: Clean this up and make it more efficient
            Iterator<User> it = users.iterator();
            while (it.hasNext()) {
                User u = (User) it.next();
                if (u != primaryContact) {
                    carrSize++;
                }
            }

            carr = new Contact[carrSize];

            /*
             * first do primary, and then filter that out in the loop
             */
            if (primaryContact != null) {
                Contact ct = getContactFromJAXRUser(primaryContact);
                carr[0] = ct;
            }

            it = users.iterator();
            int carrPos = 1;
            while (it.hasNext()) {
                User u = (User) it.next();

                if (u != primaryContact) {
                    Contact ct = getContactFromJAXRUser(u);
                    carr[carrPos] = ct;
                    carrPos++;
                }
            }

      bss.getBusinessService().addAll(Arrays.asList(barr));
            if (carr.length>0) {
                cts.getContact().addAll(Arrays.asList(carr));
                biz.setContacts(cts);
            }
            biz.setBusinessServices(bss);

            // External Links
            Iterator<ExternalLink> exiter = organization.getExternalLinks().iterator();
            DiscoveryURLs emptyDUs = null;
            boolean first = true;
            while (exiter.hasNext()) {
                ExternalLink link = (ExternalLink) exiter.next();
                /** Note: jUDDI adds its own discoverURL as the businessEntity* */
                if (first) {
                    emptyDUs = objectFactory.createDiscoveryURLs();
                    biz.setDiscoveryURLs(emptyDUs);
                    first = false;
                }
                DiscoveryURL emptyDU = objectFactory.createDiscoveryURL();
                emptyDUs.getDiscoveryURL().add(emptyDU);
                emptyDU.setUseType("businessEntityExt");
       
                if (link.getExternalURI() != null) {
                    emptyDU.setValue(link.getExternalURI());
                }
            }
     
          IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(organization.getExternalIdentifiers());
          if (idBag!=null) {
              biz.setIdentifierBag(idBag);
          }
          CategoryBag catBag = getCategoryBagFromClassifications(organization.getClassifications());
          if (catBag!=null) {
              biz.setCategoryBag(catBag);
          }
     
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
View Full Code Here

      request.setFindQualifiers(findQualifiers);
    }

    request.setMaxRows(maxRows);

        BusinessList bl;
        JAXBElement<?> o = execute(this.objectFactory.createFindBusiness(request),
            this.getInquiryURI());
        bl = (BusinessList) o.getValue();

        return bl;
View Full Code Here

        IRegistry registry = (IRegistry) registryService.getRegistry();
        try
        {
            FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
            Name[] nameArray = mapNamePatterns(namePatterns);
            BusinessList result = registry.findBusiness(nameArray,
                    null,
                    ScoutJaxrUddiHelper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers),
                    ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications),
                    null,
                    juddiFindQualifiers,
                    registryService.getMaxRows());
           
            BusinessInfo[] bizInfoArr =null;
            BusinessInfos bizInfos = result.getBusinessInfos();
            LinkedHashSet<Organization> orgs = new LinkedHashSet<Organization>();
            if(bizInfos != null)
            {
              List<BusinessInfo> bizInfoList = bizInfos.getBusinessInfo();
              for (BusinessInfo businessInfo : bizInfoList) {
View Full Code Here

      request.setFindQualifiers(findQualifiers);
    }

    request.setMaxRows(maxRows);

        BusinessList bl;
        JAXBElement<?> o = execute(this.objectFactory.createFindBusiness(request),
            this.getInquiryURI());
        bl = (BusinessList) o.getValue();

        return bl;
View Full Code Here

        IRegistry registry = registryService.getRegistry();
        try
        {
            FindQualifiers juddiFindQualifiers = mapFindQualifiers(findQualifiers);
            Name[] nameArray = mapNamePatterns(namePatterns);
            BusinessList result = registry.findBusiness(nameArray,
                    null,
                    ScoutJaxrUddiHelper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers),
                    ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications),
                    null,
                    juddiFindQualifiers,
                    registryService.getMaxRows());
           
            BusinessInfo[] bizInfoArr =null;
            BusinessInfos bizInfos = result.getBusinessInfos();
            LinkedHashSet<Organization> orgs = new LinkedHashSet<Organization>();
            if(bizInfos != null)
            {
              List<BusinessInfo> bizInfoList = bizInfos.getBusinessInfo();
              for (BusinessInfo businessInfo : bizInfoList) {
View Full Code Here

        return pa;
    }

  public static BusinessService getBusinessServiceFromJAXRService(
      Service service) throws JAXRException {
    BusinessService bs = objectFactory.createBusinessService();
    try {
      InternationalString iname = service.getName();
           
      addNames(bs.getName(), iname);
          
            InternationalString idesc = service.getDescription();
   
           addDescriptions(bs.getDescription(), idesc);

            Organization o = service.getProvidingOrganization();

            /*
             * there may not always be a key...
             */
            if (o != null) {
                Key k = o.getKey();

        if (k != null && k.getId() != null) {
                    bs.setBusinessKey(k.getId());
                }
                   
      } else {
                /*
                 * gmj - I *think* this is the right thing to do
                 */
        throw new JAXRException(
            "Service has no associated organization");
            }

      if (service.getKey() != null && service.getKey().getId() != null) {
                bs.setServiceKey(service.getKey().getId());
            } else {
                bs.setServiceKey("");
            }

            CategoryBag catBag = getCategoryBagFromClassifications(service.getClassifications());
            if (catBag!=null) {
                bs.setCategoryBag(catBag);
            }

            //Add the ServiceBinding information
            BindingTemplates bt = getBindingTemplates(service.getServiceBindings());
            if (bt != null) {
                bs.setBindingTemplates(bt);
            }
          
            log.debug("BusinessService=" + bs.toString());
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
        return bs;
    }
View Full Code Here

      barr = new BusinessService[s.size()];

            Iterator<Service> iter = s.iterator();
      int barrPos = 0;
      while (iter.hasNext()) {
        BusinessService bs = ScoutJaxrUddiHelper
            .getBusinessServiceFromJAXRService((Service) iter
                .next());
        barr[barrPos] = bs;
        barrPos++;
            }
View Full Code Here

TOP

Related Classes of org.apache.ws.scout.model.uddi.v2.BusinessList

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.