Package org.apache.ws.scout.uddi

Examples of org.apache.ws.scout.uddi.Contact$Factory


      Contacts contacts = entity.getContacts();
      Contact[] carr = contacts != null ? contacts.getContactArray() : null;

      for (int i = 0; carr != null && i < carr.length; i++)
      {
         Contact contact = (Contact)carr[i];
         User user = new UserImpl(null);
         String pname = contact.getPersonName();
         user.setPersonName(new PersonNameImpl(pname));
         if (i == 0)
         {
            org.setPrimaryContact(user);
         }
View Full Code Here


       */
      Contacts contacts = entity.getContacts();
      Contact[] carr = contacts != null ? contacts.getContactArray():null;
      for (int i = 0; carr != null && i < carr.length; i++)
      {
         Contact contact = carr[i];
         User user = new UserImpl(null);
         String pname = contact.getPersonName();
         user.setType(contact.getUseType());
         user.setPersonName(new PersonNameImpl(pname));
        

         Email[] emails = (Email[]) contact.getEmailArray();
         ArrayList<EmailAddress> tempEmails = new ArrayList<EmailAddress>();
         for (int x = 0; x < emails.length; x++) {
           tempEmails.add(new EmailAddressImpl(emails[x].getStringValue(), null));
         }
         user.setEmailAddresses(tempEmails);
        
         Address[] addresses = (Address[]) contact.getAddressArray();
         ArrayList<PostalAddress> tempAddresses = new ArrayList<PostalAddress>();
         for (int x = 0; x < addresses.length; x++) {
           AddressLine[] alines = addresses[x].getAddressLineArray();
           PostalAddress pa = getPostalAddress(alines);
           tempAddresses.add(pa);
         }
         user.setPostalAddresses(tempAddresses);
         Phone[] phones = contact.getPhoneArray();
         ArrayList<TelephoneNumber> tempPhones = new ArrayList<TelephoneNumber>();
         for (int x = 0; x < phones.length; x++) {
           TelephoneNumberImpl tni = new TelephoneNumberImpl();
           tni.setType(phones[x].getUseType());
           tni.setNumber(phones[x].getStringValue());
View Full Code Here

            /*
             * 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++;
                }
            }

View Full Code Here

     *
     * Convert JAXR User Object to UDDI  Contact
     */
    public static Contact getContactFromJAXRUser(User user)
      throws JAXRException {
    Contact ct = Contact.Factory.newInstance();

        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 = Phone.Factory.newInstance();
                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.setStringValue(str);
        } else {
          phone.setStringValue("");
        }

        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 = Email.Factory.newInstance();
       
        if (ea.getAddress() != null) {
          email.setStringValue(ea.getAddress());
        }
        // email.setText( ea.getAddress() );
       
        if (ea.getType() != null) {
                email.setUseType(ea.getType());
            }

        emailarr[emailarrPos] = email;
        emailarrPos++;
      }
      ct.setAddressArray(addarr);
      ct.setPhoneArray(phonearr);
      ct.setEmailArray(emailarr);
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
        return ct;
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.scout.uddi.Contact$Factory

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.