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.pizzaapplication.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.jcontacts.contact.Contact;
34 import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
35 import org.mxchange.jcontacts.contact.UserContact;
36 import org.mxchange.jcontacts.contact.gender.Gender;
37 import org.mxchange.jcontacts.contact.utils.ContactUtils;
38 import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
39 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
40 import org.mxchange.jcountry.data.Country;
41 import org.mxchange.jcustomercore.events.AdminAddedCustomerEvent;
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;
53 import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionController;
56 * A general contact bean (controller)
58 * @author Roland Haeder<roland@mxchange.org>
60 @Named ("contactController")
62 public class PizzaContactWebSessionBean implements PizzaContactWebSessionController {
67 private static final long serialVersionUID = 542_145_347_916L;
72 private Date birthday;
75 * Cellphone number's carrier
77 private MobileProvider cellphoneCarrier;
82 private Long cellphoneNumber;
92 private String comment;
97 private final ContactSessionBeanRemote contactBean;
102 private List<Contact> contactList;
107 private Country country;
112 private String emailAddress;
117 private List<String> emailAddressList;
120 * Email address repeated
122 private String emailAddressRepeat;
127 private String familyName;
130 * Fax number's area code
132 private Integer faxAreaCode;
135 * Country instance for fax number
137 private Country faxCountry;
142 private Long faxNumber;
147 private String firstName;
152 private Gender gender;
157 private Short houseNumber;
160 * Whether a cellphone entry has been unlinked
162 private boolean isCellphoneUnlinked;
165 * Whether a fax entry has been unlinked
167 private boolean isFaxUnlinked;
170 * Whether a land-line number has been unlinked
172 private boolean isLandLineUnlinked;
175 * Login bean (controller)
178 private PizzaUserLoginWebSessionController loginController;
181 * Phone number area code
183 private Integer phoneAreaCode;
186 * Country instance for phone number
188 private Country phoneCountry;
193 private Long phoneNumber;
198 private String street;
203 private Integer zipCode;
206 * Default constructor
208 public PizzaContactWebSessionBean () {
209 // Set gender to UNKNOWN
210 this.gender = Gender.UNKNOWN;
214 // Get initial context
215 Context context = new InitialContext();
218 this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/PizzaService-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
219 } catch (final NamingException e) {
221 throw new FaceletException(e);
226 public void addEmailAddress (final String contactEmailAddress) {
228 this.emailAddressList.add(contactEmailAddress);
232 public void afterAdminAddedCustomer (@Observes final AdminAddedCustomerEvent event) {
233 // The event must be valid
236 throw new NullPointerException("event is null"); //NOI18N
237 } else if (event.getAddedCustomer() == null) {
239 throw new NullPointerException("event.addedCustomer is null"); //NOI18N
240 } else if (event.getAddedCustomer().getCustomerId() == null) {
242 throw new NullPointerException("event.addedCustomer.customerId is null"); //NOI18N
243 } else if (event.getAddedCustomer().getCustomerId() < 1) {
245 throw new IllegalArgumentException(MessageFormat.format("event.addedCustomer.customerId={0} is not valid", event.getAddedCustomer().getCustomerId())); //NOI18N //NOI18N
252 this.contactList.add(event.getAddedCustomer().getCustomerContact());
256 public void afterAdminAddedUserEvent (@Observes final AdminAddedUserEvent event) {
257 // The event must be valid
260 throw new NullPointerException("event is null"); //NOI18N
261 } else if (event.getAddedUser() == null) {
263 throw new NullPointerException("event.addedUser is null"); //NOI18N
264 } else if (event.getAddedUser().getUserId() == null) {
266 throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
267 } else if (event.getAddedUser().getUserId() < 1) {
269 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
270 } else if (event.getAddedUser().getUserContact() == null) {
272 throw new NullPointerException("event.addedUser.userContact is null"); //NOI18N
273 } else if (event.getAddedUser().getUserContact().getContactId() == null) {
275 throw new NullPointerException("event.addedUser.userContact.contactId is null"); //NOI18N
276 } else if (event.getAddedUser().getUserContact().getContactId() < 1) {
278 throw new IllegalArgumentException(MessageFormat.format("event.addedUser.userContact.contactId={0} is not valid", event.getAddedUser().getUserContact().getContactId())); //NOI18N
281 // Add user to local list
282 this.contactList.add(event.getAddedUser().getUserContact());
286 public void afterAdminUpdatedContactDataEvent (@Observes final AdminUpdatedContactEvent event) {
288 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterAdminUpdatedContactDataEvent: event={0} - CALLED!", event)); //NOI18N
290 // event should not be null
293 throw new NullPointerException("event is null"); //NOI18N
294 } else if (event.getUpdatedContact()== null) {
296 throw new NullPointerException("event.updatedUser is null"); //NOI18N
297 } else if (event.getUpdatedContact().getContactId() == null) {
299 throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N
300 } else if (event.getUpdatedContact().getContactId() < 1) {
302 throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
305 // Get iterator from list
306 Iterator<Contact> iterator = this.contactList.iterator();
308 // "Walk" through all entries
309 while (iterator.hasNext()) {
311 Contact next = iterator.next();
313 // Is id number the same?
314 if (Objects.equals(event.getUpdatedContact().getContactId(), next.getContactId())) {
315 // Found entry, so remove it and abort
316 this.contactList.remove(next);
318 // Remove also email from list
319 this.emailAddressList.remove(next.getContactEmailAddress());
324 // Add contact to list
325 this.contactList.add(event.getUpdatedContact());
327 // Add email address to list
328 this.emailAddressList.add(event.getUpdatedContact().getContactEmailAddress());
332 public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) {
334 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N
336 // event should not be null
339 throw new NullPointerException("event is null"); //NOI18N
340 } else if (event.getRegisteredUser() == null) {
342 throw new NullPointerException("event.user is null"); //NOI18N
343 } else if (event.getRegisteredUser().getUserId() == null) {
345 throw new NullPointerException("event.user.userId is null"); //NOI18N
346 } else if (event.getRegisteredUser().getUserId() < 1) {
348 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
352 Contact registeredContact = event.getRegisteredUser().getUserContact();
355 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterRegistration: registeredContact={0}", registeredContact)); //NOI18N
357 // Copy all data from registered->user
358 this.copyContact(registeredContact);
360 // Add user name and email address
361 this.addUserNameEmailAddress(registeredContact);
367 //* NOISY-DEBUG: */ System.out.println("ContactWebBean:afterRegistration: EXIT!"); //NOI18N
371 public void afterUserLogin (final @Observes UserLoggedInEvent event) {
373 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
375 // event should not be null
378 throw new NullPointerException("event is null"); //NOI18N
379 } else if (event.getLoggedInUser() == null) {
381 throw new NullPointerException("event.user is null"); //NOI18N
382 } else if (event.getLoggedInUser().getUserId() == null) {
384 throw new NullPointerException("event.user.userId is null"); //NOI18N
385 } else if (event.getLoggedInUser().getUserId() < 1) {
387 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
390 // Copy all data to this bean
391 this.copyContact(event.getLoggedInUser().getUserContact());
394 //* NOISY-DEBUG: */ System.out.println("ContactWebBean:afterUserLogin - EXIT!"); //NOI18N
398 public List<Contact> allContacts () {
399 return this.contactList;
406 public void clear () {
409 this.setGender(Gender.UNKNOWN);
410 this.setFirstName(null);
411 this.setFamilyName(null);
412 this.setStreet(null);
413 this.setHouseNumber(null);
414 this.setZipCode(null);
416 this.setCountry(null);
419 this.setEmailAddress(null);
420 this.setEmailAddressRepeat(null);
421 this.setPhoneAreaCode(null);
422 this.setCellphoneCarrier(null);
423 this.setFaxAreaCode(null);
426 this.setBirthday(null);
427 this.setComment(null);
431 public Contact createContactInstance () {
432 // Required personal data must be set
433 assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
435 // Generate phone number
436 DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
437 DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
438 DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
440 // Create new contact
441 Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
442 contact.setContactStreet(this.getStreet());
443 contact.setContactHouseNumber(this.getHouseNumber());
444 contact.setContactZipCode(this.getZipCode());
445 contact.setContactCity(this.getCity());
446 contact.setContactCountry(this.getCountry());
447 contact.setContactEmailAddress(this.getEmailAddress());
448 contact.setContactBirthday(this.getBirthday());
449 contact.setContactComment(this.getComment());
452 contact.setContactOwnContact(Boolean.TRUE);
454 // Don't set null or wrong references
455 if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getPhoneAreaCode() != null) && (this.getPhoneNumber() != null) && (this.getPhoneAreaCode() > 0) && (this.getPhoneNumber() > 0)) {
456 // Now the number must be given
457 if (phone.getPhoneAreaCode() == null) {
459 throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
460 } else if (phone.getPhoneAreaCode() < 1) {
462 throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
463 } else if (phone.getPhoneNumber() == null) {
465 throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
466 } else if (phone.getPhoneNumber() < 1) {
468 throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
472 contact.setContactLandLineNumber(phone);
475 // Don't set null or wrong references
476 if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
477 // Now the number must be given
478 if (fax.getPhoneAreaCode() == null) {
480 throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
481 } else if (fax.getPhoneAreaCode() < 1) {
483 throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
484 } else if (fax.getPhoneNumber() == null) {
486 throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
487 } else if (fax.getPhoneNumber() < 1) {
489 throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
493 contact.setContactFaxNumber(fax);
496 // Is the provider set?
497 if ((cellphone instanceof DialableCellphoneNumber) && (this.getCellphoneCarrier() instanceof MobileProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) {
498 // Is the number set?
499 if (cellphone.getPhoneNumber() == null) {
501 throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N
502 } else if (cellphone.getPhoneNumber() < 1) {
504 throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N
507 // Set cellphone number
508 contact.setContactCellphoneNumber(cellphone);
516 public String doChangePersonalContactData () {
517 // This method shall only be called if the user is logged-in
518 if (!this.loginController.isUserLoggedIn()) {
520 throw new IllegalStateException("User is not logged-in"); //NOI18N
521 } else if (!this.isRequiredChangePersonalDataSet()) {
522 // Not all required fields are set
523 throw new FaceletException("Not all required fields are set."); //NOI18N
524 } else if (!this.loginController.ifCurrentPasswordMatches()) {
525 // Password not matching
526 throw new FaceletException(new UserPasswordMismatchException(this.loginController.getLoggedInUser()));
529 // Get contact instance
530 Contact contact = this.loginController.getLoggedInUser().getUserContact();
532 // It should be there, so run some tests on it
533 assert (contact instanceof Contact) : "Instance loginController.loggedInUser.userContact is null"; //NOI18N
534 assert (contact.getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null"; //NOI18N
535 assert (contact.getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", contact.getContactId()); //NOI18N
538 contact.setContactGender(this.getGender());
539 contact.setContactFirstName(this.getFirstName());
540 contact.setContactFamilyName(this.getFamilyName());
541 contact.setContactStreet(this.getStreet());
542 contact.setContactHouseNumber(this.getHouseNumber());
543 contact.setContactZipCode(this.getZipCode());
544 contact.setContactCity(this.getCity());
545 contact.setContactCountry(this.getCountry());
547 // Update contact's cellphone number
548 this.isCellphoneUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getCellphoneCarrier(), this.getCellphoneNumber());
550 // Update contact's land-line number
551 this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
553 // Update contact's fax number
554 this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
556 // Send it to the EJB
557 this.contactBean.updateContactData(contact, this.isCellphoneUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
560 return "contact_data_saved"; //NOI18N
564 public Date getBirthday () {
565 return this.birthday;
569 public void setBirthday (final Date birthday) {
570 this.birthday = birthday;
574 public MobileProvider getCellphoneCarrier () {
575 return this.cellphoneCarrier;
579 public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) {
580 this.cellphoneCarrier = cellphoneCarrier;
584 public Long getCellphoneNumber () {
585 return this.cellphoneNumber;
589 public void setCellphoneNumber (Long cellphoneNumber) {
590 this.cellphoneNumber = cellphoneNumber;
594 public String getCity () {
599 public void setCity (final String city) {
604 public String getComment () {
609 public void setComment (final String comment) {
610 this.comment = comment;
614 public Country getCountry () {
619 public void setCountry (final Country country) {
620 this.country = country;
624 public String getEmailAddress () {
625 return this.emailAddress;
629 public void setEmailAddress (final String emailAddress) {
630 this.emailAddress = emailAddress;
634 public String getEmailAddressRepeat () {
635 return this.emailAddressRepeat;
639 public void setEmailAddressRepeat (final String emailAddressRepeat) {
640 this.emailAddressRepeat = emailAddressRepeat;
644 public String getFamilyName () {
645 return this.familyName;
649 public void setFamilyName (final String familyName) {
650 this.familyName = familyName;
654 public Integer getFaxAreaCode () {
655 return this.faxAreaCode;
659 public void setFaxAreaCode (final Integer faxAreaCode) {
660 this.faxAreaCode = faxAreaCode;
664 public Country getFaxCountry () {
665 return this.faxCountry;
669 public void setFaxCountry (final Country faxCountry) {
670 this.faxCountry = faxCountry;
674 public Long getFaxNumber () {
675 return this.faxNumber;
679 public void setFaxNumber (final Long faxNumber) {
680 this.faxNumber = faxNumber;
684 public String getFirstName () {
685 return this.firstName;
689 public void setFirstName (final String firstName) {
690 this.firstName = firstName;
694 public Gender getGender () {
699 public void setGender (final Gender gender) {
700 this.gender = gender;
704 public Short getHouseNumber () {
705 return this.houseNumber;
709 public void setHouseNumber (final Short houseNumber) {
710 this.houseNumber = houseNumber;
714 public Integer getPhoneAreaCode () {
715 return this.phoneAreaCode;
719 public void setPhoneAreaCode (final Integer phoneAreaCode) {
720 this.phoneAreaCode = phoneAreaCode;
724 public Country getPhoneCountry () {
725 return this.phoneCountry;
729 public void setPhoneCountry (final Country phoneCountry) {
730 this.phoneCountry = phoneCountry;
734 public Long getPhoneNumber () {
735 return this.phoneNumber;
739 public void setPhoneNumber (final Long phoneNumber) {
740 this.phoneNumber = phoneNumber;
744 public String getStreet () {
749 public void setStreet (final String street) {
750 this.street = street;
754 public Integer getZipCode () {
759 public void setZipCode (final Integer zipCode) {
760 this.zipCode = zipCode;
764 * Post-initialization of this class
767 public void init () {
768 // Get full email address list for reducing EJB calls
769 this.emailAddressList = this.contactBean.getEmailAddressList();
771 // Get full contact list
772 this.contactList = this.contactBean.getAllContacts();
776 public boolean isEmailAddressRegistered (final Contact contact) {
777 return ((this.emailAddressList instanceof List) && (this.emailAddressList.contains(contact.getContactEmailAddress())));
781 public boolean isRequiredChangePersonalDataSet () {
782 return ((this.getGender() != null) &&
783 (this.getFirstName() != null) &&
784 (this.getFamilyName() != null) &&
785 (this.getStreet() != null) &&
786 (this.getHouseNumber() != null) &&
787 (this.getZipCode() != null) &&
788 (this.getCity() != null));
792 public boolean isRequiredPersonalDataSet () {
793 return ((this.getGender() != null) &&
794 (this.getFirstName() != null) &&
795 (this.getFamilyName() != null) &&
796 (this.getStreet() != null) &&
797 (this.getHouseNumber() != null) &&
798 (this.getZipCode() != null) &&
799 (this.getCity() != null) &&
800 (this.getEmailAddress() != null) &&
801 (this.getEmailAddressRepeat() != null));
805 public boolean isSameEmailAddressEntered () {
806 return (Objects.equals(this.getEmailAddress(), this.getEmailAddressRepeat()));
810 public Contact lookupContactById (final Long contactId) throws ContactNotFoundException {
812 Contact localContact = null;
817 // Try to lookup it in visible user list
818 for (final Iterator<Contact> iterator = this.contactList.iterator(); iterator.hasNext();) {
820 Contact next = iterator.next();
822 // Is the user id found?
823 if (Objects.equals(next.getContactId(), contactId)) {
824 // Copy to other variable
831 if (null == localContact) {
832 // Not visible for the current user
833 throw new ContactNotFoundException(contactId);
836 // Copy all data to this bean
837 this.copyContact(localContact);
844 public void updateContactDataFromController (final Contact userContact) {
845 // Is the instance valid?
846 if (null == userContact) {
848 throw new NullPointerException("userContact is null"); //NOI18N
849 } else if (userContact.getContactId() == null) {
851 throw new NullPointerException("userContact.contactId is null"); //NOI18N
852 } else if (userContact.getContactId() < 1) {
853 // Not valid id number
854 throw new IllegalArgumentException(MessageFormat.format("userContact.contactId={0} is not valid.", userContact.getContactId())); //NOI18N
858 this.copyContact(userContact);
862 * Adds email address to bean's internal list.
864 * @param contact Contact instance
866 private void addUserNameEmailAddress (final Contact contact) {
867 // Make sure the entry is not added yet
868 if (this.emailAddressList.contains(contact.getContactEmailAddress())) {
870 throw new IllegalArgumentException(MessageFormat.format("Email address {0} already added.", contact.getContactEmailAddress())); //NOI18N
874 this.emailAddressList.add(contact.getContactEmailAddress());
878 * Copies given contact into the controller
880 * @param contact Contact instance
882 private void copyContact (final Contact contact) {
885 this.setGender(contact.getContactGender());
886 this.setFirstName(contact.getContactFirstName());
887 this.setFamilyName(contact.getContactFamilyName());
888 this.setStreet(contact.getContactStreet());
889 this.setHouseNumber(contact.getContactHouseNumber());
890 this.setZipCode(contact.getContactZipCode());
891 this.setCity(contact.getContactCity());
892 this.setCountry(contact.getContactCountry());
894 // Get cellphone, phone and fax instance
895 DialableCellphoneNumber cellphone = contact.getContactCellphoneNumber();
896 DialableFaxNumber fax = contact.getContactFaxNumber();
897 DialableLandLineNumber phone = contact.getContactLandLineNumber();
900 if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneAreaCode() > 0)) {
901 this.setPhoneCountry(phone.getPhoneCountry());
902 this.setPhoneAreaCode(phone.getPhoneAreaCode());
903 this.setPhoneNumber(phone.getPhoneNumber());
905 if ((cellphone instanceof DialableCellphoneNumber) && (cellphone.getCellphoneProvider() instanceof MobileProvider)) {
906 this.setCellphoneCarrier(cellphone.getCellphoneProvider());
907 this.setCellphoneNumber(cellphone.getPhoneNumber());
909 if ((fax instanceof DialableFaxNumber) && (fax.getPhoneAreaCode() > 0)) {
910 this.setFaxCountry(fax.getPhoneCountry());
911 this.setFaxAreaCode(fax.getPhoneAreaCode());
912 this.setFaxNumber(fax.getPhoneNumber());
914 this.setEmailAddress(contact.getContactEmailAddress());
917 this.setBirthday(contact.getContactBirthday());
918 this.setComment(contact.getContactComment());