import java.util.Objects;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
+import org.mxchange.jusercore.events.user.AdminAddedUserEvent;
import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
*/
private static final long serialVersionUID = 542_145_347_916L;
- /////////////////////// Properties /////////////////////
+ /**
+ * An event fired when the administrator has added a new user
+ */
+ @Inject
+ @Any
+ private Event<AdminAddedUserEvent> addedUserEvent;
+
/**
* Birth day
*/
// Encrypt password and set it
user.setUserEncryptedPassword(UserUtils.encryptPassword(password));
+ // Init updated user instance
+ User updatedUser = null;
+
try {
// Now, that all is set, call EJB
- this.userBean.addUser(user);
+ updatedUser = this.userBean.addUser(user);
} catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
// Throw again
throw new FaceletException(ex);
}
+ // Fire event
+
// Clear all
this.clear();
}