001// =================== DO NOT EDIT THIS FILE ====================
002// Generated by Modello 1.7,
003// any modifications will be overwritten.
004// ==============================================================
005
006package org.apache.archiva.configuration;
007
008/**
009 * Class LegacyArtifactPath.
010 * 
011 * @version $Revision$ $Date$
012 */
013@SuppressWarnings( "all" )
014public class LegacyArtifactPath
015    implements java.io.Serializable
016{
017
018      //--------------------------/
019     //- Class/Member Variables -/
020    //--------------------------/
021
022    /**
023     * 
024     *             The legacy path.
025     *           
026     */
027    private String path;
028
029    /**
030     * 
031     *             The artifact reference, as " [groupId] :
032     * [artifactId] : [version] : [classifier] : [type] ".
033     *           
034     */
035    private String artifact;
036
037
038      //-----------/
039     //- Methods -/
040    //-----------/
041
042    /**
043     * Get the artifact reference, as " [groupId] : [artifactId] :
044     * [version] : [classifier] : [type] ".
045     * 
046     * @return String
047     */
048    public String getArtifact()
049    {
050        return this.artifact;
051    } //-- String getArtifact()
052
053    /**
054     * Get the legacy path.
055     * 
056     * @return String
057     */
058    public String getPath()
059    {
060        return this.path;
061    } //-- String getPath()
062
063    /**
064     * Set the artifact reference, as " [groupId] : [artifactId] :
065     * [version] : [classifier] : [type] ".
066     * 
067     * @param artifact
068     */
069    public void setArtifact( String artifact )
070    {
071        this.artifact = artifact;
072    } //-- void setArtifact( String )
073
074    /**
075     * Set the legacy path.
076     * 
077     * @param path
078     */
079    public void setPath( String path )
080    {
081        this.path = path;
082    } //-- void setPath( String )
083
084    
085    public boolean match( String path )
086    {
087        return path.equals( this.path );
088    }
089
090    public String getGroupId()
091    {
092        return artifact.split( ":" )[0];
093    }
094
095    public String getArtifactId()
096    {
097        return artifact.split( ":" )[1];
098    }
099        
100    public String getVersion()
101    {
102        return artifact.split( ":" )[2];
103    }
104    
105    public String getClassifier()
106    {
107        String classifier = artifact.split( ":" )[3];
108        return classifier.length() > 0 ? classifier : null;
109    }
110    
111    public String getType()
112    {
113        return artifact.split( ":" )[4];
114    }
115
116    @Override
117    public boolean equals( Object o )
118    {
119        if ( this == o )
120        {
121            return true;
122        }
123        if ( o == null || getClass() != o.getClass() )
124        {
125            return false;
126        }
127
128        LegacyArtifactPath that = (LegacyArtifactPath) o;
129
130        if ( path != null ? !path.equals( that.path ) : that.path != null )
131        {
132            return false;
133        }
134
135        return true;
136    }
137
138    @Override
139    public int hashCode()
140    {
141        return path != null ? 37 + path.hashCode() : 0;
142    }
143       
144}