2 * Copyright (C) 2016 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation, either version 3 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
14 * You should have received a copy of the GNU Affero General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.addressbook.beans.contact;
19 import java.text.MessageFormat;
20 import java.util.Date;
21 import java.util.Iterator;
22 import java.util.List;
23 import java.util.Objects;
24 import javax.annotation.PostConstruct;
25 import javax.enterprise.context.SessionScoped;
26 import javax.enterprise.event.Observes;
27 import javax.faces.view.facelets.FaceletException;
28 import javax.inject.Inject;
29 import javax.inject.Named;
30 import javax.naming.Context;
31 import javax.naming.InitialContext;
32 import javax.naming.NamingException;
33 import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
34 import org.mxchange.jcontacts.contact.Contact;
35 import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
36 import org.mxchange.jcontacts.contact.UserContact;
37 import org.mxchange.jcontacts.contact.gender.Gender;
38 import org.mxchange.jcontacts.contact.utils.ContactUtils;
39 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
40 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
41 import org.mxchange.jcountry.data.Country;
42 import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
43 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
44 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
45 import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
46 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
47 import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
48 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
49 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
50 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
51 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
52 import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
55 * A general contact bean (controller)
57 * @author Roland Haeder<roland@mxchange.org>
59 @Named ("contactController")
61 public class AddressbookContactWebSessionBean implements AddressbookContactWebSessionController {
66 private static final long serialVersionUID = 542_145_347_916L;
71 private Date birthday;
74 * Cellphone number's carrier
76 private MobileProvider cellphoneCarrier;
81 private Long cellphoneNumber;
91 private String comment;
96 private final ContactSessionBeanRemote contactBean;
101 private List<Contact> contactList;
106 private Country country;
111 private String emailAddress;
116 private List<String> emailAddressList;
119 * Email address repeated
121 private String emailAddressRepeat;
126 private String familyName;
129 * Fax number's area code
131 private Integer faxAreaCode;
134 * Country instance for fax number
136 private Country faxCountry;
141 private Long faxNumber;
146 private String firstName;
151 private Gender gender;
156 private Short houseNumber;
159 * Whether a cellphone entry has been unlinked
161 private boolean isCellphoneUnlinked;
164 * Whether a fax entry has been unlinked
166 private boolean isFaxUnlinked;
169 * Whether a land-line number has been unlinked
171 private boolean isLandLineUnlinked;
174 * Login bean (controller)
177 private AddressbookUserLoginWebSessionController loginController;
180 * Phone number area code
182 private Integer phoneAreaCode;
185 * Country instance for phone number
187 private Country phoneCountry;
192 private Long phoneNumber;
197 private String street;
202 private Integer zipCode;
205 * Default constructor
207 public AddressbookContactWebSessionBean () {
210 // Get initial context
211 Context context = new InitialContext();
214 this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/jratecalc-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
215 } catch (final NamingException e) {
217 throw new FaceletException(e);
222 public void addEmailAddress (final String contactEmailAddress) {
224 this.emailAddressList.add(contactEmailAddress);
228 public void afterAdminAddedUserEvent (@Observes final AdminAddedUserEvent event) {
230 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterAdminAddedUserEvent: event={0} - CALLED!", event)); //NOI18N
232 // event should not be null
235 throw new NullPointerException("event is null"); //NOI18N
236 } else if (event.getAddedUser() == null) {
238 throw new NullPointerException("event.addedUser is null"); //NOI18N
239 } else if (event.getAddedUser().getUserId() == null) {
241 throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
242 } else if (event.getAddedUser().getUserId() < 1) {
244 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
251 //* NOISY-DEBUG: */ System.out.println("UserWebBean:afterAdminAddedUserEvent: EXIT!"); //NOI18N
255 public void afterAdminUpdatedContactDataEvent (@Observes final AdminUpdatedContactEvent event) {
257 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterAdminUpdatedContactDataEvent: event={0} - CALLED!", event)); //NOI18N
259 // event should not be null
262 throw new NullPointerException("event is null"); //NOI18N
263 } else if (event.getUpdatedContact() == null) {
265 throw new NullPointerException("event.user is null"); //NOI18N
266 } else if (event.getUpdatedContact().getContactId() == null) {
268 throw new NullPointerException("event.user.userId is null"); //NOI18N
269 } else if (event.getUpdatedContact().getContactId() < 1) {
271 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
274 // Get iterator from list
275 Iterator<Contact> iterator = this.contactList.iterator();
277 // "Walk" through all entries
278 while (iterator.hasNext()) {
280 Contact next = iterator.next();
282 // Is id number the same?
283 if (Objects.equals(event.getUpdatedContact().getContactId(), next.getContactId())) {
284 // Found entry, so remove it and abort
285 this.contactList.remove(next);
287 // Remove also email from list
288 this.emailAddressList.remove(next.getContactEmailAddress());
293 // Add contact to list
294 this.contactList.add(event.getUpdatedContact());
296 // Add email address to list
297 this.emailAddressList.add(event.getUpdatedContact().getContactEmailAddress());
301 public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) {
303 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N
305 // event should not be null
308 throw new NullPointerException("event is null"); //NOI18N
309 } else if (event.getRegisteredUser() == null) {
311 throw new NullPointerException("event.user is null"); //NOI18N
312 } else if (event.getRegisteredUser().getUserId() == null) {
314 throw new NullPointerException("event.user.userId is null"); //NOI18N
315 } else if (event.getRegisteredUser().getUserId() < 1) {
317 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
321 Contact registeredContact = event.getRegisteredUser().getUserContact();
324 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterRegistration: registeredContact={0}", registeredContact)); //NOI18N
326 // Copy all data from registered->user
327 this.copyContact(registeredContact);
329 // Add user name and email address
330 this.addUserNameEmailAddress(registeredContact);
336 //* NOISY-DEBUG: */ System.out.println("ContactWebBean:afterRegistration: EXIT!"); //NOI18N
340 public void afterUserLogin (final @Observes UserLoggedInEvent event) {
342 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
344 // event should not be null
347 throw new NullPointerException("event is null"); //NOI18N
348 } else if (event.getLoggedInUser() == null) {
350 throw new NullPointerException("event.user is null"); //NOI18N
351 } else if (event.getLoggedInUser().getUserId() == null) {
353 throw new NullPointerException("event.user.userId is null"); //NOI18N
354 } else if (event.getLoggedInUser().getUserId() < 1) {
356 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
359 // Copy all data to this bean
360 this.copyContact(event.getLoggedInUser().getUserContact());
363 //* NOISY-DEBUG: */ System.out.println("ContactWebBean:afterUserLogin - EXIT!"); //NOI18N
367 @SuppressWarnings ("ReturnOfCollectionOrArrayField")
368 public List<Contact> allContacts () {
369 return this.contactList;
373 public Contact createContactInstance () {
375 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: CALLED!", this.getClass().getSimpleName()));
377 // Is all required data set?
378 if (!this.isRequiredPersonalDataSet()) {
379 // No, then abort here
380 throw new FaceletException(new IllegalArgumentException("Not all personal data is set, but createContactInstance() is called.")); //NOI18N
383 // Required personal data must be set
384 assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
386 // Create new contact instance
387 Contact localContact = new UserContact();
389 // Generate phone number
390 DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
391 DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
392 DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
394 // Create new contact
395 Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
396 contact.setContactStreet(this.getStreet());
397 contact.setContactHouseNumber(this.getHouseNumber());
398 contact.setContactZipCode(this.getZipCode());
399 contact.setContactCity(this.getCity());
400 contact.setContactCountry(this.getCountry());
401 contact.setContactEmailAddress(this.getEmailAddress());
402 contact.setContactBirthday(this.getBirthday());
403 contact.setContactComment(this.getComment());
406 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: this.emailAddress={1}", this.getClass().getSimpleName(), this.getEmailAddress()));
407 // Don't set null or wrong references
408 if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getPhoneAreaCode() != null) && (this.getPhoneNumber() != null) && (this.getPhoneAreaCode() > 0) && (this.getPhoneNumber() > 0)) {
409 // Now the number must be given
410 if (phone.getPhoneAreaCode() == null) {
412 throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
413 } else if (phone.getPhoneAreaCode() < 1) {
415 throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
416 } else if (phone.getPhoneNumber() == null) {
418 throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
419 } else if (phone.getPhoneNumber() < 1) {
421 throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
425 contact.setContactLandLineNumber(phone);
428 // Don't set null or wrong references
429 if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
430 // Now the number must be given
431 if (fax.getPhoneAreaCode() == null) {
433 throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
434 } else if (fax.getPhoneAreaCode() < 1) {
436 throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
437 } else if (fax.getPhoneNumber() == null) {
439 throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
440 } else if (fax.getPhoneNumber() < 1) {
442 throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
446 contact.setContactFaxNumber(fax);
449 // Is the provider set?
450 if ((cellphone instanceof DialableCellphoneNumber) && (this.getCellphoneCarrier() instanceof MobileProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) {
451 // Is the number set?
452 if (cellphone.getPhoneNumber() == null) {
454 throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N
455 } else if (cellphone.getPhoneNumber() < 1) {
457 throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N
460 // Set cellphone number
461 contact.setContactCellphoneNumber(cellphone);
465 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: contact={1} - EXIT!", this.getClass().getSimpleName(), contact));
466 // Created timestamp and ownContact
467 contact.setContactOwnContact(Boolean.TRUE);
470 //this.getLogger().logTrace(MessageFormat.format("createContactInstance: localContact={0} - EXIT!", localContact));
476 public String doChangePersonalContactData () {
477 // This method shall only be called if the user is logged-in
478 if (!this.loginController.isUserLoggedIn()) {
480 throw new IllegalStateException("User is not logged-in"); //NOI18N
481 } else if (!this.isRequiredChangePersonalDataSet()) {
482 // Not all required fields are set
483 throw new FaceletException("Not all required fields are set."); //NOI18N
484 } else if (!this.loginController.ifCurrentPasswordMatches()) {
485 // Password not matching
486 throw new FaceletException(new UserPasswordMismatchException(this.loginController.getLoggedInUser()));
489 // Get contact instance
490 Contact contact = this.loginController.getLoggedInUser().getUserContact();
492 // It should be there, so run some tests on it
493 assert (contact instanceof Contact) : "Instance loginController.loggedInUser.userContact is null"; //NOI18N
494 assert (contact.getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null"; //NOI18N
495 assert (contact.getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", contact.getContactId()); //NOI18N
498 contact.setContactGender(this.getGender());
499 contact.setContactFirstName(this.getFirstName());
500 contact.setContactFamilyName(this.getFamilyName());
501 contact.setContactStreet(this.getStreet());
502 contact.setContactHouseNumber(this.getHouseNumber());
503 contact.setContactZipCode(this.getZipCode());
504 contact.setContactCity(this.getCity());
505 contact.setContactCountry(this.getCountry());
507 // Update contact's cellphone number
508 this.isCellphoneUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getCellphoneCarrier(), this.getCellphoneNumber());
510 // Update contact's land-line number
511 this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
513 // Update contact's fax number
514 this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
516 // Send it to the EJB
517 this.contactBean.updateContactData(contact, this.isCellphoneUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
520 return "contact_data_saved"; //NOI18N
524 @SuppressWarnings ("ReturnOfDateField")
525 public Date getBirthday () {
526 return this.birthday;
530 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
531 public void setBirthday (final Date birthday) {
532 this.birthday = birthday;
536 public MobileProvider getCellphoneCarrier () {
537 return this.cellphoneCarrier;
541 public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) {
542 this.cellphoneCarrier = cellphoneCarrier;
546 public Long getCellphoneNumber () {
547 return this.cellphoneNumber;
551 public void setCellphoneNumber (Long cellphoneNumber) {
552 this.cellphoneNumber = cellphoneNumber;
556 public String getCity () {
561 public void setCity (final String city) {
566 public String getComment () {
571 public void setComment (final String comment) {
572 this.comment = comment;
576 public Country getCountry () {
581 public void setCountry (final Country country) {
582 this.country = country;
586 public String getEmailAddress () {
587 return this.emailAddress;
591 public void setEmailAddress (final String emailAddress) {
592 this.emailAddress = emailAddress;
596 public String getEmailAddressRepeat () {
597 return this.emailAddressRepeat;
601 public void setEmailAddressRepeat (final String emailAddressRepeat) {
602 this.emailAddressRepeat = emailAddressRepeat;
606 public String getFamilyName () {
607 return this.familyName;
611 public void setFamilyName (final String familyName) {
612 this.familyName = familyName;
616 public Integer getFaxAreaCode () {
617 return this.faxAreaCode;
621 public void setFaxAreaCode (final Integer faxAreaCode) {
622 this.faxAreaCode = faxAreaCode;
626 public Country getFaxCountry () {
627 return this.faxCountry;
631 public void setFaxCountry (final Country faxCountry) {
632 this.faxCountry = faxCountry;
636 public Long getFaxNumber () {
637 return this.faxNumber;
641 public void setFaxNumber (final Long faxNumber) {
642 this.faxNumber = faxNumber;
646 public String getFirstName () {
647 return this.firstName;
651 public void setFirstName (final String firstName) {
652 this.firstName = firstName;
656 public Gender getGender () {
661 public void setGender (final Gender gender) {
662 this.gender = gender;
666 public Short getHouseNumber () {
667 return this.houseNumber;
671 public void setHouseNumber (final Short houseNumber) {
672 this.houseNumber = houseNumber;
676 public Integer getPhoneAreaCode () {
677 return this.phoneAreaCode;
681 public void setPhoneAreaCode (final Integer phoneAreaCode) {
682 this.phoneAreaCode = phoneAreaCode;
686 public Country getPhoneCountry () {
687 return this.phoneCountry;
691 public void setPhoneCountry (final Country phoneCountry) {
692 this.phoneCountry = phoneCountry;
696 public Long getPhoneNumber () {
697 return this.phoneNumber;
701 public void setPhoneNumber (final Long phoneNumber) {
702 this.phoneNumber = phoneNumber;
706 public String getStreet () {
711 public void setStreet (final String street) {
712 this.street = street;
716 public Integer getZipCode () {
721 public void setZipCode (final Integer zipCode) {
722 this.zipCode = zipCode;
726 public boolean hasContacts () {
727 return (!this.allContacts().isEmpty());
731 * Post-initialization of this class
734 public void init () {
735 // Get full email address list for reducing EJB calls
736 this.emailAddressList = this.contactBean.getEmailAddressList();
738 // Get full contact list
739 this.contactList = this.contactBean.getAllContacts();
743 public boolean isEmailAddressRegistered (final Contact contact) {
744 return ((this.emailAddressList instanceof List) && (this.emailAddressList.contains(contact.getContactEmailAddress())));
748 public boolean isRequiredChangePersonalDataSet () {
749 return ((this.getGender() != null) &&
750 (this.getFirstName() != null) &&
751 (this.getFamilyName() != null) &&
752 (this.getStreet() != null) &&
753 (this.getHouseNumber() != null) &&
754 (this.getZipCode() != null) &&
755 (this.getCity() != null));
759 public boolean isRequiredPersonalDataSet () {
760 return ((this.getGender() != null) &&
761 (this.getFirstName() != null) &&
762 (this.getFamilyName() != null) &&
763 (this.getStreet() != null) &&
764 (this.getHouseNumber() != null) &&
765 (this.getZipCode() != null) &&
766 (this.getCity() != null) &&
767 (this.getEmailAddress() != null) &&
768 (this.getEmailAddressRepeat() != null));
772 public boolean isSameEmailAddressEntered () {
773 return (Objects.equals(this.getEmailAddress(), this.getEmailAddressRepeat()));
777 public Contact lookupContactById (final Long contactId) throws ContactNotFoundException {
779 Contact localContact = null;
784 // Try to lookup it in visible user list
785 for (final Iterator<Contact> iterator = this.contactList.iterator(); iterator.hasNext();) {
787 Contact next = iterator.next();
789 // Is the user id found?
790 if (Objects.equals(next.getContactId(), contactId)) {
791 // Copy to other variable
798 if (null == localContact) {
799 // Not visible for the current user
800 throw new ContactNotFoundException(contactId);
803 // Copy all data to this bean
804 this.copyContact(localContact);
811 public void updateContactDataFromController (final Contact userContact) {
812 // Is the instance valid?
813 if (null == userContact) {
815 throw new NullPointerException("userContact is null"); //NOI18N
816 } else if (userContact.getContactId() == null) {
818 throw new NullPointerException("userContact.contactId is null"); //NOI18N
819 } else if (userContact.getContactId() < 1) {
820 // Not valid id number
821 throw new IllegalArgumentException(MessageFormat.format("userContact.contactId={0} is not valid.", userContact.getContactId())); //NOI18N
825 this.copyContact(userContact);
829 * Adds email address to bean's internal list.
831 * @param contact Contact instance
833 private void addUserNameEmailAddress (final Contact contact) {
834 // Make sure the entry is not added yet
835 if (this.emailAddressList.contains(contact.getContactEmailAddress())) {
837 throw new IllegalArgumentException(MessageFormat.format("Email address {0} already added.", contact.getContactEmailAddress())); //NOI18N
841 this.emailAddressList.add(contact.getContactEmailAddress());
847 private void clear () {
850 this.setGender(Gender.UNKNOWN);
851 this.setFirstName(null);
852 this.setFamilyName(null);
853 this.setStreet(null);
854 this.setHouseNumber(null);
855 this.setZipCode(null);
857 this.setCountry(null);
860 this.setEmailAddress(null);
861 this.setEmailAddressRepeat(null);
862 this.setPhoneAreaCode(null);
863 this.setCellphoneCarrier(null);
864 this.setFaxAreaCode(null);
867 this.setBirthday(null);
868 this.setComment(null);
872 * Copies given contact into the controller
874 * @param contact Contact instance
876 private void copyContact (final Contact contact) {
879 this.setGender(contact.getContactGender());
880 this.setFirstName(contact.getContactFirstName());
881 this.setFamilyName(contact.getContactFamilyName());
882 this.setStreet(contact.getContactStreet());
883 this.setHouseNumber(contact.getContactHouseNumber());
884 this.setZipCode(contact.getContactZipCode());
885 this.setCity(contact.getContactCity());
886 this.setCountry(contact.getContactCountry());
888 // Get cellphone, phone and fax instance
889 DialableCellphoneNumber cellphone = contact.getContactCellphoneNumber();
890 DialableFaxNumber fax = contact.getContactFaxNumber();
891 DialableLandLineNumber phone = contact.getContactLandLineNumber();
894 if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneAreaCode() > 0)) {
895 this.setPhoneCountry(phone.getPhoneCountry());
896 this.setPhoneAreaCode(phone.getPhoneAreaCode());
897 this.setPhoneNumber(phone.getPhoneNumber());
899 if ((cellphone instanceof DialableCellphoneNumber) && (cellphone.getCellphoneProvider() instanceof MobileProvider)) {
900 this.setCellphoneCarrier(cellphone.getCellphoneProvider());
901 this.setCellphoneNumber(cellphone.getPhoneNumber());
903 if ((fax instanceof DialableFaxNumber) && (fax.getPhoneAreaCode() > 0)) {
904 this.setFaxCountry(fax.getPhoneCountry());
905 this.setFaxAreaCode(fax.getPhoneAreaCode());
906 this.setFaxNumber(fax.getPhoneNumber());
908 this.setEmailAddress(contact.getContactEmailAddress());
911 this.setBirthday(contact.getContactBirthday());
912 this.setComment(contact.getContactComment());