]> git.mxchange.org Git - addressbook-war.git/blobdiff - src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java
Continued with adding user by administrator:
[addressbook-war.git] / src / java / org / mxchange / addressbook / beans / user / AddressbookUserWebSessionBean.java
index 89dc6416c30d0048fc83e06338644c5994b28926..684658338b0cbe40262785c5214358b262059c89 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.addressbook.beans.user;
 import java.text.MessageFormat;
 import java.util.Collections;
 import java.util.Date;
-import java.util.GregorianCalendar;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Objects;
@@ -241,7 +240,7 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC
                        Context context = new InitialContext();
 
                        // Try to lookup
-                       this.userBean = (UserSessionBeanRemote) context.lookup("ejb/stateless-addressbook-user"); //NOI18N
+                       this.userBean = (UserSessionBeanRemote) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
                } catch (final NamingException e) {
                        // Throw again
                        throw new FaceletException(e);
@@ -344,12 +343,11 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC
                User user = new LoginUser();
                user.setUserName(this.getUserName());
                user.setUserProfileMode(this.getUserProfileMode());
-               user.setUserCreated(new GregorianCalendar());
 
                // Generate phone number
-               DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber(), new GregorianCalendar());
-               DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber(), new GregorianCalendar());
-               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber(), new GregorianCalendar());
+               DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+               DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
+               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
                // Create new contact
                Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
@@ -421,7 +419,6 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC
                contact.setContactComment(this.getComment());
 
                // Created timestamp and ownContact
-               contact.setContactCreated(new GregorianCalendar());
                contact.setContactOwnContact(Boolean.TRUE);
 
                // Set contact in user
@@ -429,6 +426,7 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC
 
                // Trace message
                //this.getLogger().logTrace(MessageFormat.format("createUserInstance: user={0} - EXIT!", user));
+
                // Return it
                return user;
        }
@@ -730,32 +728,32 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC
        }
 
        @Override
-       public boolean isRequiredPersonalDataSet () {
-               return ((this.getUserName() != null) &&
-                               (this.getUserProfileMode() != null) &&
+       public boolean isRequiredChangePersonalDataSet () {
+               return ((this.getUserProfileMode() != null) &&
                                (this.getGender() != null) &&
                                (this.getFirstName() != null) &&
                                (this.getFamilyName() != null) &&
                                (this.getStreet() != null) &&
                                (this.getHouseNumber() != null) &&
                                (this.getZipCode() != null) &&
-                               (this.getCity() != null) &&
-                               (this.getEmailAddress() != null) &&
-                               (this.getEmailAddressRepeat() != null) &&
-                               (this.getUserPassword() != null) &&
-                               (this.getUserPasswordRepeat() != null));
+                               (this.getCity() != null));
        }
 
        @Override
-       public boolean isRequiredChangePersonalDataSet () {
-               return ((this.getUserProfileMode() != null) &&
+       public boolean isRequiredPersonalDataSet () {
+               return ((this.getUserName() != null) &&
+                               (this.getUserProfileMode() != null) &&
                                (this.getGender() != null) &&
                                (this.getFirstName() != null) &&
                                (this.getFamilyName() != null) &&
                                (this.getStreet() != null) &&
                                (this.getHouseNumber() != null) &&
                                (this.getZipCode() != null) &&
-                               (this.getCity() != null));
+                               (this.getCity() != null) &&
+                               (this.getEmailAddress() != null) &&
+                               (this.getEmailAddressRepeat() != null) &&
+                               (this.getUserPassword() != null) &&
+                               (this.getUserPasswordRepeat() != null));
        }
 
        @Override
@@ -765,7 +763,7 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC
 
        @Override
        public boolean isSamePasswordEntered () {
-               return (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat()));
+               return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())));
        }
 
        @Override