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.

49 lines
1.4 KiB

package siprp.database.cayenne.objects;
import java.util.Date;
import siprp.MedicinaConstants;
import siprp.database.cayenne.objects.auto._TrabalhadoresConsultasDatas;
public class TrabalhadoresConsultasDatas extends _TrabalhadoresConsultasDatas implements MedicinaConstants
{
private static final long serialVersionUID = 1L;
public String getDataString()
{
return getData() == null ? "" : DATE_FORMAT.format( getData() );
}
public String getEstadoString()
{
return getEstado() == null || getEstado() >= ESTADOS_CONSULTA_STR.length ? "" : ESTADOS_CONSULTA_STR[ getEstado() ];
}
@Override
public String toString()
{
return getDataString() + ": " + getEstadoString();
}
@Override
public void setData( Date date )
{
if( date != null && this.getToTrabalhadoresConsultas() != null && this.getEstado() != null && new Integer(ESTADO_POR_REALIZAR).equals(this.getEstado()))
{
this.getToTrabalhadoresConsultas().setData( date );
}
super.setData( date );
}
@Override
public void setEstado( Integer estado )
{
if( estado != null && this.getToTrabalhadoresConsultas() != null && (new Integer(ESTADO_POR_REALIZAR).equals( this.getEstado() ) || new Integer(ESTADO_POR_REALIZAR).equals( estado )))
{
this.getToTrabalhadoresConsultas().setEstado( !(estado.equals( ESTADO_POR_REALIZAR ) || estado.equals( ESTADO_REALIZADO )) ? ESTADO_POR_MARCAR : estado );
}
super.setEstado( estado );
}
}