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;
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.smsprovider.MobileProvider;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
/**
* Cellphone number's carrier
*/
- private SmsProvider cellphoneCarrier;
+ private MobileProvider cellphoneCarrier;
/**
* Cellphone number
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());
}
// 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
contact.setContactComment(this.getComment());
// Created timestamp and ownContact
- contact.setContactCreated(new GregorianCalendar());
contact.setContactOwnContact(Boolean.TRUE);
// Set contact in user
// Trace message
//this.getLogger().logTrace(MessageFormat.format("createUserInstance: user={0} - EXIT!", user));
+
// Return it
return user;
}
}
@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;
}
}
@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
@Override
public boolean isSamePasswordEntered () {
- return (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat()));
+ return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())));
}
@Override
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());
}