package org.objectweb.jonas.jtests.beans.relation.tier;

/**
 * Value object for TIERS.
 */

public class TierValue extends java.lang.Object implements java.io.Serializable {

    // define attributes
    // define column 'numinttie' and update flag
    private java.lang.Integer numinttie;

    private boolean numinttieHasBeenSet = false;

    // define column 'emailtie' and update flag
    private java.lang.String emailtie;

    private boolean emailtieHasBeenSet = false;
    
    // define primary key
    private java.lang.Integer __pk;

    // public constructor
    public TierValue() {
    }

    // copy constructor ..
    // TODO Cloneable is better than this !
    public TierValue(TierValue otherValue) {
        this.numinttie = otherValue.numinttie;
        numinttieHasBeenSet = true;

        this.emailtie = otherValue.emailtie;
        emailtieHasBeenSet = true;


        //TODO ? correct ?
        // pk = otherValue.getPrimaryKey();
    }

    /*
     * ALL FIELDS EXCEPT PRIMARY KEY
     */
    // getter-setter for emailtie
    public java.lang.String getEmailtie() {
        return this.emailtie;
    }

    public void setEmailtie(java.lang.String emailtie) {
        this.emailtie = emailtie;
        this.emailtieHasBeenSet = true;
    }

    public boolean emailtieHasBeenSet() {
        return emailtieHasBeenSet;
    }

    /*
     * PRIMARY KEY(s)
     */
    public java.lang.Integer getPrimaryKey() {
        return __pk;
    }

    public java.lang.Integer getNuminttie() {
        return this.numinttie;
    }

    public void setNuminttie(java.lang.Integer numinttie) {
        this.numinttie = numinttie;
        __pk = numinttie;
        numinttieHasBeenSet = true;

    }

    public void setPrimaryKey(java.lang.Integer numinttie) {
        setNuminttie(numinttie);
    }

    protected boolean numinttieHasBeenSet() {
        return numinttieHasBeenSet;
    }

    /*
     * Exposes getMethod of type getXXXXValue(), for each related table.
     */
    public java.lang.Integer getTiephyPK() {
        return getNuminttie();
    }

    public java.lang.Integer getTiemorPK() {
        return getNuminttie();
    }

    /*
     * Generated toString() method, includes all fields and inherited fields
     * from superclass toString
     */
    public String toString() {

        StringBuffer str = new StringBuffer("{");

        str.append("{[Tier], ");

        str.append("numinttie" + getNuminttie() + ", "); // table isSimplePk ?
                                                         // true column isPk ?
                                                         // true
        str.append("emailtie" + getEmailtie() + ", "); // table isSimplePk ?
                                                       // true column isPk ?
                                                       // false
        str.append("{[Tier]");
        return (str.toString());
    }

    /*
     * ToXML builds an XML String of fields and inherited fields
     */
    public String toXML() {

        StringBuffer str = new StringBuffer("{");
        str.append("<docTier>");
        str.append("<numinttie>" + getNuminttie() + "</numinttie>");
        str.append("<emailtie>" + getEmailtie() + "</emailtie>");
        str.append("</docTier>");
        return (str.toString());
    }

    public boolean hasIdentity() {
        return numinttieHasBeenSet();
    }

    public void validateData() throws Exception {
        // mandatory columns
        if (numinttie == null) throw new Exception("the field : 'numinttie' must not be null !");
    }
}