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


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

	static
	{
		FIELD_INDEXES.put( HsRelatorioMedida.ID, HsRelatorioMedida.ID_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.ID_FULL, HsRelatorioMedida.ID_INDEX );
		com.evolute.entity.evo.EvoDataObject.register( HsRelatorioMedida.CLASS_IDENTIFIER, HsRelatorioMedida.RISCO_ID, HsRelatorioMedida.TO_RISCO_ID ); 
		FIELD_INDEXES.put( HsRelatorioMedida.RISCO_ID, HsRelatorioMedida.RISCO_ID_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.RISCO_ID_FULL, HsRelatorioMedida.RISCO_ID_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.TO_RISCO_ID, HsRelatorioMedida.TO_RISCO_ID_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.DESCRIPTION, HsRelatorioMedida.DESCRIPTION_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.DESCRIPTION_FULL, HsRelatorioMedida.DESCRIPTION_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.REQUESITOS_LEGAIS, HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.REQUESITOS_LEGAIS_FULL, HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.DELETED_DATE, HsRelatorioMedida.DELETED_DATE_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.DELETED_DATE_FULL, HsRelatorioMedida.DELETED_DATE_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.HS_MEDIDA_ID, HsRelatorioMedida.HS_MEDIDA_ID_INDEX );
		FIELD_INDEXES.put( HsRelatorioMedida.HS_MEDIDA_ID_FULL, HsRelatorioMedida.HS_MEDIDA_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 ForeignKeyrisco_idTohs_relatorio_risco = 
		new com.evolute.entity.ForeignKey( HsRelatorioMedida.class, HsRelatorioMedida.RISCO_ID, siprp.data.outer.HsRelatorioRiscoData.class, siprp.data.outer.HsRelatorioRiscoData.ID );

	public static final String TABLENAME = "hs_relatorio_medida";


	public static final String CLASS_IDENTIFIER = "hs_relatorio_medida1277401737169";

	public static final int _INVALID__INDEX = -1;
	public static final String ID = "id";
	public static final String ID_FULL = "hs_relatorio_medida.id";
	public static final int ID_INDEX = 0;
	public static final String RISCO_ID = "risco_id";
	public static final String RISCO_ID_FULL = "hs_relatorio_medida.risco_id";
	public static final int RISCO_ID_INDEX = 1;
	public static final String TO_RISCO_ID = "to_risco_id";
	public static final int TO_RISCO_ID_INDEX = 2;
	public static final String DESCRIPTION = "description";
	public static final String DESCRIPTION_FULL = "hs_relatorio_medida.description";
	public static final int DESCRIPTION_INDEX = 3;
	public static final String REQUESITOS_LEGAIS = "requesitos_legais";
	public static final String REQUESITOS_LEGAIS_FULL = "hs_relatorio_medida.requesitos_legais";
	public static final int REQUESITOS_LEGAIS_INDEX = 4;
	public static final String DELETED_DATE = "deleted_date";
	public static final String DELETED_DATE_FULL = "hs_relatorio_medida.deleted_date";
	public static final int DELETED_DATE_INDEX = 5;
	public static final String HS_MEDIDA_ID = "hs_medida_id";
	public static final String HS_MEDIDA_ID_FULL = "hs_relatorio_medida.hs_medida_id";
	public static final int HS_MEDIDA_ID_INDEX = 6;

	public static final String FIELD_NAMES[] = new String[]{
		RISCO_ID, TO_RISCO_ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, 
		HS_MEDIDA_ID, };

	public static final String FIELD_NAMES_FULL[] = new String[]{
		TABLENAME + "." + RISCO_ID, TABLENAME + "." + TO_RISCO_ID, TABLENAME + "." + DESCRIPTION, TABLENAME + "." + REQUESITOS_LEGAIS, TABLENAME + "." + DELETED_DATE, 
		TABLENAME + "." + HS_MEDIDA_ID, };

	protected static final String DB_FIELD_NAMES[] = new String[]{
		ID, RISCO_ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, HS_MEDIDA_ID, };


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


	public static final String DEFAULT_LOAD_SET[] = new String[] {
		ID, RISCO_ID, DESCRIPTION, REQUESITOS_LEGAIS, DELETED_DATE, HS_MEDIDA_ID, };

	private Integer id;
	private Integer risco_id;
	private siprp.data.outer.HsRelatorioRiscoData to_risco_id;
	private String description;
	private String requesitos_legais;
	private java.sql.Timestamp deleted_date;
	private Integer hs_medida_id;

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

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

	public Integer getRisco_id()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( RISCO_ID );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.risco_id;
	}

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

	public siprp.data.outer.HsRelatorioRiscoData toRisco_id()
	{
		try
		{
			prepare( TO_RISCO_ID );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		return this.to_risco_id;
	}

	public void setToRisco_id( siprp.data.outer.HsRelatorioRiscoData to_risco_id )
	{
		try
		{
			preProcess( TO_RISCO_ID, to_risco_id );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.to_risco_id = to_risco_id;
	}

	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 String getRequesitos_legais()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( REQUESITOS_LEGAIS );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.requesitos_legais;
	}

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

	public java.sql.Timestamp getDeleted_date()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( DELETED_DATE );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.deleted_date;
	}

	public void setDeleted_date( java.sql.Timestamp deleted_date )
	{
		try
		{
			setLockedForRefresh( true );
			preProcess( DELETED_DATE, deleted_date );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.deleted_date = deleted_date;
		LAZY_LOADED_OBJECTS.put( DELETED_DATE, Boolean.TRUE );
	}

	public Integer getHs_medida_id()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( HS_MEDIDA_ID );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.hs_medida_id;
	}

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

	public Object get( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsRelatorioMedida.ID_INDEX:
				value = getId();
				break;
			case HsRelatorioMedida.RISCO_ID_INDEX:
				value = getRisco_id();
				break;
			case HsRelatorioMedida.TO_RISCO_ID_INDEX:
				value = toRisco_id();
				break;
			case HsRelatorioMedida.DESCRIPTION_INDEX:
				value = getDescription();
				break;
			case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX:
				value = getRequesitos_legais();
				break;
			case HsRelatorioMedida.DELETED_DATE_INDEX:
				value = getDeleted_date();
				break;
			case HsRelatorioMedida.HS_MEDIDA_ID_INDEX:
				value = getHs_medida_id();
				break;
		}
		return value;
	}

	public Object rawGet( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsRelatorioMedida.ID_INDEX:
				value = this.id;
				break;
			case HsRelatorioMedida.RISCO_ID_INDEX:
				value = this.risco_id;
				break;
			case HsRelatorioMedida.TO_RISCO_ID_INDEX:
				value = this.to_risco_id;
				break;
			case HsRelatorioMedida.DESCRIPTION_INDEX:
				value = this.description;
				break;
			case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX:
				value = this.requesitos_legais;
				break;
			case HsRelatorioMedida.DELETED_DATE_INDEX:
				value = this.deleted_date;
				break;
			case HsRelatorioMedida.HS_MEDIDA_ID_INDEX:
				value = this.hs_medida_id;
				break;
		}
		return value;
	}

	public void set( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsRelatorioMedida.ID_INDEX:
				setId( ( Integer ) value );
				break;
			case HsRelatorioMedida.RISCO_ID_INDEX:
				setRisco_id( ( Integer ) value );
				break;
			case HsRelatorioMedida.TO_RISCO_ID_INDEX:
				setToRisco_id( ( siprp.data.outer.HsRelatorioRiscoData ) value );
				break;
			case HsRelatorioMedida.DESCRIPTION_INDEX:
				setDescription( ( String ) value );
				break;
			case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX:
				setRequesitos_legais( ( String ) value );
				break;
			case HsRelatorioMedida.DELETED_DATE_INDEX:
				setDeleted_date( ( java.sql.Timestamp ) value );
				break;
			case HsRelatorioMedida.HS_MEDIDA_ID_INDEX:
				setHs_medida_id( ( Integer ) value );
				break;
		}
	}

	public void rawSet( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsRelatorioMedida.ID_INDEX:
				this.id = ( Integer ) value;
				break;
			case HsRelatorioMedida.RISCO_ID_INDEX:
				this.risco_id = ( Integer ) value;
				break;
			case HsRelatorioMedida.TO_RISCO_ID_INDEX:
				this.to_risco_id = ( siprp.data.outer.HsRelatorioRiscoData ) value;
				break;
			case HsRelatorioMedida.DESCRIPTION_INDEX:
				this.description = ( String ) value;
				break;
			case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX:
				this.requesitos_legais = ( String ) value;
				break;
			case HsRelatorioMedida.DELETED_DATE_INDEX:
				this.deleted_date = ( java.sql.Timestamp ) value;
				break;
			case HsRelatorioMedida.HS_MEDIDA_ID_INDEX:
				this.hs_medida_id = ( Integer ) 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 HsRelatorioMedida.ID_INDEX:
				theClass = Integer.class;
				break;
			case HsRelatorioMedida.RISCO_ID_INDEX:
				theClass = Integer.class;
				break;
			case HsRelatorioMedida.TO_RISCO_ID_INDEX:
				theClass = siprp.data.outer.HsRelatorioRiscoData.class;
				break;
			case HsRelatorioMedida.DESCRIPTION_INDEX:
				theClass = String.class;
				break;
			case HsRelatorioMedida.REQUESITOS_LEGAIS_INDEX:
				theClass = String.class;
				break;
			case HsRelatorioMedida.DELETED_DATE_INDEX:
				theClass = java.sql.Timestamp.class;
				break;
			case HsRelatorioMedida.HS_MEDIDA_ID_INDEX:
				theClass = Integer.class;
				break;
		}
		return theClass;
	}

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