/*
* HsEmailEstabelecimento.java
*
* Generated by com.evutils.codegen.EntityObjectGenerator
*
* Use but DON'T TOUCH
* -> (can't touch this)
*/
package siprp.data.inner;


public class HsEmailEstabelecimento extends siprp.data.BaseObject
{
	private static final java.util.HashMap<String,Integer> FIELD_INDEXES = new java.util.HashMap<String,Integer>();

	static
	{
		com.evolute.entity.evo.EvoDataObject.register( HsEmailEstabelecimento.CLASS_IDENTIFIER, HsEmailEstabelecimento.EMAIL_ID, HsEmailEstabelecimento.TO_EMAIL_ID ); 
		FIELD_INDEXES.put( HsEmailEstabelecimento.EMAIL_ID, HsEmailEstabelecimento.EMAIL_ID_INDEX );
		FIELD_INDEXES.put( HsEmailEstabelecimento.EMAIL_ID_FULL, HsEmailEstabelecimento.EMAIL_ID_INDEX );
		FIELD_INDEXES.put( HsEmailEstabelecimento.TO_EMAIL_ID, HsEmailEstabelecimento.TO_EMAIL_ID_INDEX );
		com.evolute.entity.evo.EvoDataObject.register( HsEmailEstabelecimento.CLASS_IDENTIFIER, HsEmailEstabelecimento.ESTABELECIMENTO_ID, HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID ); 
		FIELD_INDEXES.put( HsEmailEstabelecimento.ESTABELECIMENTO_ID, HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX );
		FIELD_INDEXES.put( HsEmailEstabelecimento.ESTABELECIMENTO_ID_FULL, HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX );
		FIELD_INDEXES.put( HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID, HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX );
	}

	private final java.util.HashMap< String, Boolean > LAZY_LOADED_OBJECTS = new java.util.HashMap< String, Boolean >();


	public static final com.evolute.entity.ForeignKey ForeignKeyemail_idTohs_email = 
		new com.evolute.entity.ForeignKey( HsEmailEstabelecimento.class, HsEmailEstabelecimento.EMAIL_ID, siprp.data.outer.HsEmailData.class, siprp.data.outer.HsEmailData.ID );

	public static final com.evolute.entity.ForeignKey ForeignKeyestabelecimento_idToestabelecimentos = 
		new com.evolute.entity.ForeignKey( HsEmailEstabelecimento.class, HsEmailEstabelecimento.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID );

	public static final String TABLENAME = "hs_email_estabelecimento";


	public static final String CLASS_IDENTIFIER = "hs_email_estabelecimento1277401737161";

	public static final int _INVALID__INDEX = -1;
	public static final String EMAIL_ID = "email_id";
	public static final String EMAIL_ID_FULL = "hs_email_estabelecimento.email_id";
	public static final int EMAIL_ID_INDEX = 0;
	public static final String TO_EMAIL_ID = "to_email_id";
	public static final int TO_EMAIL_ID_INDEX = 1;
	public static final String ESTABELECIMENTO_ID = "estabelecimento_id";
	public static final String ESTABELECIMENTO_ID_FULL = "hs_email_estabelecimento.estabelecimento_id";
	public static final int ESTABELECIMENTO_ID_INDEX = 2;
	public static final String TO_ESTABELECIMENTO_ID = "to_estabelecimento_id";
	public static final int TO_ESTABELECIMENTO_ID_INDEX = 3;

	public static final String FIELD_NAMES[] = new String[]{
		};

	public static final String FIELD_NAMES_FULL[] = new String[]{
		};

	protected static final String DB_FIELD_NAMES[] = new String[]{
		EMAIL_ID, ESTABELECIMENTO_ID, };


	protected static final String PK_FIELD_NAMES[] = new String[]{
		EMAIL_ID, ESTABELECIMENTO_ID, };


	public static final String DEFAULT_LOAD_SET[] = new String[] {
		EMAIL_ID, ESTABELECIMENTO_ID, };

	private Integer email_id;
	private siprp.data.outer.HsEmailData to_email_id;
	private Integer estabelecimento_id;
	private siprp.data.outer.EstabelecimentosData to_estabelecimento_id;

	protected com.evolute.entity.utils.IntegerPrimaryKey primaryKey;

	public HsEmailEstabelecimento()
	{
		super();
		dirtyProperties = new boolean[]{ false, false, false
			, false };
	}

	public Integer getEmail_id()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( EMAIL_ID );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.email_id;
	}

	public void setEmail_id( Integer email_id )
	{
		try
		{
			setLockedForRefresh( true );
			preProcess( EMAIL_ID, email_id );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.email_id = email_id;
		LAZY_LOADED_OBJECTS.put( EMAIL_ID, Boolean.TRUE );
	}

	public siprp.data.outer.HsEmailData toEmail_id()
	{
		try
		{
			prepare( TO_EMAIL_ID );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		return this.to_email_id;
	}

	public void setToEmail_id( siprp.data.outer.HsEmailData to_email_id )
	{
		try
		{
			preProcess( TO_EMAIL_ID, to_email_id );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.to_email_id = to_email_id;
	}

	public Integer getEstabelecimento_id()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( ESTABELECIMENTO_ID );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.estabelecimento_id;
	}

	public void setEstabelecimento_id( Integer estabelecimento_id )
	{
		try
		{
			setLockedForRefresh( true );
			preProcess( ESTABELECIMENTO_ID, estabelecimento_id );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.estabelecimento_id = estabelecimento_id;
		LAZY_LOADED_OBJECTS.put( ESTABELECIMENTO_ID, Boolean.TRUE );
	}

	public siprp.data.outer.EstabelecimentosData toEstabelecimento_id()
	{
		try
		{
			prepare( TO_ESTABELECIMENTO_ID );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		return this.to_estabelecimento_id;
	}

	public void setToEstabelecimento_id( siprp.data.outer.EstabelecimentosData to_estabelecimento_id )
	{
		try
		{
			preProcess( TO_ESTABELECIMENTO_ID, to_estabelecimento_id );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.to_estabelecimento_id = to_estabelecimento_id;
	}

	public Object get( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsEmailEstabelecimento.EMAIL_ID_INDEX:
				value = getEmail_id();
				break;
			case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX:
				value = toEmail_id();
				break;
			case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX:
				value = getEstabelecimento_id();
				break;
			case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX:
				value = toEstabelecimento_id();
				break;
		}
		return value;
	}

	public Object rawGet( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsEmailEstabelecimento.EMAIL_ID_INDEX:
				value = this.email_id;
				break;
			case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX:
				value = this.to_email_id;
				break;
			case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX:
				value = this.estabelecimento_id;
				break;
			case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX:
				value = this.to_estabelecimento_id;
				break;
		}
		return value;
	}

	public void set( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsEmailEstabelecimento.EMAIL_ID_INDEX:
				setEmail_id( ( Integer ) value );
				break;
			case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX:
				setToEmail_id( ( siprp.data.outer.HsEmailData ) value );
				break;
			case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX:
				setEstabelecimento_id( ( Integer ) value );
				break;
			case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX:
				setToEstabelecimento_id( ( siprp.data.outer.EstabelecimentosData ) value );
				break;
		}
	}

	public void rawSet( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsEmailEstabelecimento.EMAIL_ID_INDEX:
				this.email_id = ( Integer ) value;
				break;
			case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX:
				this.to_email_id = ( siprp.data.outer.HsEmailData ) value;
				break;
			case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX:
				this.estabelecimento_id = ( Integer ) value;
				break;
			case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX:
				this.to_estabelecimento_id = ( siprp.data.outer.EstabelecimentosData ) value;
				break;
		}
	}

	public String []getFieldNames()
	{
		return FIELD_NAMES;
	}

	public String []getFieldNamesFull()
	{
		return FIELD_NAMES_FULL;
	}

	public String []getDBFieldNames()
	{
		return DB_FIELD_NAMES;
	}

	public String []getPrimaryKeyNames()
	{
		return PK_FIELD_NAMES;
	}

	public String []getDefaultLoadSet()
	{
		return DEFAULT_LOAD_SET;
	}

	public String getPrimaryKeyName()
	{
		throw new RuntimeException( "getPrimaryKeyName on HsEmailEstabelecimento is invalid" );
	}

	public Class<?> getFieldClass( String fieldName )
	{
		Integer index = getFieldIndex( fieldName );
		Class<?> theClass = null;
		switch( index )
		{
			case HsEmailEstabelecimento.EMAIL_ID_INDEX:
				theClass = Integer.class;
				break;
			case HsEmailEstabelecimento.TO_EMAIL_ID_INDEX:
				theClass = siprp.data.outer.HsEmailData.class;
				break;
			case HsEmailEstabelecimento.ESTABELECIMENTO_ID_INDEX:
				theClass = Integer.class;
				break;
			case HsEmailEstabelecimento.TO_ESTABELECIMENTO_ID_INDEX:
				theClass = siprp.data.outer.EstabelecimentosData.class;
				break;
		}
		return theClass;
	}

	public Integer getFieldIndex( String fieldName )
	{
		Integer index = FIELD_INDEXES.get( fieldName );
		return index != null ? index : HsEmailEstabelecimento._INVALID__INDEX;
	}

	public String getTableName()
	{
		return TABLENAME;
	}

	public String getClassIdentifier()
	{
		return CLASS_IDENTIFIER;
	}

	@Override
	protected void setPrimaryKeyFromVirtual2DArray( com.evolute.utils.arrays.Virtual2DArray array, int row, int col )
	{
		if( primaryKey == null )
		{
			primaryKey = new com.evolute.entity.utils.IntegerPrimaryKey( TABLENAME, HsEmailEstabelecimento.PK_FIELD_NAMES );
			primaryKey.set( 0, getEmail_id() );
			primaryKey.set( 1, getEstabelecimento_id() );
		}
	}

	@Override
	public com.evolute.entity.utils.IntegerPrimaryKey getPrimaryKey()
	{
		return primaryKey;
	}

	public void initLazyLoadFields()
	{
	}

	public boolean isPropertyLoaded( String fieldName )
	{
		if ( LAZY_LOADED_OBJECTS.get( fieldName ) == null )
		{
			return true;
		}
		else
		{
			return LAZY_LOADED_OBJECTS.get( fieldName );
		}
	}
}
