- @Deprecated
- public User fillUserData (final User user) throws UserNotFoundException {
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fillUserData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
-
- // user should not be null
- if (null == user) {
- // Abort here
- throw new NullPointerException("user is null"); //NOI18N
- } else if (user.getUserName() == null) {
- // Throw NPE
- throw new NullPointerException("user.userName is null");
- } else if (user.getUserName().isEmpty()) {
- // Throw IAE
- throw new IllegalArgumentException("user.userName is empty");
- } else if (!this.ifUserExists(user)) {
- // User does not exist
- throw new UserNotFoundException(user);
- }
-
- // Try to locate it
- final Query query = this.getEntityManager().createNamedQuery("SearchUserByName", LoginUser.class); //NOI18N
-
- // Set parameter
- query.setParameter("param", user.getUserName()); //NOI18N
-
- // Initialize variable
- final User foundUser;
-
- // Try it
- try {
- // Try to get single result
- foundUser = (User) query.getSingleResult();
- } catch (final NoResultException ex) {
- // Log it
- this.getLoggerBeanLocal().logException(ex);
- return null;
- }
-
- // Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fillUserData: foundUser={1} - EXIT!", this.getClass().getSimpleName(), foundUser)); //NOI18N
-
- // Return prepared instance
- return foundUser;
- }
-
- @Override
- @Deprecated
- public String generateRandomUserName () {