import javax.persistence.NoResultException;
import javax.persistence.Query;
import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jjobs.database.BaseJobsDatabaseBean;
+import org.mxchange.jjobs.beans.ejb.BaseJobsEnterpriseBean;
import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
import org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote;
* @author Roland Häder<roland@mxchange.org>
*/
@Stateless (name = "userRegistration", description = "A bean handling the user registration")
-public class JobsUserRegistrationSessionBean extends BaseJobsDatabaseBean implements UserRegistrationSessionBeanRemote {
+public class JobsUserRegistrationSessionBean extends BaseJobsEnterpriseBean implements UserRegistrationSessionBeanRemote {
/**
* Serial number
return confirmationKey;
}
- @Override
- public boolean isEmailAddressRegistered (final User user) {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
- // Check bean
- assert (this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N
-
- // user should not be null
- if (null == user) {
- // Abort here
- throw new NullPointerException("user is null"); //NOI18N
- }
-
- // Call other bean
- return this.userBean.isEmailAddressRegistered(user);
- }
-
- @Override
- public boolean isUserNameRegistered (final User user) {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
- // Check bean
- assert (this.userBean instanceof UserSessionBeanRemote) : "this.userBean is not set"; //NOI18N
-
- // user should not be null
- if (null == user) {
- // Abort here
- throw new NullPointerException("user is null"); //NOI18N
- }
-
- // Call other bean
- return this.userBean.isUserNameRegistered(user);
- }
-
@Override
public User registerUser (final User user, final String baseUrl, final String randomPassword) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
// Trace message
}
// Check if user is registered
- if (this.isUserNameRegistered(user)) {
+ if (this.userBean.isUserNameRegistered(user)) {
// Abort here
throw new UserNameAlreadyRegisteredException(user);
- } else if (this.isEmailAddressRegistered(user)) {
+ } else if (this.userBean.isEmailAddressRegistered(user)) {
// Abort here
throw new EmailAddressAlreadyRegisteredException(user);
}