package alma.acs.tmcdb;
// Generated Jun 5, 2017 7:15:51 PM by Hibernate Tools 4.3.1.Final


import alma.hibernate.util.StringEnumUserType;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;

/**
 * BaseElementStartup generated by hbm2java
 */
@SuppressWarnings("serial")
@Entity
@Table(name="`BASEELEMENTSTARTUP`"
    , uniqueConstraints =  @UniqueConstraint(columnNames={"`STARTUPID`", "`BASEELEMENTID`", "`PARENT`", "`BASEELEMENTTYPE`"})
)
@TypeDef(name="BEStartupBEType", typeClass=StringEnumUserType.class,
   parameters={ @Parameter(name="enumClassName", value="alma.acs.tmcdb.BEStartupBEType") })
public class BaseElementStartup extends alma.acs.tmcdb.translator.TmcdbObject implements java.io.Serializable {


     protected Integer baseElementStartupId;
     protected BaseElement baseElement;
     protected Startup startup;
     protected BaseElementStartup baseElementStartup;
     protected BEStartupBEType baseElementType;
     protected String isGeneric;
     protected Boolean simulated;
     private Set<AssemblyStartup> assemblyStartups = new HashSet<AssemblyStartup>(0);
     private Set<BaseElementStartup> baseElementStartups = new HashSet<BaseElementStartup>(0);

    public BaseElementStartup() {
    }
   
    @Id @GeneratedValue(generator="generator")
    @GenericGenerator(name="generator", strategy="native",
       parameters = {@Parameter(name="sequence", value="BaseElS_seq")}
	)

    
    @Column(name="`BASEELEMENTSTARTUPID`", unique=true, nullable=false)
    public Integer getBaseElementStartupId() {
        return this.baseElementStartupId;
    }
    
    public void setBaseElementStartupId(Integer baseElementStartupId) {    
        if( propertyChangeSupport != null )
            propertyChangeSupport.firePropertyChange("baseElementStartupId", this.baseElementStartupId, this.baseElementStartupId = baseElementStartupId);
        else
            this.baseElementStartupId = baseElementStartupId;
    }


@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="`BASEELEMENTID`")
    public BaseElement getBaseElement() {
        return this.baseElement;
    }
    
    public void setBaseElement(BaseElement baseElement) {    
        if( propertyChangeSupport != null )
            propertyChangeSupport.firePropertyChange("baseElement", this.baseElement, this.baseElement = baseElement);
        else
            this.baseElement = baseElement;
    }


@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="`STARTUPID`")
    public Startup getStartup() {
        return this.startup;
    }
    
    public void setStartup(Startup startup) {    
        if( propertyChangeSupport != null )
            propertyChangeSupport.firePropertyChange("startup", this.startup, this.startup = startup);
        else
            this.startup = startup;
    }


@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="`PARENT`")
    public BaseElementStartup getBaseElementStartup() {
        return this.baseElementStartup;
    }
    
    public void setBaseElementStartup(BaseElementStartup baseElementStartup) {    
        if( propertyChangeSupport != null )
            propertyChangeSupport.firePropertyChange("baseElementStartup", this.baseElementStartup, this.baseElementStartup = baseElementStartup);
        else
            this.baseElementStartup = baseElementStartup;
    }


    
    @Column(name="`BASEELEMENTTYPE`", nullable=false, length=24)
	@Type(type="BEStartupBEType")
    public BEStartupBEType getBaseElementType() {
        return this.baseElementType;
    }
    
    public void setBaseElementType(BEStartupBEType baseElementType) {    
        if( propertyChangeSupport != null )
            propertyChangeSupport.firePropertyChange("baseElementType", this.baseElementType, this.baseElementType = baseElementType);
        else
            this.baseElementType = baseElementType;
    }


    
    @Column(name="`ISGENERIC`", nullable=false, length=5)
    public String getIsGeneric() {
        return this.isGeneric;
    }
    
    public void setIsGeneric(String isGeneric) {    
        if( propertyChangeSupport != null )
            propertyChangeSupport.firePropertyChange("isGeneric", this.isGeneric, this.isGeneric = isGeneric);
        else
            this.isGeneric = isGeneric;
    }


    
    @Column(name="`SIMULATED`", nullable=false)
    public Boolean getSimulated() {
        return this.simulated;
    }
    
    public void setSimulated(Boolean simulated) {    
        if( propertyChangeSupport != null )
            propertyChangeSupport.firePropertyChange("simulated", this.simulated, this.simulated = simulated);
        else
            this.simulated = simulated;
    }


@OneToMany(fetch=FetchType.LAZY, mappedBy="baseElementStartup")
    public Set<AssemblyStartup> getAssemblyStartups() {
        return this.assemblyStartups;
    }
    
    public void setAssemblyStartups(Set<AssemblyStartup> assemblyStartups) {    
    	this.assemblyStartups = assemblyStartups;
    }

	public void addAssemblyStartups(Set<AssemblyStartup> elements) {
		if( this.assemblyStartups != null )
			for(Iterator<AssemblyStartup> it = elements.iterator(); it.hasNext(); )
				addAssemblyStartupToAssemblyStartups((AssemblyStartup)it.next());
	}

	public void addAssemblyStartupToAssemblyStartups(AssemblyStartup element) {
		if( !this.assemblyStartups.contains(element) ) {
			this.assemblyStartups.add(element);
		}
	}


@OneToMany(fetch=FetchType.LAZY, mappedBy="baseElementStartup")
    public Set<BaseElementStartup> getBaseElementStartups() {
        return this.baseElementStartups;
    }
    
    public void setBaseElementStartups(Set<BaseElementStartup> baseElementStartups) {    
    	this.baseElementStartups = baseElementStartups;
    }

	public void addBaseElementStartups(Set<BaseElementStartup> elements) {
		if( this.baseElementStartups != null )
			for(Iterator<BaseElementStartup> it = elements.iterator(); it.hasNext(); )
				addBaseElementStartupToBaseElementStartups((BaseElementStartup)it.next());
	}

	public void addBaseElementStartupToBaseElementStartups(BaseElementStartup element) {
		if( !this.baseElementStartups.contains(element) ) {
			this.baseElementStartups.add(element);
		}
	}



   public boolean equalsContent(Object other) {
         if ( (this == other ) ) return true;
		 if ( (other == null ) ) return false;
		 if ( !(other instanceof BaseElementStartup) ) return false;
		 BaseElementStartup castOther = ( BaseElementStartup ) other;

		 return ( (this.getBaseElement()==castOther.getBaseElement()) || ( this.getBaseElement()!=null && castOther.getBaseElement()!=null && this.getBaseElement().equals(castOther.getBaseElement()) ) )
 && ( (this.getStartup()==castOther.getStartup()) || ( this.getStartup()!=null && castOther.getStartup()!=null && this.getStartup().equals(castOther.getStartup()) ) )
 && ( (this.getBaseElementStartup()==castOther.getBaseElementStartup()) || ( this.getBaseElementStartup()!=null && castOther.getBaseElementStartup()!=null && this.getBaseElementStartup().equals(castOther.getBaseElementStartup()) ) )
 && ( (this.getBaseElementType()==castOther.getBaseElementType()) || ( this.getBaseElementType()!=null && castOther.getBaseElementType()!=null && this.getBaseElementType().equals(castOther.getBaseElementType()) ) );
   }

   public int hashCodeContent() {
         int result = 17;

         
         result = 37 * result + ( getBaseElement() == null ? 0 : this.getBaseElement().hashCode() );
         result = 37 * result + ( getStartup() == null ? 0 : this.getStartup().hashCode() );
         result = 37 * result + ( getBaseElementStartup() == null ? 0 : this.getBaseElementStartup().hashCode() );
         result = 37 * result + ( getBaseElementType() == null ? 0 : this.getBaseElementType().hashCode() );
         
         
         
         
         return result;
   }


}


