]> git.mxchange.org Git - jjobs-war.git/commitdiff
Continued with lock/unlock user: (cherry-pick)
authorRoland Häder <roland@mxchange.org>
Thu, 11 Aug 2016 11:56:46 +0000 (13:56 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 19 Aug 2016 20:55:10 +0000 (22:55 +0200)
- added event observer for locking/unlocking users

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionController.java

index add5d0929c53ccd1bcd7a4119a3baf9c4b85b90e..b38a4236ea2964e819f7eae586ee8c29b0c6c833 100644 (file)
@@ -43,7 +43,9 @@ import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.locked.AdminLockedUserEvent;
 import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent;
+import org.mxchange.jusercore.events.user.unlocked.AdminUnlockedUserEvent;
 import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
 import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
 import org.mxchange.jusercore.events.user.update.UserUpdatedPersonalDataEvent;
@@ -207,6 +209,48 @@ public class JobsUserWebSessionBean extends BaseJobsController implements JobsUs
                //* NOISY-DEBUG: */ System.out.println("UserWebBean:afterAdminAddedUserEvent: EXIT!"); //NOI18N
        }
 
+       @Override
+       public void afterAdminLockedUserEvent (@Observes final AdminLockedUserEvent event) {
+               // event should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getLockedUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.lockedUser is null"); //NOI18N
+               } else if (event.getLockedUser().getUserId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.lockedUser.userId is null"); //NOI18N
+               } else if (event.getLockedUser().getUserId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLockedUser(), event.getLockedUser().getUserId())); //NOI18N
+               }
+
+               // Add user uniquely
+               this.uniqueAddUser(event.getLockedUser());
+       }
+
+       @Override
+       public void afterAdminUnlockedUserEvent (@Observes final AdminUnlockedUserEvent event) {
+               // event should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUnlockedUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.unlockedUser is null"); //NOI18N
+               } else if (event.getUnlockedUser().getUserId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.unlockedUser.userId is null"); //NOI18N
+               } else if (event.getUnlockedUser().getUserId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUnlockedUser(), event.getUnlockedUser().getUserId())); //NOI18N
+               }
+
+               // Add user uniquely
+               this.uniqueAddUser(event.getUnlockedUser());
+       }
+
        @Override
        public void afterAdminUpdatedUserDataEvent (@Observes final AdminUpdatedUserDataEvent event) {
                // Trace message
index 418a251bcb6fdadeeb4d0d1c1691eaf621840697..13c57204b5cc8cabaf368bd7ad74f1c74a79e2de 100644 (file)
@@ -23,7 +23,10 @@ import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
+import org.mxchange.jusercore.events.user.locked.AdminLockedUserEvent;
 import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent;
+import org.mxchange.jusercore.events.user.unlocked.AdminUnlockedUserEvent;
 import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
 import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
 import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
@@ -50,6 +53,27 @@ public interface JobsUserWebSessionController extends Serializable {
         */
        void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
 
+       /**
+        * Event observer for linked users with existing contact data
+        * <p>
+        * @param event Event being fired
+        */
+       void afterAdminLinkedUserEvent (final AdminLinkedUserEvent event);
+
+       /**
+        * Event observer for locked users
+        * <p>
+        * @param event Event being fired
+        */
+       void afterAdminLockedUserEvent (final AdminLockedUserEvent event);
+
+       /**
+        * Event observer for unlocked users
+        * <p>
+        * @param event Event being fired
+        */
+       void afterAdminUnlockedUserEvent (final AdminUnlockedUserEvent event);
+
        /**
         * Event observer for updated user data by administrator
         * <p>