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

/**
 * Value object for TIEPHY.
 */

public class TiephyValue 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 'nomusatie' and update flag
    private java.lang.String nomusatie;

    private boolean nomusatieHasBeenSet = false;

    // define primary key
    private java.lang.Integer __pk;

    // public constructor
    public TiephyValue() {
    }

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

        this.nomusatie = otherValue.nomusatie;
        nomusatieHasBeenSet = true;

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

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

    public void setNomusatie(java.lang.String nomusatie) {
        this.nomusatie = nomusatie;
        this.nomusatieHasBeenSet = true;
    }

    public boolean nomusatieHasBeenSet() {
        return nomusatieHasBeenSet;
    }

    /*
     * 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 getTierPK() {
        return getNuminttie();
    }

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

        StringBuffer str = new StringBuffer("{");

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

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

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

        StringBuffer str = new StringBuffer("{");
        str.append("<docTiephy>");
        str.append("<numinttie>" + getNuminttie() + "</numinttie>");
        str.append("<nomusatie>" + getNomusatie() + "</nomusatie>");

        str.append("</docTiephy>");
        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 !");
        if (nomusatie == null) throw new Exception("the field : 'nomusatie' must not be null !");
    }
}