/* Generated by Together */

package cobalt.deployment.descriptor.dist;

import java.util.Set;
import java.util.HashSet;

/**
 * Title:        WebLogic role map
 * Description:  Represents WebLogic-specific role mapping description for standard role mapping description
 * Copyright:    Copyright (c) 2001
 * Company:      ETRI
 * @author Yeon Jun Choi
 * @version 1.0
 */

public class Weblogic60RoleEntry {
    public Weblogic60RoleEntry(String name) {
        setName(name);
        principals = new HashSet();
    }

    public Weblogic60RoleEntry(String name, String principal) {
        setName(name);
        principals = new HashSet();
        addPrincipal(principal);
    }

    public String getName(){
            return name;
        }

    public void setName(String name){
            this.name = name;
        }

    public Set getPrincipals(){
            return principals;
        }

    public void setPrincipals(Set principals){
            this.principals = principals;
        }
    public void addPrincipal(String principal) {
        principals.add(principal);
    }
    public void removePrincipal(String principal) {
        principals.remove(principal);
    }
    public boolean contains(String principal) {
        return principals.contains(principal);
    }
    public boolean isEmpty() {
        return principals.isEmpty();
    }
/*
    public boolean equals(Object obj) {
        if (obj instanceof Weblogic60RoleEntry)
            if ( ((Weblogic60RoleEntry)obj).getName().equals(name) &&
            	 ((Weblogic60RoleEntry)obj).getPrincipal().equals(principal) )
                 	return true;
        return false;
    }
    public boolean equals(String name, String principal) {
        if ( this.name.equals(name) && this.principal.equals(principal) )
            return true;
        return false;
    }
*/

    private String name;
    private Set principals;
}
