This project has retired. For details please refer to its Attic page.
AbstractRole xref
View Javadoc

1   package org.apache.archiva.redback.rbac;
2   
3   /*
4    * Copyright 2001-2006 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  /**
20   * AbstractRole useful for common logic that implementors can use. 
21   *
22   * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
23   *
24   */
25  public abstract class AbstractRole
26      implements Role
27  {
28  
29      public boolean hasChildRoles()
30      {
31          return ( getChildRoleNames() != null ) && !getChildRoleNames().isEmpty();
32      }
33  
34      /**
35       * Method equals.
36       *
37       * @param other
38       * @return boolean
39       */
40      public boolean equals( Object other )
41      {
42          if ( this == other )
43          {
44              return true;
45          }
46  
47          if ( !( other instanceof AbstractRole ) )
48          {
49              return false;
50          }
51  
52          AbstractRole that = (AbstractRole) other;
53          boolean result = true;
54  
55          result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
56  
57          return result;
58      }
59  }