1 package org.apache.archiva.redback.rbac.memory;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
22 import org.apache.archiva.redback.rbac.AbstractUserAssignment;
23 import org.apache.archiva.redback.rbac.UserAssignment;
25 import java.util.ArrayList;
26 import java.util.List;
29 * MemoryUserAssignment
31 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
34 public class MemoryUserAssignment
35 extends AbstractUserAssignment
36 implements UserAssignment, java.io.Serializable
42 private String principal;
47 private List<String> roles = new ArrayList<String>( 0 );
52 private boolean permanent = false;
59 public boolean equals( Object other )
66 if ( !( other instanceof MemoryUserAssignment ) )
71 MemoryUserAssignment that = (MemoryUserAssignment) other;
72 boolean result = true;
73 result = result && ( getPrincipal() == null
74 ? that.getPrincipal() == null
75 : getPrincipal().equals( that.getPrincipal() ) );
82 public String getPrincipal()
84 return this.principal;
90 public List<String> getRoleNames()
92 if ( this.roles == null )
94 this.roles = new ArrayList<String>( 0 );
103 public int hashCode()
106 result = 37 * result + ( principal != null ? principal.hashCode() : 0 );
115 public void setPrincipal( String principal )
117 this.principal = principal;
125 public void setRoleNames( List<String> roles )
133 public java.lang.String toString()
135 StringBuffer buf = new StringBuffer();
136 buf.append( "principal = '" );
137 buf.append( getPrincipal() + "'" );
138 return buf.toString();
141 public boolean isPermanent()
146 public void setPermanent( boolean permanent )
148 this.permanent = permanent;