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 org.codehaus.jackson.annotate.JsonIgnore;
22 import org.codehaus.jackson.annotate.JsonIgnoreProperties;
24 import javax.xml.bind.annotation.XmlRootElement;
25 import java.io.Serializable;
28 * @author Olivier Lamy
31 @XmlRootElement( name = "legacyArtifactPath" )
32 public class LegacyArtifactPath
33 implements Serializable
41 * The artifact reference, as " [groupId] :
42 * [artifactId] : [version] : [classifier] : [type] ".
44 private String artifact;
46 public LegacyArtifactPath()
51 public LegacyArtifactPath( String path, String artifact )
54 this.artifact = artifact;
57 public String getPath()
62 public void setPath( String path )
67 public String getArtifact()
72 public void setArtifact( String artifact )
74 this.artifact = artifact;
77 public boolean match( String path )
79 return path.equals( this.path );
83 public String getGroupId()
85 return artifact.split( ":" )[0];
89 public String getArtifactId()
91 return artifact.split( ":" )[1];
95 public String getVersion()
97 return artifact.split( ":" )[2];
101 public String getClassifier()
103 String classifier = artifact.split( ":" )[3];
104 return classifier.length() > 0 ? classifier : null;
108 public String getType()
110 return artifact.split( ":" )[4];
114 public boolean equals( Object o )
120 if ( o == null || getClass() != o.getClass() )
125 LegacyArtifactPath that = (LegacyArtifactPath) o;
127 if ( path != null ? !path.equals( that.path ) : that.path != null )
136 public int hashCode()
138 return path != null ? 37 + path.hashCode() : 0;
142 public String toString()
144 final StringBuilder sb = new StringBuilder();
145 sb.append( "LegacyArtifactPath" );
146 sb.append( "{path='" ).append( path ).append( '\'' );
147 sb.append( ", artifact='" ).append( artifact ).append( '\'' );
149 return sb.toString();