} else if (user.getUserId() != null) {
// Not allowed here
throw new IllegalStateException(MessageFormat.format("user.userId must be null, is: {0}", user.getUserId())); //NOI18N
+ } else if (null == user.getUserContact()) {
+ // Abort here
+ throw new NullPointerException("user.contact is null"); //NOI18N
+ } else if (user.getUserContact().getContactId() != null) {
+ // Not allowed here
+ throw new IllegalStateException(MessageFormat.format("user.userContact.contactId must be null, is: {0}", user.getUserId())); //NOI18N
}
// Check if user is registered
import java.util.Date;
import java.util.List;
import java.util.Objects;
-import javax.ejb.EJB;
import javax.ejb.EJBException;
import javax.ejb.Stateless;
import javax.persistence.Query;
import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
import org.mxchange.jusercore.model.user.password_history.UserPasswordHistory;
import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote;
/**
* A user EJB
*/
private static final long serialVersionUID = 542_145_347_916L;
- /**
- * Registration EJB
- */
- @EJB (lookup = "java:global/addressbook-ejb/userRegistration!org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote")
- private UserRegistrationSessionBeanRemote registerBean;
-
/**
* Default constructor
*/
} else if (user.getUserConfirmKey() == null) {
// Throw NPE
throw new NullPointerException("user.userConfirmKey is null"); //NOI18N
+ } else if (null == baseUrl) {
+ // Throw NPE again
+ throw new NullPointerException("baseUrl is null"); //NOI18N
+ } else if (baseUrl.isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("baseUrl is empty"); //NOI18N
}
// Update user account
managedUser.setUserUpdated(new Date());
// Create history entry
- PasswordHistory entry = new UserPasswordHistory(user.getUserEncryptedPassword(), managedUser);
+ final PasswordHistory entry = new UserPasswordHistory(user.getUserEncryptedPassword(), managedUser);
// Set created timestamp
entry.setUserPasswordHistoryCreated(new Date());