public User findUser( String username ) throws UserNotFoundException, UserManagerException { if ( StringUtils.isEmpty( username ) ) { throw new UserNotFoundException( "User with empty username not found." ); } return (User) getObjectById( username, null ); }
public User findUser( String username ) throws UserNotFoundException { triggerInit(); User user = null; Iterator<User> it = users.values().iterator(); while ( it.hasNext() ) { User u = it.next(); if ( u.getUsername().equals( username ) ) { user = u; } } if ( user == null ) { throw new UserNotFoundException( "Unable to find user '" + username + "'" ); } return user; }
private Object getObjectById( String id, String fetchGroup ) throws UserNotFoundException, UserManagerException { try { return RedbackJdoUtils.getObjectById( getPersistenceManager(), JdoUser.class, id, fetchGroup ); } catch ( RedbackObjectNotFoundException e ) { throw new UserNotFoundException( e.getMessage() ); } catch ( RedbackStoreException e ) { throw new UserManagerException( "Unable to get object '" + JdoUser.class.getName() + "', id '" + id + "', fetch-group '" + fetchGroup + "' from jdo store.", e ); } }