This project has retired. For details please refer to its Attic page.
SearchResultHit xref
View Javadoc
1   package org.apache.archiva.indexer.search;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.ArrayList;
23  import java.util.List;
24  
25  /**
26   * SearchResultHit
27   *
28   */
29  public class SearchResultHit
30  {
31      // The (optional) context for this result.
32      private String context;
33  
34      // Basic hit, direct to non-artifact resource.
35      private String url;
36  
37      // Advanced hit, reference to groupId.
38      private String groupId;
39  
40      //  Advanced hit, reference to artifactId.
41      private String artifactId;
42  
43      private String repositoryId = "";
44  
45      private List<String> versions = new ArrayList<>();
46  
47      private String packaging;
48  
49      /**
50       * Plugin goal prefix (only if packaging is "maven-plugin")
51       */
52      private String prefix;
53  
54      /**
55       * Plugin goals (only if packaging is "maven-plugin")
56       */
57      private List<String> goals;
58  
59      /**
60       * contains osgi metadata Bundle-Version if available
61       *
62       * @since 1.4-M1
63       */
64      private String bundleVersion;
65  
66      /**
67       * contains osgi metadata Bundle-SymbolicName if available
68       *
69       * @since 1.4-M1
70       */
71      private String bundleSymbolicName;
72  
73      /**
74       * contains osgi metadata Export-Package if available
75       *
76       * @since 1.4-M1
77       */
78      private String bundleExportPackage;
79  
80      /**
81       * contains osgi metadata Export-Service if available
82       *
83       * @since 1.4-M1
84       */
85      private String bundleExportService;
86  
87      /**
88       * contains osgi metadata Bundle-Description if available
89       *
90       * @since 1.4-M1
91       */
92      private String bundleDescription;
93  
94      /**
95       * contains osgi metadata Bundle-Name if available
96       *
97       * @since 1.4-M1
98       */
99      private String bundleName;
100 
101     /**
102      * contains osgi metadata Bundle-License if available
103      *
104      * @since 1.4-M1
105      */
106     private String bundleLicense;
107 
108     /**
109      * contains osgi metadata Bundle-DocURL if available
110      *
111      * @since 1.4-M1
112      */
113     private String bundleDocUrl;
114 
115     /**
116      * contains osgi metadata Import-Package if available
117      *
118      * @since 1.4-M1
119      */
120     private String bundleImportPackage;
121 
122     /**
123      * contains osgi metadata Require-Bundle if available
124      *
125      * @since 1.4-M1
126      */
127     private String bundleRequireBundle;
128 
129     private String classifier;
130 
131     /**
132      * file extension of the search result
133      * @since 1.4-M2
134      */
135     private String fileExtension;
136 
137     public String getContext()
138     {
139         return context;
140     }
141 
142     public void setContext( String context )
143     {
144         this.context = context;
145     }
146 
147     public String getUrl()
148     {
149         return url;
150     }
151 
152     public void setUrl( String url )
153     {
154         this.url = url;
155     }
156 
157     public String getUrlFilename()
158     {
159         return this.url.substring( this.url.lastIndexOf( '/' ) );
160     }
161 
162     public String getArtifactId()
163     {
164         return artifactId;
165     }
166 
167     public void setArtifactId( String artifactId )
168     {
169         this.artifactId = artifactId;
170     }
171 
172     public String getGroupId()
173     {
174         return groupId;
175     }
176 
177     public void setGroupId( String groupId )
178     {
179         this.groupId = groupId;
180     }
181 
182     public List<String> getVersions()
183     {
184         return versions;
185     }
186 
187     public void setVersions( List<String> versions )
188     {
189         this.versions = versions;
190     }
191 
192     public String getRepositoryId()
193     {
194         return repositoryId;
195     }
196 
197     public void setRepositoryId( String repositoryId )
198     {
199         this.repositoryId = repositoryId;
200     }
201 
202     public void addVersion( String version )
203     {
204         versions.add( version );
205     }
206 
207     public String getBundleVersion()
208     {
209         return bundleVersion;
210     }
211 
212     public void setBundleVersion( String bundleVersion )
213     {
214         this.bundleVersion = bundleVersion;
215     }
216 
217     public String getBundleSymbolicName()
218     {
219         return bundleSymbolicName;
220     }
221 
222     public void setBundleSymbolicName( String bundleSymbolicName )
223     {
224         this.bundleSymbolicName = bundleSymbolicName;
225     }
226 
227     public String getBundleExportPackage()
228     {
229         return bundleExportPackage;
230     }
231 
232     public void setBundleExportPackage( String bundleExportPackage )
233     {
234         this.bundleExportPackage = bundleExportPackage;
235     }
236 
237     public String getBundleExportService()
238     {
239         return bundleExportService;
240     }
241 
242     public void setBundleExportService( String bundleExportService )
243     {
244         this.bundleExportService = bundleExportService;
245     }
246 
247     public String getPrefix()
248     {
249         return prefix;
250     }
251 
252     public void setPrefix( String prefix )
253     {
254         this.prefix = prefix;
255     }
256 
257     public List<String> getGoals()
258     {
259         return goals;
260     }
261 
262     public void setGoals( List<String> goals )
263     {
264         this.goals = goals;
265     }
266 
267     public String getBundleDescription()
268     {
269         return bundleDescription;
270     }
271 
272     public void setBundleDescription( String bundleDescription )
273     {
274         this.bundleDescription = bundleDescription;
275     }
276 
277     public String getBundleName()
278     {
279         return bundleName;
280     }
281 
282     public void setBundleName( String bundleName )
283     {
284         this.bundleName = bundleName;
285     }
286 
287     public String getBundleLicense()
288     {
289         return bundleLicense;
290     }
291 
292     public void setBundleLicense( String bundleLicense )
293     {
294         this.bundleLicense = bundleLicense;
295     }
296 
297     public String getBundleDocUrl()
298     {
299         return bundleDocUrl;
300     }
301 
302     public void setBundleDocUrl( String bundleDocUrl )
303     {
304         this.bundleDocUrl = bundleDocUrl;
305     }
306 
307     public String getBundleImportPackage()
308     {
309         return bundleImportPackage;
310     }
311 
312     public void setBundleImportPackage( String bundleImportPackage )
313     {
314         this.bundleImportPackage = bundleImportPackage;
315     }
316 
317     public String getBundleRequireBundle()
318     {
319         return bundleRequireBundle;
320     }
321 
322     public void setBundleRequireBundle( String bundleRequireBundle )
323     {
324         this.bundleRequireBundle = bundleRequireBundle;
325     }
326 
327     public String getPackaging()
328     {
329         return packaging;
330     }
331 
332     public void setPackaging( String packaging )
333     {
334         this.packaging = packaging;
335     }
336 
337     public String getType()
338     {
339         return getPackaging();
340     }
341 
342     public String getClassifier()
343     {
344         return classifier;
345     }
346 
347     public void setClassifier( String classifier )
348     {
349         this.classifier = classifier;
350     }
351 
352     public String getFileExtension()
353     {
354         return fileExtension;
355     }
356 
357     public void setFileExtension( String fileExtension )
358     {
359         this.fileExtension = fileExtension;
360     }
361 
362     @Override
363     public String toString()
364     {
365         final StringBuilder sb = new StringBuilder();
366         sb.append( "SearchResultHit" );
367         sb.append( "{context='" ).append( context ).append( '\'' );
368         sb.append( ", url='" ).append( url ).append( '\'' );
369         sb.append( ", groupId='" ).append( groupId ).append( '\'' );
370         sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
371         sb.append( ", repositoryId='" ).append( repositoryId ).append( '\'' );
372         sb.append( ", versions=" ).append( versions );
373         sb.append( ", packaging='" ).append( packaging ).append( '\'' );
374         sb.append( ", prefix='" ).append( prefix ).append( '\'' );
375         sb.append( ", goals=" ).append( goals );
376         sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' );
377         sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
378         sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
379         sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
380         sb.append( ", bundleDescription='" ).append( bundleDescription ).append( '\'' );
381         sb.append( ", bundleName='" ).append( bundleName ).append( '\'' );
382         sb.append( ", bundleLicense='" ).append( bundleLicense ).append( '\'' );
383         sb.append( ", bundleDocUrl='" ).append( bundleDocUrl ).append( '\'' );
384         sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
385         sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
386         sb.append( ", classifier='" ).append( classifier ).append( '\'' );
387         sb.append( ", fileExtension='" ).append( fileExtension ).append( '\'' );
388         sb.append( '}' );
389         return sb.toString();
390     }
391 
392     @Override
393     public boolean equals( Object o )
394     {
395         if ( this == o )
396         {
397             return true;
398         }
399         if ( o == null || getClass() != o.getClass() )
400         {
401             return false;
402         }
403 
404         SearchResultHit./../../org/apache/archiva/indexer/search/SearchResultHit.html#SearchResultHit">SearchResultHit that = (SearchResultHit) o;
405 
406         if ( artifactId != null ? !artifactId.equals( that.artifactId ) : that.artifactId != null )
407         {
408             return false;
409         }
410         if ( classifier != null ? !classifier.equals( that.classifier ) : that.classifier != null )
411         {
412             return false;
413         }
414         if ( groupId != null ? !groupId.equals( that.groupId ) : that.groupId != null )
415         {
416             return false;
417         }
418         if ( packaging != null ? !packaging.equals( that.packaging ) : that.packaging != null )
419         {
420             return false;
421         }
422 
423         return true;
424     }
425 
426     @Override
427     public int hashCode()
428     {
429         int result = groupId != null ? groupId.hashCode() : 0;
430         result = 31 * result + ( artifactId != null ? artifactId.hashCode() : 0 );
431         result = 31 * result + ( packaging != null ? packaging.hashCode() : 0 );
432         result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
433         return result;
434     }
435 }