1 /*
2  * @(#) $Id: JSTKRole.java,v 1.2 2003/07/08 08:13:53 pankaj Exp $
3  *
4  * Copyright (c) 2002-03 by Pankaj Kumar (http://www.pankaj-k.net). 
5  * All rights reserved.
6  *
7  * The license governing the use of this file can be found in the 
8  * root directory of the containing software.
9  */
10package org.jstk.uam;
11
12import java.util.HashSet;
13import java.util.Iterator;
14
15public class JSTKRole implements java.io.Serializable {
16    String roleName;
17    String roleDesc;
18    HashSet users;
19
20    public JSTKRole(String roleName, String roleDesc){
21        this.roleName = roleName;
22        this.roleDesc = roleDesc;
23        users = new HashSet();
24    }
25
26    public void addUser(String loginName){
27        users.add(loginName);
28    }
29    public void remUser(String loginName){
30        users.remove(loginName);
31    }
32    public boolean hasUsers(){
33        return !users.isEmpty();
34    }
35    public Iterator users(){
36        return users.iterator();
37    }
38    public String getRoleName(){
39        return roleName;
40    }
41    public String getRoleDesc(){
42        return roleDesc;
43    }
44    public void setRoleName(String roleName){
45        this.roleName = roleName;
46    }
47    public void setRoleDesc(String roleDesc){
48        this.roleDesc = roleDesc;
49    }
50    public int hashCode(){
51        return roleName.hashCode();
52    }
53    public String toString(){
54        return "[" + this.getClass().getName() + "]" + "role: " + roleName + ", desc: " + roleDesc;
55    }
56}