View Javadoc

1   /*
2    * Created on Jun 21, 2006
3    *
4    */
5   package org.musicontroller.security;
6   
7   import java.io.Serializable;
8   import java.util.HashSet;
9   import java.util.Set;
10  
11  /**
12   * Catches a group of Authorities under one name. This class is be used to simplify
13   * the usage of Authorities. Instead of assigning a large amount of Auhthorities to a User
14   * only one or two Roles can suffice.
15   * @author Varienaja
16   * @version $Id: Role.java,v 1.1 2010/03/16 18:55:42 varienaja Exp $
17   */
18  public class Role implements Serializable {
19  	
20  	/**
21  	 * Unieke nummer t.b.v. serialisatie. 
22  	 */
23  	private static final long serialVersionUID = -2205531609151266723L;
24  	
25  	private int _id;
26  	private String _name;
27  	private Set<Authority> _authorities;
28  	
29  	/**
30  	 * Creates a new Role-object.
31  	 *
32  	 */
33  	public Role() {
34  		_id = -1;
35  		_name = "";
36  		_authorities = new HashSet<Authority>();
37  	}
38  	
39  	/**
40  	 * @return The unique identifier for this Role
41  	 */
42  	public int getId() {
43  		return _id;
44  	}
45  	
46  	/**
47  	 * Set the identifier for this Role
48  	 * @param id an integer.
49  	 */
50  	public void setId(int id) {
51  		_id = id;
52  	}
53  	
54  	/**
55  	 * @return The name of this Role
56  	 */
57  	public String getName() {
58  		return _name;
59  	}
60  	
61  	/**
62  	 * Sets the name for this Role.
63  	 * @param name The name
64  	 */
65  	public void setName(String name) {
66  		_name = name;
67  	}
68  	
69  	/**
70  	 * @return The Authorities that are granted this Role.
71  	 */
72  	public Set<Authority> getAuthorities() {
73  		return _authorities;
74  	}
75  
76  	/**
77  	 * Sets the Authorities that are granted to this Role.
78  	 * @param authorities The Authorities.
79  	 */
80  	public void setAuthorities(Set<Authority> authorities) {
81  		_authorities = authorities;
82  	}
83  
84  }