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

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


     *
     * Convert JAXR User Object to UDDI  Contact
     */
    public static Contact getContactFromJAXRUser(User user)
      throws JAXRException {
    Contact ct = objectFactory.createContact();
        if (user == null) {
            return null;
        }

    Address[] addarr = new Address[0];
    Phone[] phonearr = new Phone[0];
    Email[] emailarr = new Email[0];
    try {
     
      if (user.getPersonName() != null && user.getPersonName().getFullName() != null) {
        ct.setPersonName(user.getPersonName().getFullName());
      }
     
      if (user.getType() != null) {
            ct.setUseType(user.getType());
      }
      // Postal Address
            Collection<PostalAddress> postc = user.getPostalAddresses();

      addarr = new Address[postc.size()];

            Iterator<PostalAddress> iterator = postc.iterator();
      int addarrPos = 0;
      while (iterator.hasNext()) {
                PostalAddress post = (PostalAddress) iterator.next();
        addarr[addarrPos] = ScoutJaxrUddiHelper.getAddress(post);
        addarrPos++;
            }
      // Phone Numbers
            Collection ph = user.getTelephoneNumbers(null);

      phonearr = new Phone[ph.size()];

            Iterator it = ph.iterator();
      int phonearrPos = 0;
      while (it.hasNext()) {
                TelephoneNumber t = (TelephoneNumber) it.next();
        Phone phone = objectFactory.createPhone();
                String str = t.getNumber();
                log.debug("Telephone=" + str);
       
        // FIXME: If phone number is null, should the phone
        // not be set at all, or set to empty string?
        if (str != null) {
          phone.setValue(str);
        } else {
          phone.setValue("");
        }

        phonearr[phonearrPos] = phone;
        phonearrPos++;
            }

      // Email Addresses
            Collection ec = user.getEmailAddresses();

      emailarr = new Email[ec.size()];

            Iterator iter = ec.iterator();
      int emailarrPos = 0;
      while (iter.hasNext()) {
                EmailAddress ea = (EmailAddress) iter.next();
        Email email = objectFactory.createEmail();
       
        if (ea.getAddress() != null) {
          email.setValue(ea.getAddress());
        }
        // email.setText( ea.getAddress() );
       
        if (ea.getType() != null) {
                email.setUseType(ea.getType());
            }

        emailarr[emailarrPos] = email;
        emailarrPos++;
      }
      ct.getAddress().addAll(Arrays.asList(addarr));
      ct.getPhone().addAll(Arrays.asList(phonearr));
      ct.getEmail().addAll(Arrays.asList(emailarr));
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
        return ct;
    }
View Full Code Here


             * 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
View Full Code Here

   *
   * @exception RegistryException;
   */
  public DispositionReport deleteBinding(String authInfo,
      String[] bindingKeyArray) throws RegistryException {
    DeleteBinding request = this.objectFactory.createDeleteBinding();

    if (authInfo != null) {
      request.setAuthInfo(authInfo);
    }

    if (bindingKeyArray != null) {
      request.getBindingKey().addAll(Arrays.asList(bindingKeyArray));
    }

        DispositionReport dr;
        JAXBElement<?> o = execute(this.objectFactory.createDeleteBinding(request), this.getPublishURI());
        dr = (DispositionReport) o.getValue();
View Full Code Here

   *
   * @exception RegistryException;
   */
  public DispositionReport deleteBusiness(String authInfo,
      String[] businessKeyArray) throws RegistryException {
    DeleteBusiness request = this.objectFactory.createDeleteBusiness();
   
    if (authInfo != null) {
      request.setAuthInfo(authInfo);
    }

    if (businessKeyArray != null) {
      request.getBusinessKey().addAll(Arrays.asList(businessKeyArray));
    }

        DispositionReport dr;
        JAXBElement<?> o = execute(this.objectFactory.createDeleteBusiness(request), this.getPublishURI());
        dr = (DispositionReport) o.getValue();
View Full Code Here

  /**
   * @exception RegistryException;
   */
  public DispositionReport deletePublisherAssertions(String authInfo,
      PublisherAssertion[] assertionArray) throws RegistryException {
    DeletePublisherAssertions request = this.objectFactory.createDeletePublisherAssertions();

    if (authInfo != null) {
      request.setAuthInfo(authInfo);
    }

    if (assertionArray != null) {
      request.getPublisherAssertion().addAll(Arrays.asList(assertionArray));
    }

        DispositionReport dr;
        JAXBElement<?> o = execute(this.objectFactory.createDeletePublisherAssertions(request),
            this.getPublishURI());
View Full Code Here

   *
   * @exception RegistryException;
   */
  public DispositionReport deleteService(String authInfo,
      String[] serviceKeyArray) throws RegistryException {
    DeleteService request = this.objectFactory.createDeleteService();
   
    if (authInfo != null) {
      request.setAuthInfo(authInfo);
    }

    if (serviceKeyArray != null) {
      request.getServiceKey().addAll(Arrays.asList(serviceKeyArray));
    }

        DispositionReport dr;
        JAXBElement<?> o = execute(this.objectFactory.createDeleteService(request),
            this.getPublishURI());
View Full Code Here

   *
   * @exception RegistryException;
   */
  public DispositionReport deleteTModel(String authInfo,
      String[] tModelKeyArray) throws RegistryException {
    DeleteTModel request = this.objectFactory.createDeleteTModel();

    if (authInfo != null) {
      request.setAuthInfo(authInfo);
    }

    if (tModelKeyArray != null) {
      request.getTModelKey().addAll(Arrays.asList(tModelKeyArray));
    }

        DispositionReport dr;
        JAXBElement<?> o = execute(this.objectFactory.createDeleteTModel(request),
            this.getPublishURI());
View Full Code Here

          if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
            emptyTInfo.setTModelKey(specificationObject.getKey().getId());
                        if (specificationObject.getDescription()!=null) {
                            for (Object o : specificationObject.getDescription().getLocalizedStrings()) {
                                LocalizedString locDesc = (LocalizedString) o;
                                Description description = objectFactory.createDescription();
                                emptyTInfo.getDescription().add(description);
                                description.setValue(locDesc.getValue());
                                description.setLang(locDesc.getLocale().getLanguage());
                            }
                        }
                        Collection<ExternalLink> externalLinks = slink.getExternalLinks();
                        if (externalLinks!=null && externalLinks.size()>0) {
                            for (ExternalLink link : externalLinks) {
                                InstanceDetails ids = objectFactory.createInstanceDetails();
                                emptyTInfo.setInstanceDetails(ids);
                                if (link.getDescription()!=null) {
                                    Description description = objectFactory.createDescription();
                                    ids.getDescription().add(description);
                                    description.setValue(link.getDescription().getValue());
                                }
                                if (link.getExternalURI()!=null) {
                                    OverviewDoc overviewDoc = objectFactory.createOverviewDoc();
                                    ids.setOverviewDoc(overviewDoc);
                                    overviewDoc.setOverviewURL(link.getExternalURI());
View Full Code Here

    private static void addDescriptions(List<Description> descripions, InternationalString idesc) throws JAXRException {
        if (idesc != null) {
            for (Object o : idesc.getLocalizedStrings()) {
                LocalizedString locName = (LocalizedString) o;
                Description desc = objectFactory.createDescription();
                descripions.add(desc);
                desc.setValue(locName.getValue());
                desc.setLang(locName.getLocale().getLanguage());
            }
        }
    }
View Full Code Here

           String url = link.getExternalURI();
           if(url != null)
               od.setOverviewURL(url);
           InternationalString extDesc = link.getDescription();
           if(extDesc != null) {
               Description description = objectFactory.createDescription();
               od.getDescription().add(description);
               description.setValue(extDesc.getValue());
           }
           return od;
       }
View Full Code Here

TOP

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

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.