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


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

	static
	{
		FIELD_INDEXES.put( EmailPlanoDeActuacao.ID, EmailPlanoDeActuacao.ID_INDEX );
		FIELD_INDEXES.put( EmailPlanoDeActuacao.ID_FULL, EmailPlanoDeActuacao.ID_INDEX );
		FIELD_INDEXES.put( EmailPlanoDeActuacao.DESCRIPTION, EmailPlanoDeActuacao.DESCRIPTION_INDEX );
		FIELD_INDEXES.put( EmailPlanoDeActuacao.DESCRIPTION_FULL, EmailPlanoDeActuacao.DESCRIPTION_INDEX );
		com.evolute.entity.evo.EvoDataObject.register( EmailPlanoDeActuacao.CLASS_IDENTIFIER, EmailPlanoDeActuacao.ESTABELECIMENTO_ID, EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID ); 
		FIELD_INDEXES.put( EmailPlanoDeActuacao.ESTABELECIMENTO_ID, EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX );
		FIELD_INDEXES.put( EmailPlanoDeActuacao.ESTABELECIMENTO_ID_FULL, EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX );
		FIELD_INDEXES.put( EmailPlanoDeActuacao.TO_ESTABELECIMENTO_ID, EmailPlanoDeActuacao.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 ForeignKeyestabelecimento_idToestabelecimentos = 
		new com.evolute.entity.ForeignKey( EmailPlanoDeActuacao.class, EmailPlanoDeActuacao.ESTABELECIMENTO_ID, siprp.data.outer.EstabelecimentosData.class, siprp.data.outer.EstabelecimentosData.ID );

	public static final String TABLENAME = "email_plano_de_actuacao";


	public static final String CLASS_IDENTIFIER = "email_plano_de_actuacao1277401737155";

	public static final int _INVALID__INDEX = -1;
	public static final String ID = "id";
	public static final String ID_FULL = "email_plano_de_actuacao.id";
	public static final int ID_INDEX = 0;
	public static final String DESCRIPTION = "description";
	public static final String DESCRIPTION_FULL = "email_plano_de_actuacao.description";
	public static final int DESCRIPTION_INDEX = 1;
	public static final String ESTABELECIMENTO_ID = "estabelecimento_id";
	public static final String ESTABELECIMENTO_ID_FULL = "email_plano_de_actuacao.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[]{
		DESCRIPTION, ESTABELECIMENTO_ID, TO_ESTABELECIMENTO_ID, };

	public static final String FIELD_NAMES_FULL[] = new String[]{
		TABLENAME + "." + DESCRIPTION, TABLENAME + "." + ESTABELECIMENTO_ID, TABLENAME + "." + TO_ESTABELECIMENTO_ID, };

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


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


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

	private Integer id;
	private String description;
	private Integer estabelecimento_id;
	private siprp.data.outer.EstabelecimentosData to_estabelecimento_id;

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

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

	public Integer getId()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( ID );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.id;
	}

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

	public String getDescription()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( DESCRIPTION );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.description;
	}

	public void setDescription( String description )
	{
		try
		{
			setLockedForRefresh( true );
			preProcess( DESCRIPTION, description );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.description = description;
		LAZY_LOADED_OBJECTS.put( DESCRIPTION, Boolean.TRUE );
	}

	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 EmailPlanoDeActuacao.ID_INDEX:
				value = getId();
				break;
			case EmailPlanoDeActuacao.DESCRIPTION_INDEX:
				value = getDescription();
				break;
			case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX:
				value = getEstabelecimento_id();
				break;
			case EmailPlanoDeActuacao.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 EmailPlanoDeActuacao.ID_INDEX:
				value = this.id;
				break;
			case EmailPlanoDeActuacao.DESCRIPTION_INDEX:
				value = this.description;
				break;
			case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX:
				value = this.estabelecimento_id;
				break;
			case EmailPlanoDeActuacao.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 EmailPlanoDeActuacao.ID_INDEX:
				setId( ( Integer ) value );
				break;
			case EmailPlanoDeActuacao.DESCRIPTION_INDEX:
				setDescription( ( String ) value );
				break;
			case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX:
				setEstabelecimento_id( ( Integer ) value );
				break;
			case EmailPlanoDeActuacao.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 EmailPlanoDeActuacao.ID_INDEX:
				this.id = ( Integer ) value;
				break;
			case EmailPlanoDeActuacao.DESCRIPTION_INDEX:
				this.description = ( String ) value;
				break;
			case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX:
				this.estabelecimento_id = ( Integer ) value;
				break;
			case EmailPlanoDeActuacao.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()
	{
		return PK_FIELD_NAMES[ 0 ];
	}

	public Class<?> getFieldClass( String fieldName )
	{
		Integer index = getFieldIndex( fieldName );
		Class<?> theClass = null;
		switch( index )
		{
			case EmailPlanoDeActuacao.ID_INDEX:
				theClass = Integer.class;
				break;
			case EmailPlanoDeActuacao.DESCRIPTION_INDEX:
				theClass = String.class;
				break;
			case EmailPlanoDeActuacao.ESTABELECIMENTO_ID_INDEX:
				theClass = Integer.class;
				break;
			case EmailPlanoDeActuacao.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 : EmailPlanoDeActuacao._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, EmailPlanoDeActuacao.PK_FIELD_NAMES );
			primaryKey.set( 0, ( Integer ) array.get( row, col + 0 ) );
		}
		setId( ( Integer ) array.get( row, col + 0 ) );
	}

	@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 );
		}
	}
}
