This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.configuration;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022/**
023 * Class LegacyArtifactPath.
024 * 
025 * @version $Revision$ $Date$
026 */
027@SuppressWarnings( "all" )
028public class LegacyArtifactPath
029    implements java.io.Serializable
030{
031
032      //--------------------------/
033     //- Class/Member Variables -/
034    //--------------------------/
035
036    /**
037     * 
038     *             The legacy path.
039     *           
040     */
041    private String path;
042
043    /**
044     * 
045     *             The artifact reference, as " [groupId] :
046     * [artifactId] : [version] : [classifier] : [type] ".
047     *           
048     */
049    private String artifact;
050
051
052      //-----------/
053     //- Methods -/
054    //-----------/
055
056    /**
057     * Get the artifact reference, as " [groupId] : [artifactId] :
058     * [version] : [classifier] : [type] ".
059     * 
060     * @return String
061     */
062    public String getArtifact()
063    {
064        return this.artifact;
065    } //-- String getArtifact()
066
067    /**
068     * Get the legacy path.
069     * 
070     * @return String
071     */
072    public String getPath()
073    {
074        return this.path;
075    } //-- String getPath()
076
077    /**
078     * Set the artifact reference, as " [groupId] : [artifactId] :
079     * [version] : [classifier] : [type] ".
080     * 
081     * @param artifact
082     */
083    public void setArtifact( String artifact )
084    {
085        this.artifact = artifact;
086    } //-- void setArtifact( String )
087
088    /**
089     * Set the legacy path.
090     * 
091     * @param path
092     */
093    public void setPath( String path )
094    {
095        this.path = path;
096    } //-- void setPath( String )
097
098    
099    public boolean match( String path )
100    {
101        return path.equals( this.path );
102    }
103
104    public String getGroupId()
105    {
106        return artifact.split( ":" )[0];
107    }
108
109    public String getArtifactId()
110    {
111        return artifact.split( ":" )[1];
112    }
113        
114    public String getVersion()
115    {
116        return artifact.split( ":" )[2];
117    }
118    
119    public String getClassifier()
120    {
121        String classifier = artifact.split( ":" )[3];
122        return classifier.length() > 0 ? classifier : null;
123    }
124    
125    public String getType()
126    {
127        return artifact.split( ":" )[4];
128    }
129
130    @Override
131    public boolean equals( Object o )
132    {
133        if ( this == o )
134        {
135            return true;
136        }
137        if ( o == null || getClass() != o.getClass() )
138        {
139            return false;
140        }
141
142        LegacyArtifactPath that = (LegacyArtifactPath) o;
143
144        if ( path != null ? !path.equals( that.path ) : that.path != null )
145        {
146            return false;
147        }
148
149        return true;
150    }
151
152    @Override
153    public int hashCode()
154    {
155        return path != null ? 37 + path.hashCode() : 0;
156    }
157       
158}