This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.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;
023
024/**
025 * @author Olivier Lamy
026 * @since 1.4-M3
027 */
028@XmlRootElement( name = "browseResultEntry" )
029public class BrowseResultEntry
030    implements Comparable<BrowseResultEntry>, Serializable
031{
032
033    private String name;
034
035    private boolean project;
036
037    /**
038     * @since 2.0.0
039     */
040    private String groupId;
041
042    /**
043     * @since 2.0.0
044     */
045    private String artifactId;
046
047    public BrowseResultEntry()
048    {
049        // no op
050    }
051
052    public BrowseResultEntry( String name, boolean project )
053    {
054        this.name = name;
055        this.project = project;
056    }
057
058    public String getName()
059    {
060        return name;
061    }
062
063    public void setName( String name )
064    {
065        this.name = name;
066    }
067
068    public boolean isProject()
069    {
070        return project;
071    }
072
073    public void setProject( boolean project )
074    {
075        this.project = project;
076    }
077
078    @Override
079    public int compareTo( BrowseResultEntry browseGroupResultEntry )
080    {
081        return this.name.compareTo( browseGroupResultEntry.name );
082    }
083
084    public String getGroupId()
085    {
086        return groupId;
087    }
088
089    public void setGroupId( String groupId )
090    {
091        this.groupId = groupId;
092    }
093
094    public BrowseResultEntry groupId( String groupId )
095    {
096        this.groupId = groupId;
097        return this;
098    }
099
100    public String getArtifactId()
101    {
102        return artifactId;
103    }
104
105    public void setArtifactId( String artifactId )
106    {
107        this.artifactId = artifactId;
108    }
109
110    public BrowseResultEntry artifactId( String artifactId )
111    {
112        this.artifactId = artifactId;
113        return this;
114    }
115
116    @Override
117    public String toString()
118    {
119        final StringBuilder sb = new StringBuilder( "BrowseResultEntry{" );
120        sb.append( "name='" ).append( name ).append( '\'' );
121        sb.append( ", project=" ).append( project );
122        sb.append( ", groupId='" ).append( groupId ).append( '\'' );
123        sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
124        sb.append( '}' );
125        return sb.toString();
126    }
127
128    @Override
129    public boolean equals( Object o )
130    {
131        if ( this == o )
132        {
133            return true;
134        }
135        if ( !( o instanceof BrowseResultEntry ) )
136        {
137            return false;
138        }
139
140        BrowseResultEntry that = (BrowseResultEntry) o;
141
142        if ( project != that.project )
143        {
144            return false;
145        }
146        if ( !name.equals( that.name ) )
147        {
148            return false;
149        }
150
151        return true;
152    }
153
154    @Override
155    public int hashCode()
156    {
157        int result = name.hashCode();
158        result = 31 * result + ( project ? 1 : 0 );
159        return result;
160    }
161}