KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > security > InfoGlueRole


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.cms.security;
25
26 import java.io.Serializable JavaDoc;
27
28
29 /**
30  * This class represents an generic Role in InfoGlue. It is used to identify a role no matter what source it was defined in.
31  *
32  * @author Mattias Bogeblad
33  */

34
35 public class InfoGlueRole implements Serializable JavaDoc
36 {
37     private static final long serialVersionUID = 812195937936895191L;
38
39     private final String JavaDoc name;
40     private final String JavaDoc description;
41     private final AuthorizationModule autorizationModule;
42
43     public InfoGlueRole(String JavaDoc name, String JavaDoc description, AuthorizationModule autorizationModule)
44     {
45         this.name = name;
46         this.description = description;
47         this.autorizationModule = autorizationModule;
48     }
49
50     public String JavaDoc getName()
51     {
52         return name;
53     }
54
55     public String JavaDoc getDescription()
56     {
57         return description;
58     }
59     
60     public String JavaDoc toString()
61     {
62         return "InfoGlueRole: " + name;
63     }
64
65     public boolean equals(Object JavaDoc obj)
66     {
67         if (obj == null)
68             return false;
69         if (obj == this)
70             return true;
71         if (!(obj instanceof InfoGlueRole))
72             return false;
73         
74         InfoGlueRole another = (InfoGlueRole)obj;
75         return name.equals(another.getName());
76     }
77
78     public int hasCode()
79     {
80         return name.hashCode();
81     }
82
83     public AuthorizationModule getAutorizationModule()
84     {
85         return autorizationModule;
86     }
87 }
88
89
Popular Tags