import java.util.Objects;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController;
+import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
+import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
+import org.mxchange.jusercore.events.user.update.UserUpdatedPersonalDataEvent;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
+import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
import org.mxchange.jusercore.model.user.LoginUser;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
-import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
-import org.mxchange.addressbook.beans.contact.AddressbookContactWebSessionController;
-import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
/**
* A user bean (controller)
@Inject
private AddressbookUserLoginWebSessionController loginController;
+ /**
+ * Event being fired when user updated personal data
+ */
+ @Inject
+ @Any
+ private Event<UpdatedUserPersonalDataEvent> updatedPersonalDataEvent;
+
/**
* Remote user bean
*/
user.setUserProfileMode(this.getUserProfileMode());
// Send it to the EJB
- this.userBean.updateUserPersonalData(user);
+ User updatedUser = this.userBean.updateUserPersonalData(user);
+
+ // Fire event
+ this.updatedPersonalDataEvent.fire(new UserUpdatedPersonalDataEvent(updatedUser));
// All fine
return "user_data_saved"; //NOI18N
@Override
public boolean isRequiredChangePersonalDataSet () {
return ((this.getUserProfileMode() != null) &&
+ (this.getUserName() != null) && (!this.getUserName().isEmpty()) &&
(this.contactController.isRequiredChangePersonalDataSet()));
}