You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SIPRP/trunk/SIPRPSoft/src/siprp/database/cayenne/objects/TrabalhadoresEcdsDatas.java

64 lines
1.6 KiB

package siprp.database.cayenne.objects;
import java.util.Date;
import java.util.HashMap;
import siprp.database.cayenne.objects.auto._TrabalhadoresEcdsDatas;
import siprp.medicina.MedicinaConstants;
public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements MedicinaConstants{
private static final long serialVersionUID = 1L;
public String getDataString()
{
return getData() == null ? "" : sdf.format( getData() );
}
public String getEstadoString()
{
return getEstado() == null || getEstado() >= ESTADOS_EXAME_STR.length ? "" : ESTADOS_EXAME_STR[ getEstado() ];
}
public HashMap<Integer, String> getEstados()
{
HashMap<Integer, String> result = new HashMap<Integer, String>();
for( int i = 0; i < ESTADOS_EXAME_STR.length; ++i )
{
if( ESTADOS_EXAME_STR[i] != null )
{
result.put( new Integer( i ), ESTADOS_EXAME_STR[i] );
}
}
return result;
}
@Override
public void setData( Date date )
{
if( date != null && this.getToTrabalhadoresEcds() != null && this.getEstado() != null && new Integer(ESTADO_POR_REALIZAR).equals(this.getEstado()))
{
this.getToTrabalhadoresEcds().setData( date );
}
super.setData( date );
}
@Override
public void setEstado( Integer estado )
{
if( estado != null && this.getToTrabalhadoresEcds() != null && (new Integer(ESTADO_POR_REALIZAR).equals( this.getEstado() ) || new Integer(ESTADO_POR_REALIZAR).equals( estado )))
{
this.getToTrabalhadoresEcds().setEstado( estado );
}
super.setEstado( estado );
}
@Override
public String toString()
{
return getDataString() + ": " + getEstadoString();
}
}