Package org.apache.myfaces.trinidaddemo.samples.email

Examples of org.apache.myfaces.trinidaddemo.samples.email.ContactListBean$Contact


     *
     * 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


      return setExportLifetime;
   }

   public static Contact createContact(Postal postal, Telecom telecom, Online online)
   {
      Contact contact = new Contact();
      contact.setPostal(postal);
      contact.setTelecom(telecom);
      contact.setOnline(online);

      return contact;
   }
View Full Code Here

      {
         PersonName name = toV2PersonName(v1UserProfile.getName());
         XMLGregorianCalendar bdate = v1UserProfile.getBdate();
         String gender = v1UserProfile.getGender();
         EmployerInfo employerInfo = toV2EmployerInfo(v1UserProfile.getEmployerInfo());
         Contact homeInfo = toV2Context(v1UserProfile.getHomeInfo());
         Contact businessInfo = toV2Context(v1UserProfile.getBusinessInfo());
         UserProfile userProfile = WSRPTypeFactory.createUserProfile(name, bdate, gender, employerInfo, homeInfo, businessInfo);

         return userProfile;
      }
      else
View Full Code Here

      if (v1Contact != null)
      {
         Postal postal = toV2Postal(v1Contact.getPostal());
         Telecom teleCom = toV2Telecom(v1Contact.getTelecom());
         Online online = toV2Online(v1Contact.getOnline());
         Contact contact = WSRPTypeFactory.createContact(postal, teleCom, online);

         List<V1Extension> extensions = v1Contact.getExtensions();
         if (extensions != null)
         {
            contact.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
         }

         return contact;
      }
      else
View Full Code Here

      String employer = userInfos.get(INFO_USER_EMPLOYER);
      String department = userInfos.get(INFO_USER_DEPARTMENT);
      String jobTitle = userInfos.get(INFO_USER_JOB_TITLE);
      EmployerInfo employerInfo = WSRPTypeFactory.createEmployerInfo(employer, department, jobTitle);

      Contact homeInfo = createContactFrom(userInfos, false);
      Contact businessInfo = createContactFrom(userInfos, true);
      UserProfile userProfile = WSRPTypeFactory.createUserProfile(name, bdate, userInfos.get(INFO_USER_GENDER), employerInfo, homeInfo, businessInfo);

      return userProfile;
   }
View Full Code Here

      TelephoneNum fax = createTelephoneNumFrom(infos, TelecomType.FAX, isBusiness);
      TelephoneNum mobile = createTelephoneNumFrom(infos, TelecomType.MOBILE, isBusiness);
      TelephoneNum pager = createTelephoneNumFrom(infos, TelecomType.PAGER, isBusiness);
      Telecom telecom = WSRPTypeFactory.createTelecom(telephone, fax, mobile, pager);
     
      Contact contact = WSRPTypeFactory.createContact(postal, telecom, online);

      return contact;
   }
View Full Code Here

      return setExportLifetime;
   }

   public static Contact createContact(Postal postal, Telecom telecom, Online online)
   {
      Contact contact = new Contact();
      contact.setPostal(postal);
      contact.setTelecom(telecom);
      contact.setOnline(online);

      return contact;
   }
View Full Code Here

      String employer = userInfos.get(INFO_USER_EMPLOYER);
      String department = userInfos.get(INFO_USER_DEPARTMENT);
      String jobTitle = userInfos.get(INFO_USER_JOB_TITLE);
      EmployerInfo employerInfo = WSRPTypeFactory.createEmployerInfo(employer, department, jobTitle);

      Contact homeInfo = createContactFrom(userInfos, false);
      Contact businessInfo = createContactFrom(userInfos, true);
      UserProfile userProfile = WSRPTypeFactory.createUserProfile(name, bdate, userInfos.get(INFO_USER_GENDER), employerInfo, homeInfo, businessInfo);

      return userProfile;
   }
View Full Code Here

      TelephoneNum fax = createTelephoneNumFrom(infos, TelecomType.FAX, isBusiness);
      TelephoneNum mobile = createTelephoneNumFrom(infos, TelecomType.MOBILE, isBusiness);
      TelephoneNum pager = createTelephoneNumFrom(infos, TelecomType.PAGER, isBusiness);
      Telecom telecom = WSRPTypeFactory.createTelecom(telephone, fax, mobile, pager);
     
      Contact contact = WSRPTypeFactory.createContact(postal, telecom, online);

      return contact;
   }
View Full Code Here

      return setExportLifetime;
   }

   public static Contact createContact(Postal postal, Telecom telecom, Online online)
   {
      Contact contact = new Contact();
      contact.setPostal(postal);
      contact.setTelecom(telecom);
      contact.setOnline(online);

      return contact;
   }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidaddemo.samples.email.ContactListBean$Contact

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.