From bf9a405d97165a8386ff5b55b76235787f244fc5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 25 Aug 2016 17:54:15 +0200 Subject: [PATCH] Please cherry-pick: - renamed helper interface and class according to naming convention - added link in administrative user links including navigation rule - added + implemented controller method allCurrentUsersActivityLog() which requires beanHeper.user being set MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../JobsConfirmationLinkWebRequestBean.java | 4 +- .../JobsAdminContactWebRequestBean.java | 4 +- .../JobsAdminContactPhoneWebRequestBean.java | 4 +- .../phone/JobsContactPhoneWebSessionBean.java | 4 +- .../phone/JobsAdminPhoneWebRequestBean.java | 4 +- .../user/JobsAdminUserWebRequestBean.java | 4 +- .../JobsUserActivityWebApplicationBean.java | 38 +++++++++++++++++++ 7 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java index edc4f1b9..5e81e924 100644 --- a/src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java @@ -31,6 +31,7 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jjobs.beans.BaseJobsController; +import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; import org.mxchange.jjobs.beans.user.JobsUserWebSessionController; import org.mxchange.jusercore.events.confirmation.ConfirmedUserAccountEvent; import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent; @@ -39,7 +40,6 @@ import org.mxchange.jusercore.exceptions.UserStatusLockedException; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; import org.mxchange.jusercore.model.user.status.UserAccountStatus; -import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; /** * A web request bean for confirmation link handling @@ -56,7 +56,7 @@ public class JobsConfirmationLinkWebRequestBean extends BaseJobsController imple private static final long serialVersionUID = 57_637_182_796_370L; /** - * Admin helper instance + * Bean helper */ @Inject private JobsWebViewHelperController beanHelper; diff --git a/src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java index 99cf6b91..f5f168a9 100644 --- a/src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java @@ -45,13 +45,13 @@ import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent; import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException; import org.mxchange.jcountry.data.Country; import org.mxchange.jjobs.beans.BaseJobsController; +import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; import org.mxchange.jphone.phonenumbers.DialableNumber; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; -import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; /** * An administrative user controller (bean) @@ -80,7 +80,7 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement private AdminContactSessionBeanRemote adminContactBean; /** - * Admin helper instance + * Bean helper */ @Inject private JobsWebViewHelperController beanHelper; diff --git a/src/java/org/mxchange/jjobs/beans/contact/phone/JobsAdminContactPhoneWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/contact/phone/JobsAdminContactPhoneWebRequestBean.java index a6d52804..e41685dc 100644 --- a/src/java/org/mxchange/jjobs/beans/contact/phone/JobsAdminContactPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/contact/phone/JobsAdminContactPhoneWebRequestBean.java @@ -45,6 +45,7 @@ import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEv import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote; import org.mxchange.jcountry.data.Country; import org.mxchange.jjobs.beans.BaseJobsController; +import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; import org.mxchange.jjobs.beans.phone.JobsAdminPhoneWebRequestController; import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException; import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException; @@ -56,7 +57,6 @@ import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.mobile.MobileNumber; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; -import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; /** * An administrative contact phone controller (bean) @@ -110,7 +110,7 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsController impl private JobsAdminPhoneWebRequestController adminPhoneController; /** - * Admin helper instance + * Bean helper */ @Inject private JobsWebViewHelperController beanHelper; diff --git a/src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebSessionBean.java index ece8bd7e..cb25fef7 100644 --- a/src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebSessionBean.java @@ -34,12 +34,12 @@ import org.mxchange.jcontacts.events.landline.unlinked.AdminUnlinkedLandLineNumb import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEvent; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController; +import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; import org.mxchange.jphone.phonenumbers.DialableNumber; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; -import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; /** * An administrative contact phone controller (bean) @@ -56,7 +56,7 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement private static final long serialVersionUID = 542_145_347_916L; /** - * Admin helper instance + * Bean helper */ @Inject private JobsWebViewHelperController beanHelper; diff --git a/src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestBean.java index 024020b7..9342c2bb 100644 --- a/src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestBean.java @@ -30,6 +30,7 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jcountry.data.Country; import org.mxchange.jjobs.beans.BaseJobsController; +import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent; import org.mxchange.jphone.events.fax.deleted.AdminFaxNumberDeletedEvent; import org.mxchange.jphone.events.fax.removed.AdminFaxNumberRemovedFromListEvent; @@ -53,7 +54,6 @@ import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote; -import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; /** * Administrative controller (bean) for phone numbers @@ -80,7 +80,7 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements private AdminPhoneSessionBeanRemote adminPhoneBean; /** - * Admin helper instance + * Bean helper */ @Inject private JobsWebViewHelperController beanHelper; diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java index a806e1a6..19e7b17a 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java @@ -34,6 +34,7 @@ import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jjobs.beans.BaseJobsController; import org.mxchange.jjobs.beans.contact.JobsAdminContactWebRequestController; import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController; +import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; import org.mxchange.jusercore.container.login.UserLoginContainer; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; @@ -60,7 +61,6 @@ import org.mxchange.jusercore.model.user.UserSessionBeanRemote; import org.mxchange.jusercore.model.user.UserUtils; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; import org.mxchange.jusercore.model.user.status.UserAccountStatus; -import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController; /** * A user controller (bean) @@ -95,7 +95,7 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J private final AdminUserSessionBeanRemote adminUserBean; /** - * Admin helper instance + * Bean helper */ @Inject private JobsWebViewHelperController beanHelper; diff --git a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java index 6062b056..722385d4 100644 --- a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java @@ -26,11 +26,13 @@ import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; 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.jjobs.beans.BaseJobsController; +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.registration.UserRegisteredEvent; @@ -61,6 +63,12 @@ public class JobsUserActivityWebApplicationBean extends BaseJobsController imple */ private static final long serialVersionUID = 192_586_376_717_856_904L; + /** + * Bean helper + */ + @Inject + private JobsWebViewHelperController beanHelper; + /** * EJB for user activity log */ @@ -383,6 +391,36 @@ public class JobsUserActivityWebApplicationBean extends BaseJobsController imple this.addUserActivity(event.getUpdatedUser(), "USER_UPDATED_PERSONAL_DATA"); //NOI18N } + @Override + public List allCurrentUsersActivityLog () { + // Get user + User user = this.beanHelper.getUser(); + + // beanHelper.user should be set and valid + if (null == user) { + // Is not set + throw new NullPointerException("this.beanHelper.user is null"); + } else if (user.getUserId() == null) { + // Throw NPE again + throw new NullPointerException("this.beanHelper.user.userId is null"); + } else if (user.getUserId() < 1) { + // Invalid id number + throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.user.userId={0} is not valid", user.getUserId())); + } + + // Init list + List list = new LinkedList<>(); + + // Is the user set? + if (this.usersActivity.containsKey(user)) { + // Return it + list.addAll(this.usersActivity.get(user)); + } + + // Return it + return list; + } + /** * Post-constructor method */ -- 2.39.5