BallotContainer.java

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2018.10.06 at 11:58:34 AM CEST 
//


package com.hack23.cia.model.external.riksdagen.votering.impl;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import com.hack23.cia.model.common.api.ModelObject;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;


/**
 * <p>Java class for BallotContainer complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="BallotContainer"&gt;
 *   &lt;complexContent&gt;
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
 *       &lt;sequence&gt;
 *         &lt;element name="dokvotering" type="{http://votering.riksdagen.external.model.cia.hack23.com/impl}BallotDocumentData"/&gt;
 *         &lt;element name="dokument" type="{http://votering.riksdagen.external.model.cia.hack23.com/impl}BallotDocumentElement"/&gt;
 *       &lt;/sequence&gt;
 *     &lt;/restriction&gt;
 *   &lt;/complexContent&gt;
 * &lt;/complexType&gt;
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BallotContainer", propOrder = {
    "ballotDocumentData",
    "ballotDocumentElement"
})
@Entity(name = "BallotContainer")
@Table(name = "BALLOT_CONTAINER")
@Inheritance(strategy = InheritanceType.JOINED)
public class BallotContainer
    implements Serializable, ModelObject, Equals, HashCode, ToString
{

    @XmlElement(name = "dokvotering", required = true)
    protected BallotDocumentData ballotDocumentData;
    @XmlElement(name = "dokument", required = true)
    protected BallotDocumentElement ballotDocumentElement;
    @XmlAttribute(name = "Hjid")
    protected Long hjid;

    /**
     * Gets the value of the ballotDocumentData property.
     * 
     * @return
     *     possible object is
     *     {@link BallotDocumentData }
     *     
     */
    @ManyToOne(targetEntity = BallotDocumentData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "BALLOT_DOCUMENT_DATA_BALLOT__0")
    public BallotDocumentData getBallotDocumentData() {
        return ballotDocumentData;
    }

    /**
     * Sets the value of the ballotDocumentData property.
     * 
     * @param value
     *     allowed object is
     *     {@link BallotDocumentData }
     *     
     */
    public void setBallotDocumentData(BallotDocumentData value) {
        this.ballotDocumentData = value;
    }

    /**
     * Gets the value of the ballotDocumentElement property.
     * 
     * @return
     *     possible object is
     *     {@link BallotDocumentElement }
     *     
     */
    @ManyToOne(targetEntity = BallotDocumentElement.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "BALLOT_DOCUMENT_ELEMENT_BALL_0")
    public BallotDocumentElement getBallotDocumentElement() {
        return ballotDocumentElement;
    }

    /**
     * Sets the value of the ballotDocumentElement property.
     * 
     * @param value
     *     allowed object is
     *     {@link BallotDocumentElement }
     *     
     */
    public void setBallotDocumentElement(BallotDocumentElement value) {
        this.ballotDocumentElement = value;
    }

    public BallotContainer withBallotDocumentData(BallotDocumentData value) {
        setBallotDocumentData(value);
        return this;
    }

    public BallotContainer withBallotDocumentElement(BallotDocumentElement value) {
        setBallotDocumentElement(value);
        return this;
    }

    public String toString() {
        final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
        final StringBuilder buffer = new StringBuilder();
        append(null, buffer, strategy);
        return buffer.toString();
    }

    public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
        strategy.appendStart(locator, this, buffer);
        appendFields(locator, buffer, strategy);
        strategy.appendEnd(locator, this, buffer);
        return buffer;
    }

    public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
        {
            BallotDocumentData theBallotDocumentData;
            theBallotDocumentData = this.getBallotDocumentData();
            strategy.appendField(locator, this, "ballotDocumentData", buffer, theBallotDocumentData);
        }
        {
            BallotDocumentElement theBallotDocumentElement;
            theBallotDocumentElement = this.getBallotDocumentElement();
            strategy.appendField(locator, this, "ballotDocumentElement", buffer, theBallotDocumentElement);
        }
        return buffer;
    }

    /**
     * Gets the value of the hjid property.
     * 
     * @return
     *     possible object is
     *     {@link Long }
     *     
     */
    @Id
    @Column(name = "HJID")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getHjid() {
        return hjid;
    }

    /**
     * Sets the value of the hjid property.
     * 
     * @param value
     *     allowed object is
     *     {@link Long }
     *     
     */
    public void setHjid(Long value) {
        this.hjid = value;
    }

    public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
        if ((object == null)||(this.getClass()!= object.getClass())) {
            return false;
        }
        if (this == object) {
            return true;
        }
        final BallotContainer that = ((BallotContainer) object);
        {
            BallotDocumentData lhsBallotDocumentData;
            lhsBallotDocumentData = this.getBallotDocumentData();
            BallotDocumentData rhsBallotDocumentData;
            rhsBallotDocumentData = that.getBallotDocumentData();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "ballotDocumentData", lhsBallotDocumentData), LocatorUtils.property(thatLocator, "ballotDocumentData", rhsBallotDocumentData), lhsBallotDocumentData, rhsBallotDocumentData)) {
                return false;
            }
        }
        {
            BallotDocumentElement lhsBallotDocumentElement;
            lhsBallotDocumentElement = this.getBallotDocumentElement();
            BallotDocumentElement rhsBallotDocumentElement;
            rhsBallotDocumentElement = that.getBallotDocumentElement();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "ballotDocumentElement", lhsBallotDocumentElement), LocatorUtils.property(thatLocator, "ballotDocumentElement", rhsBallotDocumentElement), lhsBallotDocumentElement, rhsBallotDocumentElement)) {
                return false;
            }
        }
        return true;
    }

    public boolean equals(Object object) {
        final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE;
        return equals(null, null, object, strategy);
    }

    public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
        int currentHashCode = 1;
        {
            BallotDocumentData theBallotDocumentData;
            theBallotDocumentData = this.getBallotDocumentData();
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "ballotDocumentData", theBallotDocumentData), currentHashCode, theBallotDocumentData);
        }
        {
            BallotDocumentElement theBallotDocumentElement;
            theBallotDocumentElement = this.getBallotDocumentElement();
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "ballotDocumentElement", theBallotDocumentElement), currentHashCode, theBallotDocumentElement);
        }
        return currentHashCode;
    }

    public int hashCode() {
        final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
        return this.hashCode(null, strategy);
    }

}