|
|
|
@ -277,6 +277,8 @@ public class TrabalhadorPanel extends JPanel
|
|
|
|
|
|
|
|
|
|
|
|
public Object save()
|
|
|
|
public Object save()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
StringBuffer msg = new StringBuffer();
|
|
|
|
|
|
|
|
boolean hasMsg = false;
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( trabalhador == null )
|
|
|
|
if( trabalhador == null )
|
|
|
|
@ -297,14 +299,28 @@ public class TrabalhadorPanel extends JPanel
|
|
|
|
String name = ( String )enum.nextElement();
|
|
|
|
String name = ( String )enum.nextElement();
|
|
|
|
trabalhador.setProperty( name, hash.get( name ) );
|
|
|
|
trabalhador.setProperty( name, hash.get( name ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return trabalhador;
|
|
|
|
if( ((String)trabalhador.getProperty( provider.NOME )).trim().length() == 0 )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msg.append( "O trabalhador tem de ter nome\n" );
|
|
|
|
|
|
|
|
hasMsg = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if( trabalhador.getProperty( provider.SEXO ) == null )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
msg.append( "O trabalhador tem de ter um sexo definido\n" );
|
|
|
|
|
|
|
|
hasMsg = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( Exception ex )
|
|
|
|
catch( Exception ex )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ex.printStackTrace();
|
|
|
|
ex.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( hasMsg )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ValuesException( msg.toString() );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return trabalhador;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void clear()
|
|
|
|
public void clear()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|