001package org.apache.archiva.redback.rest.api.model.v2;/*
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 io.swagger.v3.oas.annotations.media.Schema;
020
021import javax.xml.bind.annotation.XmlElement;
022import java.io.Serializable;
023
024/**
025 * @author Martin Stockhammer <martin_s@apache.org>
026 */
027@Schema( name = "BaseUserInfo", description = "Basic user information" )
028public class BaseUserInfo implements Serializable
029{
030    private static final long serialVersionUID = 4643187400578104895L;
031    protected String userId;
032    private String id;
033
034
035    public BaseUserInfo( )
036    {
037    }
038
039    public BaseUserInfo( String id , String userId )
040    {
041        this.userId = userId;
042        this.id = id;
043    }
044
045    @Schema( name = "user_id", description = "The user id" )
046    @XmlElement( name = "user_id" )
047    public String getUserId( )
048    {
049        return userId;
050    }
051
052    public void setUserId( String userId )
053    {
054        this.userId = userId;
055    }
056
057    @Schema( description = "User id that is unique over all user managers" )
058    public String getId( )
059    {
060        return id;
061    }
062
063    public void setId( String id )
064    {
065        this.id = id;
066    }
067
068    @Override
069    public String toString( )
070    {
071        final StringBuilder sb = new StringBuilder( "BaseUserInfo{" );
072        sb.append( "userId='" ).append( userId ).append( '\'' );
073        sb.append( ", id='" ).append( id ).append( '\'' );
074        sb.append( '}' );
075        return sb.toString( );
076    }
077
078    @Override
079    public boolean equals( Object o )
080    {
081        if ( this == o ) return true;
082        if ( o == null || getClass( ) != o.getClass( ) ) return false;
083
084        BaseUserInfo that = (BaseUserInfo) o;
085
086        if ( !userId.equals( that.userId ) ) return false;
087        return id.equals( that.id );
088    }
089
090    @Override
091    public int hashCode( )
092    {
093        int result = userId.hashCode( );
094        result = 31 * result + id.hashCode( );
095        return result;
096    }
097}