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


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

	static
	{
		FIELD_INDEXES.put( Errors.ID, Errors.ID_INDEX );
		FIELD_INDEXES.put( Errors.ID_FULL, Errors.ID_INDEX );
		FIELD_INDEXES.put( Errors.DATE, Errors.DATE_INDEX );
		FIELD_INDEXES.put( Errors.DATE_FULL, Errors.DATE_INDEX );
		FIELD_INDEXES.put( Errors.TYPE, Errors.TYPE_INDEX );
		FIELD_INDEXES.put( Errors.TYPE_FULL, Errors.TYPE_INDEX );
		FIELD_INDEXES.put( Errors.ENVIRONMENT, Errors.ENVIRONMENT_INDEX );
		FIELD_INDEXES.put( Errors.ENVIRONMENT_FULL, Errors.ENVIRONMENT_INDEX );
		FIELD_INDEXES.put( Errors.DESCRIPTION, Errors.DESCRIPTION_INDEX );
		FIELD_INDEXES.put( Errors.DESCRIPTION_FULL, Errors.DESCRIPTION_INDEX );
	}

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


	public static final String TABLENAME = "errors";


	public static final String CLASS_IDENTIFIER = "errors1277401737157";

	public static final int _INVALID__INDEX = -1;
	public static final String ID = "id";
	public static final String ID_FULL = "errors.id";
	public static final int ID_INDEX = 0;
	public static final String DATE = "date";
	public static final String DATE_FULL = "errors.date";
	public static final int DATE_INDEX = 1;
	public static final String TYPE = "type";
	public static final String TYPE_FULL = "errors.type";
	public static final int TYPE_INDEX = 2;
	public static final String ENVIRONMENT = "environment";
	public static final String ENVIRONMENT_FULL = "errors.environment";
	public static final int ENVIRONMENT_INDEX = 3;
	public static final String DESCRIPTION = "description";
	public static final String DESCRIPTION_FULL = "errors.description";
	public static final int DESCRIPTION_INDEX = 4;

	public static final String FIELD_NAMES[] = new String[]{
		DATE, TYPE, ENVIRONMENT, DESCRIPTION, };

	public static final String FIELD_NAMES_FULL[] = new String[]{
		TABLENAME + "." + DATE, TABLENAME + "." + TYPE, TABLENAME + "." + ENVIRONMENT, TABLENAME + "." + DESCRIPTION, };

	protected static final String DB_FIELD_NAMES[] = new String[]{
		ID, DATE, TYPE, ENVIRONMENT, DESCRIPTION, };


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


	public static final String DEFAULT_LOAD_SET[] = new String[] {
		ID, DATE, TYPE, ENVIRONMENT, DESCRIPTION, };

	private Integer id;
	private java.sql.Timestamp date;
	private String type;
	private String environment;
	private String description;

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

	public Errors()
	{
		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.sql.Timestamp getDate()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( DATE );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.date;
	}

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

	public String getType()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( TYPE );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.type;
	}

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

	public String getEnvironment()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( ENVIRONMENT );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.environment;
	}

	public void setEnvironment( String environment )
	{
		try
		{
			setLockedForRefresh( true );
			preProcess( ENVIRONMENT, environment );
		}
		catch( com.evolute.entity.evo.EvoDataException edex )
		{
			throw new RuntimeException( edex );
		}
		this.environment = environment;
		LAZY_LOADED_OBJECTS.put( ENVIRONMENT, 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 Object get( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Errors.ID_INDEX:
				value = getId();
				break;
			case Errors.DATE_INDEX:
				value = getDate();
				break;
			case Errors.TYPE_INDEX:
				value = getType();
				break;
			case Errors.ENVIRONMENT_INDEX:
				value = getEnvironment();
				break;
			case Errors.DESCRIPTION_INDEX:
				value = getDescription();
				break;
		}
		return value;
	}

	public Object rawGet( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Errors.ID_INDEX:
				value = this.id;
				break;
			case Errors.DATE_INDEX:
				value = this.date;
				break;
			case Errors.TYPE_INDEX:
				value = this.type;
				break;
			case Errors.ENVIRONMENT_INDEX:
				value = this.environment;
				break;
			case Errors.DESCRIPTION_INDEX:
				value = this.description;
				break;
		}
		return value;
	}

	public void set( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Errors.ID_INDEX:
				setId( ( Integer ) value );
				break;
			case Errors.DATE_INDEX:
				setDate( ( java.sql.Timestamp ) value );
				break;
			case Errors.TYPE_INDEX:
				setType( ( String ) value );
				break;
			case Errors.ENVIRONMENT_INDEX:
				setEnvironment( ( String ) value );
				break;
			case Errors.DESCRIPTION_INDEX:
				setDescription( ( String ) value );
				break;
		}
	}

	public void rawSet( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Errors.ID_INDEX:
				this.id = ( Integer ) value;
				break;
			case Errors.DATE_INDEX:
				this.date = ( java.sql.Timestamp ) value;
				break;
			case Errors.TYPE_INDEX:
				this.type = ( String ) value;
				break;
			case Errors.ENVIRONMENT_INDEX:
				this.environment = ( String ) value;
				break;
			case Errors.DESCRIPTION_INDEX:
				this.description = ( 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 Errors.ID_INDEX:
				theClass = Integer.class;
				break;
			case Errors.DATE_INDEX:
				theClass = java.sql.Timestamp.class;
				break;
			case Errors.TYPE_INDEX:
				theClass = String.class;
				break;
			case Errors.ENVIRONMENT_INDEX:
				theClass = String.class;
				break;
			case Errors.DESCRIPTION_INDEX:
				theClass = String.class;
				break;
		}
		return theClass;
	}

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