import java.text.MessageFormat;
import java.util.Objects;
import javax.ejb.EJB;
-import javax.ejb.EJBException;
import javax.ejb.Stateless;
-import javax.mail.Address;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
import javax.persistence.NoResultException;
import javax.persistence.Query;
import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
-import org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote;
import org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote;
import org.mxchange.jusercore.model.user.LoginUser;
import org.mxchange.jusercore.model.user.User;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@Stateless (name = "register", description = "A bean handling the user registration")
+@Stateless (name = "userRegistration", description = "A bean handling the user registration")
public class AddressbookUserRegistrationSessionBean extends BaseAddressbookDatabaseBean implements UserRegistrationSessionBeanRemote {
/**
*/
public AddressbookUserRegistrationSessionBean () {
// Call super constructor
- super();
+ super("jms/addressbook-queue-factory", "jms/addressbook-email-queue"); //NOI18N
}
@Override
// Call other EJB
User addedUser = this.adminUserBean.addUser(user);
- // Init variable
- Address emailAddress;
-
- try {
- // Create email address and set
- emailAddress = new InternetAddress(addedUser.getUserContact().getContactEmailAddress());
- } catch (final AddressException ex) {
- // Throw again
- throw new EJBException(ex);
- }
-
// Default template is with no random password
String templateName = "user_registration"; //NOI18N
// Send email
// @TODO: Internationlize the subject line somehow
- this.sendEmail("Registration", templateName, emailAddress, addedUser, baseUrl, randomPassword); //NOI18N
+ this.sendEmail("Registration", templateName, addedUser, baseUrl, randomPassword); //NOI18N
// Trace message
this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.registerUser: addedUser={1},addedUser.userId={2} - EXIT!", this.getClass().getSimpleName(), addedUser, addedUser.getUserId())); //NOI18N