01: /*
02: Copyright (c) 2004 eInnovation Inc. All rights reserved
03:
04: This library is free software; you can redistribute it and/or modify it under the terms
05: of the GNU Lesser General Public License as published by the Free Software Foundation;
06: either version 2.1 of the License, or (at your option) any later version.
07:
08: This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
09: without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: See the GNU Lesser General Public License for more details.
11: */
12:
13: package com.openedit.users;
14:
15: /**
16: * This object represents a permission that can be assigned to a group.
17: *
18: * @author Dennis Brown
19: */
20: public class Permission {
21: protected String fieldName;
22: protected String fieldDisplayName;
23:
24: public Permission() {
25: }
26:
27: public Permission(String inName) {
28: fieldName = inName;
29: }
30:
31: public Permission(String inName, String inDisplayName) {
32: fieldName = inName;
33: fieldDisplayName = inDisplayName;
34: }
35:
36: public String getName() {
37: return fieldName;
38: }
39:
40: public String getDisplayName() {
41: return fieldDisplayName;
42: }
43:
44: public void setName(String inName) {
45: fieldName = inName;
46: }
47:
48: public void setDisplayName(String inDisplayName) {
49: fieldDisplayName = inDisplayName;
50: }
51:
52: /**
53: * Two <code>Permission</code>s are equal if their names are equal.
54: */
55: public boolean equals(Object o) {
56: if (o instanceof Permission) {
57: Permission p = (Permission) o;
58: if (fieldName != null) {
59: return fieldName.equals(p.fieldName);
60: } else {
61: return (p.fieldName == null);
62: }
63: } else {
64: return false;
65: }
66: }
67:
68: public int hashCode() {
69: return (fieldName != null) ? fieldName.hashCode() : 0;
70: }
71:
72: public String toString() {
73: return fieldName;
74: }
75: }
|