package siprp.database.cayenne.objects;

import static com.evolute.utils.strings.UnicodeLatin1Map.atilde;
import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;

import java.text.DateFormat;
import java.util.HashMap;
import java.util.Locale;

import org.apache.cayenne.CayenneDataObject;
import org.apache.cayenne.PersistenceState;

import siprp.database.cayenne.providers.MedicinaDAO;
import siprp.medicina.MedicinaConstants;

public class BaseObject extends CayenneDataObject
{
	private static final long serialVersionUID = 1L;
	
	protected static MedicinaDAO medicinaProvider = new MedicinaDAO();
	
	protected static final DateFormat sdf = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) );

	protected static final String isNewMessage = " ";
	
	public boolean isNew()
	{
		return getPersistenceState() == PersistenceState.NEW;
	}
	
	public boolean isCommited()
	{
		return getPersistenceState() == PersistenceState.COMMITTED;
	}
	
	public boolean isModified()
	{
		return getPersistenceState() == PersistenceState.MODIFIED;
	}
	
	public HashMap<Integer, String> getConsultaEstados()
	{
		HashMap<Integer, String> result = new HashMap<Integer, String>();
		for( int i = 0; i < MedicinaConstants.ESTADOS_CONSULTA_STR.length; ++i )
		{
			if( MedicinaConstants.ESTADOS_CONSULTA_STR[i] != null)
			{
				result.put( new Integer( i ), MedicinaConstants.ESTADOS_CONSULTA_STR[i] );
			}
		}
		return result;
	}
	
}
