001package org.apache.archiva.redback.rbac.jpa.model;/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 * Unless required by applicable law or agreed to in writing,
012 * software distributed under the License is distributed on an
013 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
014 * KIND, either express or implied.  See the License for the
015 * specific language governing permissions and limitations
016 * under the License.
017 */
018
019import java.io.Serializable;
020
021/**
022 * @author Martin Stockhammer <martin_s@apache.org>
023 */
024public class RoleId implements Serializable
025{
026    private static final long serialVersionUID = -3358026083136193536L;
027    private String id;
028    private String name;
029
030    public RoleId( )
031    {
032    }
033
034    public RoleId( String id, String name )
035    {
036        this.id = id;
037        this.name = name;
038    }
039
040    @Override
041    public boolean equals( Object o )
042    {
043        if ( this == o ) return true;
044        if ( o == null || getClass( ) != o.getClass( ) ) return false;
045
046        RoleId roleId = (RoleId) o;
047
048        if ( !id.equals( roleId.id ) ) return false;
049        return name.equals( roleId.name );
050    }
051
052    @Override
053    public int hashCode( )
054    {
055        int result = id.hashCode( );
056        result = 31 * result + name.hashCode( );
057        return result;
058    }
059}