X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Fjava%2Forg%2Fmxchange%2Fpizzaapplication%2Fbeans%2Fuser%2FPizzaUserWebSessionBean.java;h=acaf269a69e517e313270ca06e7050a629e5be64;hb=b2ce3db57eb7c64f7b856e24d614556c3a57a048;hp=a71bd4c80e82610d9468e299a1ce5074c8dc77d1;hpb=16c517e78c186ed0ff9d891e6da4e115915a0621;p=pizzaservice-war.git diff --git a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java index a71bd4c8..acaf269a 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java @@ -19,7 +19,6 @@ package org.mxchange.pizzaapplication.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; @@ -42,7 +41,7 @@ import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.fax.FaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; -import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider; +import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; import org.mxchange.jusercore.events.login.UserLoggedInEvent; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.exceptions.UserNotFoundException; @@ -75,7 +74,7 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { /** * Cellphone number's carrier */ - private SmsProvider cellphoneCarrier; + private MobileProvider cellphoneCarrier; /** * Cellphone number @@ -344,12 +343,11 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { 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()); @@ -403,7 +401,7 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { } // Is the provider set? - if ((cellphone instanceof DialableCellphoneNumber) && (this.getCellphoneCarrier() instanceof SmsProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) { + if ((cellphone instanceof DialableCellphoneNumber) && (this.getCellphoneCarrier() instanceof MobileProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) { // Is the number set? if (cellphone.getPhoneNumber() == null) { // Is null @@ -421,7 +419,6 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { 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 PizzaUserWebSessionBean implements PizzaUserWebSessionController { // Trace message //this.getLogger().logTrace(MessageFormat.format("createUserInstance: user={0} - EXIT!", user)); + // Return it return user; } @@ -444,12 +442,12 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { } @Override - public SmsProvider getCellphoneCarrier () { + public MobileProvider getCellphoneCarrier () { return this.cellphoneCarrier; } @Override - public void setCellphoneCarrier (final SmsProvider cellphoneCarrier) { + public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) { this.cellphoneCarrier = cellphoneCarrier; } @@ -730,32 +728,32 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { } @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 PizzaUserWebSessionBean implements PizzaUserWebSessionController { @Override public boolean isSamePasswordEntered () { - return (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())); + return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat()))); } @Override @@ -896,7 +894,7 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { this.setPhoneAreaCode(phone.getPhoneAreaCode()); this.setPhoneNumber(phone.getPhoneNumber()); } - if ((cellphone instanceof DialableCellphoneNumber) && (cellphone.getCellphoneProvider() instanceof SmsProvider)) { + if ((cellphone instanceof DialableCellphoneNumber) && (cellphone.getCellphoneProvider() instanceof MobileProvider)) { this.setCellphoneCarrier(cellphone.getCellphoneProvider()); this.setCellphoneNumber(cellphone.getPhoneNumber()); } @@ -911,4 +909,5 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController { this.setBirthday(user.getUserContact().getContactBirthday()); this.setComment(user.getUserContact().getContactComment()); } + }