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


public class HsEmailEmpresa 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( HsEmailEmpresa.CLASS_IDENTIFIER, HsEmailEmpresa.EMAIL_ID, HsEmailEmpresa.TO_EMAIL_ID ); 
		FIELD_INDEXES.put( HsEmailEmpresa.EMAIL_ID, HsEmailEmpresa.EMAIL_ID_INDEX );
		FIELD_INDEXES.put( HsEmailEmpresa.EMAIL_ID_FULL, HsEmailEmpresa.EMAIL_ID_INDEX );
		FIELD_INDEXES.put( HsEmailEmpresa.TO_EMAIL_ID, HsEmailEmpresa.TO_EMAIL_ID_INDEX );
		com.evolute.entity.evo.EvoDataObject.register( HsEmailEmpresa.CLASS_IDENTIFIER, HsEmailEmpresa.EMPRESA_ID, HsEmailEmpresa.TO_EMPRESA_ID ); 
		FIELD_INDEXES.put( HsEmailEmpresa.EMPRESA_ID, HsEmailEmpresa.EMPRESA_ID_INDEX );
		FIELD_INDEXES.put( HsEmailEmpresa.EMPRESA_ID_FULL, HsEmailEmpresa.EMPRESA_ID_INDEX );
		FIELD_INDEXES.put( HsEmailEmpresa.TO_EMPRESA_ID, HsEmailEmpresa.TO_EMPRESA_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( HsEmailEmpresa.class, HsEmailEmpresa.EMAIL_ID, siprp.data.outer.HsEmailData.class, siprp.data.outer.HsEmailData.ID );

	public static final com.evolute.entity.ForeignKey ForeignKeyempresa_idToempresas = 
		new com.evolute.entity.ForeignKey( HsEmailEmpresa.class, HsEmailEmpresa.EMPRESA_ID, siprp.data.outer.EmpresasData.class, siprp.data.outer.EmpresasData.ID );

	public static final String TABLENAME = "hs_email_empresa";


	public static final String CLASS_IDENTIFIER = "hs_email_empresa1277401737161";

	public static final int _INVALID__INDEX = -1;
	public static final String EMAIL_ID = "email_id";
	public static final String EMAIL_ID_FULL = "hs_email_empresa.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 EMPRESA_ID = "empresa_id";
	public static final String EMPRESA_ID_FULL = "hs_email_empresa.empresa_id";
	public static final int EMPRESA_ID_INDEX = 2;
	public static final String TO_EMPRESA_ID = "to_empresa_id";
	public static final int TO_EMPRESA_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, EMPRESA_ID, };


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


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

	private Integer email_id;
	private siprp.data.outer.HsEmailData to_email_id;
	private Integer empresa_id;
	private siprp.data.outer.EmpresasData to_empresa_id;

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

	public HsEmailEmpresa()
	{
		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 getEmpresa_id()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( EMPRESA_ID );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.empresa_id;
	}

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

	public siprp.data.outer.EmpresasData toEmpresa_id()
	{
		try
		{
			prepare( TO_EMPRESA_ID );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		return this.to_empresa_id;
	}

	public void setToEmpresa_id( siprp.data.outer.EmpresasData to_empresa_id )
	{
		try
		{
			preProcess( TO_EMPRESA_ID, to_empresa_id );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.to_empresa_id = to_empresa_id;
	}

	public Object get( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsEmailEmpresa.EMAIL_ID_INDEX:
				value = getEmail_id();
				break;
			case HsEmailEmpresa.TO_EMAIL_ID_INDEX:
				value = toEmail_id();
				break;
			case HsEmailEmpresa.EMPRESA_ID_INDEX:
				value = getEmpresa_id();
				break;
			case HsEmailEmpresa.TO_EMPRESA_ID_INDEX:
				value = toEmpresa_id();
				break;
		}
		return value;
	}

	public Object rawGet( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsEmailEmpresa.EMAIL_ID_INDEX:
				value = this.email_id;
				break;
			case HsEmailEmpresa.TO_EMAIL_ID_INDEX:
				value = this.to_email_id;
				break;
			case HsEmailEmpresa.EMPRESA_ID_INDEX:
				value = this.empresa_id;
				break;
			case HsEmailEmpresa.TO_EMPRESA_ID_INDEX:
				value = this.to_empresa_id;
				break;
		}
		return value;
	}

	public void set( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsEmailEmpresa.EMAIL_ID_INDEX:
				setEmail_id( ( Integer ) value );
				break;
			case HsEmailEmpresa.TO_EMAIL_ID_INDEX:
				setToEmail_id( ( siprp.data.outer.HsEmailData ) value );
				break;
			case HsEmailEmpresa.EMPRESA_ID_INDEX:
				setEmpresa_id( ( Integer ) value );
				break;
			case HsEmailEmpresa.TO_EMPRESA_ID_INDEX:
				setToEmpresa_id( ( siprp.data.outer.EmpresasData ) value );
				break;
		}
	}

	public void rawSet( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsEmailEmpresa.EMAIL_ID_INDEX:
				this.email_id = ( Integer ) value;
				break;
			case HsEmailEmpresa.TO_EMAIL_ID_INDEX:
				this.to_email_id = ( siprp.data.outer.HsEmailData ) value;
				break;
			case HsEmailEmpresa.EMPRESA_ID_INDEX:
				this.empresa_id = ( Integer ) value;
				break;
			case HsEmailEmpresa.TO_EMPRESA_ID_INDEX:
				this.to_empresa_id = ( siprp.data.outer.EmpresasData ) 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 HsEmailEmpresa is invalid" );
	}

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

	public Integer getFieldIndex( String fieldName )
	{
		Integer index = FIELD_INDEXES.get( fieldName );
		return index != null ? index : HsEmailEmpresa._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, HsEmailEmpresa.PK_FIELD_NAMES );
			primaryKey.set( 0, getEmail_id() );
			primaryKey.set( 1, getEmpresa_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 );
		}
	}
}
