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


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

	static
	{
		FIELD_INDEXES.put( HsNormalizacao.ID, HsNormalizacao.ID_INDEX );
		FIELD_INDEXES.put( HsNormalizacao.ID_FULL, HsNormalizacao.ID_INDEX );
		FIELD_INDEXES.put( HsNormalizacao.CODIGO, HsNormalizacao.CODIGO_INDEX );
		FIELD_INDEXES.put( HsNormalizacao.CODIGO_FULL, HsNormalizacao.CODIGO_INDEX );
		FIELD_INDEXES.put( HsNormalizacao.DESCRICAO, HsNormalizacao.DESCRICAO_INDEX );
		FIELD_INDEXES.put( HsNormalizacao.DESCRICAO_FULL, HsNormalizacao.DESCRICAO_INDEX );
		FIELD_INDEXES.put( HsNormalizacao.PORTUGUESA, HsNormalizacao.PORTUGUESA_INDEX );
		FIELD_INDEXES.put( HsNormalizacao.PORTUGUESA_FULL, HsNormalizacao.PORTUGUESA_INDEX );
		FIELD_INDEXES.put( HsNormalizacao.DELETED_DATE, HsNormalizacao.DELETED_DATE_INDEX );
		FIELD_INDEXES.put( HsNormalizacao.DELETED_DATE_FULL, HsNormalizacao.DELETED_DATE_INDEX );
	}

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


	public static final String TABLENAME = "hs_normalizacao";


	public static final String CLASS_IDENTIFIER = "hs_normalizacao1277401737164";

	public static final int _INVALID__INDEX = -1;
	public static final String ID = "id";
	public static final String ID_FULL = "hs_normalizacao.id";
	public static final int ID_INDEX = 0;
	public static final String CODIGO = "codigo";
	public static final String CODIGO_FULL = "hs_normalizacao.codigo";
	public static final int CODIGO_INDEX = 1;
	public static final String DESCRICAO = "descricao";
	public static final String DESCRICAO_FULL = "hs_normalizacao.descricao";
	public static final int DESCRICAO_INDEX = 2;
	public static final String PORTUGUESA = "portuguesa";
	public static final String PORTUGUESA_FULL = "hs_normalizacao.portuguesa";
	public static final int PORTUGUESA_INDEX = 3;
	public static final String DELETED_DATE = "deleted_date";
	public static final String DELETED_DATE_FULL = "hs_normalizacao.deleted_date";
	public static final int DELETED_DATE_INDEX = 4;

	public static final String FIELD_NAMES[] = new String[]{
		CODIGO, DESCRICAO, PORTUGUESA, DELETED_DATE, };

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

	protected static final String DB_FIELD_NAMES[] = new String[]{
		ID, CODIGO, DESCRICAO, PORTUGUESA, DELETED_DATE, };


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


	public static final String DEFAULT_LOAD_SET[] = new String[] {
		ID, CODIGO, DESCRICAO, PORTUGUESA, DELETED_DATE, };

	private Integer id;
	private String codigo;
	private String descricao;
	private Boolean portuguesa;
	private java.sql.Timestamp deleted_date;

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

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

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

	public String getCodigo()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( CODIGO );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.codigo;
	}

	public void setCodigo( String codigo )
	{
		try
		{
			setLockedForRefresh( true );
			preProcess( CODIGO, codigo );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.codigo = codigo;
		LAZY_LOADED_OBJECTS.put( CODIGO, 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 Boolean getPortuguesa()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( PORTUGUESA );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.portuguesa;
	}

	public void setPortuguesa( Boolean portuguesa )
	{
		try
		{
			setLockedForRefresh( true );
			preProcess( PORTUGUESA, portuguesa );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.portuguesa = portuguesa;
		LAZY_LOADED_OBJECTS.put( PORTUGUESA, 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 Object get( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsNormalizacao.ID_INDEX:
				value = getId();
				break;
			case HsNormalizacao.CODIGO_INDEX:
				value = getCodigo();
				break;
			case HsNormalizacao.DESCRICAO_INDEX:
				value = getDescricao();
				break;
			case HsNormalizacao.PORTUGUESA_INDEX:
				value = getPortuguesa();
				break;
			case HsNormalizacao.DELETED_DATE_INDEX:
				value = getDeleted_date();
				break;
		}
		return value;
	}

	public Object rawGet( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsNormalizacao.ID_INDEX:
				value = this.id;
				break;
			case HsNormalizacao.CODIGO_INDEX:
				value = this.codigo;
				break;
			case HsNormalizacao.DESCRICAO_INDEX:
				value = this.descricao;
				break;
			case HsNormalizacao.PORTUGUESA_INDEX:
				value = this.portuguesa;
				break;
			case HsNormalizacao.DELETED_DATE_INDEX:
				value = this.deleted_date;
				break;
		}
		return value;
	}

	public void set( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsNormalizacao.ID_INDEX:
				setId( ( Integer ) value );
				break;
			case HsNormalizacao.CODIGO_INDEX:
				setCodigo( ( String ) value );
				break;
			case HsNormalizacao.DESCRICAO_INDEX:
				setDescricao( ( String ) value );
				break;
			case HsNormalizacao.PORTUGUESA_INDEX:
				setPortuguesa( ( Boolean ) value );
				break;
			case HsNormalizacao.DELETED_DATE_INDEX:
				setDeleted_date( ( java.sql.Timestamp ) value );
				break;
		}
	}

	public void rawSet( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case HsNormalizacao.ID_INDEX:
				this.id = ( Integer ) value;
				break;
			case HsNormalizacao.CODIGO_INDEX:
				this.codigo = ( String ) value;
				break;
			case HsNormalizacao.DESCRICAO_INDEX:
				this.descricao = ( String ) value;
				break;
			case HsNormalizacao.PORTUGUESA_INDEX:
				this.portuguesa = ( Boolean ) value;
				break;
			case HsNormalizacao.DELETED_DATE_INDEX:
				this.deleted_date = ( java.sql.Timestamp ) 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 HsNormalizacao.ID_INDEX:
				theClass = Integer.class;
				break;
			case HsNormalizacao.CODIGO_INDEX:
				theClass = String.class;
				break;
			case HsNormalizacao.DESCRICAO_INDEX:
				theClass = String.class;
				break;
			case HsNormalizacao.PORTUGUESA_INDEX:
				theClass = Boolean.class;
				break;
			case HsNormalizacao.DELETED_DATE_INDEX:
				theClass = java.sql.Timestamp.class;
				break;
		}
		return theClass;
	}

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