]> git.mxchange.org Git - pizzaservice-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Thu, 22 Sep 2022 17:20:23 +0000 (19:20 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 22 Sep 2022 19:14:56 +0000 (21:14 +0200)
- registerBean is no longer used here (old, removed code)
- baseUrl should never be NULL or empty
- user.userContact must be valid

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java

index 3e80bb04b4007fbbec273b00cbacf8f2adbbe9f6..d9d768b7a24d11e1a9c085ea968ee84bf0b09429 100644 (file)
@@ -70,6 +70,12 @@ public class PizzaAdminUserSessionBean extends BasePizzaEnterpriseBean implement
                } else if (user.getUserId() instanceof Long) {
                        // Not allowed here
                        throw new IllegalStateException(MessageFormat.format("user.userId must be null, is: {0}", user.getUserId())); //NOI18N
+               } else if (null == user.getUserContact()) {
+                       // Abort here
+                       throw new NullPointerException("user.contact is null"); //NOI18N
+               } else if (user.getUserContact().getContactId() != null) {
+                       // Not allowed here
+                       throw new IllegalStateException(MessageFormat.format("user.userContact.contactId must be null, is: {0}", user.getUserId())); //NOI18N
                }
 
                // Check if user is registered
index 4a1980dd936a33f8ed0e804436f737d41a128ea5..83bba184246523f0c25754a7a4e54ba6cd9fae3c 100644 (file)
@@ -20,7 +20,6 @@ import java.text.MessageFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
-import javax.ejb.EJB;
 import javax.ejb.EJBException;
 import javax.ejb.Stateless;
 import javax.persistence.Query;
@@ -39,7 +38,6 @@ import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
 import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
 import org.mxchange.jusercore.model.user.password_history.UserPasswordHistory;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote;
 import org.mxchange.pizzaaplication.enterprise.BasePizzaEnterpriseBean;
 
 /**
@@ -55,12 +53,6 @@ public class PizzaUserSessionBean extends BasePizzaEnterpriseBean implements Use
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
-       /**
-        * Registration EJB
-        */
-       @EJB (lookup = "java:global/pizzaservice-ejb/userRegistration!org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote")
-       private UserRegistrationSessionBeanRemote registerBean;
-
        /**
         * Default constructor
         */
@@ -97,7 +89,7 @@ public class PizzaUserSessionBean extends BasePizzaEnterpriseBean implements Use
                        // Throw it again
                        throw new NullPointerException("baseUrl is null"); //NOI18N
                } else if (baseUrl.isEmpty()) {
-                       // Invalid parameter
+                       // Throw IAE
                        throw new IllegalArgumentException("baseUrl is empty"); //NOI18N
                }
 
@@ -366,7 +358,7 @@ public class PizzaUserSessionBean extends BasePizzaEnterpriseBean implements Use
                managedUser.setUserEntryUpdated(new Date());
 
                // Create history entry
-               PasswordHistory entry = new UserPasswordHistory(user.getUserEncryptedPassword(), managedUser);
+               final PasswordHistory entry = new UserPasswordHistory(user.getUserEncryptedPassword(), managedUser);
 
                // Set created timestamp
                entry.setUserPasswordHistoryCreated(new Date());