From 058f547aa4daa794555e9210bce2428c8f31ca63 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 24 Mar 2018 23:20:53 +0100 Subject: [PATCH] Please cherry-pick: - updated reference UserUtils to Users MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/user/PizzaUserSessionBean.java | 34 +++++++++---------- .../enterprise/BasePizzaEnterpriseBean.java | 4 +-- 2 files changed, 19 insertions(+), 19 deletions(-) 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 -- 2.39.5