This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.admin.model.beans;
002/*
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 */
020
021import java.util.Arrays;
022import java.util.Collection;
023
024/**
025 * @author Olivier Lamy
026 * @since 1.4-M4
027 */
028public class LdapGroupMapping
029{
030    private String group;
031
032    private Collection<String> roleNames;
033
034    public LdapGroupMapping()
035    {
036        // no op
037    }
038
039    public LdapGroupMapping( String group )
040    {
041        this.group = group;
042    }
043
044    public LdapGroupMapping( String group, Collection<String> roleNames )
045    {
046        this.group = group;
047        this.roleNames = roleNames;
048    }
049
050    public LdapGroupMapping( String group, String[] roleNames )
051    {
052        this.group = group;
053        if ( roleNames != null )
054        {
055            this.roleNames = Arrays.asList( roleNames );
056        }
057    }
058
059    public String getGroup()
060    {
061        return group;
062    }
063
064    public void setGroup( String group )
065    {
066        this.group = group;
067    }
068
069    public Collection<String> getRoleNames()
070    {
071        return roleNames;
072    }
073
074    public void setRoleNames( Collection<String> roleNames )
075    {
076        this.roleNames = roleNames;
077    }
078
079    @Override
080    public boolean equals( Object o )
081    {
082        if ( this == o )
083        {
084            return true;
085        }
086        if ( o == null || getClass() != o.getClass() )
087        {
088            return false;
089        }
090
091        LdapGroupMapping that = (LdapGroupMapping) o;
092
093        if ( group != null ? !group.equals( that.group ) : that.group != null )
094        {
095            return false;
096        }
097
098        return true;
099    }
100
101    @Override
102    public int hashCode()
103    {
104        return group != null ? group.hashCode() : 0;
105    }
106
107    @Override
108    public String toString()
109    {
110        return "LdapGroupMapping{" +
111            "group='" + group + '\'' +
112            ", roleNames=" + roleNames +
113            '}';
114    }
115}