1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.security.om.impl;
18
19 import java.util.Collection;
20
21 import org.apache.jetspeed.security.om.InternalRolePrincipal;
22
23 /***
24 * <p>{@link InternalRolePrincipal} interface implementation.</p>
25 *
26 * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
27 */
28 public class InternalRolePrincipalImpl extends InternalPrincipalImpl implements InternalRolePrincipal
29 {
30 /*** The serial version uid. */
31 private static final long serialVersionUID = 4422827842052325846L;
32
33 /*** <p>Role principal security class.</p> */
34 static String ROLE_PRINCIPAL_CLASSNAME = "org.apache.jetspeed.security.InternalRolePrincipalImpl";
35
36 /***
37 * <p>Role principal implementation default constructor.</p>
38 */
39 public InternalRolePrincipalImpl()
40 {
41 super();
42 }
43
44 /***
45 * <p>Constructor to create a new role principal.</p>
46 * @param fullPath The role full path.
47 */
48 public InternalRolePrincipalImpl(String fullPath)
49 {
50 super(ROLE_PRINCIPAL_CLASSNAME, fullPath);
51 }
52
53 private Collection userPrincipals;
54
55 /***
56 * @see org.apache.jetspeed.security.om.InternalRolePrincipal#getUserPrincipals()
57 */
58 public Collection getUserPrincipals()
59 {
60 return this.userPrincipals;
61 }
62
63 /***
64 * @see org.apache.jetspeed.security.om.InternalRolePrincipal#setUserPrincipals(java.util.Collection)
65 */
66 public void setUserPrincipals(Collection userPrincipals)
67 {
68 this.userPrincipals = userPrincipals;
69 }
70
71 private Collection groupPrincipals;
72
73 /***
74 * @see org.apache.jetspeed.security.om.InternalRolePrincipal#getGroupPrincipals()
75 */
76 public Collection getGroupPrincipals()
77 {
78 return this.groupPrincipals;
79 }
80
81 /***
82 * @see org.apache.jetspeed.security.om.InternalRolePrincipal#setGroupPrincipals(java.util.Collection)
83 */
84 public void setGroupPrincipals(Collection groupPrincipals)
85 {
86 this.groupPrincipals = groupPrincipals;
87 }
88
89 /***
90 * <p>Compares this {@link InternalRolePrincipal} to the provided role principal
91 * and check if they are equal.</p>
92 * return Whether the {@link InternalRolePrincipal} are equal.
93 */
94 public boolean equals(Object object)
95 {
96 if (!(object instanceof InternalRolePrincipal))
97 return false;
98
99 InternalRolePrincipal r = (InternalRolePrincipal) object;
100 boolean isEqual = (r.getFullPath().equals(this.getFullPath()));
101 return isEqual;
102 }
103
104 }