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


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

	static
	{
		FIELD_INDEXES.put( Contactos.ID, Contactos.ID_INDEX );
		FIELD_INDEXES.put( Contactos.ID_FULL, Contactos.ID_INDEX );
		FIELD_INDEXES.put( Contactos.NOME, Contactos.NOME_INDEX );
		FIELD_INDEXES.put( Contactos.NOME_FULL, Contactos.NOME_INDEX );
		FIELD_INDEXES.put( Contactos.TELEFONE, Contactos.TELEFONE_INDEX );
		FIELD_INDEXES.put( Contactos.TELEFONE_FULL, Contactos.TELEFONE_INDEX );
		FIELD_INDEXES.put( Contactos.TELEMOVEL, Contactos.TELEMOVEL_INDEX );
		FIELD_INDEXES.put( Contactos.TELEMOVEL_FULL, Contactos.TELEMOVEL_INDEX );
		FIELD_INDEXES.put( Contactos.FAX, Contactos.FAX_INDEX );
		FIELD_INDEXES.put( Contactos.FAX_FULL, Contactos.FAX_INDEX );
		FIELD_INDEXES.put( Contactos.EMAIL, Contactos.EMAIL_INDEX );
		FIELD_INDEXES.put( Contactos.EMAIL_FULL, Contactos.EMAIL_INDEX );
		FIELD_INDEXES.put( Contactos.CARGO, Contactos.CARGO_INDEX );
		FIELD_INDEXES.put( Contactos.CARGO_FULL, Contactos.CARGO_INDEX );
	}

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


	public static final String TABLENAME = "contactos";


	public static final String CLASS_IDENTIFIER = "contactos1277401737155";

	public static final int _INVALID__INDEX = -1;
	public static final String ID = "id";
	public static final String ID_FULL = "contactos.id";
	public static final int ID_INDEX = 0;
	public static final String NOME = "nome";
	public static final String NOME_FULL = "contactos.nome";
	public static final int NOME_INDEX = 1;
	public static final String TELEFONE = "telefone";
	public static final String TELEFONE_FULL = "contactos.telefone";
	public static final int TELEFONE_INDEX = 2;
	public static final String TELEMOVEL = "telemovel";
	public static final String TELEMOVEL_FULL = "contactos.telemovel";
	public static final int TELEMOVEL_INDEX = 3;
	public static final String FAX = "fax";
	public static final String FAX_FULL = "contactos.fax";
	public static final int FAX_INDEX = 4;
	public static final String EMAIL = "email";
	public static final String EMAIL_FULL = "contactos.email";
	public static final int EMAIL_INDEX = 5;
	public static final String CARGO = "cargo";
	public static final String CARGO_FULL = "contactos.cargo";
	public static final int CARGO_INDEX = 6;

	public static final String FIELD_NAMES[] = new String[]{
		NOME, TELEFONE, TELEMOVEL, FAX, EMAIL, CARGO, };

	public static final String FIELD_NAMES_FULL[] = new String[]{
		TABLENAME + "." + NOME, TABLENAME + "." + TELEFONE, TABLENAME + "." + TELEMOVEL, TABLENAME + "." + FAX, TABLENAME + "." + EMAIL, TABLENAME + "." + CARGO, };

	protected static final String DB_FIELD_NAMES[] = new String[]{
		ID, NOME, TELEFONE, TELEMOVEL, FAX, EMAIL, CARGO, };


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


	public static final String DEFAULT_LOAD_SET[] = new String[] {
		ID, NOME, TELEFONE, TELEMOVEL, FAX, EMAIL, CARGO, };

	private Integer id;
	private String nome;
	private String telefone;
	private String telemovel;
	private String fax;
	private String email;
	private String cargo;

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

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

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

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

	public java.util.List<siprp.data.outer.PrestadoresData>fromPrestadores_contacto_id()
	{
		java.util.List<siprp.data.outer.PrestadoresData> result = null;
		try
		{
			result = fromReference( siprp.data.outer.PrestadoresData.class , getPrimaryKey().getMap().get("id"), "contacto_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 getTelefone()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( TELEFONE );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.telefone;
	}

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

	public String getTelemovel()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( TELEMOVEL );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.telemovel;
	}

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

	public String getFax()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( FAX );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.fax;
	}

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

	public String getEmail()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( EMAIL );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.email;
	}

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

	public String getCargo()
	{
		try
		{
			setLastAccess( System.currentTimeMillis() );
			prepare( CARGO );
		}
		catch( java.lang.Exception ex )
		{
			throw new RuntimeException( ex );
		}
		return this.cargo;
	}

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

	public Object get( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Contactos.ID_INDEX:
				value = getId();
				break;
			case Contactos.NOME_INDEX:
				value = getNome();
				break;
			case Contactos.TELEFONE_INDEX:
				value = getTelefone();
				break;
			case Contactos.TELEMOVEL_INDEX:
				value = getTelemovel();
				break;
			case Contactos.FAX_INDEX:
				value = getFax();
				break;
			case Contactos.EMAIL_INDEX:
				value = getEmail();
				break;
			case Contactos.CARGO_INDEX:
				value = getCargo();
				break;
		}
		return value;
	}

	public Object rawGet( String fieldName )
	{
		Object value = null;
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Contactos.ID_INDEX:
				value = this.id;
				break;
			case Contactos.NOME_INDEX:
				value = this.nome;
				break;
			case Contactos.TELEFONE_INDEX:
				value = this.telefone;
				break;
			case Contactos.TELEMOVEL_INDEX:
				value = this.telemovel;
				break;
			case Contactos.FAX_INDEX:
				value = this.fax;
				break;
			case Contactos.EMAIL_INDEX:
				value = this.email;
				break;
			case Contactos.CARGO_INDEX:
				value = this.cargo;
				break;
		}
		return value;
	}

	public void set( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Contactos.ID_INDEX:
				setId( ( Integer ) value );
				break;
			case Contactos.NOME_INDEX:
				setNome( ( String ) value );
				break;
			case Contactos.TELEFONE_INDEX:
				setTelefone( ( String ) value );
				break;
			case Contactos.TELEMOVEL_INDEX:
				setTelemovel( ( String ) value );
				break;
			case Contactos.FAX_INDEX:
				setFax( ( String ) value );
				break;
			case Contactos.EMAIL_INDEX:
				setEmail( ( String ) value );
				break;
			case Contactos.CARGO_INDEX:
				setCargo( ( String ) value );
				break;
		}
	}

	public void rawSet( String fieldName, Object value )
	{
		Integer index = getFieldIndex( fieldName );
		switch( index )
		{
			case Contactos.ID_INDEX:
				this.id = ( Integer ) value;
				break;
			case Contactos.NOME_INDEX:
				this.nome = ( String ) value;
				break;
			case Contactos.TELEFONE_INDEX:
				this.telefone = ( String ) value;
				break;
			case Contactos.TELEMOVEL_INDEX:
				this.telemovel = ( String ) value;
				break;
			case Contactos.FAX_INDEX:
				this.fax = ( String ) value;
				break;
			case Contactos.EMAIL_INDEX:
				this.email = ( String ) value;
				break;
			case Contactos.CARGO_INDEX:
				this.cargo = ( 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 Contactos.ID_INDEX:
				theClass = Integer.class;
				break;
			case Contactos.NOME_INDEX:
				theClass = String.class;
				break;
			case Contactos.TELEFONE_INDEX:
				theClass = String.class;
				break;
			case Contactos.TELEMOVEL_INDEX:
				theClass = String.class;
				break;
			case Contactos.FAX_INDEX:
				theClass = String.class;
				break;
			case Contactos.EMAIL_INDEX:
				theClass = String.class;
				break;
			case Contactos.CARGO_INDEX:
				theClass = String.class;
				break;
		}
		return theClass;
	}

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