Package org.jboss.seam.examples.booking.model

Examples of org.jboss.seam.examples.booking.model.User


    private final List<User> users = new ArrayList<User>();
    private final List<Hotel> hotels = new ArrayList<Hotel>();

    public ApplicationInitializer() {
        users.addAll(Arrays.asList(
                new User("Shane Bryzak", "shane", "shane@example.com", "brisbane"),
                new User("Dan Allen", "dan", "dan@example.com", "laurel"),
                new User("Lincoln Baxter III", "lincoln", "lincoln@example.com", "charlotte"),
                new User("Jose Freitas", "jose", "jose.freitas@example.com", "brazil")));

        hotels.addAll(Arrays.asList(
                new Hotel(129, 3, "Marriott Courtyard", "Tower Place, Buckhead", "Atlanta", "GA", "30305", "USA"),
                new Hotel(84, 4, "Doubletree Atlanta-Buckhead", "3342 Peachtree Road NE", "Atlanta", "GA", "30326", "USA"),
                new Hotel(289, 4, "W New York - Union Square", "201 Park Avenue South", "New York", "NY", "10003", "USA"),
View Full Code Here


    public void setUsernameInput(final UIInput usernameInput) {
        this.usernameInput = usernameInput;
    }

    private boolean verifyUsernameIsAvailable() {
        User existing = em.find(User.class, newUser.getUsername());
        if (existing != null) {
            messages.warn(new BundleKey("messages", "account_usernameTaken"))
                    .defaults("The username '{0}' is already taken. Please choose another username.")
                    .targets(usernameInput.getClientId()).params(newUser.getUsername());
            return false;
View Full Code Here

        log.info("Logging in " + credentials.getUsername());
        if ((credentials.getUsername() == null) || (credentials.getCredential() == null)) {
            messages.error(new DefaultBundleKey("identity_loginFailed")).defaults("Invalid username or password");
            setStatus(AuthenticationStatus.FAILURE);
        }
        User user = em.find(User.class, credentials.getUsername());
        if (user != null && credentials.getCredential() instanceof PasswordCredential &&
            user.getPassword().equals(((PasswordCredential) credentials.getCredential()).getValue())) {
            loginEventSrc.fire(user);
            messages.info(new DefaultBundleKey("identity_loggedIn"), user.getName()).defaults("You're signed in as {0}")
                    .params(user.getName());
            setStatus(AuthenticationStatus.SUCCESS);
            setUser(new SimpleUser(user.getUsername())); //TODO confirm the need for this set method
            return;
        }

        messages.error(new DefaultBundleKey("identity_loginFailed")).defaults("Invalid username or password");
        setStatus(AuthenticationStatus.FAILURE);
View Full Code Here

TOP

Related Classes of org.jboss.seam.examples.booking.model.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.