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.user;
19 import java.text.MessageFormat;
20 import java.util.Collections;
21 import java.util.Date;
22 import java.util.Iterator;
23 import java.util.List;
24 import java.util.Objects;
25 import javax.annotation.PostConstruct;
26 import javax.enterprise.context.SessionScoped;
27 import javax.enterprise.event.Observes;
28 import javax.faces.view.facelets.FaceletException;
29 import javax.inject.Inject;
30 import javax.inject.Named;
31 import javax.naming.Context;
32 import javax.naming.InitialContext;
33 import javax.naming.NamingException;
34 import org.mxchange.jcontacts.contact.Contact;
35 import org.mxchange.jcontacts.contact.UserContact;
36 import org.mxchange.jcontacts.contact.gender.Gender;
37 import org.mxchange.jcountry.data.Country;
38 import org.mxchange.jjobs.beans.login.JobsUserLoginWebSessionController;
39 import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
40 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
41 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
42 import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
43 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
44 import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
45 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
46 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
47 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
48 import org.mxchange.jusercore.exceptions.UserNotFoundException;
49 import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
50 import org.mxchange.jusercore.model.user.LoginUser;
51 import org.mxchange.jusercore.model.user.User;
52 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
53 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
56 * A user bean (controller)
58 * @author Roland Haeder<roland@mxchange.org>
60 @Named ("userController")
62 public class JobsUserWebSessionBean implements JobsUserWebSessionController {
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 Country country;
102 private String emailAddress;
107 private List<String> emailAddressList;
110 * Email address repeated
112 private String emailAddressRepeat;
117 private String familyName;
120 * Fax number's area code
122 private Integer faxAreaCode;
125 * Country instance for fax number
127 private Country faxCountry;
132 private Long faxNumber;
137 private String firstName;
142 private Gender gender;
147 private Short houseNumber;
150 * Login bean (controller)
153 private JobsUserLoginWebSessionController loginController;
156 * Phone number area code
158 private Integer phoneAreaCode;
161 * Country instance for phone number
163 private Country phoneCountry;
168 private Long phoneNumber;
173 private String street;
183 private final UserSessionBeanRemote userBean;
193 private String userName;
198 private List<String> userNameList;
201 * User password (unencrypted from web form)
203 private String userPassword;
206 * User password repeated (unencrypted from web form)
208 private String userPasswordRepeat;
211 * Whether the user wants a public profile
213 private ProfileMode userProfileMode;
216 * A list of all public user profiles
218 private List<User> visibleUserList;
223 private Integer zipCode;
226 * Default constructor
228 public JobsUserWebSessionBean () {
229 // Set gender to UNKNOWN
230 this.gender = Gender.UNKNOWN;
234 // Get initial context
235 Context context = new InitialContext();
238 this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
239 } catch (final NamingException e) {
241 throw new FaceletException(e);
246 public void afterRegistrationEvent (final @Observes UserRegisteredEvent event) {
248 System.out.println(MessageFormat.format("UserWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N
250 // event should not be null
253 throw new NullPointerException("event is null"); //NOI18N
254 } else if (event.getRegisteredUser() == null) {
256 throw new NullPointerException("event.user is null"); //NOI18N
257 } else if (event.getRegisteredUser().getUserId() == null) {
259 throw new NullPointerException("event.user.userId is null"); //NOI18N
260 } else if (event.getRegisteredUser().getUserId() < 1) {
262 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
266 User registeredUser = event.getRegisteredUser();
269 System.out.println(MessageFormat.format("UserWebBean:afterRegistration: registeredUser={0}", registeredUser)); //NOI18N
271 // Copy all data from registered->user
272 this.copyUser(registeredUser);
274 // Add user name and email address
275 this.addUserNameEmailAddress(registeredUser);
281 this.setUserId(registeredUser.getUserId());
283 // Is the account public?
284 if (Objects.equals(registeredUser.getUserProfileMode(), ProfileMode.PUBLIC)) {
285 // Also add it to this list
286 this.visibleUserList.add(registeredUser);
290 System.out.println("UserWebBean:afterRegistration: EXIT!"); //NOI18N
294 public void afterUserLogin (final @Observes UserLoggedInEvent event) {
296 System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
298 // event should not be null
301 throw new NullPointerException("event is null"); //NOI18N
302 } else if (event.getLoggedInUser() == null) {
304 throw new NullPointerException("event.user is null"); //NOI18N
305 } else if (event.getLoggedInUser().getUserId() == null) {
307 throw new NullPointerException("event.user.userId is null"); //NOI18N
308 } else if (event.getLoggedInUser().getUserId() < 1) {
310 throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
313 // Re-initialize list
314 this.visibleUserList = this.userBean.allMemberPublicVisibleUsers();
316 // Copy all data to this bean
317 this.copyUser(event.getLoggedInUser());
320 System.out.println(MessageFormat.format("UserWebBean:afterUserLogin: this.visibleUserList.size()={0} - EXIT!", this.visibleUserList.size())); //NOI18N
324 public List<User> allVisibleUsers () {
326 return Collections.unmodifiableList(this.visibleUserList);
330 public User createUserInstance () {
332 //this.getLogger().logTrace("createUserInstance: CALLED!");
334 // Required personal data must be set
335 assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
337 // Create new user instance
338 User localUser = new LoginUser();
340 // Update all data ...
341 localUser.setUserName(this.getUserName());
342 localUser.setUserProfileMode(this.getUserProfileMode());
344 // Generate phone number
345 DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
346 DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
347 DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
349 // Create new contact
350 Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
351 contact.setContactStreet(this.getStreet());
352 contact.setContactHouseNumber(this.getHouseNumber());
353 contact.setContactZipCode(this.getZipCode());
354 contact.setContactCity(this.getCity());
355 contact.setContactCountry(this.getCountry());
356 contact.setContactEmailAddress(this.getEmailAddress());
358 // Don't set null or wrong references
359 if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getPhoneAreaCode() != null) && (this.getPhoneNumber() != null) && (this.getPhoneAreaCode() > 0) && (this.getPhoneNumber() > 0)) {
360 // Now the number must be given
361 if (phone.getPhoneAreaCode() == null) {
363 throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
364 } else if (phone.getPhoneAreaCode() < 1) {
366 throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
367 } else if (phone.getPhoneNumber() == null) {
369 throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
370 } else if (phone.getPhoneNumber() < 1) {
372 throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
376 contact.setContactLandLineNumber(phone);
379 // Don't set null or wrong references
380 if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
381 // Now the number must be given
382 if (fax.getPhoneAreaCode() == null) {
384 throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
385 } else if (fax.getPhoneAreaCode() < 1) {
387 throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
388 } else if (fax.getPhoneNumber() == null) {
390 throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
391 } else if (fax.getPhoneNumber() < 1) {
393 throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
397 contact.setContactFaxNumber(fax);
400 // Is the provider set?
401 if ((cellphone instanceof DialableCellphoneNumber) && (this.getCellphoneCarrier() instanceof MobileProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) {
402 // Is the number set?
403 if (cellphone.getPhoneNumber() == null) {
405 throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N
406 } else if (cellphone.getPhoneNumber() < 1) {
408 throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N
411 // Set cellphone number
412 contact.setContactCellphoneNumber(cellphone);
415 contact.setContactBirthday(this.getBirthday());
416 contact.setContactComment(this.getComment());
418 // Created timestamp and ownContact
419 contact.setContactOwnContact(Boolean.TRUE);
421 // Set contact in user
422 localUser.setUserContact(contact);
425 //this.getLogger().logTrace(MessageFormat.format("createUserInstance: user={0} - EXIT!", user));
432 public String doChangePersonalData () {
433 // This method shall only be called if the user is logged-in
434 if (!this.loginController.isUserLoggedIn()) {
436 throw new IllegalStateException("User is not logged-in"); //NOI18N
437 } else if (!this.isRequiredChangePersonalDataSet()) {
438 // Not all required fields are set
439 throw new FaceletException("Not all required fields are set."); //NOI18N
440 } else if (!this.loginController.ifCurrentPasswordMatches()) {
441 // Password not matching
442 throw new FaceletException(new UserPasswordMismatchException(this.loginController.getLoggedInUser()));
446 User user = this.loginController.getLoggedInUser();
448 // It should be there, so run some tests on it
449 assert (user instanceof User) : "Instance loginController.loggedInUser is null";
450 assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null";
451 assert (user.getUserId() > 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId());
452 assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null";
453 assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null";
454 assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId());
457 user.setUserProfileMode(this.getUserProfileMode());
458 user.getUserContact().setContactGender(this.getGender());
459 user.getUserContact().setContactFirstName(this.getFirstName());
460 user.getUserContact().setContactFamilyName(this.getFamilyName());
461 user.getUserContact().setContactStreet(this.getStreet());
462 user.getUserContact().setContactHouseNumber(this.getHouseNumber());
463 user.getUserContact().setContactZipCode(this.getZipCode());
464 user.getUserContact().setContactCity(this.getCity());
465 user.getUserContact().setContactCountry(this.getCountry());
467 // Is there a phone number?
468 if (user.getUserContact().getContactLandLineNumber() instanceof DialableLandLineNumber) {
470 System.out.println(MessageFormat.format("UserWebBean:doChangePersonalData: phoneId={0}", user.getUserContact().getContactLandLineNumber().getPhoneId())); //NOI18N
472 // Yes, then update as well
473 user.getUserContact().getContactLandLineNumber().setPhoneAreaCode(this.getPhoneAreaCode());
474 user.getUserContact().getContactLandLineNumber().setPhoneNumber(this.getPhoneNumber());
477 // Is there a fax number?
478 if (user.getUserContact().getContactFaxNumber() instanceof DialableFaxNumber) {
480 System.out.println(MessageFormat.format("UserWebBean:doChangePersonalData: faxId={0}", user.getUserContact().getContactFaxNumber().getPhoneId())); //NOI18N
482 // Yes, then update as well
483 user.getUserContact().getContactFaxNumber().setPhoneAreaCode(this.getFaxAreaCode());
484 user.getUserContact().getContactFaxNumber().setPhoneNumber(this.getFaxNumber());
487 // Is there a cellphone number?
488 if (user.getUserContact().getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
490 System.out.println(MessageFormat.format("UserWebBean:doChangePersonalData: cellPhoneId={0}", user.getUserContact().getContactCellphoneNumber().getPhoneId())); //NOI18N
492 // Yes, then update as well
493 user.getUserContact().getContactCellphoneNumber().setCellphoneProvider(this.getCellphoneCarrier());
494 user.getUserContact().getContactCellphoneNumber().setPhoneNumber(this.getCellphoneNumber());
497 // Send it to the EJB
498 this.userBean.updateUserPersonalData(user);
501 return "login_data_saved"; //NOI18N
505 public Date getBirthday () {
506 return this.birthday;
510 public void setBirthday (final Date birthday) {
511 this.birthday = birthday;
515 public MobileProvider getCellphoneCarrier () {
516 return this.cellphoneCarrier;
520 public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) {
521 this.cellphoneCarrier = cellphoneCarrier;
525 public Long getCellphoneNumber () {
526 return this.cellphoneNumber;
530 public void setCellphoneNumber (Long cellphoneNumber) {
531 this.cellphoneNumber = cellphoneNumber;
535 public String getCity () {
540 public void setCity (final String city) {
545 public String getComment () {
550 public void setComment (final String comment) {
551 this.comment = comment;
555 public Country getCountry () {
560 public void setCountry (final Country country) {
561 this.country = country;
565 public String getEmailAddress () {
566 return this.emailAddress;
570 public void setEmailAddress (final String emailAddress) {
571 this.emailAddress = emailAddress;
575 public String getEmailAddressRepeat () {
576 return this.emailAddressRepeat;
580 public void setEmailAddressRepeat (final String emailAddressRepeat) {
581 this.emailAddressRepeat = emailAddressRepeat;
585 public String getFamilyName () {
586 return this.familyName;
590 public void setFamilyName (final String familyName) {
591 this.familyName = familyName;
595 public Integer getFaxAreaCode () {
596 return this.faxAreaCode;
600 public void setFaxAreaCode (final Integer faxAreaCode) {
601 this.faxAreaCode = faxAreaCode;
605 public Country getFaxCountry () {
606 return this.faxCountry;
610 public void setFaxCountry (final Country faxCountry) {
611 this.faxCountry = faxCountry;
615 public Long getFaxNumber () {
616 return this.faxNumber;
620 public void setFaxNumber (final Long faxNumber) {
621 this.faxNumber = faxNumber;
625 public String getFirstName () {
626 return this.firstName;
630 public void setFirstName (final String firstName) {
631 this.firstName = firstName;
635 public Gender getGender () {
640 public void setGender (final Gender gender) {
641 this.gender = gender;
645 public Short getHouseNumber () {
646 return this.houseNumber;
650 public void setHouseNumber (final Short houseNumber) {
651 this.houseNumber = houseNumber;
655 public Integer getPhoneAreaCode () {
656 return this.phoneAreaCode;
660 public void setPhoneAreaCode (final Integer phoneAreaCode) {
661 this.phoneAreaCode = phoneAreaCode;
665 public Country getPhoneCountry () {
666 return this.phoneCountry;
670 public void setPhoneCountry (final Country phoneCountry) {
671 this.phoneCountry = phoneCountry;
675 public Long getPhoneNumber () {
676 return this.phoneNumber;
680 public void setPhoneNumber (final Long phoneNumber) {
681 this.phoneNumber = phoneNumber;
685 public String getStreet () {
690 public void setStreet (final String street) {
691 this.street = street;
695 public User getUser () {
700 public void setUser (final User user) {
705 public Long getUserId () {
710 public void setUserId (final Long userId) {
711 this.userId = userId;
715 public String getUserName () {
716 return this.userName;
720 public void setUserName (final String userName) {
721 this.userName = userName;
725 public String getUserPassword () {
726 return this.userPassword;
730 public void setUserPassword (final String userPassword) {
731 this.userPassword = userPassword;
735 public String getUserPasswordRepeat () {
736 return this.userPasswordRepeat;
740 public void setUserPasswordRepeat (final String userPasswordRepeat) {
741 this.userPasswordRepeat = userPasswordRepeat;
745 public ProfileMode getUserProfileMode () {
746 return this.userProfileMode;
750 public void setUserProfileMode (final ProfileMode userProfileMode) {
751 this.userProfileMode = userProfileMode;
755 public Integer getZipCode () {
760 public void setZipCode (final Integer zipCode) {
761 this.zipCode = zipCode;
765 * Post-initialization of this class
768 public void init () {
769 // Get full user name list for reducing EJB calls
770 this.userNameList = this.userBean.getUserNameList();
772 // Get full email address list for reducing EJB calls
773 this.emailAddressList = this.userBean.getEmailAddressList();
775 // Is the user logged-in?
776 if (this.loginController.isUserLoggedIn()) {
777 // Is logged-in, so load also users visible to memebers
778 this.visibleUserList = this.userBean.allMemberPublicVisibleUsers();
780 // Initialize user list
781 this.visibleUserList = this.userBean.allPublicUsers();
786 public boolean isEmailAddressRegistered (final User user) {
787 return ((this.emailAddressList instanceof List) && (this.emailAddressList.contains(user.getUserContact().getContactEmailAddress())));
791 public boolean isRequiredChangePersonalDataSet () {
792 return ((this.getUserProfileMode() != null) &&
793 (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));
803 public boolean isRequiredPersonalDataSet () {
804 return ((this.getUserName() != null) &&
805 (this.getUserProfileMode() != null) &&
806 (this.getGender() != null) &&
807 (this.getFirstName() != null) &&
808 (this.getFamilyName() != null) &&
809 (this.getStreet() != null) &&
810 (this.getHouseNumber() != null) &&
811 (this.getZipCode() != null) &&
812 (this.getCity() != null) &&
813 (this.getEmailAddress() != null) &&
814 (this.getEmailAddressRepeat() != null) &&
815 (this.getUserPassword() != null) &&
816 (this.getUserPasswordRepeat() != null));
820 public boolean isSameEmailAddressEntered () {
821 return (Objects.equals(this.getEmailAddress(), this.getEmailAddressRepeat()));
825 public boolean isSamePasswordEntered () {
826 return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())));
830 public boolean isUserIdEmpty () {
831 return ((this.getUserId() == null) || (this.getUserId() == 0));
835 public boolean isUserNameRegistered (final User user) {
836 return ((this.userNameList instanceof List) && (this.userNameList.contains(user.getUserName())));
840 public boolean isVisibleUserFound () {
841 return ((this.visibleUserList instanceof List) && (this.visibleUserList.size() > 0));
845 public User lookupUserById (final Long userId) throws UserNotFoundException {
847 User localUser = null;
852 // Try to lookup it in visible user list
853 for (final Iterator<User> iterator = this.visibleUserList.iterator(); iterator.hasNext();) {
855 User next = iterator.next();
857 // Is the user id found?
858 if (Objects.equals(next.getUserId(), userId)) {
859 // Copy to other variable
866 if (null == localUser) {
867 // Not visible for the current user
868 throw new UserNotFoundException(userId);
871 // Copy all data to this bean
872 this.copyUser(localUser);
879 * Adds user's name and email address to bean's internal list. It also
880 * updates the public user list if the user has decided to ha }
882 * @param user User instance
884 private void addUserNameEmailAddress (final User user) {
885 // Make sure the entry is not added yet
886 if (this.userNameList.contains(user.getUserName())) {
888 throw new IllegalArgumentException(MessageFormat.format("User name {0} already added.", user.getUserName())); //NOI18N
889 } else if (this.emailAddressList.contains(user.getUserContact().getContactEmailAddress())) {
891 throw new IllegalArgumentException(MessageFormat.format("Email address {0} already added.", user.getUserContact().getContactEmailAddress())); //NOI18N
895 this.userNameList.add(user.getUserName());
898 this.emailAddressList.add(user.getUserContact().getContactEmailAddress());
904 private void clear () {
907 this.setUserId(null);
908 this.setGender(Gender.UNKNOWN);
909 this.setUserProfileMode(null);
910 this.setFirstName(null);
911 this.setFamilyName(null);
912 this.setStreet(null);
913 this.setHouseNumber(null);
914 this.setZipCode(null);
916 this.setCountry(null);
919 this.setEmailAddress(null);
920 this.setEmailAddressRepeat(null);
921 this.setPhoneAreaCode(null);
922 this.setCellphoneCarrier(null);
923 this.setFaxAreaCode(null);
926 this.setBirthday(null);
927 this.setComment(null);
928 this.setUserName(null);
929 this.setUserPassword(null);
930 this.setUserPasswordRepeat(null);
937 * Copies given user into the controller
939 * @param user User instance
941 private void copyUser (final User user) {
944 this.setUserId(user.getUserId());
945 this.setUserProfileMode(user.getUserProfileMode());
946 this.setGender(user.getUserContact().getContactGender());
947 this.setFirstName(user.getUserContact().getContactFirstName());
948 this.setFamilyName(user.getUserContact().getContactFamilyName());
949 this.setStreet(user.getUserContact().getContactStreet());
950 this.setHouseNumber(user.getUserContact().getContactHouseNumber());
951 this.setZipCode(user.getUserContact().getContactZipCode());
952 this.setCity(user.getUserContact().getContactCity());
953 this.setCountry(user.getUserContact().getContactCountry());
955 // Get cellphone, phone and fax instance
956 DialableCellphoneNumber cellphone = user.getUserContact().getContactCellphoneNumber();
957 DialableFaxNumber fax = user.getUserContact().getContactFaxNumber();
958 DialableLandLineNumber phone = user.getUserContact().getContactLandLineNumber();
961 if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneAreaCode() > 0)) {
962 this.setPhoneCountry(phone.getPhoneCountry());
963 this.setPhoneAreaCode(phone.getPhoneAreaCode());
964 this.setPhoneNumber(phone.getPhoneNumber());
966 if ((cellphone instanceof DialableCellphoneNumber) && (cellphone.getCellphoneProvider() instanceof MobileProvider)) {
967 this.setCellphoneCarrier(cellphone.getCellphoneProvider());
968 this.setCellphoneNumber(cellphone.getPhoneNumber());
970 if ((fax instanceof DialableFaxNumber) && (fax.getPhoneAreaCode() > 0)) {
971 this.setFaxCountry(fax.getPhoneCountry());
972 this.setFaxAreaCode(fax.getPhoneAreaCode());
973 this.setFaxNumber(fax.getPhoneNumber());
975 this.setEmailAddress(user.getUserContact().getContactEmailAddress());
978 this.setBirthday(user.getUserContact().getContactBirthday());
979 this.setComment(user.getUserContact().getContactComment());