]> git.mxchange.org Git - jjobs-war.git/blobdiff - src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java
Please cherry-pick:
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / user / JobsUserWebRequestBean.java
index 49165b4340bb04e76893a609f40f32e086c07272..9a082abbbf8dc372a310a872fd52e6826a89054c 100644 (file)
  */
 package org.mxchange.jjobs.beans.user;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
 import java.util.Objects;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
@@ -44,20 +37,13 @@ import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.clear.password.ObservableClearUserPasswordEvent;
 import org.mxchange.jusercore.events.user.clear.username.ObservableClearUserNameEvent;
 import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
-import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent;
 import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
-import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent;
-import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent;
-import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
 import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent;
 import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
-import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
-import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
-import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent;
 import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent;
 import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent;
 import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
@@ -78,11 +64,6 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
-       /**
-        * List of all users
-        */
-       private final List<User> allUsers;
-
        /**
         * General contact controller
         */
@@ -96,14 +77,10 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
        private JobsFeaturesWebApplicationController featureController;
 
        /**
-        * List of filtered users
-        */
-       private List<User> filteredUsers;
-
-       /**
-        * Locale instance
+        * Localization controller
         */
-       private Locale locale;
+       @Inject
+       private JobsLocalizationSessionController localizationController;
 
        /**
         * Event being fired when user updated personal data
@@ -118,13 +95,6 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
        @EJB (lookup = "java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
        private UserSessionBeanRemote userBean;
 
-       /**
-        * A list of all user profiles
-        */
-       @Inject
-       @NamedCache (cacheName = "userCache")
-       private Cache<Long, User> userCache;
-
        /**
         * User id
         */
@@ -162,9 +132,6 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
        public JobsUserWebRequestBean () {
                // Call super constructor
                super();
-
-               // Init list
-               this.allUsers = new LinkedList<>();
        }
 
        /**
@@ -173,7 +140,7 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
         * @param event Event being fired
         */
        public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
-               // event should not be null
+               // Event and contained entity instance should not be null
                if (null == event) {
                        // Throw NPE
                        throw new NullPointerException("event is null"); //NOI18N
@@ -188,51 +155,17 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                        throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
                }
 
-               // Update user list
-               this.updateList(event.getAddedUser());
-
-               // Clear all data
-               this.clear();
-
                // Set user id again
                this.setUserId(event.getAddedUser().getUserId());
        }
 
-       /**
-        * Event observer for deleted user accounts (by administrator)
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminDeletedUserEvent (@Observes final ObservableAdminDeletedUserEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getDeletedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.deletedUser is null"); //NOI18N
-               } else if (event.getDeletedUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.deletedUser.userId is null"); //NOI18N
-               } else if (event.getDeletedUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getDeletedUser(), event.getDeletedUser().getUserId())); //NOI18N
-               }
-
-               // Update user list
-               this.removeFromList(event.getDeletedUser());
-
-               // Clear all data
-               this.clear();
-       }
-
        /**
         * Event observer for linked users with existing contact data
         * <p>
         * @param event Event being fired
         */
        public void afterAdminLinkedUserEvent (@Observes final ObservableAdminLinkedUserEvent event) {
-               // event should not be null
+               // Event and contained entity instance should not be null
                if (null == event) {
                        // Throw NPE
                        throw new NullPointerException("event is null"); //NOI18N
@@ -247,94 +180,10 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                        throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLinkedUser(), event.getLinkedUser().getUserId())); //NOI18N
                }
 
-               // Update user list
-               this.updateList(event.getLinkedUser());
-
-               // Clear all data
-               this.clear();
-
                // Set user id again
                this.setUserId(event.getLinkedUser().getUserId());
        }
 
-       /**
-        * Event observer for locked users
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminLockedUserEvent (@Observes final ObservableAdminLockedUserEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getLockedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.lockedUser is null"); //NOI18N
-               } else if (event.getLockedUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.lockedUser.userId is null"); //NOI18N
-               } else if (event.getLockedUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLockedUser(), event.getLockedUser().getUserId())); //NOI18N
-               }
-
-               // Update user list
-               this.updateList(event.getLockedUser());
-       }
-
-       /**
-        * Event observer for unlocked users
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminUnlockedUserEvent (@Observes final ObservableAdminUnlockedUserEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getUnlockedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.unlockedUser is null"); //NOI18N
-               } else if (event.getUnlockedUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.unlockedUser.userId is null"); //NOI18N
-               } else if (event.getUnlockedUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUnlockedUser(), event.getUnlockedUser().getUserId())); //NOI18N
-               }
-
-               // Update user list
-               this.updateList(event.getUnlockedUser());
-       }
-
-       /**
-        * Event observer for updated user data by administrator
-        * <p>
-        * @param event Event being updated
-        */
-       public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminUpdatedUserDataEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getUpdatedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.updatedUser is null"); //NOI18N
-               } else if (event.getUpdatedUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N
-               } else if (event.getUpdatedUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUpdatedUser(), event.getUpdatedUser().getUserId())); //NOI18N
-               }
-
-               // Update user list
-               this.updateList(event.getUpdatedUser());
-
-               // Clear all data
-               this.clear();
-       }
-
        /**
         * Event observer for when a bean helper has successfully created a user
         * instance, means the user exists. If the user does not exist, this event
@@ -365,58 +214,13 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                this.copyUser(user);
        }
 
-       /**
-        * Observer method for events being fired when the application's locale has
-        * been changed.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterLocaleChangeEvent (@Observes final ObservableLocaleChangeEvent event) {
-               // Is the parameter valid?
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getLocale() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.locale is null"); //NOI18N
-               }
-
-               // Set it here
-               this.setLocale(event.getLocale());
-       }
-
-       /**
-        * Event observer when user confirmed account.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterUserConfirmedAccountEvent (@Observes final ObservableUserConfirmedAccountEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getConfirmedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.confirmedUser is null"); //NOI18N
-               } else if (event.getConfirmedUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.confirmedUser.userId is null"); //NOI18N
-               } else if (event.getConfirmedUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getConfirmedUser(), event.getConfirmedUser().getUserId())); //NOI18N
-               }
-
-               // Update user list
-               this.updateList(event.getConfirmedUser());
-       }
-
        /**
         * Event observer for logged-in user
         * <p>
         * @param event Event instance
         */
        public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) {
-               // event should not be null
+               // Event and contained entity instance should not be null
                if (null == event) {
                        // Throw NPE
                        throw new NullPointerException("event is null"); //NOI18N
@@ -467,7 +271,7 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
         * @param event User registration event
         */
        public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
-               // event should not be null
+               // Event and contained entity instance should not be null
                if (null == event) {
                        // Throw NPE
                        throw new NullPointerException("event is null"); //NOI18N
@@ -488,73 +292,10 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                // Copy all data from registered->user
                this.copyUser(registeredUser);
 
-               // Clear all data
-               this.clear();
-
-               // Update user list
-               this.updateList(registeredUser);
-
                // Set user id again
                this.setUserId(registeredUser.getUserId());
        }
 
-       /**
-        * Method being call after user's password has been updated (and history
-        * entry has been created).
-        * <p>
-        * @param event Event being observed
-        */
-       public void afterUserUpdatedPasswordEvent (@Observes final ObservableUpdatedUserPasswordEvent event) {
-               // Check parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getPasswordHistory() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.passwordHistory is null"); //NOI18N
-               } else if (event.getPasswordHistory().getUserPasswordHistoryId() == null) {
-                       // ... and again
-                       throw new NullPointerException("event.passwordHistory.userPasswordHistoryId is null"); //NOI18N
-               } else if (event.getPasswordHistory().getUserPasswordHistoryId() < 1) {
-                       // Invalid value
-                       throw new IllegalArgumentException(MessageFormat.format("event.passwordHistory.userPasswordHistoryId={0} is in valid", event.getPasswordHistory().getUserPasswordHistoryId())); //NOI18N
-               }
-
-               // Update user list
-               this.updateList(event.getPasswordHistory().getUserPasswordHistoryUser());
-       }
-
-       /**
-        * Listens to fired event when user updated personal data
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterUserUpdatedPersonalDataEvent (@Observes final ObservableUpdatedUserPersonalDataEvent event) {
-               // Check parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getUpdatedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.updatedUser is null"); //NOI18N
-               } else if (event.getUpdatedUser().getUserId() == null) {
-                       // ... and again
-                       throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N
-               } else if (event.getUpdatedUser().getUserId() < 1) {
-                       // Invalid value
-                       throw new IllegalArgumentException(MessageFormat.format("event.updatedUser.userId={0} is in valid", event.getUpdatedUser().getUserId())); //NOI18N
-               }
-
-               // Update user list
-               this.updateList(event.getUpdatedUser());
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<User> allUsers () {
-               return this.allUsers;
-       }
-
        /**
         * Event observer for when a user name should be cleared
         * <p>
@@ -592,9 +333,6 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                // Required personal data must be set
                assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
 
-               // Create new user instance
-               final User user = new LoginUser();
-
                // Is user name required?
                if (!this.isUserNameRequired()) {
                        // Generate pseudo-random user name
@@ -613,10 +351,13 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                        this.setUserPasswordRepeat(randomPassword);
                }
 
+               // Create new user instance
+               final User user = new LoginUser();
+
                // Set user name profile mode and locale
                user.setUserName(this.getUserName());
                user.setUserProfileMode(this.getUserProfileMode());
-               user.setUserLocale(this.getLocale());
+               user.setUserLocale(this.localizationController.getLocale());
 
                // Is multiple registration page
                if ((createContactData) || (!this.featureController.isFeatureEnabled("user_register_multiple_page"))) { //NOI18N
@@ -696,47 +437,6 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                return "user_contact_data_saved"; //NOI18N
        }
 
-       @Override
-       public User findUserById (final Long userId) throws UserNotFoundException {
-               // Validate parameter
-               if (null == userId) {
-                       // Throw NPE
-                       throw new NullPointerException("userId is null"); //NOI18N
-               } else if (userId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N
-               } else if (!this.userCache.containsKey(userId)) {
-                       // Not found
-                       throw new UserNotFoundException(userId);
-               }
-
-               // Get it from cache
-               final User user = this.userCache.get(userId);
-
-               // Return it
-               return user;
-       }
-
-       /**
-        * Getter for filtered users list
-        * <p>
-        * @return Filtered users list
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<User> getFilteredUsers () {
-               return this.filteredUsers;
-       }
-
-       /**
-        * Setter for filtered users list
-        * <p>
-        * @param filteredUsers Filtered users list
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredUsers (final List<User> filteredUsers) {
-               this.filteredUsers = filteredUsers;
-       }
-
        /**
         * Getter for user id
         * <p>
@@ -831,90 +531,6 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                                ((this.getUserPasswordRepeat() == null) || (this.getUserPasswordRepeat().isEmpty())));
        }
 
-       @Override
-       public boolean ifUserIdExists (final Long userId) {
-               // Validate parameter
-               if (null == userId) {
-                       // Throw NPE
-                       throw new NullPointerException("userId is null"); //NOI18N
-               } else if (userId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N
-               }
-
-               // Check if key is there
-               boolean isFound = this.userCache.containsKey(userId);
-
-               // Return flag
-               return isFound;
-       }
-
-       /**
-        * Post-initialization of this class
-        */
-       @PostConstruct
-       public void init () {
-               // Is cache there?
-               if (!this.userCache.iterator().hasNext()) {
-                       // Get whole list from EJB
-                       final List<User> users = this.userBean.allUsers();
-
-                       // Add all
-                       for (final User user : users) {
-                               // Add it to cache
-                               this.userCache.put(user.getUserId(), user);
-                       }
-               }
-
-               // Is cache filled and list is empty
-               if ((this.userCache.iterator().hasNext()) && (this.allUsers.isEmpty())) {
-                       // Build up list
-                       for (final Cache.Entry<Long, User> currentEntry : this.userCache) {
-                               // Add to list
-                               this.allUsers.add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.allUsers.sort(new Comparator<User>() {
-                               @Override
-                               public int compare (final User user1, final User user2) {
-                                       return user1.getUserId() > user2.getUserId() ? 1 : user1.getUserId() < user2.getUserId() ? -1 : 0;
-                               }
-                       });
-               }
-       }
-
-       @Override
-       public boolean isContactFound (final Contact contact) {
-               // The contact must be valid
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
-               }
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Loop through all entries
-               for (final User currentUser : this.allUsers()) {
-                       // Compare both objects
-                       if (Objects.equals(contact, currentUser.getUserContact())) {
-                               // Found it
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return status
-               return isFound;
-       }
-
        @Override
        public boolean isRequiredChangePersonalDataSet () {
                return ((this.getUserProfileMode() != null) &&
@@ -947,25 +563,6 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                return ((this.getUserId() == null) || (this.getUserId() == 0));
        }
 
-       @Override
-       public boolean isUserNameRegistered (final User user) {
-               // Default is not found
-               boolean isFound = false;
-
-               // Determine it
-               for (final User currentUser : this.allUsers()) {
-                       // Is same name found?
-                       if (Objects.equals(user.getUserName(), currentUser.getUserName())) {
-                               // Yes, then set flag and abort loop
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
-       }
-
        @Override
        public boolean isUserNameRequired () {
                // Get context parameter
@@ -978,98 +575,6 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                return isRequired;
        }
 
-       @Override
-       public User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException {
-               // Parameter must be valid
-               if (null == emailAddress) {
-                       // Throw NPE
-                       throw new NullPointerException("emailAddress is null"); //NOI18N
-               } else if (emailAddress.isEmpty()) {
-                       // Not valid
-                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
-               }
-
-               // Init variable
-               User user = null;
-
-               // Try to lookup it in visible user list
-               for (final Cache.Entry<Long, User> currentUser : this.userCache) {
-                       // Contact should be set
-                       if (currentUser.getValue().getUserContact() == null) {
-                               // Contact is null
-                               throw new NullPointerException(MessageFormat.format("currentUser.userContact is null for user id {0}", currentUser.getKey())); //NOI18N
-                       } else if (currentUser.getValue().getUserContact().getContactEmailAddress() == null) {
-                               // Email address should be set
-                               throw new NullPointerException(MessageFormat.format("currentUser.userContact.contactEmailAddress is null for user id {0}", currentUser.getKey())); //NOI18N
-                       }
-
-                       // Is the email address found?
-                       if (Objects.equals(currentUser.getValue().getUserContact().getContactEmailAddress(), emailAddress)) {
-                               // Copy to other variable
-                               user = currentUser.getValue();
-                               break;
-                       }
-               }
-
-               // Is it still null?
-               if (null == user) {
-                       // Not visible for the current user
-                       throw new UserEmailAddressNotFoundException(emailAddress);
-               }
-
-               // Return it
-               return user;
-       }
-
-       @Override
-       public User lookupUserById (final Long userId) throws UserNotFoundException {
-               // Parameter must be valid
-               if (null == userId) {
-                       // Throw NPE
-                       throw new NullPointerException("userId is null"); //NOI18N
-               } else if (userId < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("userId={0} is not valid.", userId)); //NOI18N
-               }
-
-               // Init variable
-               User user = null;
-
-               // Try to lookup it in visible user list
-               for (final Cache.Entry<Long, User> currentUser : this.userCache) {
-                       // Is the user id found?
-                       if (Objects.equals(currentUser.getKey(), userId)) {
-                               // Copy to other variable
-                               user = currentUser.getValue();
-                               break;
-                       }
-               }
-
-               // Is it still null?
-               if (null == user) {
-                       // Not visible for the current user
-                       throw new UserNotFoundException(userId);
-               }
-
-               // Return it
-               return user;
-       }
-
-       /**
-        * Clears this bean
-        */
-       private void clear () {
-               // Clear all data
-               // - personal data
-               this.setUserId(null);
-               this.setUserProfileMode(null);
-
-               // - other data
-               this.clearUserName();
-               this.clearUserPasswords();
-               this.setLocale(null);
-       }
-
        /**
         * Clears user name
         */
@@ -1108,77 +613,4 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                this.setUserProfileMode(user.getUserProfileMode());
        }
 
-       /**
-        * Getter for locale instance
-        * <p>
-        * @return Locale instance
-        */
-       private Locale getLocale () {
-               return this.locale;
-       }
-
-       /**
-        * Setter for locale instance
-        * <p>
-        * @param locale Locale instance
-        */
-       private void setLocale (final Locale locale) {
-               this.locale = locale;
-       }
-
-       /**
-        * Removes user from all lists
-        * <p>
-        * @param user User to remove
-        */
-       private void removeFromList (final User user) {
-               // The user should be valid
-               if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // ... again NPE
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N
-               }
-
-               // Remove it from lists
-               this.allUsers().remove(user);
-               this.userCache.remove(user.getUserId());
-       }
-
-       /**
-        * Updates list with given user instance
-        * <p>
-        * @param user User instance
-        */
-       private void updateList (final User user) {
-               // The user should be valid
-               if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() == null) {
-                       // ... again NPE
-                       throw new NullPointerException("user.userId is null"); //NOI18N
-               } else if (user.getUserId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Throw again ...
-                       throw new NullPointerException(MessageFormat.format("user.userContact.contactId={0} is invalid.", user.getUserContact().getContactId())); //NOI18N
-               }
-
-               // Add/update user
-               this.userCache.put(user.getUserId(), user);
-               this.allUsers.add(user);
-       }
-
 }