001package org.apache.archiva.redback.rest.api.model; 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 javax.xml.bind.annotation.XmlRootElement; 022import java.io.Serializable; 023import java.util.Collection; 024 025/** 026 * @author Olivier Lamy 027 * @since 2.1 028 */ 029@XmlRootElement(name = "ldapGroupMapping") 030public class LdapGroupMapping 031 implements Serializable 032{ 033 private String group; 034 035 private Collection<String> roleNames; 036 037 public LdapGroupMapping() 038 { 039 // no op 040 } 041 042 public LdapGroupMapping( String group, Collection<String> roleNames ) 043 { 044 this.group = group; 045 this.roleNames = roleNames; 046 } 047 048 public String getGroup() 049 { 050 return group; 051 } 052 053 public void setGroup( String group ) 054 { 055 this.group = group; 056 } 057 058 public Collection<String> getRoleNames() 059 { 060 return roleNames; 061 } 062 063 public void setRoleNames( Collection<String> roleNames ) 064 { 065 this.roleNames = roleNames; 066 } 067 068 @Override 069 public String toString() 070 { 071 final StringBuilder sb = new StringBuilder(); 072 sb.append( "LdapGroupMapping" ); 073 sb.append( "{group='" ).append( group ).append( '\'' ); 074 sb.append( ", roleNames=" ).append( roleNames ); 075 sb.append( '}' ); 076 return sb.toString(); 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.equals( that.group ) ) 094 { 095 return false; 096 } 097 098 return true; 099 } 100 101 @Override 102 public int hashCode() 103 { 104 return group.hashCode(); 105 } 106}