SwedenMunicipalityData.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:56:36 AM CEST 
//


package com.hack23.cia.model.external.val.kommunvalkrets.impl;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Basic;
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.OneToMany;
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.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;


/**
 * <p>Java class for SwedenMunicipalityData complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="SwedenMunicipalityData"&gt;
 *   &lt;complexContent&gt;
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
 *       &lt;sequence&gt;
 *         &lt;element name="kommunkod" type="{http://www.w3.org/2001/XMLSchema}integer"/&gt;
 *         &lt;element name="kommunnamn" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
 *         &lt;element name="kommunvalkrets" type="{http://kommunvalkrets.val.external.model.cia.hack23.com/impl}SwedenMunicipalityElectionRegionData" maxOccurs="unbounded"/&gt;
 *       &lt;/sequence&gt;
 *     &lt;/restriction&gt;
 *   &lt;/complexContent&gt;
 * &lt;/complexType&gt;
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SwedenMunicipalityData", propOrder = {
    "code",
    "municipalName",
    "kommunvalkrets"
})
@Entity(name = "SwedenMunicipalityData")
@Table(name = "SWEDEN_MUNICIPALITY_DATA")
@Inheritance(strategy = InheritanceType.JOINED)
public class SwedenMunicipalityData
    implements Serializable, ModelObject, Equals, HashCode
{

    @XmlElement(name = "kommunkod", required = true)
    protected BigInteger code;
    @XmlElement(name = "kommunnamn", required = true)
    protected String municipalName;
    @XmlElement(required = true)
    protected List<SwedenMunicipalityElectionRegionData> kommunvalkrets;
    @XmlAttribute(name = "Hjid")
    protected Long hjid;

    /**
     * Gets the value of the code property.
     * 
     * @return
     *     possible object is
     *     {@link BigInteger }
     *     
     */
    @Basic
    @Column(name = "CODE", precision = 20, scale = 0)
    public BigInteger getCode() {
        return code;
    }

    /**
     * Sets the value of the code property.
     * 
     * @param value
     *     allowed object is
     *     {@link BigInteger }
     *     
     */
    public void setCode(BigInteger value) {
        this.code = value;
    }

    /**
     * Gets the value of the municipalName property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    @Basic
    @Column(name = "MUNICIPAL_NAME", length = 255)
    public String getMunicipalName() {
        return municipalName;
    }

    /**
     * Sets the value of the municipalName property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setMunicipalName(String value) {
        this.municipalName = value;
    }

    /**
     * Gets the value of the kommunvalkrets property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the kommunvalkrets property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getKommunvalkrets().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link SwedenMunicipalityElectionRegionData }
     * 
     * 
     */
    @OneToMany(targetEntity = SwedenMunicipalityElectionRegionData.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "KOMMUNVALKRETS_SWEDEN_MUNICI_0")
    public List<SwedenMunicipalityElectionRegionData> getKommunvalkrets() {
        if (kommunvalkrets == null) {
            kommunvalkrets = new ArrayList<SwedenMunicipalityElectionRegionData>();
        }
        return this.kommunvalkrets;
    }

    /**
     * 
     * 
     */
    public void setKommunvalkrets(List<SwedenMunicipalityElectionRegionData> kommunvalkrets) {
        this.kommunvalkrets = kommunvalkrets;
    }

    /**
     * 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 SwedenMunicipalityData that = ((SwedenMunicipalityData) object);
        {
            BigInteger lhsCode;
            lhsCode = this.getCode();
            BigInteger rhsCode;
            rhsCode = that.getCode();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "code", lhsCode), LocatorUtils.property(thatLocator, "code", rhsCode), lhsCode, rhsCode)) {
                return false;
            }
        }
        {
            String lhsMunicipalName;
            lhsMunicipalName = this.getMunicipalName();
            String rhsMunicipalName;
            rhsMunicipalName = that.getMunicipalName();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "municipalName", lhsMunicipalName), LocatorUtils.property(thatLocator, "municipalName", rhsMunicipalName), lhsMunicipalName, rhsMunicipalName)) {
                return false;
            }
        }
        {
            List<SwedenMunicipalityElectionRegionData> lhsKommunvalkrets;
            lhsKommunvalkrets = (((this.kommunvalkrets!= null)&&(!this.kommunvalkrets.isEmpty()))?this.getKommunvalkrets():null);
            List<SwedenMunicipalityElectionRegionData> rhsKommunvalkrets;
            rhsKommunvalkrets = (((that.kommunvalkrets!= null)&&(!that.kommunvalkrets.isEmpty()))?that.getKommunvalkrets():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "kommunvalkrets", lhsKommunvalkrets), LocatorUtils.property(thatLocator, "kommunvalkrets", rhsKommunvalkrets), lhsKommunvalkrets, rhsKommunvalkrets)) {
                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;
        {
            BigInteger theCode;
            theCode = this.getCode();
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "code", theCode), currentHashCode, theCode);
        }
        {
            String theMunicipalName;
            theMunicipalName = this.getMunicipalName();
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "municipalName", theMunicipalName), currentHashCode, theMunicipalName);
        }
        {
            List<SwedenMunicipalityElectionRegionData> theKommunvalkrets;
            theKommunvalkrets = (((this.kommunvalkrets!= null)&&(!this.kommunvalkrets.isEmpty()))?this.getKommunvalkrets():null);
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "kommunvalkrets", theKommunvalkrets), currentHashCode, theKommunvalkrets);
        }
        return currentHashCode;
    }

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

}