no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@305 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Luis Flores 19 years ago
parent 2a65376af1
commit 7cc27e8c08

@ -29,7 +29,7 @@ import javax.swing.tree.*;
public class Main implements com.evolute.utils.ui.window.Connector
{
public final static String SHST_VERSION = "5.8.7";
public final static String SHST_VERSION = "6.0";
private final static ClassLoader classLoader = new EVUtilsImageLib().getClass().getClassLoader();

@ -46,6 +46,7 @@ public class SIPRPTracker extends WindowTracker
/** Creates a new instance of SIPRPTracker */
public SIPRPTracker( AvisosPanel avisosP )
{
Singleton.setInstance( SingletonConstants.SIPRP_TRACKER, this );
this.avisos = avisosP;
avisos.setTracker( this );
Hashtable creators = new Hashtable();

@ -49,6 +49,8 @@ public class SingletonConstants
public static final String LOCAL_DB_NAME = "local_db_name";
public static final String LOCAL_DRIVER_NAME = "local_driver_name";
public static final String SIPRP_TRACKER = "SIPRP_TRACKER";
/** Creates a new instance of SingletonConstants */
private SingletonConstants()
{

@ -132,6 +132,15 @@ public class LembretesDataProvider
EXECUTER.executeQuery( insert );
}
public void apagarLembreteByID( Integer id )
throws Exception
{
Delete delete =
new Delete( "lembretes",
new Field( "id" ).isEqual( id ) );
EXECUTER.executeQuery( delete );
}
public void apagarLembreteByMarcacaoTrabalhadorID( Integer marcacaoID )
throws Exception
{
@ -196,4 +205,41 @@ public class LembretesDataProvider
}
return lembretes;
}
public Lembrete getLembreteByID( Integer id )
throws Exception
{
Select select =
new Select( new String[]{ "lembretes" },
new String[]{ "id", "tipo_id", "data", "descricao",
"texto", "empresa_id", "estabelecimento_id",
"trabalhador_id", "marcacao_estabelecimento_id",
"marcacao_trabalhador_id", "enviar_email",
"periodicidade_dias", "periodicidade_meses" },
new Field( "id" ).isEqual( id ) );
Virtual2DArray array = EXECUTER.executeQuery( select );
if( array.columnLength() == 0 )
{
return null;
}
else
{
Integer tipoID = ( Integer ) array.get( 0, 1 );
Date data = ( Date ) array.get( 0, 2 );
String descricao = ( String ) array.get( 0, 3 );
String texto = ( String ) array.get( 0, 4 );
Integer empresaID = ( Integer ) array.get( 0, 5 );
Integer estabelecimentoID = ( Integer ) array.get( 0, 6 );
Integer trabalhadorID = ( Integer ) array.get( 0, 7 );
Integer marcacaoEstabelecimentoID = ( Integer ) array.get( 0, 8 );
Integer marcacaoTrabalhadorID = ( Integer ) array.get( 0, 9 );
boolean enviarEmail = "y".equals( array.get( 0, 10 ) );
Integer periodicidadeDias = ( Integer ) array.get( 0, 11 );
Integer periodicidadeMeses = ( Integer ) array.get( 0, 12 );
return new Lembrete( id, tipoID, data, descricao, texto,
empresaID, estabelecimentoID, trabalhadorID,
marcacaoEstabelecimentoID, marcacaoTrabalhadorID,
enviarEmail, periodicidadeDias, periodicidadeMeses );
}
}
}

@ -11,6 +11,7 @@ package siprp.lembretes.remarcacoes;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.data.MappableObject;
import com.evolute.utils.jdo.JDOProvider;
import com.evolute.utils.ui.panel.multipleactionlist.MultipleActionListPanel;
import java.awt.BorderLayout;
import java.awt.GridLayout;
@ -33,13 +34,15 @@ public class LembretesRemarcacaoPanel extends JPanel
protected MultipleActionListPanel listTrabalhadoresPanel;
protected MultipleActionListPanel listEstabelecimentosPanel;
protected LembretesDataProvider provider;
protected RemarcacoesDataProvider provider;
private JDOProvider JDO;
/** Creates a new instance of LembretesRemarcacaoPanel */
public LembretesRemarcacaoPanel()
throws Exception
{
provider = LembretesDataProvider.getProvider();
provider = RemarcacoesDataProvider.getProvider();
setupComponents();
}
@ -73,26 +76,9 @@ public class LembretesRemarcacaoPanel extends JPanel
estabelecimentosPanel.setLayout( new BorderLayout() );
estabelecimentosPanel.add( new JLabel( "Higiene e Seguran\u00e7a", JLabel.CENTER ), BorderLayout.NORTH );
estabelecimentosPanel.add( listEstabelecimentosScroll, BorderLayout.CENTER );
Lembrete lembretes[] =
provider.getLembretesByTipo(
provider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID() );
List<IDObject> trabalhadores = new Vector<IDObject>();
List<IDObject> estabelecimentos = new Vector<IDObject>();
for( int n = 0; n < lembretes.length; n++ )
{
if( lembretes[ n ].getMarcacaoTrabalhadorID() != null )
{
trabalhadores.add( new MappableObject(
lembretes[ n ].getMarcacaoTrabalhadorID(),
lembretes[ n ].getDescricao() ) );
}
else if( lembretes[ n ].getMarcacaoEstabelecimentoID() != null )
{
}
}
listTrabalhadoresPanel.showList( trabalhadores.toArray( new IDObject[ trabalhadores.size() ] ) );
listEstabelecimentosPanel.showList( estabelecimentos.toArray( new IDObject[ estabelecimentos.size() ] ) );
listTrabalhadoresPanel.showList( provider.getLembretesRemarcacaoTrabalhador() );
// listEstabelecimentosPanel.showList( estabelecimentos.toArray( new IDObject[ estabelecimentos.size() ] ) );
}
protected String criarDetalhesMarcacaoTrabalhador( Integer marcacaoID )

@ -0,0 +1,124 @@
/*
* RemarcacoesDataProvider.java
*
* Created on February 14, 2007, 10:56 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.lembretes.remarcacoes;
import com.evolute.utils.Singleton;
import com.evolute.utils.arrays.Virtual2DArray;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.data.MappableObject;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
import com.evolute.utils.sql.Expression;
import com.evolute.utils.sql.Field;
import com.evolute.utils.sql.Select;
import com.evolute.utils.sql.Select2;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import siprp.data.Marcacao;
import siprp.lembretes.LembretesConstants;
import siprp.lembretes.LembretesDataProvider;
/**
*
* @author lflores
*/
public class RemarcacoesDataProvider
{
private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) );
private static final Object LOCK = new Object();
private static RemarcacoesDataProvider instance = null;
private Executer EXECUTER;
private LembretesDataProvider lembretesProvider;
/** Creates a new instance of RemarcacoesDataProvider */
public RemarcacoesDataProvider()
throws Exception
{
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
EXECUTER = dbm.getSharedExecuter( this );
lembretesProvider = LembretesDataProvider.getProvider();
}
public static RemarcacoesDataProvider getProvider()
throws Exception
{
synchronized( LOCK )
{
if( instance == null )
{
instance = new RemarcacoesDataProvider();
}
}
return instance;
}
public IDObject[] getLembretesRemarcacaoTrabalhador()
throws Exception
{
Select select =
new Select2( new String[]{ "lembretes", "marcacoes_trabalhador", "trabalhadores",
"estabelecimentos", "empresas" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "lembretes.marcacao_trabalhador_id" ).isEqual( new Field( "marcacoes_trabalhador.id" ) ),
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ),
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ),
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ),
},
new String[]{ "lembretes.id", "lembretes.descricao",
"marcacoes_trabalhador.tipo", "marcacoes_trabalhador.data",
"trabalhadores.nome", "estabelecimentos.nome", "empresas.designacao_social",
"trabalhadores.nome_plain" },
new Field( "lembretes.tipo_id" ).isEqual(
lembretesProvider.getTipoLembreteByCodigo( LembretesConstants.CODE_REMARCACOES ).getID() ).and(
new Field( "lembretes.data" ).isLessOrEqual( new Field( "current_date" ) ) ),
new String[]{ "trabalhadores.nome_plain" },
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
IDObject lembretes[] = new IDObject[ array.columnLength() ];
for( int n = 0; n < lembretes.length; n++ )
{
Integer id = ( Integer ) array.get( n, 0 );
String descricao = ( String ) array.get( n, 1 );
Integer tipoMarcacao = ( Integer ) array.get( n, 2 );
String tipoMarcacaoStr = "";
switch( tipoMarcacao.intValue() )
{
case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES:
tipoMarcacaoStr = "ECDs";
break;
case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA:
tipoMarcacaoStr = "Consulta";
break;
}
Date data = ( Date ) array.get( n, 3 );
String trabalhador = ( String ) array.get( n, 4 );
String split[] = trabalhador.split( " " );
trabalhador = split[ 0 ] + " " + ( split.length > 2 ? split[ 1 ].charAt( 0 ) + ". " : " " ) +
( split.length > 1 ? split[ split.length - 1 ] : "" );
String estabelecimento = ( String ) array.get( n, 5 );
String empresa = ( String ) array.get( n, 6 );
String str = "<html><body><font color=\"#00009f\">" + trabalhador + "</font>"
+ "<br>&nbsp;&nbsp;&nbsp;" + tipoMarcacaoStr + " de " + D_F.format( data )
+ "<br>&nbsp;&nbsp;&nbsp;<font color=\"#009f00\">" + descricao + "</font>"
+ "<br>&nbsp;&nbsp;&nbsp;" + empresa.substring( 0, empresa.length() > 20 ? 20 : empresa.length() )
+ " / " + estabelecimento.substring( 0, estabelecimento.length() > 10 ? 10 : estabelecimento.length() )
+ "</body></html>";
lembretes[ n ] = new MappableObject( id, str );
}
return lembretes;
}
}

@ -9,10 +9,21 @@
package siprp.lembretes.remarcacoes.actions;
import com.evolute.utils.Singleton;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.jdo.JDOProvider;
import com.evolute.utils.ui.DialogException;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
import siprp.SIPRPTracker;
import siprp.SingletonConstants;
import siprp.data.EmpresaData;
import siprp.data.EstabelecimentoData;
import siprp.data.MarcacaoTrabalhadorData;
import siprp.data.TrabalhadorData;
import siprp.lembretes.Lembrete;
import siprp.lembretes.LembretesDataProvider;
/**
*
@ -20,22 +31,57 @@ import javax.swing.AbstractAction;
*/
public class TratarMarcacaoTrabalhadorAction extends AbstractAction
{
private LembretesDataProvider lembretesProvider;
private JDOProvider JDO;
private SIPRPTracker tracker;
private Integer lembreteID;
/**
* Creates a new instance of TratarMarcacaoTrabalhadorAction
*/
public TratarMarcacaoTrabalhadorAction( IDObject marcacaoID )
public TratarMarcacaoTrabalhadorAction( IDObject lembrete )
{
super( "Tratar" );
try
{
lembreteID = lembrete.getID();
lembretesProvider = LembretesDataProvider.getProvider();
JDO = (JDOProvider) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
}
catch( Exception ex )
{
ex.printStackTrace();
}
}
public void actionPerformed(ActionEvent e)
{
try
{
tracker = ( SIPRPTracker ) Singleton.getInstance( SingletonConstants.SIPRP_TRACKER );
Lembrete lembrete = lembretesProvider.getLembreteByID( lembreteID );
if( lembrete == null )
{
JOptionPane.showMessageDialog( null, "Este lembrete j\u00e1 foi tratado.", "J\u00e1 tratado",
JOptionPane.WARNING_MESSAGE );
return;
}
MarcacaoTrabalhadorData marcacao = ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, lembrete.getMarcacaoTrabalhadorID() );
TrabalhadorData trabalhador = ( TrabalhadorData ) marcacao.get( MarcacaoTrabalhadorData.TRABALHADOR );
EstabelecimentoData estabelecimento = ( EstabelecimentoData ) trabalhador.get( TrabalhadorData.ESTABELECIMENTO );
EmpresaData empresa = ( EmpresaData ) estabelecimento.get( EstabelecimentoData.EMPRESA );
lembretesProvider.apagarLembreteByID( lembreteID );
setEnabled( false );
tracker.getMedicinaWindow().setVisible( true );
tracker.getMedicinaWindow().setEmpresaAndEstabelecimentoAndTrabalhador( (Integer) empresa.get( EmpresaData.ID ),
( Integer ) estabelecimento.get( EstabelecimentoData.ID ),
( Integer ) trabalhador.get( TrabalhadorData.ID ) );
}
catch( Exception ex )
{
DialogException.showExceptionMessage( ex, "Erro a marcar", true );
DialogException.showExceptionMessage( ex, "Erro a tratar", true );
}
}

@ -382,9 +382,8 @@ public class MedicinaDataProvider extends MetaProvider
new String[]{ "marcacoes_trabalhador.id", "trabalhadores.nome", "trabalhadores.nome_plain",
"empresas.designacao_social", "marcacoes_trabalhador.tipo"},
new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and(
new Field( "marcacoes_trabalhador.estado" ).notIn(
new Integer[]{ new Integer( Marcacao.ESTADO_DESMARCADA_TRABALHADOR ),
new Integer( Marcacao.ESTADO_DESMARCADA_SHST ) } ) ).and(
new Field( "marcacoes_trabalhador.estado" ).isEqual(
new Integer( Marcacao.ESTADO_POR_REALIZAR ) ) ).and(
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ),
null,
null,
@ -407,9 +406,8 @@ public class MedicinaDataProvider extends MetaProvider
new String[]{ "marcacoes_trabalhador.id", "trabalhadores.nome", "trabalhadores.nome_plain",
"empresas.designacao_social", "marcacoes_trabalhador.tipo"},
new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and(
new Field( "marcacoes_trabalhador.estado" ).notIn(
new Integer[]{ new Integer( Marcacao.ESTADO_DESMARCADA_TRABALHADOR ),
new Integer( Marcacao.ESTADO_DESMARCADA_SHST ) } ) ).and(
new Field( "marcacoes_trabalhador.estado" ).isEqual(
new Integer( Marcacao.ESTADO_POR_REALIZAR ) ) ).and(
new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ),
null,
null,

@ -87,7 +87,7 @@ public class RegistarPresencasWindow extends JFrame
listECDsPanel =
new MultipleActionListPanel(
new PresencasActionFactory[]{ shstDesmarcouFactory, faltouFactory },
new PresencasActionFactory[]{ /*shstDesmarcouFactory, faltouFactory*/ },
new PresencasActionFactory[]{ realizouFactory, realizouParcialmenteFactory,
trabalhadorDesmarcouFactory, shstDesmarcouFactory,
faltouFactory } );
@ -96,7 +96,7 @@ public class RegistarPresencasWindow extends JFrame
listConsultasPanel =
new MultipleActionListPanel(
new PresencasActionFactory[]{ shstDesmarcouFactory, faltouFactory },
new PresencasActionFactory[]{ /*shstDesmarcouFactory, faltouFactory*/ },
new PresencasActionFactory[]{ realizouFactory, trabalhadorDesmarcouFactory,
shstDesmarcouFactory, faltouFactory } );
listConsultasScroll = new JScrollPane( listConsultasPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,

Loading…
Cancel
Save