]> git.mxchange.org Git - jjobs-war.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Tue, 10 May 2016 12:02:16 +0000 (14:02 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 10 May 2016 18:20:00 +0000 (20:20 +0200)
- moved all contact data to one place (was a bit scattered)
- no need to update cellphone data here (contact controller does it)
- added check on parameter 'user'
- added noisy debug line (contact)

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java

index 65af5406a5242630e76982c1962f677edeb6ad39..034afc6a307a5f3dc7f95dc29c9bf1c98068a755 100644 (file)
@@ -383,6 +383,10 @@ public class JobsContactWebSessionBean implements JobsContactWebSessionControlle
        @Override
        @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<Contact> allContacts () {
+               // Debug message
+               /* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactController.allContacts: contactList.size()={0} - EXIT!", this.contactList.size()));
+
+               // Return un-modified list
                return this.contactList;
        }
 
@@ -909,6 +913,9 @@ public class JobsContactWebSessionBean implements JobsContactWebSessionControlle
                this.setZipCode(contact.getContactZipCode());
                this.setCity(contact.getContactCity());
                this.setCountry(contact.getContactCountry());
+               this.setEmailAddress(contact.getContactEmailAddress());
+               this.setBirthday(contact.getContactBirthday());
+               this.setComment(contact.getContactComment());
 
                // Get cellphone, phone and fax instance
                DialableCellphoneNumber cellphone = contact.getContactCellphoneNumber();
@@ -921,20 +928,17 @@ public class JobsContactWebSessionBean implements JobsContactWebSessionControlle
                        this.setPhoneAreaCode(phone.getPhoneAreaCode());
                        this.setPhoneNumber(phone.getPhoneNumber());
                }
+
                if ((cellphone instanceof DialableCellphoneNumber) && (cellphone.getCellphoneProvider() instanceof MobileProvider)) {
                        this.setCellphoneCarrier(cellphone.getCellphoneProvider());
                        this.setCellphoneNumber(cellphone.getPhoneNumber());
                }
+
                if ((fax instanceof DialableFaxNumber) && (fax.getPhoneAreaCode() > 0)) {
                        this.setFaxCountry(fax.getPhoneCountry());
                        this.setFaxAreaCode(fax.getPhoneAreaCode());
                        this.setFaxNumber(fax.getPhoneNumber());
                }
-               this.setEmailAddress(contact.getContactEmailAddress());
-
-               // -- other data
-               this.setBirthday(contact.getContactBirthday());
-               this.setComment(contact.getContactComment());
        }
 
        /**
index c95bc7c1602a5c49386b8231b9d06b32bd0a45fb..e456737c0e174b4bc92daf59bc2dfe7b08575f92 100644 (file)
@@ -38,6 +38,7 @@ import org.mxchange.jjobs.beans.login.JobsUserLoginWebSessionController;
 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
@@ -693,15 +694,19 @@ public class JobsUserWebSessionBean implements JobsUserWebSessionController {
         * @param user User instance
         */
        private void copyUser (final User user) {
+               // Make sure the instance is valid
+               if (null == user) {
+                       // Throw NPE
+                       throw new NullPointerException("user is null"); //NOI18N
+               } else if (user.getUserContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("user.userContact is null"); //NOI18N
+               }
+
                // Copy all fields:
                // - base data
                this.setUserId(user.getUserId());
                this.setUserProfileMode(user.getUserProfileMode());
-
-               // Get cellphone, phone and fax instance
-               DialableCellphoneNumber cellphone = user.getUserContact().getContactCellphoneNumber();
-               DialableFaxNumber fax = user.getUserContact().getContactFaxNumber();
-               DialableLandLineNumber phone = user.getUserContact().getContactLandLineNumber();
        }
 
        /**