SwedenElectionRegion.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:55:51 AM CEST 
//


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

import java.io.Serializable;
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 SwedenElectionRegion complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="SwedenElectionRegion"&gt;
 *   &lt;complexContent&gt;
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
 *       &lt;sequence&gt;
 *         &lt;element name="lan_id" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
 *         &lt;element name="kommun_id" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
 *         &lt;element name="namn" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
 *         &lt;element name="parti" type="{http://partier.val.external.model.cia.hack23.com/impl}SwedenPoliticalParty" maxOccurs="unbounded"/&gt;
 *       &lt;/sequence&gt;
 *     &lt;/restriction&gt;
 *   &lt;/complexContent&gt;
 * &lt;/complexType&gt;
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SwedenElectionRegion", propOrder = {
    "countyId",
    "municipalId",
    "regionName",
    "parties"
})
@Entity(name = "SwedenElectionRegion")
@Table(name = "SWEDEN_ELECTION_REGION")
@Inheritance(strategy = InheritanceType.JOINED)
public class SwedenElectionRegion
    implements Serializable, ModelObject, Equals, HashCode
{

    @XmlElement(name = "lan_id", required = true)
    protected String countyId;
    @XmlElement(name = "kommun_id", required = true)
    protected String municipalId;
    @XmlElement(name = "namn", required = true)
    protected String regionName;
    @XmlElement(name = "parti", required = true)
    protected List<SwedenPoliticalParty> parties;
    @XmlAttribute(name = "Hjid")
    protected Long hjid;

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

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

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

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

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

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

    /**
     * Gets the value of the parties 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 parties property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getParties().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link SwedenPoliticalParty }
     * 
     * 
     */
    @OneToMany(targetEntity = SwedenPoliticalParty.class, cascade = {
        CascadeType.ALL
    })
    @JoinColumn(name = "PARTIES_SWEDEN_ELECTION_REGI_0")
    public List<SwedenPoliticalParty> getParties() {
        if (parties == null) {
            parties = new ArrayList<SwedenPoliticalParty>();
        }
        return this.parties;
    }

    /**
     * 
     * 
     */
    public void setParties(List<SwedenPoliticalParty> parties) {
        this.parties = parties;
    }

    /**
     * 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 SwedenElectionRegion that = ((SwedenElectionRegion) object);
        {
            String lhsCountyId;
            lhsCountyId = this.getCountyId();
            String rhsCountyId;
            rhsCountyId = that.getCountyId();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "countyId", lhsCountyId), LocatorUtils.property(thatLocator, "countyId", rhsCountyId), lhsCountyId, rhsCountyId)) {
                return false;
            }
        }
        {
            String lhsMunicipalId;
            lhsMunicipalId = this.getMunicipalId();
            String rhsMunicipalId;
            rhsMunicipalId = that.getMunicipalId();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "municipalId", lhsMunicipalId), LocatorUtils.property(thatLocator, "municipalId", rhsMunicipalId), lhsMunicipalId, rhsMunicipalId)) {
                return false;
            }
        }
        {
            String lhsRegionName;
            lhsRegionName = this.getRegionName();
            String rhsRegionName;
            rhsRegionName = that.getRegionName();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "regionName", lhsRegionName), LocatorUtils.property(thatLocator, "regionName", rhsRegionName), lhsRegionName, rhsRegionName)) {
                return false;
            }
        }
        {
            List<SwedenPoliticalParty> lhsParties;
            lhsParties = (((this.parties!= null)&&(!this.parties.isEmpty()))?this.getParties():null);
            List<SwedenPoliticalParty> rhsParties;
            rhsParties = (((that.parties!= null)&&(!that.parties.isEmpty()))?that.getParties():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "parties", lhsParties), LocatorUtils.property(thatLocator, "parties", rhsParties), lhsParties, rhsParties)) {
                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;
        {
            String theCountyId;
            theCountyId = this.getCountyId();
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "countyId", theCountyId), currentHashCode, theCountyId);
        }
        {
            String theMunicipalId;
            theMunicipalId = this.getMunicipalId();
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "municipalId", theMunicipalId), currentHashCode, theMunicipalId);
        }
        {
            String theRegionName;
            theRegionName = this.getRegionName();
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "regionName", theRegionName), currentHashCode, theRegionName);
        }
        {
            List<SwedenPoliticalParty> theParties;
            theParties = (((this.parties!= null)&&(!this.parties.isEmpty()))?this.getParties():null);
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "parties", theParties), currentHashCode, theParties);
        }
        return currentHashCode;
    }

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

}