View Javadoc

1   /*
2    * Created on Jun 20, 2006
3    *
4    */
5   package org.musicontroller.security;
6   
7   import java.io.Serializable;
8   
9   import org.acegisecurity.GrantedAuthority;
10  
11  /**
12   * A Authority is the right to perform a certain task in an application.
13   * Authorities are specified by a String giving a short description of
14   * the task.
15   * @author Varienaja
16   * @version $Id: Authority.java,v 1.1 2010/03/16 18:55:42 varienaja Exp $
17   */
18  public class Authority implements GrantedAuthority, Serializable {
19  
20  	/**
21  	 * Ten behoeve van Serializable. 
22  	 */
23  	private static final long serialVersionUID = -6943806173894874184L;
24  	
25  	private int _id;
26  	private String _description;
27  	
28  	/**
29  	 * Creates a new Authority-object with an empty description.
30  	 *
31  	 */
32  	public Authority() {
33  		_id = -1;
34  		_description = "";
35  	}
36  	
37  	/**
38  	 * Set the identifier of this Authority
39  	 * @param id an integer.
40  	 */
41  	public void setId(int id) {
42  		_id = id;
43  	}
44  	
45  	/**
46  	 * @return the identifier of this Authority
47  	 */
48  	public int getId() {
49  		return _id;
50  	}
51  	
52  	public String getAuthority() {
53  		return _description;
54  	}
55  
56  	/**
57  	 * Sets the descrition of this Authority. Use cryptic names like 'CAN_CLOSE' or 'ROLE_COMMITTER' ;-)
58  	 * @param description The description of this Authority
59  	 */
60  	public void setDescription(String description) {
61  		_description = description;
62  	}
63  	
64  	/** 
65  	 * @return The description of this Authority.
66  	 * @see #getAuthority() 
67  	 */
68  	public String getDescription() {
69  		return _description;
70  	}
71  
72  }