KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jresearch > gossip > am > values > PermissionRole


1 /*
2  *
3  * ***** BEGIN LICENSE BLOCK ***** The contents of this file are subject to the
4  * Mozilla Public License Version 1.1 (the "License"); you may not use this file
5  * except in compliance with the License. You may obtain a copy of the License
6  * at http://www.mozilla.org/MPL/
7  *
8  * Software distributed under the License is distributed on an "AS IS" basis,
9  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
10  * the specific language governing rights and limitations under the License.
11  *
12  * The Original Code is JGossip forum code.
13  *
14  * The Initial Developer of the Original Code is the JResearch, Org. Portions
15  * created by the Initial Developer are Copyright (C) 2004 the Initial
16  * Developer. All Rights Reserved.
17  *
18  * Contributor(s): Stanislav Spiridonov <stas@jresearch.org>, Dmitry Belov
19  * <bel@jresearch.org>
20  *
21  * ***** END LICENSE BLOCK *****
22  */

23 package org.jresearch.gossip.am.values;
24
25 import java.io.Serializable JavaDoc;
26 import java.util.Hashtable JavaDoc;
27
28 import org.jresearch.gossip.constants.UserStatus;
29
30 public class PermissionRole implements Serializable JavaDoc {
31
32     /**
33      *
34      */

35     private static final long serialVersionUID = -5551042452899523417L;
36
37     private int id;
38
39     private String JavaDoc name;
40
41     /**
42      * Field <code>GUEST</code>
43      */

44     public static final PermissionRole GUEST = new PermissionRole(
45             UserStatus.GUEST);
46
47     /**
48      * Field <code>USER</code>
49      */

50     public static final PermissionRole USER = new PermissionRole(
51             UserStatus.USER);
52
53     /**
54      * Field <code>MOD</code>
55      */

56     public static final PermissionRole MOD = new PermissionRole(UserStatus.MOD);
57
58     /**
59      * Field <code>MAINMOD</code>
60      */

61     public static final PermissionRole MAINMOD = new PermissionRole(
62             UserStatus.MAINMOD);
63
64     /**
65      * Field <code>JRADM</code>
66      */

67     public static final PermissionRole JRADM = new PermissionRole(
68             UserStatus.JRADM);
69
70     /**
71      * Field <code>ADM</code>
72      */

73     public static final PermissionRole ADM = new PermissionRole(UserStatus.ADM);
74
75     /**
76      * @param id
77      */

78     public PermissionRole(int id) {
79         super();
80         this.id = id;
81     }
82
83     /**
84      * @param id
85      * @param name
86      */

87     public PermissionRole(int id, String JavaDoc name) {
88         super();
89         this.id = id;
90         this.name = name;
91     }
92
93     /**
94      * @return a hash code value for this object.
95      * @see Object#equals(Object)
96      * @see Hashtable
97      */

98     public int hashCode() {
99         return id;
100     }
101
102     /**
103      * @param obj
104      * the reference object with which to compare.
105      * @return <code>true</code> if this object is the same as the obj
106      * argument; <code>false</code> otherwise.
107      * @see Boolean#hashCode()
108      * @see Hashtable
109      */

110     public boolean equals(Object JavaDoc obj) {
111         if (obj instanceof PermissionRole) {
112             return id == ((PermissionRole) obj).id;
113         }
114         return false;
115     }
116 }
Popular Tags