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

1   package org.apache.archiva.redback.rbac.memory;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.archiva.redback.rbac.AbstractUserAssignment;
23  import org.apache.archiva.redback.rbac.UserAssignment;
24  
25  import java.util.ArrayList;
26  import java.util.List;
27  
28  /**
29   * MemoryUserAssignment
30   *
31   * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
32   *
33   */
34  public class MemoryUserAssignment
35      extends AbstractUserAssignment
36      implements UserAssignment, java.io.Serializable
37  {
38  
39      /**
40       * Field principal
41       */
42      private String principal;
43  
44      /**
45       * Field roles
46       */
47      private List<String> roles = new ArrayList<String>( 0 );
48  
49      /**
50       * Field permanent
51       */
52      private boolean permanent = false;
53  
54      /**
55       * Method equals
56       *
57       * @param other
58       */
59      public boolean equals( Object other )
60      {
61          if ( this == other )
62          {
63              return true;
64          }
65  
66          if ( !( other instanceof MemoryUserAssignment ) )
67          {
68              return false;
69          }
70  
71          MemoryUserAssignment that = (MemoryUserAssignment) other;
72          boolean result = true;
73          result = result && ( getPrincipal() == null
74              ? that.getPrincipal() == null
75              : getPrincipal().equals( that.getPrincipal() ) );
76          return result;
77      }
78  
79      /**
80       * Get null
81       */
82      public String getPrincipal()
83      {
84          return this.principal;
85      }
86  
87      /**
88       * Method getRoles
89       */
90      public List<String> getRoleNames()
91      {
92          if ( this.roles == null )
93          {
94              this.roles = new ArrayList<String>( 0 );
95          }
96  
97          return this.roles;
98      }
99  
100     /**
101      * Method hashCode
102      */
103     public int hashCode()
104     {
105         int result = 17;
106         result = 37 * result + ( principal != null ? principal.hashCode() : 0 );
107         return result;
108     }
109 
110     /**
111      * Set null
112      *
113      * @param principal
114      */
115     public void setPrincipal( String principal )
116     {
117         this.principal = principal;
118     }
119 
120     /**
121      * Set null
122      *
123      * @param roles
124      */
125     public void setRoleNames( List<String> roles )
126     {
127         this.roles = roles;
128     }
129 
130     /**
131      * Method toString
132      */
133     public java.lang.String toString()
134     {
135         StringBuilder buf = new StringBuilder();
136         buf.append( "principal = '" );
137         buf.append( getPrincipal() + "'" );
138         return buf.toString();
139     }
140 
141     public boolean isPermanent()
142     {
143         return permanent;
144     }
145 
146     public void setPermanent( boolean permanent )
147     {
148         this.permanent = permanent;
149     }
150 }