package org.apache.maven;

/* ====================================================================
 *   Copyright 2001-2004 The Apache Software Foundation.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 * ====================================================================
 */

import org.apache.maven.project.Dependency;

/**
 * 
 * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> 
 * @version $Id: DescribedDependency.java,v 1.2 2004/03/02 15:36:14 evenisse Exp $
 */
public class DescribedDependency implements Comparable
{
    private Dependency dependency;

    private String description = null;

    private String url = null;

    public DescribedDependency(Dependency dependency)
    {
        this.dependency = dependency;
    }

    /**
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    public int compareTo(Object obj)
    {
        DescribedDependency other = (DescribedDependency) obj;
        return this.getId().compareTo(other.getId()); 
    }
    /**
     * @return
     */
    public String getArtifact()
    {
        return dependency.getArtifact();
    }

    /**
     * @return
     */
    public String getArtifactDirectory()
    {
        return dependency.getArtifactDirectory();
    }

    /**
     * @return
     */
    public String getArtifactId()
    {
        return dependency.getArtifactId();
    }

    /**
     * @return
     */
    public String getExtension()
    {
        return dependency.getExtension();
    }

    /**
     * @return
     */
    public String getGroupId()
    {
        return dependency.getGroupId();
    }

    /**
     * @return
     */
    public String getId()
    {
        return dependency.getId();
    }

    /**
     * @return
     */
    public String getJar()
    {
        return dependency.getJar();
    }

    /**
     * @return
     */
    public String getName()
    {
        return dependency.getName();
    }

    /**
     * @return
     */
    public String getType()
    {
        return dependency.getType();
    }

    /**
     * 
     * @param url
     */
    public void setUrl(String url)
    {
        this.url = url;
    }

    /**
     * @return
     */
    public String getUrl()
    {
        String retValue = null;
        if (dependency.getUrl() != null && dependency.getUrl().length()>0)
        {
            retValue = dependency.getUrl();
        }
        else
        {

            return retValue = url;
        }
        return retValue;
    }

    /**
     * @return
     */
    public String getVersion()
    {
        return dependency.getVersion();
    }

    /**
    /**
     * @return
     */
    public String getDescription()
    {
        return description;
    }

    /**
     * @param description
     */
    public void setDescription(String description)
    {
        this.description = description;
    }

}
