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.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
30: implements InternalGroupPrincipal {
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: super ();
42: }
43:
44: /**
45: * <p>Constructor to create a new group principal.</p>
46: * @param fullPath The group full path.
47: */
48: public InternalGroupPrincipalImpl(String fullPath) {
49: super (GROUP_PRINCIPAL_CLASSNAME, fullPath);
50: this .rolePrincipals = new ArrayList();
51: }
52:
53: private Collection userPrincipals;
54:
55: /**
56: * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#getUserPrincipals()
57: */
58: public Collection getUserPrincipals() {
59: return this .userPrincipals;
60: }
61:
62: /**
63: * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#setUserPrincipals(java.util.Collection)
64: */
65: public void setUserPrincipals(Collection userPrincipals) {
66: this .userPrincipals = userPrincipals;
67: }
68:
69: private Collection rolePrincipals;
70:
71: /**
72: * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#getRolePrincipals()
73: */
74: public Collection getRolePrincipals() {
75: return this .rolePrincipals;
76: }
77:
78: /**
79: * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#setRolePrincipals(java.util.Collection)
80: */
81: public void setRolePrincipals(Collection rolePrincipals) {
82: this .rolePrincipals = rolePrincipals;
83: }
84:
85: /**
86: * <p>Compares this {@link InternalGroupPrincipal} to the provided group principal
87: * and check if they are equal.</p>
88: * return Whether the {@link InternalGroupPrincipal} are equal.
89: */
90: public boolean equals(Object object) {
91: if (!(object instanceof InternalGroupPrincipal))
92: return false;
93:
94: InternalGroupPrincipal r = (InternalGroupPrincipal) object;
95: boolean isEqual = (r.getFullPath().equals(this.getFullPath()));
96: return isEqual;
97: }
98: }
|