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


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

	static
	{
		FIELD_INDEXES.put( Medicos.ID, Medicos.ID_INDEX );
		FIELD_INDEXES.put( Medicos.ID_FULL, Medicos.ID_INDEX );
		FIELD_INDEXES.put( Medicos.NOME, Medicos.NOME_INDEX );
		FIELD_INDEXES.put( Medicos.NOME_FULL, Medicos.NOME_INDEX );
		FIELD_INDEXES.put( Medicos.NUMERO_CEDULA, Medicos.NUMERO_CEDULA_INDEX );
		FIELD_INDEXES.put( Medicos.NUMERO_CEDULA_FULL, Medicos.NUMERO_CEDULA_INDEX );
		FIELD_INDEXES.put( Medicos.INACTIVO, Medicos.INACTIVO_INDEX );
		FIELD_INDEXES.put( Medicos.INACTIVO_FULL, Medicos.INACTIVO_INDEX );
	}

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


	public static final String TABLENAME = "medicos";


	public static final String CLASS_IDENTIFIER = "medicos1277401737179";

	public static final int _INVALID__INDEX = -1;
	public static final String ID = "id";
	public static final String ID_FULL = "medicos.id";
	public static final int ID_INDEX = 0;
	public static final String NOME = "nome";
	public static final String NOME_FULL = "medicos.nome";
	public static final int NOME_INDEX = 1;
	public static final String NUMERO_CEDULA = "numero_cedula";
	public static final String NUMERO_CEDULA_FULL = "medicos.numero_cedula";
	public static final int NUMERO_CEDULA_INDEX = 2;
	public static final String INACTIVO = "inactivo";
	public static final String INACTIVO_FULL = "medicos.inactivo";
	public static final int INACTIVO_INDEX = 3;

	public static final String FIELD_NAMES[] = new String[]{
		NOME, NUMERO_CEDULA, INACTIVO, };

	public static final String FIELD_NAMES_FULL[] = new String[]{
		TABLENAME + "." + NOME, TABLENAME + "." + NUMERO_CEDULA, TABLENAME + "." + INACTIVO, };

	protected static final String DB_FIELD_NAMES[] = new String[]{
		ID, NOME, NUMERO_CEDULA, INACTIVO, };


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


	public static final String DEFAULT_LOAD_SET[] = new String[] {
		ID, NOME, NUMERO_CEDULA, INACTIVO, };

	private Integer id;
	private String nome;
	private String numero_cedula;
	private String inactivo;

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

	public Medicos()
	{
		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 java.util.List<siprp.data.outer.EstabelecimentosData>fromEstabelecimentos_medico_id()
	{
		java.util.List<siprp.data.outer.EstabelecimentosData> result = null;
		try
		{
			result = fromReference( siprp.data.outer.EstabelecimentosData.class , getPrimaryKey().getMap().get("id"), "medico_id" );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		return result;
	}

	public java.util.List<siprp.data.outer.ExamesData>fromExames_medico_id()
	{
		java.util.List<siprp.data.outer.ExamesData> result = null;
		try
		{
			result = fromReference( siprp.data.outer.ExamesData.class , getPrimaryKey().getMap().get("id"), "medico_id" );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		return result;
	}

	public String getNome()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( NOME );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.nome;
	}

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

	public String getNumero_cedula()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( NUMERO_CEDULA );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.numero_cedula;
	}

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

	public String getInactivo()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( INACTIVO );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.inactivo;
	}

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

	public Object get( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Medicos.ID_INDEX:
				value = getId();
				break;
			case Medicos.NOME_INDEX:
				value = getNome();
				break;
			case Medicos.NUMERO_CEDULA_INDEX:
				value = getNumero_cedula();
				break;
			case Medicos.INACTIVO_INDEX:
				value = getInactivo();
				break;
		}
		return value;
	}

	public Object rawGet( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Medicos.ID_INDEX:
				value = this.id;
				break;
			case Medicos.NOME_INDEX:
				value = this.nome;
				break;
			case Medicos.NUMERO_CEDULA_INDEX:
				value = this.numero_cedula;
				break;
			case Medicos.INACTIVO_INDEX:
				value = this.inactivo;
				break;
		}
		return value;
	}

	public void set( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Medicos.ID_INDEX:
				setId( ( Integer ) value );
				break;
			case Medicos.NOME_INDEX:
				setNome( ( String ) value );
				break;
			case Medicos.NUMERO_CEDULA_INDEX:
				setNumero_cedula( ( String ) value );
				break;
			case Medicos.INACTIVO_INDEX:
				setInactivo( ( String ) value );
				break;
		}
	}

	public void rawSet( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Medicos.ID_INDEX:
				this.id = ( Integer ) value;
				break;
			case Medicos.NOME_INDEX:
				this.nome = ( String ) value;
				break;
			case Medicos.NUMERO_CEDULA_INDEX:
				this.numero_cedula = ( String ) value;
				break;
			case Medicos.INACTIVO_INDEX:
				this.inactivo = ( 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 Medicos.ID_INDEX:
				theClass = Integer.class;
				break;
			case Medicos.NOME_INDEX:
				theClass = String.class;
				break;
			case Medicos.NUMERO_CEDULA_INDEX:
				theClass = String.class;
				break;
			case Medicos.INACTIVO_INDEX:
				theClass = String.class;
				break;
		}
		return theClass;
	}

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