From: Roland Häder Date: Sat, 24 Mar 2018 22:20:53 +0000 (+0100) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=058f547aa4daa794555e9210bce2428c8f31ca63;p=pizzaservice-ejb.git Please cherry-pick: - updated reference UserUtils to Users Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java index 54260d3..bbd7735 100644 --- a/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java @@ -221,7 +221,7 @@ public class PizzaUserSessionBean extends BasePizzaEnterpriseBean implements Use // Loop until a user name is found while ((userName == null) || (userList.contains(userName))) { // Generate random name - userName = UserUtils.generateRandomUserName(); + userName = Users.generateRandomUserName(); } // Trace message @@ -416,33 +416,33 @@ public class PizzaUserSessionBean extends BasePizzaEnterpriseBean implements Use } @Override - public User updateUserData (final User user) { + public User updateUserData (final User detachedUser) { // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: detachedUser={1} - CALLED!", this.getClass().getSimpleName(), detachedUser)); //NOI18N // user should not be null - if (null == user) { + if (null == detachedUser) { // Abort here - throw new NullPointerException("user is null"); //NOI18N - } else if (user.getUserId() == null) { + throw new NullPointerException("detachedUser is null"); //NOI18N + } else if (detachedUser.getUserId() == null) { // Throw NPE again - throw new NullPointerException("user.userId is null"); //NOI18N - } else if (user.getUserId() < 1) { + throw new NullPointerException("detachedUser.userId is null"); //NOI18N + } else if (detachedUser.getUserId() < 1) { // Not valid - throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N - } else if (user.getUserAccountStatus() == null) { + throw new IllegalArgumentException(MessageFormat.format("detachedUser.userId={0} is not valid", detachedUser.getUserId())); //NOI18N + } else if (detachedUser.getUserAccountStatus() == null) { // Throw NPE again - throw new NullPointerException("user.userAccountStatus is null"); //NOI18N - } else if (!this.ifUserExists(user)) { + throw new NullPointerException("detachedUser.userAccountStatus is null"); //NOI18N + } else if (!this.ifUserExists(detachedUser)) { // User does not exist - throw new EJBException(MessageFormat.format("User with id {0} does not exist.", user.getUserId())); //NOI18N + throw new EJBException(MessageFormat.format("User with id {0} does not exist.", detachedUser.getUserId())); //NOI18N } // Find the instance - final User foundUser = this.getEntityManager().find(user.getClass(), user.getUserId()); + final User foundUser = this.getEntityManager().find(detachedUser.getClass(), detachedUser.getUserId()); // Should be found! - assert (foundUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N + assert (foundUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", detachedUser.getUserId()); //NOI18N // Merge user final User managedUser = this.getEntityManager().merge(foundUser); @@ -451,7 +451,7 @@ public class PizzaUserSessionBean extends BasePizzaEnterpriseBean implements Use assert (managedUser instanceof User) : MessageFormat.format("User with id {0} not merged, but should be.", managedUser.getUserId()); //NOI18N // Copy all data - UserUtils.copyAll(user, managedUser); + Users.copyAll(detachedUser, managedUser); // Set as updated managedUser.setUserUpdated(new Date()); @@ -569,7 +569,7 @@ public class PizzaUserSessionBean extends BasePizzaEnterpriseBean implements Use assert (managedUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N // Copy all data - UserUtils.copyAll(user, managedUser); + Users.copyAll(user, managedUser); // Set as updated managedUser.setUserUpdated(new Date()); diff --git a/src/java/org/mxchange/pizzaapplication/enterprise/BasePizzaEnterpriseBean.java b/src/java/org/mxchange/pizzaapplication/enterprise/BasePizzaEnterpriseBean.java index aa0472f..057ec07 100644 --- a/src/java/org/mxchange/pizzaapplication/enterprise/BasePizzaEnterpriseBean.java +++ b/src/java/org/mxchange/pizzaapplication/enterprise/BasePizzaEnterpriseBean.java @@ -52,7 +52,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumbers; import org.mxchange.jphone.utils.PhoneUtils; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; -import org.mxchange.jusercore.model.user.UserUtils; +import org.mxchange.jusercore.model.user.Users; /** * A helper class for beans that access the database. @@ -1168,7 +1168,7 @@ public abstract class BasePizzaEnterpriseBean extends BaseEnterpriseBean { } // Set all values - final Properties variables = UserUtils.getAllUserFields(user); + final Properties variables = Users.getAllUserFields(user); // Set base URL and random password variables.put("baseUrl", baseUrl); //NOI18N