/*
 * $Id: VKCDynaAttribute.java,v 1.4 2004/07/20 08:18:23 jonyp Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 *
 * $Log: VKCDynaAttribute.java,v $
 * Revision 1.4  2004/07/20 08:18:23  jonyp
 * added copyright info + cvs log
 *
 * Revision 1.3  2003/04/08 21:19:57  marbobo
 * Serialisierung
 *
 * Revision 1.2  2003/03/12 00:35:54  koppy
 * Editierfunktion für Dynamische Attribute
 *
 * Revision 1.1  2003/02/23 13:23:28  koppy
 * Initiale Version
 *
 */

package vkc.db.entities;
import java.io.Serializable;
/**
 * Klasse kapselt (zunächst) Schlüssel
 * und Wert eines dynamischen Attributes
 *
 * @author koppy
 * @version 1.0
 */
public class VKCDynaAttribute implements Serializable{

    private Integer dynaEntryId;
    private Integer dynaAttrId;
    private String name;
    private String value;

    public VKCDynaAttribute() {
    }

    public VKCDynaAttribute( Integer dynaEntryId,
			     String name,
			     String value ){
	this.dynaEntryId = dynaEntryId;
	this.name = name;
	this.value = value;
    }


    public Integer getDynaAttrId() {
        return dynaAttrId;
    }
    public void setDynaAttrId(Integer dynaAttrId) {
        this.dynaAttrId = dynaAttrId;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }


    public Integer getDynaEntryId() {
        return dynaEntryId;
    }

    public void setDynaEntryId(Integer dynaEntryId) {
        this.dynaEntryId = dynaEntryId;
    }

    /**
     * Overrides equals( Object o )
     * @param o
     * @return
     */
    public boolean equals( Object o ) {

	if( !(o instanceof VKCDynaAttribute ) ){
	    return false;
	}
	VKCDynaAttribute dynaAttr = (VKCDynaAttribute)o;

	String b = new StringBuffer( name ).append( value ).append( dynaAttrId ).toString();

	return b.equals( new StringBuffer( dynaAttr.getName()).append(
		dynaAttr.getValue()).append( dynaAttr.getDynaAttrId()).toString() );
    }

    /**
     * Overrides hashCode()
     * @return
     */
    public int hashCode(){

	return new StringBuffer( name ).append( value ).append( dynaAttrId ).toString().hashCode();
    }

    /**
     *
     * @return String representation of this dynamic Attribute
     */
    public String toString(){
	return new StringBuffer( name ).append( ": " ).append( value ).toString();
    }

}