1 package org.apache.archiva.maven2.model;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
22 import javax.xml.bind.annotation.XmlRootElement;
23 import java.io.Serializable;
24 import java.util.List;
26 @XmlRootElement( name = "artifact" )
28 implements Serializable
30 // The (optional) context for this result.
31 private String context;
33 // Basic hit, direct to non-artifact resource.
36 // Advanced hit, reference to groupId.
37 private String groupId;
39 // Advanced hit, reference to artifactId.
40 private String artifactId;
42 private String repositoryId;
44 private String version;
47 * Plugin goal prefix (only if packaging is "maven-plugin")
49 private String prefix;
52 * Plugin goals (only if packaging is "maven-plugin")
54 private List<String> goals;
57 * contains osgi metadata Bundle-Version if available
61 private String bundleVersion;
64 * contains osgi metadata Bundle-SymbolicName if available
68 private String bundleSymbolicName;
71 * contains osgi metadata Export-Package if available
75 private String bundleExportPackage;
78 * contains osgi metadata Export-Service if available
82 private String bundleExportService;
85 * contains osgi metadata Bundle-Description if available
89 private String bundleDescription;
92 * contains osgi metadata Bundle-Name if available
96 private String bundleName;
99 * contains osgi metadata Bundle-License if available
103 private String bundleLicense;
106 * contains osgi metadata Bundle-DocURL if available
110 private String bundleDocUrl;
113 * contains osgi metadata Import-Package if available
117 private String bundleImportPackage;
120 * contains osgi metadata Require-Bundle if available
124 private String bundleRequireBundle;
126 private String classifier;
128 private String packaging;
131 * file extension of the artifact
135 private String fileExtension;
138 * human readable size : not available for all services
156 * concat of artifactId+'-'+version+'.'+type
165 private String scope;
173 public Artifact( String groupId, String artifactId, String version )
175 this.artifactId = artifactId;
176 this.groupId = groupId;
177 this.version = version;
183 public Artifact( String groupId, String artifactId, String version, String scope )
185 this( groupId, artifactId, version );
192 public Artifact( String groupId, String artifactId, String version, String scope, String classifier )
194 this( groupId, artifactId, version );
196 this.classifier = classifier;
199 public String getGroupId()
204 public String getArtifactId()
209 public String getVersion()
214 public String getRepositoryId()
219 public void setGroupId( String groupId )
221 this.groupId = groupId;
224 public void setArtifactId( String artifactId )
226 this.artifactId = artifactId;
229 public void setVersion( String version )
231 this.version = version;
234 public void setRepositoryId( String repositoryId )
236 this.repositoryId = repositoryId;
239 public String getContext()
244 public void setContext( String context )
246 this.context = context;
249 public String getUrl()
254 public void setUrl( String url )
259 public String getPrefix()
264 public void setPrefix( String prefix )
266 this.prefix = prefix;
269 public List<String> getGoals()
274 public void setGoals( List<String> goals )
279 public String getBundleVersion()
281 return bundleVersion;
284 public void setBundleVersion( String bundleVersion )
286 this.bundleVersion = bundleVersion;
289 public String getBundleSymbolicName()
291 return bundleSymbolicName;
294 public void setBundleSymbolicName( String bundleSymbolicName )
296 this.bundleSymbolicName = bundleSymbolicName;
299 public String getBundleExportPackage()
301 return bundleExportPackage;
304 public void setBundleExportPackage( String bundleExportPackage )
306 this.bundleExportPackage = bundleExportPackage;
309 public String getBundleExportService()
311 return bundleExportService;
314 public void setBundleExportService( String bundleExportService )
316 this.bundleExportService = bundleExportService;
319 public String getBundleDescription()
321 return bundleDescription;
324 public void setBundleDescription( String bundleDescription )
326 this.bundleDescription = bundleDescription;
329 public String getBundleName()
334 public void setBundleName( String bundleName )
336 this.bundleName = bundleName;
339 public String getBundleLicense()
341 return bundleLicense;
344 public void setBundleLicense( String bundleLicense )
346 this.bundleLicense = bundleLicense;
349 public String getBundleDocUrl()
354 public void setBundleDocUrl( String bundleDocUrl )
356 this.bundleDocUrl = bundleDocUrl;
359 public String getBundleImportPackage()
361 return bundleImportPackage;
364 public void setBundleImportPackage( String bundleImportPackage )
366 this.bundleImportPackage = bundleImportPackage;
369 public String getBundleRequireBundle()
371 return bundleRequireBundle;
374 public void setBundleRequireBundle( String bundleRequireBundle )
376 this.bundleRequireBundle = bundleRequireBundle;
379 public String getClassifier()
384 public void setClassifier( String classifier )
386 this.classifier = classifier;
390 public String getPackaging()
395 public void setPackaging( String packaging )
397 this.packaging = packaging;
400 public String getFileExtension()
402 return fileExtension;
405 public void setFileExtension( String fileExtension )
407 this.fileExtension = fileExtension;
410 public String getSize()
415 public void setSize( String size )
420 public String getType()
425 public void setType( String type )
430 public String getPath()
435 public void setPath( String path )
440 public String getId()
445 public void setId( String id )
450 public String getScope()
455 public void setScope( String scope )
461 public String toString()
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( '\'' );
491 return sb.toString();
495 public boolean equals( Object o )
501 if ( !( o instanceof Artifact ) )
506 Artifact artifact = (Artifact) o;
508 if ( !artifactId.equals( artifact.artifactId ) )
512 if ( bundleDescription != null
513 ? !bundleDescription.equals( artifact.bundleDescription )
514 : artifact.bundleDescription != null )
518 if ( bundleDocUrl != null ? !bundleDocUrl.equals( artifact.bundleDocUrl ) : artifact.bundleDocUrl != null )
522 if ( bundleExportPackage != null
523 ? !bundleExportPackage.equals( artifact.bundleExportPackage )
524 : artifact.bundleExportPackage != null )
528 if ( bundleExportService != null
529 ? !bundleExportService.equals( artifact.bundleExportService )
530 : artifact.bundleExportService != null )
534 if ( bundleImportPackage != null
535 ? !bundleImportPackage.equals( artifact.bundleImportPackage )
536 : artifact.bundleImportPackage != null )
540 if ( bundleLicense != null ? !bundleLicense.equals( artifact.bundleLicense ) : artifact.bundleLicense != null )
544 if ( bundleName != null ? !bundleName.equals( artifact.bundleName ) : artifact.bundleName != null )
548 if ( bundleRequireBundle != null
549 ? !bundleRequireBundle.equals( artifact.bundleRequireBundle )
550 : artifact.bundleRequireBundle != null )
554 if ( bundleSymbolicName != null
555 ? !bundleSymbolicName.equals( artifact.bundleSymbolicName )
556 : artifact.bundleSymbolicName != null )
560 if ( bundleVersion != null ? !bundleVersion.equals( artifact.bundleVersion ) : artifact.bundleVersion != null )
564 if ( classifier != null ? !classifier.equals( artifact.classifier ) : artifact.classifier != null )
568 if ( context != null ? !context.equals( artifact.context ) : artifact.context != null )
572 if ( fileExtension != null ? !fileExtension.equals( artifact.fileExtension ) : artifact.fileExtension != null )
576 if ( goals != null ? !goals.equals( artifact.goals ) : artifact.goals != null )
580 if ( !groupId.equals( artifact.groupId ) )
584 if ( id != null ? !id.equals( artifact.id ) : artifact.id != null )
588 if ( packaging != null ? !packaging.equals( artifact.packaging ) : artifact.packaging != null )
592 if ( path != null ? !path.equals( artifact.path ) : artifact.path != null )
596 if ( prefix != null ? !prefix.equals( artifact.prefix ) : artifact.prefix != null )
600 if ( repositoryId != null ? !repositoryId.equals( artifact.repositoryId ) : artifact.repositoryId != null )
604 if ( scope != null ? !scope.equals( artifact.scope ) : artifact.scope != null )
608 if ( size != null ? !size.equals( artifact.size ) : artifact.size != null )
612 if ( type != null ? !type.equals( artifact.type ) : artifact.type != null )
616 if ( url != null ? !url.equals( artifact.url ) : artifact.url != null )
620 if ( !version.equals( artifact.version ) )
629 public int hashCode()
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 );