01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
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
29: implements InternalRolePrincipal {
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: super ();
41: }
42:
43: /**
44: * <p>Constructor to create a new role principal.</p>
45: * @param fullPath The role full path.
46: */
47: public InternalRolePrincipalImpl(String fullPath) {
48: super (ROLE_PRINCIPAL_CLASSNAME, fullPath);
49: }
50:
51: private Collection userPrincipals;
52:
53: /**
54: * @see org.apache.jetspeed.security.om.InternalRolePrincipal#getUserPrincipals()
55: */
56: public Collection getUserPrincipals() {
57: return this .userPrincipals;
58: }
59:
60: /**
61: * @see org.apache.jetspeed.security.om.InternalRolePrincipal#setUserPrincipals(java.util.Collection)
62: */
63: public void setUserPrincipals(Collection userPrincipals) {
64: this .userPrincipals = userPrincipals;
65: }
66:
67: private Collection groupPrincipals;
68:
69: /**
70: * @see org.apache.jetspeed.security.om.InternalRolePrincipal#getGroupPrincipals()
71: */
72: public Collection getGroupPrincipals() {
73: return this .groupPrincipals;
74: }
75:
76: /**
77: * @see org.apache.jetspeed.security.om.InternalRolePrincipal#setGroupPrincipals(java.util.Collection)
78: */
79: public void setGroupPrincipals(Collection groupPrincipals) {
80: this .groupPrincipals = groupPrincipals;
81: }
82:
83: /**
84: * <p>Compares this {@link InternalRolePrincipal} to the provided role principal
85: * and check if they are equal.</p>
86: * return Whether the {@link InternalRolePrincipal} are equal.
87: */
88: public boolean equals(Object object) {
89: if (!(object instanceof InternalRolePrincipal))
90: return false;
91:
92: InternalRolePrincipal r = (InternalRolePrincipal) object;
93: boolean isEqual = (r.getFullPath().equals(this.getFullPath()));
94: return isEqual;
95: }
96:
97: }
|