usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/LoginRequest.java
author Dan Labrecque <Dan.Labrecque@oracle.com>
Tue, 14 Dec 2010 14:54:59 -0500
changeset 624 23c2892e582e
parent 600 c16a7e34499d
child 629 98d1255b86eb
permissions -rw-r--r--
17520 - "Change role..." needs better behavior when no roles

/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 */

package org.opensolaris.os.vp.panel.common;

import java.util.*;
import org.opensolaris.os.vp.util.misc.DialogMessage;

public class LoginRequest {
    //
    // Instance data
    //

    private List<DialogMessage> messages = new LinkedList<DialogMessage>();
    private StringLoginProperty host;
    private StringLoginProperty user;
    private StringLoginProperty role;
    private boolean ensureRoles;

    //
    // Constructors
    //

    /**
     * Constructs a {@code LoginRequest}.  Each editable
     * {@code StringLoginProperty} may be changed by the user during the login
     * process.
     *
     * @param	    host
     *		    the host property
     *
     * @param	    user
     *		    the user property
     *
     * @param	    role
     *		    the role property
     *
     * @param	    messages
     *		    optional messages to instruct the user
     */
    public LoginRequest(StringLoginProperty host, StringLoginProperty user,
	StringLoginProperty role, DialogMessage... messages) {

	this.host = host;
	this.user = user;
	this.role = role;

	for (DialogMessage message : messages) {
	    this.messages.add(message);
	}
    }

    /**
     * Constructs a {@code LoginRequest}.  Each editable
     * {@code StringLoginProperty} may be changed by the user during the login
     * process.
     *
     * @param	    host
     *		    the host property
     *
     * @param	    user
     *		    the user property
     *
     * @param	    role
     *		    the role property
     *
     * @param	    ensureRoles
     *		    Ensure there are valid roles for this host/user
     *
     * @param	    messages
     *		    optional messages to instruct the user
     */
    public LoginRequest(StringLoginProperty host, StringLoginProperty user,
	StringLoginProperty role, boolean ensureRoles,
            DialogMessage... messages) {

        this(host, user, role, messages);
        this.ensureRoles = ensureRoles;
    }

    //
    // LoginRequest methods
    //

    public StringLoginProperty getHost() {
	return host;
    }

    public List<DialogMessage> getMessages() {
	return messages;
    }

    public StringLoginProperty getUser() {
	return user;
    }

    public StringLoginProperty getRole() {
	return role;
    }

    public boolean getEnsureRoles() {
	return ensureRoles;
    }
}