1 package org.apache.archiva.admin.model.beans;
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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
21 import javax.xml.bind.annotation.XmlRootElement;
22 import java.io.Serializable;
25 * @author Olivier Lamy
28 @XmlRootElement( name = "legacyArtifactPath" )
29 public class LegacyArtifactPath
30 implements Serializable
38 * The artifact reference, as " [groupId] :
39 * [artifactId] : [version] : [classifier] : [type] ".
41 private String artifact;
43 public LegacyArtifactPath()
48 public LegacyArtifactPath( String path, String artifact )
51 this.artifact = artifact;
54 public String getPath()
59 public void setPath( String path )
64 public String getArtifact()
69 public void setArtifact( String artifact )
71 this.artifact = artifact;
74 public boolean match( String path )
76 return path.equals( this.path );
79 public String getGroupId()
81 return artifact.split( ":" )[0];
84 public String getArtifactId()
86 return artifact.split( ":" )[1];
89 public String getVersion()
91 return artifact.split( ":" )[2];
94 public String getClassifier()
96 String classifier = artifact.split( ":" )[3];
97 return classifier.length() > 0 ? classifier : null;
100 public String getType()
102 return artifact.split( ":" )[4];
106 public boolean equals( Object o )
112 if ( o == null || getClass() != o.getClass() )
117 LegacyArtifactPath that = (LegacyArtifactPath) o;
119 if ( path != null ? !path.equals( that.path ) : that.path != null )
128 public int hashCode()
130 return path != null ? 37 + path.hashCode() : 0;
134 public String toString()
136 final StringBuilder sb = new StringBuilder();
137 sb.append( "LegacyArtifactPath" );
138 sb.append( "{path='" ).append( path ).append( '\'' );
139 sb.append( ", artifact='" ).append( artifact ).append( '\'' );
141 return sb.toString();