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


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

	static
	{
		FIELD_INDEXES.put( TiposExamesComp.ID, TiposExamesComp.ID_INDEX );
		FIELD_INDEXES.put( TiposExamesComp.ID_FULL, TiposExamesComp.ID_INDEX );
		FIELD_INDEXES.put( TiposExamesComp.ORDEM, TiposExamesComp.ORDEM_INDEX );
		FIELD_INDEXES.put( TiposExamesComp.ORDEM_FULL, TiposExamesComp.ORDEM_INDEX );
		FIELD_INDEXES.put( TiposExamesComp.DESCRICAO, TiposExamesComp.DESCRICAO_INDEX );
		FIELD_INDEXES.put( TiposExamesComp.DESCRICAO_FULL, TiposExamesComp.DESCRICAO_INDEX );
	}

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


	public static final String TABLENAME = "tipos_exames_comp";


	public static final String CLASS_IDENTIFIER = "tipos_exames_comp1277401737185";

	public static final int _INVALID__INDEX = -1;
	public static final String ID = "id";
	public static final String ID_FULL = "tipos_exames_comp.id";
	public static final int ID_INDEX = 0;
	public static final String ORDEM = "ordem";
	public static final String ORDEM_FULL = "tipos_exames_comp.ordem";
	public static final int ORDEM_INDEX = 1;
	public static final String DESCRICAO = "descricao";
	public static final String DESCRICAO_FULL = "tipos_exames_comp.descricao";
	public static final int DESCRICAO_INDEX = 2;

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

	public static final String FIELD_NAMES_FULL[] = new String[]{
		TABLENAME + "." + ORDEM, TABLENAME + "." + DESCRICAO, };

	protected static final String DB_FIELD_NAMES[] = new String[]{
		ID, ORDEM, DESCRICAO, };


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


	public static final String DEFAULT_LOAD_SET[] = new String[] {
		ID, ORDEM, DESCRICAO, };

	private Integer id;
	private Integer ordem;
	private String descricao;

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

	public TiposExamesComp()
	{
		super();
		dirtyProperties = new boolean[]{ 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 java.util.List<siprp.data.outer.ExamesPerfisData>fromExamesPerfis_tipo()
	{
		java.util.List<siprp.data.outer.ExamesPerfisData> result = null;
		try
		{
			result = fromReference( siprp.data.outer.ExamesPerfisData.class , getPrimaryKey().getMap().get("id"), "tipo" );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		return result;
	}

	public Integer getOrdem()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( ORDEM );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.ordem;
	}

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

	public String getDescricao()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( DESCRICAO );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.descricao;
	}

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

	public Object get( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case TiposExamesComp.ID_INDEX:
				value = getId();
				break;
			case TiposExamesComp.ORDEM_INDEX:
				value = getOrdem();
				break;
			case TiposExamesComp.DESCRICAO_INDEX:
				value = getDescricao();
				break;
		}
		return value;
	}

	public Object rawGet( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case TiposExamesComp.ID_INDEX:
				value = this.id;
				break;
			case TiposExamesComp.ORDEM_INDEX:
				value = this.ordem;
				break;
			case TiposExamesComp.DESCRICAO_INDEX:
				value = this.descricao;
				break;
		}
		return value;
	}

	public void set( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case TiposExamesComp.ID_INDEX:
				setId( ( Integer ) value );
				break;
			case TiposExamesComp.ORDEM_INDEX:
				setOrdem( ( Integer ) value );
				break;
			case TiposExamesComp.DESCRICAO_INDEX:
				setDescricao( ( String ) value );
				break;
		}
	}

	public void rawSet( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case TiposExamesComp.ID_INDEX:
				this.id = ( Integer ) value;
				break;
			case TiposExamesComp.ORDEM_INDEX:
				this.ordem = ( Integer ) value;
				break;
			case TiposExamesComp.DESCRICAO_INDEX:
				this.descricao = ( String ) 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 TiposExamesComp.ID_INDEX:
				theClass = Integer.class;
				break;
			case TiposExamesComp.ORDEM_INDEX:
				theClass = Integer.class;
				break;
			case TiposExamesComp.DESCRICAO_INDEX:
				theClass = String.class;
				break;
		}
		return theClass;
	}

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

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