This project has retired. For details please refer to its Attic page.
Artifact xref
View Javadoc
1   package org.apache.archiva.maven2.model;
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 javax.xml.bind.annotation.XmlRootElement;
23  import java.io.Serializable;
24  import java.util.List;
25  
26  @XmlRootElement( name = "artifact" )
27  public class Artifact
28      implements Serializable
29  {
30      // The (optional) context for this result.
31      private String context;
32  
33      // Basic hit, direct to non-artifact resource.
34      private String url;
35  
36      // Advanced hit, reference to groupId.
37      private String groupId;
38  
39      //  Advanced hit, reference to artifactId.
40      private String artifactId;
41  
42      private String repositoryId;
43  
44      private String version;
45  
46      /**
47       * Plugin goal prefix (only if packaging is "maven-plugin")
48       */
49      private String prefix;
50  
51      /**
52       * Plugin goals (only if packaging is "maven-plugin")
53       */
54      private List<String> goals;
55  
56      /**
57       * contains osgi metadata Bundle-Version if available
58       *
59       * @since 1.4-M1
60       */
61      private String bundleVersion;
62  
63      /**
64       * contains osgi metadata Bundle-SymbolicName if available
65       *
66       * @since 1.4-M1
67       */
68      private String bundleSymbolicName;
69  
70      /**
71       * contains osgi metadata Export-Package if available
72       *
73       * @since 1.4-M1
74       */
75      private String bundleExportPackage;
76  
77      /**
78       * contains osgi metadata Export-Service if available
79       *
80       * @since 1.4-M1
81       */
82      private String bundleExportService;
83  
84      /**
85       * contains osgi metadata Bundle-Description if available
86       *
87       * @since 1.4-M1
88       */
89      private String bundleDescription;
90  
91      /**
92       * contains osgi metadata Bundle-Name if available
93       *
94       * @since 1.4-M1
95       */
96      private String bundleName;
97  
98      /**
99       * contains osgi metadata Bundle-License if available
100      *
101      * @since 1.4-M1
102      */
103     private String bundleLicense;
104 
105     /**
106      * contains osgi metadata Bundle-DocURL if available
107      *
108      * @since 1.4-M1
109      */
110     private String bundleDocUrl;
111 
112     /**
113      * contains osgi metadata Import-Package if available
114      *
115      * @since 1.4-M1
116      */
117     private String bundleImportPackage;
118 
119     /**
120      * contains osgi metadata Require-Bundle if available
121      *
122      * @since 1.4-M1
123      */
124     private String bundleRequireBundle;
125 
126     private String classifier;
127 
128     private String packaging;
129 
130     /**
131      * file extension of the artifact
132      *
133      * @since 1.4-M2
134      */
135     private String fileExtension;
136 
137     /**
138      * human readable size : not available for all services
139      *
140      * @since 1.4-M3
141      */
142     private String size;
143 
144     /**
145      * @since 1.4-M3
146      */
147     private String type;
148 
149 
150     /**
151      * @since 1.4-M3
152      */
153     private String path;
154 
155     /**
156      * concat of artifactId+'-'+version+'.'+type
157      *
158      * @since 1.4-M3
159      */
160     private String id;
161 
162     /**
163      * @since 1.4-M3
164      */
165     private String scope;
166 
167 
168     public Artifact()
169     {
170         // no op
171     }
172 
173     public Artifact( String groupId, String artifactId, String version )
174     {
175         this.artifactId = artifactId;
176         this.groupId = groupId;
177         this.version = version;
178     }
179 
180     /**
181      * @since 1.4-M3
182      */
183     public Artifact( String groupId, String artifactId, String version, String scope )
184     {
185         this( groupId, artifactId, version );
186         this.scope = scope;
187     }
188 
189     /**
190      * @since 1.4-M3
191      */
192     public Artifact( String groupId, String artifactId, String version, String scope, String classifier )
193     {
194         this( groupId, artifactId, version );
195         this.scope = scope;
196         this.classifier = classifier;
197     }
198 
199     public String getGroupId()
200     {
201         return groupId;
202     }
203 
204     public String getArtifactId()
205     {
206         return artifactId;
207     }
208 
209     public String getVersion()
210     {
211         return version;
212     }
213 
214     public String getRepositoryId()
215     {
216         return repositoryId;
217     }
218 
219     public void setGroupId( String groupId )
220     {
221         this.groupId = groupId;
222     }
223 
224     public void setArtifactId( String artifactId )
225     {
226         this.artifactId = artifactId;
227     }
228 
229     public void setVersion( String version )
230     {
231         this.version = version;
232     }
233 
234     public void setRepositoryId( String repositoryId )
235     {
236         this.repositoryId = repositoryId;
237     }
238 
239     public String getContext()
240     {
241         return context;
242     }
243 
244     public void setContext( String context )
245     {
246         this.context = context;
247     }
248 
249     public String getUrl()
250     {
251         return url;
252     }
253 
254     public void setUrl( String url )
255     {
256         this.url = url;
257     }
258 
259     public String getPrefix()
260     {
261         return prefix;
262     }
263 
264     public void setPrefix( String prefix )
265     {
266         this.prefix = prefix;
267     }
268 
269     public List<String> getGoals()
270     {
271         return goals;
272     }
273 
274     public void setGoals( List<String> goals )
275     {
276         this.goals = goals;
277     }
278 
279     public String getBundleVersion()
280     {
281         return bundleVersion;
282     }
283 
284     public void setBundleVersion( String bundleVersion )
285     {
286         this.bundleVersion = bundleVersion;
287     }
288 
289     public String getBundleSymbolicName()
290     {
291         return bundleSymbolicName;
292     }
293 
294     public void setBundleSymbolicName( String bundleSymbolicName )
295     {
296         this.bundleSymbolicName = bundleSymbolicName;
297     }
298 
299     public String getBundleExportPackage()
300     {
301         return bundleExportPackage;
302     }
303 
304     public void setBundleExportPackage( String bundleExportPackage )
305     {
306         this.bundleExportPackage = bundleExportPackage;
307     }
308 
309     public String getBundleExportService()
310     {
311         return bundleExportService;
312     }
313 
314     public void setBundleExportService( String bundleExportService )
315     {
316         this.bundleExportService = bundleExportService;
317     }
318 
319     public String getBundleDescription()
320     {
321         return bundleDescription;
322     }
323 
324     public void setBundleDescription( String bundleDescription )
325     {
326         this.bundleDescription = bundleDescription;
327     }
328 
329     public String getBundleName()
330     {
331         return bundleName;
332     }
333 
334     public void setBundleName( String bundleName )
335     {
336         this.bundleName = bundleName;
337     }
338 
339     public String getBundleLicense()
340     {
341         return bundleLicense;
342     }
343 
344     public void setBundleLicense( String bundleLicense )
345     {
346         this.bundleLicense = bundleLicense;
347     }
348 
349     public String getBundleDocUrl()
350     {
351         return bundleDocUrl;
352     }
353 
354     public void setBundleDocUrl( String bundleDocUrl )
355     {
356         this.bundleDocUrl = bundleDocUrl;
357     }
358 
359     public String getBundleImportPackage()
360     {
361         return bundleImportPackage;
362     }
363 
364     public void setBundleImportPackage( String bundleImportPackage )
365     {
366         this.bundleImportPackage = bundleImportPackage;
367     }
368 
369     public String getBundleRequireBundle()
370     {
371         return bundleRequireBundle;
372     }
373 
374     public void setBundleRequireBundle( String bundleRequireBundle )
375     {
376         this.bundleRequireBundle = bundleRequireBundle;
377     }
378 
379     public String getClassifier()
380     {
381         return classifier;
382     }
383 
384     public void setClassifier( String classifier )
385     {
386         this.classifier = classifier;
387     }
388 
389 
390     public String getPackaging()
391     {
392         return packaging;
393     }
394 
395     public void setPackaging( String packaging )
396     {
397         this.packaging = packaging;
398     }
399 
400     public String getFileExtension()
401     {
402         return fileExtension;
403     }
404 
405     public void setFileExtension( String fileExtension )
406     {
407         this.fileExtension = fileExtension;
408     }
409 
410     public String getSize()
411     {
412         return size;
413     }
414 
415     public void setSize( String size )
416     {
417         this.size = size;
418     }
419 
420     public String getType()
421     {
422         return type;
423     }
424 
425     public void setType( String type )
426     {
427         this.type = type;
428     }
429 
430     public String getPath()
431     {
432         return path;
433     }
434 
435     public void setPath( String path )
436     {
437         this.path = path;
438     }
439 
440     public String getId()
441     {
442         return id;
443     }
444 
445     public void setId( String id )
446     {
447         this.id = id;
448     }
449 
450     public String getScope()
451     {
452         return scope;
453     }
454 
455     public void setScope( String scope )
456     {
457         this.scope = scope;
458     }
459 
460     @Override
461     public String toString()
462     {
463         final StringBuilder sb = new StringBuilder();
464         sb.append( "Artifact" );
465         sb.append( "{context='" ).append( context ).append( '\'' );
466         sb.append( ", url='" ).append( url ).append( '\'' );
467         sb.append( ", groupId='" ).append( groupId ).append( '\'' );
468         sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
469         sb.append( ", repositoryId='" ).append( repositoryId ).append( '\'' );
470         sb.append( ", version='" ).append( version ).append( '\'' );
471         sb.append( ", prefix='" ).append( prefix ).append( '\'' );
472         sb.append( ", goals=" ).append( goals );
473         sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' );
474         sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
475         sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
476         sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
477         sb.append( ", bundleDescription='" ).append( bundleDescription ).append( '\'' );
478         sb.append( ", bundleName='" ).append( bundleName ).append( '\'' );
479         sb.append( ", bundleLicense='" ).append( bundleLicense ).append( '\'' );
480         sb.append( ", bundleDocUrl='" ).append( bundleDocUrl ).append( '\'' );
481         sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
482         sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
483         sb.append( ", classifier='" ).append( classifier ).append( '\'' );
484         sb.append( ", packaging='" ).append( packaging ).append( '\'' );
485         sb.append( ", fileExtension='" ).append( fileExtension ).append( '\'' );
486         sb.append( ", size='" ).append( size ).append( '\'' );
487         sb.append( ", type='" ).append( type ).append( '\'' );
488         sb.append( ", path='" ).append( path ).append( '\'' );
489         sb.append( ", id='" ).append( id ).append( '\'' );
490         sb.append( '}' );
491         return sb.toString();
492     }
493 
494     @Override
495     public boolean equals( Object o )
496     {
497         if ( this == o )
498         {
499             return true;
500         }
501         if ( !( o instanceof Artifact ) )
502         {
503             return false;
504         }
505 
506         Artifact artifact = (Artifact) o;
507 
508         if ( !artifactId.equals( artifact.artifactId ) )
509         {
510             return false;
511         }
512         if ( bundleDescription != null
513             ? !bundleDescription.equals( artifact.bundleDescription )
514             : artifact.bundleDescription != null )
515         {
516             return false;
517         }
518         if ( bundleDocUrl != null ? !bundleDocUrl.equals( artifact.bundleDocUrl ) : artifact.bundleDocUrl != null )
519         {
520             return false;
521         }
522         if ( bundleExportPackage != null
523             ? !bundleExportPackage.equals( artifact.bundleExportPackage )
524             : artifact.bundleExportPackage != null )
525         {
526             return false;
527         }
528         if ( bundleExportService != null
529             ? !bundleExportService.equals( artifact.bundleExportService )
530             : artifact.bundleExportService != null )
531         {
532             return false;
533         }
534         if ( bundleImportPackage != null
535             ? !bundleImportPackage.equals( artifact.bundleImportPackage )
536             : artifact.bundleImportPackage != null )
537         {
538             return false;
539         }
540         if ( bundleLicense != null ? !bundleLicense.equals( artifact.bundleLicense ) : artifact.bundleLicense != null )
541         {
542             return false;
543         }
544         if ( bundleName != null ? !bundleName.equals( artifact.bundleName ) : artifact.bundleName != null )
545         {
546             return false;
547         }
548         if ( bundleRequireBundle != null
549             ? !bundleRequireBundle.equals( artifact.bundleRequireBundle )
550             : artifact.bundleRequireBundle != null )
551         {
552             return false;
553         }
554         if ( bundleSymbolicName != null
555             ? !bundleSymbolicName.equals( artifact.bundleSymbolicName )
556             : artifact.bundleSymbolicName != null )
557         {
558             return false;
559         }
560         if ( bundleVersion != null ? !bundleVersion.equals( artifact.bundleVersion ) : artifact.bundleVersion != null )
561         {
562             return false;
563         }
564         if ( classifier != null ? !classifier.equals( artifact.classifier ) : artifact.classifier != null )
565         {
566             return false;
567         }
568         if ( context != null ? !context.equals( artifact.context ) : artifact.context != null )
569         {
570             return false;
571         }
572         if ( fileExtension != null ? !fileExtension.equals( artifact.fileExtension ) : artifact.fileExtension != null )
573         {
574             return false;
575         }
576         if ( goals != null ? !goals.equals( artifact.goals ) : artifact.goals != null )
577         {
578             return false;
579         }
580         if ( !groupId.equals( artifact.groupId ) )
581         {
582             return false;
583         }
584         if ( id != null ? !id.equals( artifact.id ) : artifact.id != null )
585         {
586             return false;
587         }
588         if ( packaging != null ? !packaging.equals( artifact.packaging ) : artifact.packaging != null )
589         {
590             return false;
591         }
592         if ( path != null ? !path.equals( artifact.path ) : artifact.path != null )
593         {
594             return false;
595         }
596         if ( prefix != null ? !prefix.equals( artifact.prefix ) : artifact.prefix != null )
597         {
598             return false;
599         }
600         if ( repositoryId != null ? !repositoryId.equals( artifact.repositoryId ) : artifact.repositoryId != null )
601         {
602             return false;
603         }
604         if ( scope != null ? !scope.equals( artifact.scope ) : artifact.scope != null )
605         {
606             return false;
607         }
608         if ( size != null ? !size.equals( artifact.size ) : artifact.size != null )
609         {
610             return false;
611         }
612         if ( type != null ? !type.equals( artifact.type ) : artifact.type != null )
613         {
614             return false;
615         }
616         if ( url != null ? !url.equals( artifact.url ) : artifact.url != null )
617         {
618             return false;
619         }
620         if ( !version.equals( artifact.version ) )
621         {
622             return false;
623         }
624 
625         return true;
626     }
627 
628     @Override
629     public int hashCode()
630     {
631         int result = context != null ? context.hashCode() : 0;
632         result = 31 * result + ( url != null ? url.hashCode() : 0 );
633         result = 31 * result + groupId.hashCode();
634         result = 31 * result + artifactId.hashCode();
635         result = 31 * result + ( repositoryId != null ? repositoryId.hashCode() : 0 );
636         result = 31 * result + version.hashCode();
637         result = 31 * result + ( prefix != null ? prefix.hashCode() : 0 );
638         result = 31 * result + ( goals != null ? goals.hashCode() : 0 );
639         result = 31 * result + ( bundleVersion != null ? bundleVersion.hashCode() : 0 );
640         result = 31 * result + ( bundleSymbolicName != null ? bundleSymbolicName.hashCode() : 0 );
641         result = 31 * result + ( bundleExportPackage != null ? bundleExportPackage.hashCode() : 0 );
642         result = 31 * result + ( bundleExportService != null ? bundleExportService.hashCode() : 0 );
643         result = 31 * result + ( bundleDescription != null ? bundleDescription.hashCode() : 0 );
644         result = 31 * result + ( bundleName != null ? bundleName.hashCode() : 0 );
645         result = 31 * result + ( bundleLicense != null ? bundleLicense.hashCode() : 0 );
646         result = 31 * result + ( bundleDocUrl != null ? bundleDocUrl.hashCode() : 0 );
647         result = 31 * result + ( bundleImportPackage != null ? bundleImportPackage.hashCode() : 0 );
648         result = 31 * result + ( bundleRequireBundle != null ? bundleRequireBundle.hashCode() : 0 );
649         result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
650         result = 31 * result + ( packaging != null ? packaging.hashCode() : 0 );
651         result = 31 * result + ( fileExtension != null ? fileExtension.hashCode() : 0 );
652         result = 31 * result + ( size != null ? size.hashCode() : 0 );
653         result = 31 * result + ( type != null ? type.hashCode() : 0 );
654         result = 31 * result + ( path != null ? path.hashCode() : 0 );
655         result = 31 * result + ( id != null ? id.hashCode() : 0 );
656         result = 31 * result + ( scope != null ? scope.hashCode() : 0 );
657         return result;
658     }
659 }