FileDocCategorySizeDatePackage
UserBeanImpl.javaAPI DocExample1737Sat Nov 22 13:40:20 GMT 2003fcexample.model

UserBeanImpl

public class UserBeanImpl extends Object implements UserBean
An implmentation of the mailing bean interface, using local variables as storage. Real implementations should use a real login mechanism.

Fields Summary
private String
username
the username
private String
password
the password
private boolean
loggedIn
whether the user is logged in or not
Constructors Summary
Methods Summary
public booleandoLogin()
Business method to actually perform login. This method just checks that the password exists and is longer than 3 characters long. Real versions should check with some kind of real mechanism to determing username and password validity.

        if (password == null || password.length() < 3) {
            setLoggedIn(false);
        } else {
            setLoggedIn(true);
        }
        
        return isLoggedIn();
    
public java.lang.StringgetPassword()
Get the password

        return this.password;
    
public java.lang.StringgetUsername()
Get the user name

        return this.username;
    
public booleanisLoggedIn()
Determine if we are currently logged in or not

        return loggedIn;
    
private voidsetLoggedIn(boolean loggedIn)
Set whether we are currently logged in or not

        this.loggedIn = loggedIn;
    
public voidsetPassword(java.lang.String password)
Set the password

        this.password = password;
    
public voidsetUsername(java.lang.String username)
Set the user name

        this.username = username;