]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - src/java/org/mxchange/pizzaapplication/beans/user/confirmlink/PizzaConfirmationLinkWebRequestBean.java
Please cherry-pick:
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / user / confirmlink / PizzaConfirmationLinkWebRequestBean.java
index 98b46a9a3afc89b008ad186e067244941bcc97dd..ad0a09e37ac17a5c5d975c10f51e8208c420bc79 100644 (file)
@@ -30,14 +30,18 @@ import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import org.mxchange.jcoreee.events.helper.clear.HelperCleanupEvent;
+import org.mxchange.jcoreee.events.helper.clear.ObservableHelperCleanupEvent;
 import org.mxchange.jcoreee.utils.FacesUtils;
-import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
-import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
+import org.mxchange.jusercore.events.user.created.CreatedUserEvent;
+import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
 import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
 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.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent;
+import org.mxchange.juserlogincore.events.confirmation.UserConfirmedAccountEvent;
 import org.mxchange.pizzaapplication.beans.BasePizzaController;
 import org.mxchange.pizzaapplication.beans.helper.PizzaWebRequestHelperController;
 import org.mxchange.pizzaapplication.beans.user.PizzaUserWebSessionController;
@@ -62,6 +66,13 @@ public class PizzaConfirmationLinkWebRequestBean extends BasePizzaController imp
        @Inject
        private PizzaWebRequestHelperController beanHelper;
 
+       /**
+        * Event being fired when a bean helper should be cleaned
+        */
+       @Inject
+       @Any
+       private Event<ObservableHelperCleanupEvent> cleanHelperEvent;
+
        /**
         * Confirmation key
         */
@@ -85,6 +96,13 @@ public class PizzaConfirmationLinkWebRequestBean extends BasePizzaController imp
        @Inject
        private PizzaUserWebSessionController userController;
 
+       /**
+        * Event for when a user instance was created
+        */
+       @Any
+       @Inject
+       private Event<ObservableCreatedUserEvent> userCreatedEvent;
+
        /**
         * Default constructor
         */
@@ -172,7 +190,7 @@ public class PizzaConfirmationLinkWebRequestBean extends BasePizzaController imp
                // Is the user instance null?
                if ((null == user) || (user.getUserAccountStatus() != UserAccountStatus.UNCONFIRMED)) {
                        // Then clear this bean and the helper
-                       this.beanHelper.setUser(null);
+                       this.cleanHelperEvent.fire(new HelperCleanupEvent());
                } else {
                        // Try to confirm it
                        this.confirmUserAccount(user);
@@ -241,11 +259,8 @@ public class PizzaConfirmationLinkWebRequestBean extends BasePizzaController imp
                // Debug message
                System.out.println(MessageFormat.format("{0}.confirmUserAccount: updatedUser={1}", this.getClass().getSimpleName(), updatedUser)); //NOI18N
 
-               // Set it again in helper
-               this.beanHelper.setUser(updatedUser);
-
-               // ... and copy it to the controller
-               this.beanHelper.copyUserToController();
+               // Fire event
+               this.userCreatedEvent.fire(new CreatedUserEvent(updatedUser));
 
                // Trace message
                System.out.println(MessageFormat.format("{0}.confirmUserAccount: EXIT!", this.getClass().getSimpleName())); //NOI18N