This project has retired. For details please refer to its Attic page.
BrowseResultEntry xref
View Javadoc
1   package org.apache.archiva.rest.api.model;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  import javax.xml.bind.annotation.XmlRootElement;
22  import java.io.Serializable;
23  
24  /**
25   * @author Olivier Lamy
26   * @since 1.4-M3
27   */
28  @XmlRootElement( name = "browseResultEntry" )
29  public class BrowseResultEntry
30      implements Comparable<BrowseResultEntry>, Serializable
31  {
32  
33      private String name;
34  
35      private boolean project;
36  
37      /**
38       * @since 2.0.0
39       */
40      private String groupId;
41  
42      /**
43       * @since 2.0.0
44       */
45      private String artifactId;
46  
47      public BrowseResultEntry()
48      {
49          // no op
50      }
51  
52      public BrowseResultEntry( String name, boolean project )
53      {
54          this.name = name;
55          this.project = project;
56      }
57  
58      public String getName()
59      {
60          return name;
61      }
62  
63      public void setName( String name )
64      {
65          this.name = name;
66      }
67  
68      public boolean isProject()
69      {
70          return project;
71      }
72  
73      public void setProject( boolean project )
74      {
75          this.project = project;
76      }
77  
78      @Override
79      public int compareTo( BrowseResultEntry browseGroupResultEntry )
80      {
81          return this.name.compareTo( browseGroupResultEntry.name );
82      }
83  
84      public String getGroupId()
85      {
86          return groupId;
87      }
88  
89      public void setGroupId( String groupId )
90      {
91          this.groupId = groupId;
92      }
93  
94      public BrowseResultEntry groupId( String groupId )
95      {
96          this.groupId = groupId;
97          return this;
98      }
99  
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 }