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.ArrayList;
20 import java.util.Collection;
21
22 import org.apache.jetspeed.security.om.InternalGroupPrincipal;
23
24 /***
25 * <p>{@link InternalGroupPrincipal} interface implementation.</p>
26 *
27 * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
28 */
29 public class InternalGroupPrincipalImpl extends InternalPrincipalImpl implements InternalGroupPrincipal
30 {
31 /*** The serial version uid. */
32 private static final long serialVersionUID = -8236429453373927824L;
33
34 /*** <p>Group principal security class.</p> */
35 static String GROUP_PRINCIPAL_CLASSNAME = "org.apache.jetspeed.security.InternalGroupPrincipalImpl";
36
37 /***
38 * <p>Group principal implementation default constructor.</p>
39 */
40 public InternalGroupPrincipalImpl()
41 {
42 super();
43 }
44
45 /***
46 * <p>Constructor to create a new group principal.</p>
47 * @param fullPath The group full path.
48 */
49 public InternalGroupPrincipalImpl(String fullPath)
50 {
51 super(GROUP_PRINCIPAL_CLASSNAME, fullPath);
52 this.rolePrincipals = new ArrayList();
53 }
54
55 private Collection userPrincipals;
56
57 /***
58 * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#getUserPrincipals()
59 */
60 public Collection getUserPrincipals()
61 {
62 return this.userPrincipals;
63 }
64
65 /***
66 * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#setUserPrincipals(java.util.Collection)
67 */
68 public void setUserPrincipals(Collection userPrincipals)
69 {
70 this.userPrincipals = userPrincipals;
71 }
72
73 private Collection rolePrincipals;
74
75 /***
76 * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#getRolePrincipals()
77 */
78 public Collection getRolePrincipals()
79 {
80 return this.rolePrincipals;
81 }
82
83 /***
84 * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#setRolePrincipals(java.util.Collection)
85 */
86 public void setRolePrincipals(Collection rolePrincipals)
87 {
88 this.rolePrincipals = rolePrincipals;
89 }
90
91 /***
92 * <p>Compares this {@link InternalGroupPrincipal} to the provided group principal
93 * and check if they are equal.</p>
94 * return Whether the {@link InternalGroupPrincipal} are equal.
95 */
96 public boolean equals(Object object)
97 {
98 if (!(object instanceof InternalGroupPrincipal))
99 return false;
100
101 InternalGroupPrincipal r = (InternalGroupPrincipal) object;
102 boolean isEqual = (r.getFullPath().equals(this.getFullPath()));
103 return isEqual;
104 }
105 }