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.jjobs.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.jjobs.beans.login.JobsUserLoginWebSessionController;
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 JobsContactWebSessionBean implements JobsContactWebSessionController {
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 * Phone number area code
176 private Integer phoneAreaCode;
179 * Country instance for phone number
181 private Country phoneCountry;
186 private Long phoneNumber;
191 private String street;
194 * Login bean (controller)
197 private JobsUserLoginWebSessionController userLoginController;
202 private Integer zipCode;
205 * Default constructor
207 public JobsContactWebSessionBean () {
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.updatedUser is null"); //NOI18N
266 } else if (event.getUpdatedContact().getContactId() == null) {
268 throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N
269 } else if (event.getUpdatedContact().getContactId() < 1) {
271 throw new IllegalArgumentException(MessageFormat.format("contactId of contact={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 (@Observes final 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
325 // Copy all data from registered->user
326 this.copyContact(registeredContact);
328 // Add user name and email address
329 this.addUserNameEmailAddress(registeredContact);
335 //* NOISY-DEBUG: */ System.out.println("ContactWebBean:afterRegistration: EXIT!"); //NOI18N
339 public void afterUserLogin (@Observes final UserLoggedInEvent event) {
341 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
343 // event should not be null
346 throw new NullPointerException("event is null"); //NOI18N
347 } else if (event.getLoggedInUser() == null) {
349 throw new NullPointerException("event.user is null"); //NOI18N
350 } else if (event.getLoggedInUser().getUserId() == null) {
352 throw new NullPointerException("event.user.userId is null"); //NOI18N
353 } else if (event.getLoggedInUser().getUserId() < 1) {
355 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
358 // Copy all data to this bean
359 this.copyContact(event.getLoggedInUser().getUserContact());
362 //* NOISY-DEBUG: */ System.out.println("ContactWebBean:afterUserLogin - EXIT!"); //NOI18N
366 @SuppressWarnings ("ReturnOfCollectionOrArrayField")
367 public List<Contact> allContacts () {
368 return this.contactList;
372 public Contact createContactInstance () {
374 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: CALLED!", this.getClass().getSimpleName()));
376 // Is all required data set?
377 if (!this.isRequiredPersonalDataSet()) {
378 // No, then abort here
379 throw new FaceletException(new IllegalArgumentException("Not all personal data is set, but createContactInstance() is called.")); //NOI18N
382 // Required personal data must be set
383 assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
385 // Create new contact instance
386 Contact localContact = new UserContact();
388 // Generate phone number
389 DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
390 DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
391 DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
393 // Create new contact
394 Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
395 contact.setContactStreet(this.getStreet());
396 contact.setContactHouseNumber(this.getHouseNumber());
397 contact.setContactZipCode(this.getZipCode());
398 contact.setContactCity(this.getCity());
399 contact.setContactCountry(this.getCountry());
400 contact.setContactEmailAddress(this.getEmailAddress());
401 contact.setContactBirthday(this.getBirthday());
402 contact.setContactComment(this.getComment());
405 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: this.emailAddress={1}", this.getClass().getSimpleName(), this.getEmailAddress()));
406 // Don't set null or wrong references
407 if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getPhoneAreaCode() != null) && (this.getPhoneNumber() != null) && (this.getPhoneAreaCode() > 0) && (this.getPhoneNumber() > 0)) {
408 // Now the number must be given
409 if (phone.getPhoneAreaCode() == null) {
411 throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
412 } else if (phone.getPhoneAreaCode() < 1) {
414 throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
415 } else if (phone.getPhoneNumber() == null) {
417 throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
418 } else if (phone.getPhoneNumber() < 1) {
420 throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
424 contact.setContactLandLineNumber(phone);
427 // Don't set null or wrong references
428 if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
429 // Now the number must be given
430 if (fax.getPhoneAreaCode() == null) {
432 throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
433 } else if (fax.getPhoneAreaCode() < 1) {
435 throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
436 } else if (fax.getPhoneNumber() == null) {
438 throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
439 } else if (fax.getPhoneNumber() < 1) {
441 throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
445 contact.setContactFaxNumber(fax);
448 // Is the provider set?
449 if ((cellphone instanceof DialableCellphoneNumber) && (this.getCellphoneCarrier() instanceof MobileProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) {
450 // Is the number set?
451 if (cellphone.getPhoneNumber() == null) {
453 throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N
454 } else if (cellphone.getPhoneNumber() < 1) {
456 throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N
459 // Set cellphone number
460 contact.setContactCellphoneNumber(cellphone);
464 //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("{0}.createContactInstance: contact={1} - EXIT!", this.getClass().getSimpleName(), contact));
465 // Created timestamp and ownContact
466 contact.setContactOwnContact(Boolean.TRUE);
469 //this.getLogger().logTrace(MessageFormat.format("createContactInstance: localContact={0} - EXIT!", localContact));
475 public String doChangePersonalContactData () {
476 // This method shall only be called if the user is logged-in
477 if (!this.userLoginController.isUserLoggedIn()) {
479 throw new IllegalStateException("User is not logged-in"); //NOI18N
480 } else if (!this.isRequiredChangePersonalDataSet()) {
481 // Not all required fields are set
482 throw new FaceletException("Not all required fields are set."); //NOI18N
483 } else if (!this.userLoginController.ifCurrentPasswordMatches()) {
484 // Password not matching
485 throw new FaceletException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()));
488 // Get contact instance
489 Contact contact = this.userLoginController.getLoggedInUser().getUserContact();
491 // It should be there, so run some tests on it
492 assert (contact instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null"; //NOI18N
493 assert (contact.getContactId() instanceof Long) : "Instance userLoginController.userContact.contactId is null"; //NOI18N
494 assert (contact.getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", contact.getContactId()); //NOI18N
497 contact.setContactGender(this.getGender());
498 contact.setContactFirstName(this.getFirstName());
499 contact.setContactFamilyName(this.getFamilyName());
500 contact.setContactStreet(this.getStreet());
501 contact.setContactHouseNumber(this.getHouseNumber());
502 contact.setContactZipCode(this.getZipCode());
503 contact.setContactCity(this.getCity());
504 contact.setContactCountry(this.getCountry());
506 // Update contact's cellphone number
507 this.isCellphoneUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getCellphoneCarrier(), this.getCellphoneNumber());
509 // Update contact's land-line number
510 this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
512 // Update contact's fax number
513 this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
515 // Send it to the EJB
516 this.contactBean.updateContactData(contact, this.isCellphoneUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
519 return "contact_data_saved"; //NOI18N
523 @SuppressWarnings ("ReturnOfDateField")
524 public Date getBirthday () {
525 return this.birthday;
529 @SuppressWarnings ("AssignmentToDateFieldFromParameter")
530 public void setBirthday (final Date birthday) {
531 this.birthday = birthday;
535 public MobileProvider getCellphoneCarrier () {
536 return this.cellphoneCarrier;
540 public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) {
541 this.cellphoneCarrier = cellphoneCarrier;
545 public Long getCellphoneNumber () {
546 return this.cellphoneNumber;
550 public void setCellphoneNumber (Long cellphoneNumber) {
551 this.cellphoneNumber = cellphoneNumber;
555 public String getCity () {
560 public void setCity (final String city) {
565 public String getComment () {
570 public void setComment (final String comment) {
571 this.comment = comment;
575 public Country getCountry () {
580 public void setCountry (final Country country) {
581 this.country = country;
585 public String getEmailAddress () {
586 return this.emailAddress;
590 public void setEmailAddress (final String emailAddress) {
591 this.emailAddress = emailAddress;
595 public String getEmailAddressRepeat () {
596 return this.emailAddressRepeat;
600 public void setEmailAddressRepeat (final String emailAddressRepeat) {
601 this.emailAddressRepeat = emailAddressRepeat;
605 public String getFamilyName () {
606 return this.familyName;
610 public void setFamilyName (final String familyName) {
611 this.familyName = familyName;
615 public Integer getFaxAreaCode () {
616 return this.faxAreaCode;
620 public void setFaxAreaCode (final Integer faxAreaCode) {
621 this.faxAreaCode = faxAreaCode;
625 public Country getFaxCountry () {
626 return this.faxCountry;
630 public void setFaxCountry (final Country faxCountry) {
631 this.faxCountry = faxCountry;
635 public Long getFaxNumber () {
636 return this.faxNumber;
640 public void setFaxNumber (final Long faxNumber) {
641 this.faxNumber = faxNumber;
645 public String getFirstName () {
646 return this.firstName;
650 public void setFirstName (final String firstName) {
651 this.firstName = firstName;
655 public Gender getGender () {
660 public void setGender (final Gender gender) {
661 this.gender = gender;
665 public Short getHouseNumber () {
666 return this.houseNumber;
670 public void setHouseNumber (final Short houseNumber) {
671 this.houseNumber = houseNumber;
675 public Integer getPhoneAreaCode () {
676 return this.phoneAreaCode;
680 public void setPhoneAreaCode (final Integer phoneAreaCode) {
681 this.phoneAreaCode = phoneAreaCode;
685 public Country getPhoneCountry () {
686 return this.phoneCountry;
690 public void setPhoneCountry (final Country phoneCountry) {
691 this.phoneCountry = phoneCountry;
695 public Long getPhoneNumber () {
696 return this.phoneNumber;
700 public void setPhoneNumber (final Long phoneNumber) {
701 this.phoneNumber = phoneNumber;
705 public String getStreet () {
710 public void setStreet (final String street) {
711 this.street = street;
715 public Integer getZipCode () {
720 public void setZipCode (final Integer zipCode) {
721 this.zipCode = zipCode;
725 public boolean hasContacts () {
726 return (!this.allContacts().isEmpty());
730 * Post-initialization of this class
733 public void init () {
734 // Get full email address list for reducing EJB calls
735 this.emailAddressList = this.contactBean.getEmailAddressList();
737 // Get full contact list
738 this.contactList = this.contactBean.getAllContacts();
742 public boolean isEmailAddressRegistered (final Contact contact) {
743 return ((this.emailAddressList instanceof List) && (this.emailAddressList.contains(contact.getContactEmailAddress())));
747 public boolean isRequiredChangePersonalDataSet () {
748 return ((this.getGender() != null) &&
749 (this.getFirstName() != null) &&
750 (this.getFamilyName() != null) &&
751 (this.getStreet() != null) &&
752 (this.getHouseNumber() != null) &&
753 (this.getZipCode() != null) &&
754 (this.getCity() != null));
758 public boolean isRequiredPersonalDataSet () {
759 return ((this.getGender() != null) &&
760 (this.getFirstName() != null) &&
761 (this.getFamilyName() != null) &&
762 (this.getStreet() != null) &&
763 (this.getHouseNumber() != null) &&
764 (this.getZipCode() != null) &&
765 (this.getCity() != null) &&
766 (this.getEmailAddress() != null) &&
767 (this.getEmailAddressRepeat() != null));
771 public boolean isSameEmailAddressEntered () {
772 return (Objects.equals(this.getEmailAddress(), this.getEmailAddressRepeat()));
776 public Contact lookupContactById (final Long contactId) throws ContactNotFoundException {
778 Contact localContact = null;
783 // Try to lookup it in visible user list
784 for (final Iterator<Contact> iterator = this.contactList.iterator(); iterator.hasNext();) {
786 Contact next = iterator.next();
788 // Is the user id found?
789 if (Objects.equals(next.getContactId(), contactId)) {
790 // Copy to other variable
797 if (null == localContact) {
798 // Not visible for the current user
799 throw new ContactNotFoundException(contactId);
802 // Copy all data to this bean
803 this.copyContact(localContact);
810 public void updateContactDataFromController (final Contact userContact) {
811 // Is the instance valid?
812 if (null == userContact) {
814 throw new NullPointerException("userContact is null"); //NOI18N
815 } else if (userContact.getContactId() == null) {
817 throw new NullPointerException("userContact.contactId is null"); //NOI18N
818 } else if (userContact.getContactId() < 1) {
819 // Not valid id number
820 throw new IllegalArgumentException(MessageFormat.format("userContact.contactId={0} is not valid.", userContact.getContactId())); //NOI18N
824 this.copyContact(userContact);
828 * Adds email address to bean's internal list.
830 * @param contact Contact instance
832 private void addUserNameEmailAddress (final Contact contact) {
833 // Make sure the entry is not added yet
834 if (this.emailAddressList.contains(contact.getContactEmailAddress())) {
836 throw new IllegalArgumentException(MessageFormat.format("Email address {0} already added.", contact.getContactEmailAddress())); //NOI18N
840 this.emailAddressList.add(contact.getContactEmailAddress());
846 private void clear () {
849 this.setGender(Gender.UNKNOWN);
850 this.setFirstName(null);
851 this.setFamilyName(null);
852 this.setStreet(null);
853 this.setHouseNumber(null);
854 this.setZipCode(null);
856 this.setCountry(null);
859 this.setEmailAddress(null);
860 this.setEmailAddressRepeat(null);
861 this.setPhoneAreaCode(null);
862 this.setCellphoneCarrier(null);
863 this.setFaxAreaCode(null);
866 this.setBirthday(null);
867 this.setComment(null);
871 * Copies given contact into the controller
873 * @param contact Contact instance
875 private void copyContact (final Contact contact) {
878 this.setGender(contact.getContactGender());
879 this.setFirstName(contact.getContactFirstName());
880 this.setFamilyName(contact.getContactFamilyName());
881 this.setStreet(contact.getContactStreet());
882 this.setHouseNumber(contact.getContactHouseNumber());
883 this.setZipCode(contact.getContactZipCode());
884 this.setCity(contact.getContactCity());
885 this.setCountry(contact.getContactCountry());
887 // Get cellphone, phone and fax instance
888 DialableCellphoneNumber cellphone = contact.getContactCellphoneNumber();
889 DialableFaxNumber fax = contact.getContactFaxNumber();
890 DialableLandLineNumber phone = contact.getContactLandLineNumber();
893 if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneAreaCode() > 0)) {
894 this.setPhoneCountry(phone.getPhoneCountry());
895 this.setPhoneAreaCode(phone.getPhoneAreaCode());
896 this.setPhoneNumber(phone.getPhoneNumber());
898 if ((cellphone instanceof DialableCellphoneNumber) && (cellphone.getCellphoneProvider() instanceof MobileProvider)) {
899 this.setCellphoneCarrier(cellphone.getCellphoneProvider());
900 this.setCellphoneNumber(cellphone.getPhoneNumber());
902 if ((fax instanceof DialableFaxNumber) && (fax.getPhoneAreaCode() > 0)) {
903 this.setFaxCountry(fax.getPhoneCountry());
904 this.setFaxAreaCode(fax.getPhoneAreaCode());
905 this.setFaxNumber(fax.getPhoneNumber());
907 this.setEmailAddress(contact.getContactEmailAddress());
910 this.setBirthday(contact.getContactBirthday());
911 this.setComment(contact.getContactComment());