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.exceptions.EmailAddressAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
import org.mxchange.jusercore.model.user.UserUtils;
import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
+import org.mxchange.jusercore.model.user.status.UserAccountStatus;
/**
* A user bean (controller)
/**
* Cellphone number's carrier
*/
- private SmsProvider cellphoneCarrier;
+ private MobileProvider cellphoneCarrier;
/**
* Cellphone number
*/
private final UserSessionBeanRemote userBean;
- /**
- * User id
- */
- private Long userId;
-
/**
* A list of all user profiles
*/
*/
private String userPasswordRepeat;
- /**
- * Whether the user wants a public profile
- */
- private ProfileMode userProfileMode;
-
/**
* ZIP code
*/
// Create new user instance
User user = new LoginUser();
user.setUserName(this.getUserName());
- user.setUserProfileMode(this.getUserProfileMode());
+ user.setUserAccountStatus(UserAccountStatus.CONFIRMED);
+ user.setUserProfileMode(ProfileMode.INVISIBLE);
// Generate phone number
DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
}
// 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
} else if (this.userController.isEmailAddressRegistered(user)) {
// Email address is already used
throw new FaceletException(new EmailAddressAlreadyRegisteredException(user));
- } else if ((this.getUserPassword().isEmpty()) && (this.getUserPasswordRepeat().isEmpty())) {
+ } else if ((this.getUserPassword() == null && (this.getUserPasswordRepeat() == null)) || ((this.getUserPassword().isEmpty()) && (this.getUserPasswordRepeat().isEmpty()))) {
// Empty password entered, then generate one
password = UserUtils.createRandomPassword(PizzaUserWebSessionController.MINIMUM_PASSWORD_LENGTH);
} else if (!this.isSamePasswordEntered()) {
// Throw again
throw new FaceletException(ex);
}
+
+ // Clear all
+ this.clear();
}
@Override
}
@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;
}
this.street = street;
}
- @Override
- public Long getUserId () {
- return this.userId;
- }
-
- @Override
- public void setUserId (final Long userId) {
- this.userId = userId;
- }
-
@Override
public String getUserName () {
return this.userName;
this.userPasswordRepeat = userPasswordRepeat;
}
- @Override
- public ProfileMode getUserProfileMode () {
- return this.userProfileMode;
- }
-
- @Override
- public void setUserProfileMode (final ProfileMode userProfileMode) {
- this.userProfileMode = userProfileMode;
- }
-
@Override
public Integer getZipCode () {
return this.zipCode;
return user;
}
+ /**
+ * Clears this bean
+ */
+ private void clear () {
+ // Clear all
+ this.setBirthday(null);
+ this.setCellphoneCarrier(null);
+ this.setCellphoneNumber(null);
+ this.setCity(null);
+ this.setComment(null);
+ this.setCountry(null);
+ this.setEmailAddress(null);
+ this.setFamilyName(null);
+ this.setFaxAreaCode(null);
+ this.setFaxCountry(null);
+ this.setFaxNumber(null);
+ this.setFirstName(null);
+ this.setGender(null);
+ this.setHouseNumber(null);
+ this.setPhoneAreaCode(null);
+ this.setPhoneCountry(null);
+ this.setPhoneNumber(null);
+ this.setStreet(null);
+ this.setUserName(null);
+ this.setUserPassword(null);
+ this.setUserPasswordRepeat(null);
+ this.setZipCode(null);
+ }
+
}