- added methods to controller to expand activity type for admin and user respectivly
- renamed user-registration-event method to have "User" in it as this is explicity for users
- renamed user-logout-event observer method to have "Event" as suffix
- fixed template, no user here (copy-paste mistake)
- also add new event to controller's list
- added missing i18n strings for user activity log
- added missing navigation rule
Signed-off-by: Roland Häder <roland@mxchange.org>
}
@Override
- public void afterRegistrationEvent (@Observes final UserRegisteredEvent event) {
+ public void afterUserRegistrationEvent (@Observes final UserRegisteredEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
* <p>
* @param event User registration event
*/
- void afterRegistrationEvent (final UserRegisteredEvent event);
+ void afterUserRegistrationEvent (final UserRegisteredEvent event);
/**
* Observes events being fired when an administrator has added a new
import javax.inject.Named;
import org.mxchange.jjobs.beans.BaseJobsController;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
+import org.mxchange.jusercore.events.logout.ObserveableUserLogoutEvent;
/**
* A session bean for handling localization/internationalization changes. This
throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
}
- // Set locale here
- this.setLocale(event.getLoggedInUser().getUserLocale());
+ // Is the locale set?
+ if (event.getLoggedInUser().getUserLocale() instanceof Locale) {
+ // Set locale here
+ this.setLocale(event.getLoggedInUser().getUserLocale());
+ }
+ }
+
+ @Override
+ public void afterUserLogoutEvent (@Observes final ObserveableUserLogoutEvent event) {
+ // event should not be null
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getLoggedOutUser() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.loggedOutUser is null"); //NOI18N
+ } else if (event.getLoggedOutUser().getUserId() == null) {
+ // userId is null
+ throw new NullPointerException("event.loggedOutUser.userId is null"); //NOI18N
+ } else if (event.getLoggedOutUser().getUserId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedOutUser(), event.getLoggedOutUser().getUserId())); //NOI18N
+ }
// Trace message
//* NOISY-DEBUG: */ System.out.println("LandingLocalizationSessionBean:afterUserLogin - EXIT!"); //NOI18N
import java.io.Serializable;
import java.util.Locale;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
+import org.mxchange.jusercore.events.logout.ObserveableUserLogoutEvent;
/**
* An interface for localization change beans
*/
void afterUserLoginEvent (final UserLoggedInEvent event);
+ /**
+ * Event observer for logged-out user
+ * <p>
+ * @param event Event instance
+ */
+ void afterUserLogoutEvent (final ObserveableUserLogoutEvent event);
+
/**
* Getter for locale
* <p>
}
@Override
- public void afterRegistrationEvent (@Observes final UserRegisteredEvent event) {
- // Trace message
- //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterRegistration: event={0} - CALLED!", event)); //NOI18N
-
+ public void afterUserRegistrationEvent (@Observes final UserRegisteredEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
* <p>
* @param event User registration event
*/
- void afterRegistrationEvent (final UserRegisteredEvent event);
+ void afterUserRegistrationEvent (final UserRegisteredEvent event);
/**
* Adds user instance to database by preparing a complete user instance and
}
@Override
- public void afterRegistrationEvent (@Observes final UserRegisteredEvent event) {
+ public void afterUserRegistrationEvent (@Observes final UserRegisteredEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
* <p>
* @param event User registration event
*/
- void afterRegistrationEvent (final UserRegisteredEvent event);
+ void afterUserRegistrationEvent (final UserRegisteredEvent event);
/**
* Event observer for logged-in user
import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController;
import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
+import org.mxchange.jusercore.events.logout.ObserveableUserLogoutEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
import org.mxchange.jusercore.events.resendlink.UserResendLinkAccountEvent;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
// Call bean to add it
this.userActivityBean.addUserActivityLog(userActivity);
+
+ // Add to cache, too
+ this.usersActivity.get(user).add(userActivity);
}
@Override
// Call bean to add it
this.userActivityBean.addUserActivityLog(userActivity);
+
+ // Add to cache, too
+ this.usersActivity.get(user).add(userActivity);
}
@Override
this.addUserActivity(event.getUpdatedUser(), "ADMIN_UPDATED_USER_PERSONAL_DATA"); //NOI18N
}
- @Override
- public void afterRegistrationEvent (@Observes final UserRegisteredEvent event) {
- // event should not be null
- if (null == event) {
- // Throw NPE
- throw new NullPointerException("event is null"); //NOI18N
- } else if (event.getRegisteredUser() == null) {
- // Throw NPE again
- throw new NullPointerException("event.registeredUser is null"); //NOI18N
- } else if (event.getRegisteredUser().getUserId() == null) {
- // userId is null
- throw new NullPointerException("event.registeredUser.userId is null"); //NOI18N
- } else if (event.getRegisteredUser().getUserId() < 1) {
- // Not avalid id
- throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
- }
-
- // Update user list
- this.addUserActivity(event.getRegisteredUser(), "USER_REGISTERED_NEW_ACCOUNT"); //NOI18N
- }
-
@Override
public void afterUserConfirmedAccountEvent (@Observes final UserConfirmedAccountEvent event) {
// event should not be null
this.addUserActivity(event.getLoggedInUser(), "USER_LOGGED_IN"); //NOI18N
}
+ @Override
+ public void afterUserLogoutEvent (@Observes final ObserveableUserLogoutEvent event) {
+ // event should not be null
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getLoggedOutUser()== null) {
+ // Throw NPE again
+ throw new NullPointerException("event.loggedOutUser is null"); //NOI18N
+ } else if (event.getLoggedOutUser().getUserId() == null) {
+ // userId is null
+ throw new NullPointerException("event.loggedOutUser.userId is null"); //NOI18N
+ } else if (event.getLoggedOutUser().getUserId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedOutUser(), event.getLoggedOutUser().getUserId())); //NOI18N
+ }
+
+ // Update user list
+ this.addUserActivity(event.getLoggedOutUser(), "USER_LOGGED_OUT"); //NOI18N
+ }
+
+ @Override
+ public void afterUserRegistrationEvent (@Observes final UserRegisteredEvent event) {
+ // event should not be null
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getRegisteredUser() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.registeredUser is null"); //NOI18N
+ } else if (event.getRegisteredUser().getUserId() == null) {
+ // userId is null
+ throw new NullPointerException("event.registeredUser.userId is null"); //NOI18N
+ } else if (event.getRegisteredUser().getUserId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
+ }
+
+ // Update user list
+ this.addUserActivity(event.getRegisteredUser(), "USER_REGISTERED_NEW_ACCOUNT"); //NOI18N
+ }
+
@Override
public void afterUserResendConfirmationLinkEvent (@Observes final UserResendLinkAccountEvent event) {
// event should not be null
if (null == event) {
// Throw NPE
throw new NullPointerException("event is null"); //NOI18N
- } else if (event.getResendLinkUser()== null) {
+ } else if (event.getResendLinkUser() == null) {
// Throw NPE again
throw new NullPointerException("event.resendLinkUser is null"); //NOI18N
} else if (event.getResendLinkUser().getUserId() == null) {
// beanHelper.user should be set and valid
if (null == user) {
// Is not set
- throw new NullPointerException("this.beanHelper.user is null");
+ throw new NullPointerException("this.beanHelper.user is null"); //NOI18N
} else if (user.getUserId() == null) {
// Throw NPE again
- throw new NullPointerException("this.beanHelper.user.userId is null");
+ throw new NullPointerException("this.beanHelper.user.userId is null"); //NOI18N
} else if (user.getUserId() < 1) {
// Invalid id number
- throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.user.userId={0} is not valid", user.getUserId()));
+ throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.user.userId={0} is not valid", user.getUserId())); //NOI18N
}
// Init list
return list;
}
+ @Override
+ public String expandAdminActivityType (final String activityType) {
+ // Is it valid?
+ if (null == activityType) {
+ // Throw NPE
+ throw new NullPointerException("activityType is null"); //NOI18N
+ } else if (activityType.isEmpty()) {
+ // Is empty
+ throw new IllegalArgumentException("activityType is empty"); //NOI18N
+ }
+
+ // Expand it
+ return "ADMIN_ACTIVITY_" + activityType; //NOI18N
+ }
+
+ @Override
+ public String expandUserActivityType (final String activityType) {
+ // Is it valid?
+ if (null == activityType) {
+ // Throw NPE
+ throw new NullPointerException("activityType is null"); //NOI18N
+ } else if (activityType.isEmpty()) {
+ // Is empty
+ throw new IllegalArgumentException("activityType is empty"); //NOI18N
+ }
+
+ // Expand it
+ return "USER_ACTIVITY_" + activityType; //NOI18N
+ }
+
/**
* Post-constructor method
*/
import javax.ejb.Local;
import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
+import org.mxchange.jusercore.events.logout.ObserveableUserLogoutEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
import org.mxchange.jusercore.events.resendlink.UserResendLinkAccountEvent;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
*/
void afterUserConfirmedAccountEvent (final UserConfirmedAccountEvent event);
+ /**
+ * Event observer for logged-out user
+ * <p>
+ * @param event Event instance
+ */
+ void afterUserLogoutEvent (final ObserveableUserLogoutEvent event);
+
/**
* Method being call after user's password has been updated (and history
* entry has been created).
* <p>
* @param event Event being fired
*/
- void afterRegistrationEvent (final UserRegisteredEvent event);
+ void afterUserRegistrationEvent (final UserRegisteredEvent event);
/**
* Event observer for logged-in user
* <p>
* @return List of user's activity log
*/
- List<LogableUserActivity> allCurrentUsersActivityLog();
+ List<LogableUserActivity> allCurrentUsersActivityLog ();
+
+ /**
+ * Expands given activity type into a i18n string for administrators
+ * <p>
+ * @param activityType Activity type
+ * <p>
+ * @return Expanded i18n string
+ */
+ String expandAdminActivityType (final String activityType);
+
+ /**
+ * Expands given activity type into a i18n string for users
+ * <p>
+ * @param activityType Activity type
+ * <p>
+ * @return Expanded i18n string
+ */
+ String expandUserActivityType (final String activityType);
}
* <p>
* @param event User registration event
*/
- public void afterRegistrationEvent (@Observes final UserRegisteredEvent event) {
+ public void afterUserRegistrationEvent (@Observes final UserRegisteredEvent event) {
// Trace message
- this.loggerBeanLocal.logTrace(MessageFormat.format("UserIdValidator:afterRegistrationEvent: event={0} - CALLED!", event)); //NOI18N
+ this.loggerBeanLocal.logTrace(MessageFormat.format("UserIdValidator:afterUserRegistrationEvent: event={0} - CALLED!", event)); //NOI18N
// event should not be null
if (null == event) {
User registeredUser = event.getRegisteredUser();
// Debug message
- this.loggerBeanLocal.logDebug(MessageFormat.format("UserIdValidator:afterRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N
+ this.loggerBeanLocal.logDebug(MessageFormat.format("UserIdValidator:afterUserRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N
// Update cache
JobsUserIdValidator.cachedStatus.add(registeredUser.getUserId());
// Trace message
- this.loggerBeanLocal.logTrace("UserIdValidator:afterRegistrationEvent: EXIT!"); //NOI18N
+ this.loggerBeanLocal.logTrace("UserIdValidator:afterUserRegistrationEvent: EXIT!"); //NOI18N
}
@Override
ADMIN_SHOW_USER_ID=Benutzer-Id:
TABLE_SUMMARY_ADMIN_LIST_USER_ACTIVITY_LOG=Diese Tabelle enth\u00e4lt die Aktivit\u00e4ten des ausgew\u00e4hlten Benutzeraccounts.
ADMIN_LINK_SHOW_USER_ACTIVITY_LOG=Aktivit\u00e4ten des Benutzers auflisten
+PAGE_TITLE_ADMIN_USER_ACTIVITY_LOG=Logbuch Benutzeraktivit\u00e4ten
+CONTENT_TITLE_ADMIN_USER_ACTIVITY_LOG=Logbuch Benutzeraktivit\u00e4ten:
+ADMIN_LIST_USER_ACTIVIRY_LOG_MESSAGE=Nachricht an Benutzer:
+ADMIN_LIST_USER_ACTIVIRY_LOG_TYPE=Aktivit\u00e4t:
+ADMIN_LIST_USER_ACTIVITY_LOG_TIMESTAMP=Zeitmarke:
+ADMIN_ACTIVITY_ADMIN_LINKED_USER_ACCOUNT=Kontaktdaten mit Benutzeraccount verlinkt.
+USER_ACTIVITY_ADMIN_LINKED_USER_ACCOUNT=Ihr Account wurde aus bestehenden Kontaktdaten erstellt.
+ADMIN_ACTIVITY_ADMIN_LOCKED_USER_ACCOUNT=Benutzer wurde vom Administrator gesperrt.
+USER_ACTIVITY_ADMIN_LOCKED_USER_ACCOUNT=Ihr Account wurde vom Administrator geperrt.
+ADMIN_ACTIVITY_ADMIN_UNLOCKED_USER_ACCOUNT=Benutzeraccount wurde vom Administrator freigegeben.
+USER_ACTIVITY_ADMIN_UNLOCKED_USER_ACCOUNT=Ihr Account wurde vom Administrator wieder freigegeben.
+ADMIN_ACTIVITY_ADMIN_UPDATED_USER_PERSONAL_DATA=Pers\u00f6nliche Daten des Benutzers vom Administrator ge\u00e4ndert.
+USER_ACTIVITY_ADMIN_UPDATED_USER_PERSONAL_DATA=Ihre pers\u00f6nlichen Daten wurden vom Administrator ge\u00e4ndert.
+ADMIN_ACTIVITY_USER_REGISTERED_NEW_ACCOUNT=Ein neuer Benutzer hat sich registriert.
+USER_ACTIVITY_USER_REGISTERED_NEW_ACCOUNT=Sie haben sich an dieser Webseite registriert.
+ADMIN_ACTIVITY_USER_CONFIRMED_ACCOUNT=Benutzer hat Account best\u00e4tigt.
+USER_ACTIVITY_USER_CONFIRMED_ACCOUNT=Sie haben Ihren Account best\u00e4tigt.
+ADMIN_ACTIVITY_USER_LOGGED_IN=Benutzer hat sich eingeloggt.
+USER_ACTIVITY_USER_LOGGED_IN=Sie haben sich eingeloggt.
+ADMIN_ACTIVITY_USER_RESEND_CONFIRMATION_LINK=Benutzer hat neuen Best\u00e4tigungslink angefordert.
+USER_ACTIVITY_USER_RESEND_CONFIRMATION_LINK=Sie haben einen neuen Best\u00e4tigungslink angefordert.
+ADMIN_ACTIVITY_USER_UPDATED_PASSWORD=Benutzer hat sein Zugangspasswort ge\u00e4ndert.
+USER_ACTIVITY_USER_UPDATED_PASSWORD=Sie haben Ihr Zugangspasswort ge\u00e4ndert.
+ADMIN_ACTIVITY_USER_UPDATED_PERSONAL_DATA=Benutzer hat pers\u00f6nliche Daten ge\u00e4ndert.
+USER_ACTIVITY_USER_UPDATED_PERSONAL_DATA=Sie haben Ihre pers\u00f6nlichen Daten ge\u00e4ndert.
+ADMIN_ACTIVITY_ADMIN_ADDED_USER_ACCOUNT=Administrator hat neues Benutzeraccount angelegt.
+USER_ACTIVITY_ADMIN_ADDED_USER_ACCOUNT=Ein Administrator hat Ihren Benutzeracciunt angelegt.
+ADMIN_ACTIVITY_USER_LOGGED_OUT=Benutzer hat sich ausgeloggt.
+USER_ACTIVITY_USER_LOGGED_OUT=Sie haben sich ausgeloggt.
ADMIN_SHOW_USER_ID=User id:
TABLE_SUMMARY_ADMIN_LIST_USER_ACTIVITY_LOG=This table shows choosen user's activity log.
ADMIN_LINK_SHOW_USER_ACTIVITY_LOG=List user's actitivy log
+PAGE_TITLE_ADMIN_USER_ACTIVITY_LOG=Logfile of user activity
+CONTENT_TITLE_ADMIN_USER_ACTIVITY_LOG=Logfile of user activity:
+ADMIN_LIST_USER_ACTIVIRY_LOG_MESSAGE=Message to user:
+ADMIN_LIST_USER_ACTIVIRY_LOG_TYPE=Activity:
+ADMIN_LIST_USER_ACTIVITY_LOG_TIMESTAMP=Timestamp:
+ADMIN_ACTIVITY_ADMIN_LINKED_USER_ACCOUNT=Contact data linked with user account.
+USER_ACTIVITY_ADMIN_LINKED_USER_ACCOUNT=Your account has been created with existing contact data.
+ADMIN_ACTIVITY_ADMIN_LOCKED_USER_ACCOUNT=User was locked by administrator.
+USER_ACTIVITY_ADMIN_LOCKED_USER_ACCOUNT=Your account has been locked by an administrator.
+ADMIN_ACTIVITY_ADMIN_UNLOCKED_USER_ACCOUNT=User was unlocked by an administrator.
+USER_ACTIVITY_ADMIN_UNLOCKED_USER_ACCOUNT=Your account has been unlocked by an administrator.
+ADMIN_ACTIVITY_ADMIN_UPDATED_USER_PERSONAL_DATA=Personal data of the user was changed by administrator.
+USER_ACTIVITY_ADMIN_UPDATED_USER_PERSONAL_DATA=Your personal data has been changed by an administrator.
+ADMIN_ACTIVITY_USER_REGISTERED_NEW_ACCOUNT=A new user has registered.
+USER_ACTIVITY_USER_REGISTERED_NEW_ACCOUNT=You have registered with this website.
+ADMIN_ACTIVITY_USER_CONFIRMED_ACCOUNT=User has confirmed account.
+ADMIN_ACTIVITY_USER_LOGGED_IN=User has logged in.
+USER_ACTIVITY_USER_CONFIRMED_ACCOUNT=You have confirmed your user account.
+USER_ACTIVITY_USER_LOGGED_IN=You have logged in.
+ADMIN_ACTIVITY_USER_RESEND_CONFIRMATION_LINK=User has requested new confirmation link.
+USER_ACTIVITY_USER_RESEND_CONFIRMATION_LINK=You have requested a new confirmation link.
+ADMIN_ACTIVITY_USER_UPDATED_PASSWORD=User has changed account password.
+USER_ACTIVITY_USER_UPDATED_PASSWORD=You have changed your account password.
+ADMIN_ACTIVITY_USER_UPDATED_PERSONAL_DATA=User has changed personal data.
+USER_ACTIVITY_USER_UPDATED_PERSONAL_DATA=You have changed your personal data.
+ADMIN_ACTIVITY_ADMIN_ADDED_USER_ACCOUNT=An administrator has created a new user account.
+USER_ACTIVITY_ADMIN_ADDED_USER_ACCOUNT=An aministrator has created your new user account.
+ADMIN_ACTIVITY_USER_LOGGED_OUT=User has logged out.
+USER_ACTIVITY_USER_LOGGED_OUT=You have logged out.
<to-view-id>/admin/mobile_provider/admin_mobile_provider_show.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+
<navigation-rule>
<from-view-id>/admin/user/admin_user_list.xhtml</from-view-id>
<navigation-case>
<to-view-id>/admin/user/admin_user_show.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/admin/user/admin_user_activity_log.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>admin_show_user</from-outcome>
+ <to-view-id>/admin/user/admin_user_show.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
<!--
<factory>
<exception-handler-factory>
<h:outputText value="#{msg.ADMIN_LIST_USER_ID}" />
</f:facet>
- <h:link outcome="admin_show_user" title="#{msg.ADMIN_LINK_SHOW_USER_TITLE}" value="#{user.userId}">
+ <h:link outcome="admin_show_user" title="#{msg.ADMIN_LINK_SHOW_USER_TITLE}" value="#{userActivity.activityUser.userId}">
<f:param name="userId" value="#{userActivity.activityUser.userId}" />
</h:link>
</h:column>
<h:outputText value="#{msg.ADMIN_LIST_USER_ACTIVIRY_LOG_TYPE}" />
</f:facet>
- <h:outputText value="#{msg['ADMIN_ACTIVITY_' + userActivity.activityType]}" />
+ <h:outputText value="#{msg[userActivityController.expandAdminActivityType(userActivity.activityType)]}" />
</h:column>
<h:column>