1/*2 * Licensed to the Apache Software Foundation (ASF) under one or more3 * contributor license agreements. See the NOTICE file distributed with4 * this work for additional information regarding copyright ownership.5 * The ASF licenses this file to You under the Apache License, Version 2.06 * (the "License"); you may not use this file except in compliance with7 * the License. You may obtain a copy of the License at8 *9 * http://www.apache.org/licenses/LICENSE-2.010 *11 * Unless required by applicable law or agreed to in writing, software12 * 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 and15 * limitations under the License.16 */17packageorg.apache.jetspeed.security.om.impl;
1819import java.util.ArrayList;
20import java.util.Collection;
2122import org.apache.jetspeed.security.om.InternalGroupPrincipal;
2324/***25 * <p>{@link InternalGroupPrincipal} interface implementation.</p>26 * 27 * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>28 */29publicclassInternalGroupPrincipalImplextendsInternalPrincipalImpl implements InternalGroupPrincipal
30 {
31/*** The serial version uid. */32privatestaticfinallong serialVersionUID = -8236429453373927824L;
3334/*** <p>Group principal security class.</p> */35static String GROUP_PRINCIPAL_CLASSNAME = "org.apache.jetspeed.security.InternalGroupPrincipalImpl";
3637/***38 * <p>Group principal implementation default constructor.</p>39 */40publicInternalGroupPrincipalImpl()
41 {
42super();
43 }
4445/***46 * <p>Constructor to create a new group principal.</p>47 * @param fullPath The group full path.48 */49publicInternalGroupPrincipalImpl(String fullPath)
50 {
51super(GROUP_PRINCIPAL_CLASSNAME, fullPath);
52this.rolePrincipals = new ArrayList();
53 }
5455private Collection userPrincipals;
5657/***58 * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#getUserPrincipals()59 */60public Collection getUserPrincipals()
61 {
62returnthis.userPrincipals;
63 }
6465/***66 * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#setUserPrincipals(java.util.Collection)67 */68publicvoid setUserPrincipals(Collection userPrincipals)
69 {
70this.userPrincipals = userPrincipals;
71 }
7273private Collection rolePrincipals;
7475/***76 * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#getRolePrincipals()77 */78public Collection getRolePrincipals()
79 {
80returnthis.rolePrincipals;
81 }
8283/***84 * @see org.apache.jetspeed.security.om.InternalGroupPrincipal#setRolePrincipals(java.util.Collection)85 */86publicvoid setRolePrincipals(Collection rolePrincipals)
87 {
88this.rolePrincipals = rolePrincipals;
89 }
9091/***92 * <p>Compares this {@link InternalGroupPrincipal} to the provided group principal93 * and check if they are equal.</p>94 * return Whether the {@link InternalGroupPrincipal} are equal.95 */96publicboolean equals(Object object)
97 {
98if (!(object instanceof InternalGroupPrincipal))
99return false;
100101 InternalGroupPrincipal r = (InternalGroupPrincipal) object;
102boolean isEqual = (r.getFullPath().equals(this.getFullPath()));
103return isEqual;
104 }
105 }