view gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java @ 1022:28a0628b11b0

Added license file and license header. gnv/trunk@1258 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Nov 2010 17:15:08 +0000
parents d5d4dbda17cc
children
line wrap: on
line source
/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */

package de.intevation.gnv.artifactdatabase.objects;

/**
 * Implementation of an <code>ArtifactObject> which represents an
 * <code>ArtifactFactory</code>
 * This Class provides the name, the description, the URL where the 
 * the <code>ArtifactDatabase</code> the factory belongs to could be reached 
 * and if the <code>ArtifacFactory</code> is currently selected or not.
 *  
 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
 */
public class ArtifactFactory implements ArtifactObject {

    /**
     * The UID of this Class.
     */
    private static final long serialVersionUID = 5453748230625831527L;

    /**
     * The name of the factory.
     */
    private String name = null;

    /**
     * The description of the Factory.
     */
    private String description = null;

    /**
     * Flag which mark the Artifactfactory as selected if value is true
     * unselected if value is false.
     */
    private boolean selected = false;

    /**
     * The URL where the Factory could be reached.
     */
    private String dataBaseUrl = null;

    /**
     * Returns the url of the artifact server.
     *
     * @return the dataBaseUrl
     */
    public String getDataBaseUrl() {
        return dataBaseUrl;
    }

    /**
     * Constructor
     * @param name the name of the factory
     * @param description the description of the Factory
     * @param dataBaseUrl the URL where the Factory could be reached.
     */
    public ArtifactFactory(String name, 
                           String description, 
                           String dataBaseUrl) {
        super();
        this.name = name;
        this.description = description;
        this.dataBaseUrl = dataBaseUrl;
    }


    public String getId() {
        return this.name;
    }


    public boolean isSelected() {

        return this.selected;
    }


    public void setSelected(boolean selected) {
        this.selected = selected;
    }


    public String getName() {
        return name;
    }


    public String getDescription() {
        return description;
    }


    public String getHash() {
        return null;
    }

    /**
     * Two ArtifactFactories are equal, if the name and the url to the artifact
     * server are equal.
     *
     * @param obj
     * @return true, if the factories are equal - otherwise false.
     */
    @Override
    public boolean equals(Object obj) {
        boolean returnValue = false;
        if (obj instanceof ArtifactFactory){
            ArtifactFactory af = (ArtifactFactory)obj;
            returnValue = this.getName().equals(af.getName()) &&
                          this.getDataBaseUrl().equals(af.getDataBaseUrl());
        }
        return returnValue;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org