git-svn-id: https://svn.coded.pt/svn/SIPRP@734 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Tiago Simão 18 years ago
parent 8b4f19bd5e
commit 53ff4dcc71

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<driver project-version="3.0" class="org.postgresql.Driver">
<url value="jdbc:postgresql://storage:5432/siprp_local"/>
<url value="jdbc:postgresql://10.158.2.2:5432/siprp_local"/>
<!-- url value="jdbc:postgresql://storage:5432/siprp_local"/-->
<connectionPool min="1" max="1"/>
<login userName="postgres" password="Typein" encoderClass="org.apache.cayenne.conf.PlainTextPasswordEncoder" passwordLocation="model" passwordSource="Not Applicable"/>
</driver>

@ -4,6 +4,7 @@ import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
@ -23,7 +24,6 @@ import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
@ -114,7 +114,7 @@ public class LeafInputField<ObjClass extends Object> extends JPanel implements F
private String getStringFromUser()
{
LeafTextDialog textDialog = new LeafTextDialog( getParentFrame(), this, (String) object, true );
LeafTextDialog textDialog = new LeafTextDialog( getParentWindow(), this, (String) object, true );
return textDialog.getText();
}
@ -124,7 +124,7 @@ public class LeafInputField<ObjClass extends Object> extends JPanel implements F
{
if(((Map) object).size() > 0)
{
LeafOptionDialog<Object> optionDialog = new LeafOptionDialog<Object>( (Map) object, null );
LeafOptionDialog<Object> optionDialog = new LeafOptionDialog<Object>( getParentWindow(), (Map) object, null );
return optionDialog.getOption();
}
}
@ -132,7 +132,7 @@ public class LeafInputField<ObjClass extends Object> extends JPanel implements F
{
if(((OrderedMap) object).rows() > 0)
{
LeafOptionDialog<Object> optionDialog = new LeafOptionDialog<Object>( (OrderedMap<Object>) object, null, null, null, null );
LeafOptionDialog<Object> optionDialog = new LeafOptionDialog<Object>( getParentWindow(), (OrderedMap<Object>) object, null, null, null, null );
return optionDialog.getOption();
}
}
@ -141,17 +141,21 @@ public class LeafInputField<ObjClass extends Object> extends JPanel implements F
private Date getDateFromUser()
{
LeafCalendarDialog calendarDialog = new LeafCalendarDialog( getParentFrame(), this );
LeafCalendarDialog calendarDialog = new LeafCalendarDialog( getParentWindow(), this );
return calendarDialog.getDate();
}
private JFrame getParentFrame()
private LeafWindow getParentWindow()
{
if( getRootPane() != null && getRootPane().getParent() instanceof JFrame )
LeafWindow result = null;
for( Container parent = this.getParent(); parent != null; parent = parent.getParent() )
{
return (JFrame) getRootPane().getParent();
if( parent instanceof LeafWindow )
{
result = (LeafWindow) parent;
}
}
return null;
return result;
}
protected void paintComponent( Graphics g )

@ -4,7 +4,6 @@ import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.Dimension;
import java.awt.LayoutManager;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
@ -12,7 +11,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
@ -26,8 +24,6 @@ import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.ScrollPaneConstants;
import com.evolute.utils.tables.models.SortableModel;
public class LeafOptionDialog<KeyClass extends Object> extends JDialog
{
@ -66,9 +62,9 @@ public class LeafOptionDialog<KeyClass extends Object> extends JDialog
private boolean ordered = false;
public LeafOptionDialog(Map<KeyClass, ? extends Object> map, String message)
public LeafOptionDialog( LeafWindow owner, Map<KeyClass, ? extends Object> map, String message)
{
super();
super( owner );
this.mapEnabledForKey = new HashMap<KeyClass, Boolean>();
this.mapChosenForKey = new HashMap<KeyClass, Boolean>();
this.message = message;
@ -80,7 +76,7 @@ public class LeafOptionDialog<KeyClass extends Object> extends JDialog
startup( map, null );
}
public LeafOptionDialog(OrderedMap<KeyClass> orderedMap, Map<KeyClass, Boolean> chosen, Map<KeyClass, Boolean> enabled, String message, String okButton)
public LeafOptionDialog( LeafWindow owner, OrderedMap<KeyClass> orderedMap, Map<KeyClass, Boolean> chosen, Map<KeyClass, Boolean> enabled, String message, String okButton)
{
super();
ordered = true;

@ -96,23 +96,23 @@ public class SIPRPDataLoader implements CompanyDataLoader
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL, "www.evolute.pt:5436" );
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local_3" );
// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL, "10.158.2.3:5432" );
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" );
// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
Singleton.setInstance( SingletonConstants.LOCAL_URL, "dbserver:5432" );
Singleton.setInstance( SingletonConstants.LOCAL_URL, "10.158.2.2:5432" );
Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" );
Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
//
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL, "dbserver:5432" );
// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" );
// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" );
// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" );
// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" );
// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" );

@ -1,6 +1,9 @@
package siprp.database.cayenne.objects;
import java.util.Date;
import siprp.database.cayenne.objects.auto._TrabalhadoresFichasAptidao;
import siprp.ficha.FichaAptidaoConstants;
public class TrabalhadoresFichasAptidao extends _TrabalhadoresFichasAptidao {
private static final long serialVersionUID = 1L;
@ -8,7 +11,38 @@ public class TrabalhadoresFichasAptidao extends _TrabalhadoresFichasAptidao {
@Override
public String toString()
{
return getToTrabalhadoresProcesso().getDataFimString();
String result = "";
Date data = getToExames().getProximoExame();
if( data != null )
{
result = sdf.format( data );
}
return result + ": " + getEstadoString();
}
private String getEstadoString()
{
String result = "";
Integer resultadoCodigo = getToExames().getResultado();
if( resultadoCodigo != null )
{
switch( resultadoCodigo.intValue() )
{
case 1:
result += "Apto";
break;
case 2:
result += "Apto (cond)";
break;
case 3:
result += "Inapto (temp)";
break;
case 4:
result += "Inapto (def)";
break;
}
}
return result;
}
}

@ -12,6 +12,7 @@ import org.apache.cayenne.query.SelectQuery;
import siprp.database.cayenne.objects.BaseObject;
import siprp.database.cayenne.objects.Empresas;
import siprp.database.cayenne.objects.Exames;
import siprp.database.cayenne.objects.LembretesTipos;
import siprp.database.cayenne.objects.Prestadores;
import siprp.database.cayenne.objects.PrtGruposProtocolo;
@ -19,9 +20,7 @@ import siprp.database.cayenne.objects.Trabalhadores;
import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas;
import siprp.database.cayenne.objects.TrabalhadoresEcd;
import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas;
import siprp.database.cayenne.objects.TrabalhadoresFichasAptidao;
import siprp.database.cayenne.objects.TrabalhadoresProcesso;
import siprp.lembretes.LembretesConstants;
import siprp.medicina.MedicinaConstants;
import siprp.medicina.processo.ProcessoConstants;
@ -46,6 +45,11 @@ public class MedicinaDAO extends MainDAO implements MedicinaConstants
}
public Exames getExameForExameID( Integer currentFichaExameID )
{
return (Exames) DataObjectUtils.objectForPK( context, Exames.class, currentFichaExameID );
}
public LembretesTipos getTipoLembretesCustomizavel( )
{
return (LembretesTipos) DataObjectUtils.objectForPK( context, LembretesTipos.class, 1 );

@ -10,6 +10,7 @@ import leaf.LeafWindow.LeafObject;
import siprp.database.cayenne.objects.BaseObject;
import siprp.database.cayenne.objects.Empresas;
import siprp.database.cayenne.objects.Estabelecimentos;
import siprp.database.cayenne.objects.Exames;
import siprp.database.cayenne.objects.Lembretes;
import siprp.database.cayenne.objects.Prestadores;
import siprp.database.cayenne.objects.Trabalhadores;
@ -25,6 +26,7 @@ import siprp.database.cayenne.objects.TrabalhadoresFichasAptidao;
import siprp.database.cayenne.objects.TrabalhadoresProcesso;
import siprp.database.cayenne.providers.MedicinaDAO;
import siprp.ficha.FichaWindow;
import siprp.ficha.SaveExameListener;
import siprp.lembretes.LembretesConstants;
import siprp.lembretes.LembretesDataProvider;
import siprp.medicina.MedicinaConstants;
@ -233,6 +235,8 @@ public class MedicinaProcessoLogic extends LeafLogic
@LeafObject(useWith = SAVE_EXAME)
public TrabalhadoresEcds currentExame = null;
public Integer currentFichaExameID = null;
public MedicinaProcessoLogic()
{
@ -575,15 +579,34 @@ public class MedicinaProcessoLogic extends LeafLogic
FichaWindow fichaWindow = FichaWindow.getWindow();
if( fichaWindow != null )
{
fichaWindow.editTrabalhador( currentTrabalhador.getId(), null );
currentFicha = new TrabalhadoresFichasAptidao();
currentFicha.setToTrabalhadoresProcesso( currentProcesso );
fichaWindow.editTrabalhador( currentTrabalhador.getId(), new SaveExameListener()
{
@Override
public void exameSaved( Integer trabalhadorID, Integer exameID )
{
if( trabalhadorID != null && exameID != null )
{
if( trabalhadorID.equals( currentTrabalhador.getId() ) )
{
currentFichaExameID = exameID;
Exames exame = provider.getExameForExameID( currentFichaExameID );
if( exame != null )
{
currentFicha.setToExames( exame );
provider.saveObject( currentFicha );
runAction( REFRESH );
}
}
}
}
} );
}
} catch( Exception e )
{
e.printStackTrace();
}
// currentFicha = new TrabalhadoresFichasAptidao();
// currentFicha.setToTrabalhadoresProcesso( currentProcesso );
// return currentFicha;
}
@LeafLogicActionBinding(actions = {

@ -139,7 +139,7 @@ public class MedicinaProcessoWindow extends LeafWindow
}
}
LeafOptionDialog<PrtGruposProtocolo> option = new LeafOptionDialog<PrtGruposProtocolo>( grupos, null, null, "Marcar falta para:", "Faltou >>" );
LeafOptionDialog<PrtGruposProtocolo> option = new LeafOptionDialog<PrtGruposProtocolo>( this, grupos, null, null, "Marcar falta para:", "Faltou >>" );
List<PrtGruposProtocolo> selected = option.getSelected();
if( selected != null )
{

@ -534,7 +534,7 @@ public class ProcessoDadosPanel extends JPanel
public void setForNewProcesso( TrabalhadoresProcesso processo )
{
HashMap<Integer, String> tipos = processo.getMotivos();
LeafOptionDialog<Integer> option = new LeafOptionDialog<Integer>( tipos, "Escolha o tipo de processo:" );
LeafOptionDialog<Integer> option = new LeafOptionDialog<Integer>( parentWindow, tipos, "Escolha o tipo de processo:" );
Integer chosen = option.getOption();
if( chosen != null )
{
@ -703,7 +703,7 @@ public class ProcessoDadosPanel extends JPanel
}
}
}
LeafOptionDialog<PrtGruposProtocolo> gruposChosen = new LeafOptionDialog<PrtGruposProtocolo>( grupos, gruposSelected, null, "Escolha os ECDs para esta marca" + ccedil + atilde + "o", "Marcar >>" );
LeafOptionDialog<PrtGruposProtocolo> gruposChosen = new LeafOptionDialog<PrtGruposProtocolo>( parentWindow, grupos, gruposSelected, null, "Escolha os ECDs para esta marca" + ccedil + atilde + "o", "Marcar >>" );
for( PrtGruposProtocolo grupo : gruposChosen.getSelected() )
{
marcacao.marcarGrupoExames( grupo );

@ -322,23 +322,23 @@ public class ProcessoTreePanel extends JPanel
TrabalhadoresFichasAptidao ficha = null;
for( TrabalhadoresFichasAptidao currentFicha : fichas )
{
if( ficha == null && ficha.getId() < currentFicha.getId() )
if( ficha == null || ficha.getId() < currentFicha.getId() )
{
ficha = currentFicha;
}
}
if( ficha != null )
{
// addNodeTo( loadFicha( ficha ), node);
addNodeTo( loadFicha( ficha ), node);
}
}
return node;
}
private FichaAptidaoMutableTreeNode loadFicha(TrabalhadoresFichasAptidao ficha)
{
return null;
FichaAptidaoMutableTreeNode result = new FichaAptidaoMutableTreeNode( ficha );
return result;
}
private ECDsMutableTreeNode loadExame( TrabalhadoresEcds exame )

Loading…
Cancel
Save