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

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Tiago Simão 17 years ago
parent c0edf313c7
commit 95136da97c

@ -3,11 +3,9 @@
<classpathentry kind="src" path="SIPRPSoft/src"/>
<classpathentry kind="src" path="common/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib.common/evolute.jar" sourcepath="/evolute/src"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/jdo.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/jdom.jar"/>
<classpathentry kind="lib" path="lib.tools/servlet-api.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/TableLayout.jar"/>
<classpathentry kind="lib" path="web/lib/commons-fileupload-1.0.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/jxl-2.6.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/jpox-1.0.4.jar"/>
@ -25,10 +23,8 @@
<classpathentry kind="lib" path="SIPRPSoft/lib/commons-logging-1.1.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/postgresql-8.0-317.jdbc3.jar"/>
<classpathentry kind="lib" path="web/lib/commons-email-1.0-dev.jar"/>
<classpathentry kind="lib" path="lib.common/mail.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/iText-2.0.7.jar"/>
<classpathentry kind="lib" path="SIPRPSoft/lib/PDFRenderer.jar"/>
<classpathentry kind="lib" path="lib.common/log4j-1.2.8.jar"/>
<classpathentry kind="lib" path="AnaliseAcidentesTrabalho/jars/activation.jar"/>
<classpathentry kind="lib" path="AnaliseAcidentesTrabalho/lib/jai_imageio.jar"/>
<classpathentry kind="lib" path="lib.netbeans/webui.jar"/>
@ -36,5 +32,9 @@
<classpathentry kind="lib" path="lib.netbeans/jsf-impl.jar"/>
<classpathentry kind="lib" path="lib.netbeans/dataprovider.jar"/>
<classpathentry kind="lib" path="lib.netbeans/appbase.jar"/>
<classpathentry kind="lib" path="common/lib/evolute.jar"/>
<classpathentry kind="lib" path="common/lib/log4j-1.2.8.jar"/>
<classpathentry kind="lib" path="common/lib/mail.jar"/>
<classpathentry kind="lib" path="common/lib/TableLayout.jar"/>
<classpathentry kind="output" path="SIPRPSoft/build/classes"/>
</classpath>

@ -28,7 +28,7 @@ public class MarcacaoVisitaHSTPanel
private final JLabel dataLabel = new JLabel( "Data da visita", JLabel.RIGHT );
private final JCalendarPanel dataPanel = new JCalendarPanel( null );
private final JButton emailButton = new JButton( "Enviar Email" );
private final JLabel dataFichaLabel = new JLabel( "Data do Relat\u00f3rio", JLabel.RIGHT );
private final JLabel dataFichaLabel = new JLabel( "Data do Relat\u00f3rio(externo)", JLabel.RIGHT );
private final JCalendarPanel dataFichaPanel = new JCalendarPanel( null );
private final JLabel tecnicoLabel = new JLabel( "T\u00e9cnico", JLabel.RIGHT );
private final JComboBox tecnicoList = new JComboBox();

@ -0,0 +1,403 @@
package siprp.higiene.relatorio;
import static com.evolute.utils.strings.UnicodeLatin1Map.atilde;
import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;
import static com.evolute.utils.strings.UnicodeLatin1Map.oacute;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import siprp.data.MarcacaoEstabelecimento;
import siprp.database.cayenne.objects.Empresas;
import siprp.database.cayenne.objects.Estabelecimentos;
import siprp.database.cayenne.objects.HsRelatorio;
import siprp.database.cayenne.objects.HsRelatorioMedida;
import siprp.database.cayenne.objects.HsRelatorioRisco;
import siprp.database.cayenne.objects.MarcacoesEstabelecimento;
import siprp.database.cayenne.providers.MedicinaDAO;
import com.evolute.utils.tables.VectorTableModel;
import com.evolute.utils.ui.calendar.JCalendarPanel;
public class RelatorioWindow extends JFrame
{
private static final long serialVersionUID = 1L;
public static final String TITLE = "Relat" + oacute + "rios de Higiene e Seguran" + ccedil + "a no Trabalho";
public static final Dimension SIZE = new Dimension( 800, 600 );
private final JComboBox comboEmpresas = new JComboBox();
private final JComboBox comboEstabelecimentos = new JComboBox();
private final VectorTableModel<MarcacoesEstabelecimento> modelVisitas = new VectorTableModel<MarcacoesEstabelecimento>( new String[]{ "Data" } );
private final JTable tableVisitas = new JTable( modelVisitas );
private final JScrollPane scrollVisitas = new JScrollPane( tableVisitas );
private final JButton buttonCriarRelatorio = new JButton("Criar Relat"+oacute+"rio");
private final JPanel panelRelatorio = new JPanel();
private final JCalendarPanel dateRelatorio = new JCalendarPanel( this );
private final JPanel panelRiscos = new JPanel();
private final VectorTableModel<HsRelatorioRisco> modelRiscos = new VectorTableModel<HsRelatorioRisco>( new String[]{ "Riscos" } );
private final JTable tableRiscos = new JTable( modelRiscos );
private final JScrollPane scrollRiscos = new JScrollPane( tableRiscos );
private final JPanel panelRiscoValores = new JPanel();
private final JRadioButton radioValorQuantitativo = new JRadioButton();
private final JRadioButton radioValorQualitativo = new JRadioButton();
private final JTextField textSeveridade = new JTextField();
private final JTextField textProbabilidade = new JTextField();
private final JComboBox comboValorQualitativo = new JComboBox();
private final JCheckBox checkPlanoActuacao = new JCheckBox("Plano de actua" + ccedil + atilde + "o" );
private final JPanel panelMedidas = new JPanel();
private final VectorTableModel<HsRelatorioMedida> modelMedidas = new VectorTableModel<HsRelatorioMedida>( new String[]{ "Medidas" } );
private final JTable tableMedidas = new JTable( modelMedidas );
private final JScrollPane scrollMedidas = new JScrollPane( tableMedidas );
private final JTextArea textMedida = new JTextArea();
private final JTextArea textRequisitosLegais = new JTextArea();
private final JButton buttonMedidaAdd = new JButton("Adicionar");
private final JButton buttonMedidaRemove = new JButton("Remover");
private final JButton buttonSubmeterRelatorio = new JButton( "Submeter Plano de Actua" + ccedil + atilde + "o" );
public RelatorioWindow()
{
startupComponents();
startupLayout();
placeComponents();
setupListeners();
setTitle( TITLE );
setSize( SIZE );
loadEmpresas();
}
private void startupComponents()
{
scrollMedidas.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
scrollMedidas.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
scrollMedidas.setPreferredSize( new Dimension( 150, 0 ) );
scrollRiscos.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
scrollRiscos.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
scrollRiscos.setPreferredSize( new Dimension( 300, 0 ) );
scrollVisitas.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
scrollVisitas.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
scrollVisitas.setPreferredSize( new Dimension( 200, 0 ) );
panelRelatorio.setBorder( BorderFactory.createTitledBorder( "Relat" + oacute + "rio" ) );
panelRiscoValores.setBorder( BorderFactory.createTitledBorder( "Valores" ) );
panelRiscos.setBorder( BorderFactory.createEtchedBorder() );
panelMedidas.setBorder( BorderFactory.createEtchedBorder() );
dateRelatorio.setPreferredSize( new Dimension( 150, 0 ) );
textSeveridade.setPreferredSize( new Dimension( 30, 0 ) );
textProbabilidade.setPreferredSize( new Dimension( 30, 0 ) );
tableVisitas.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
tableRiscos.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
tableMedidas.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
ButtonGroup bg = new ButtonGroup();
bg.add( radioValorQualitativo );
bg.add( radioValorQuantitativo );
}
private void disableAndClearRelatorio( )
{
dateRelatorio.setEnabled( false );
dateRelatorio.clear();
tableMedidas.setEnabled( false );
tableRiscos.setEnabled( false );
radioValorQualitativo.setEnabled( false );
radioValorQualitativo.setSelected( false );
radioValorQuantitativo.setEnabled( false );
radioValorQuantitativo.setSelected( false );
textSeveridade.setEnabled( false );
textSeveridade.setText( "" );
textProbabilidade.setEnabled( false );
textProbabilidade.setText( "" );
comboValorQualitativo.setEnabled( false );
checkPlanoActuacao.setEnabled( false );
checkPlanoActuacao.setSelected( false );
textMedida.setEnabled( false );
textMedida.setText( "" );
textRequisitosLegais.setEnabled( false );
textRequisitosLegais.setText( "" );
buttonMedidaAdd.setEnabled( false );
buttonMedidaRemove.setEnabled( false );
buttonSubmeterRelatorio.setEnabled( false );
modelMedidas.clearAll();
modelRiscos.clearAll();
}
private void startupLayout()
{
TableLayout layout = new TableLayout(
new double[]{ TableLayout.PREFERRED, TableLayout.FILL },
new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM }
);
layout.setVGap( 5 );
layout.setHGap( 5 );
getContentPane().setLayout( layout );
layout = new TableLayout(
new double[]{ TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED },
new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.FILL }
);
layout.setVGap( 5 );
layout.setHGap( 5 );
panelRelatorio.setLayout( layout );
layout = new TableLayout(
new double[]{ TableLayout.PREFERRED, TableLayout.FILL },
new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }
);
layout.setVGap( 5 );
layout.setHGap( 5 );
panelRiscos.setLayout( layout );
layout = new TableLayout(
new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.PREFERRED },
new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM }
);
layout.setVGap( 5 );
layout.setHGap( 5 );
panelRiscoValores.setLayout( layout );
layout = new TableLayout(
new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL },
new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM }
);
layout.setVGap( 5 );
layout.setHGap( 5 );
panelMedidas.setLayout( layout );
}
private void placeComponents()
{
panelRiscoValores.add( radioValorQuantitativo, new TableLayoutConstraints( 0, 0 ) );
panelRiscoValores.add( new JLabel("Severidade"), new TableLayoutConstraints( 1, 0 ) );
panelRiscoValores.add( textSeveridade, new TableLayoutConstraints( 2, 0 ) );
panelRiscoValores.add( new JLabel("Probabilidade"), new TableLayoutConstraints( 3, 0 ) );
panelRiscoValores.add( textProbabilidade, new TableLayoutConstraints( 4, 0 ) );
panelRiscoValores.add( radioValorQualitativo, new TableLayoutConstraints( 0, 1 ) );
panelRiscoValores.add( comboValorQualitativo, new TableLayoutConstraints( 1, 1, 4, 1 ) );
panelRiscos.add( panelRiscoValores, new TableLayoutConstraints( 1, 0 ) );
panelRiscos.add( checkPlanoActuacao, new TableLayoutConstraints( 1, 1 ) );
panelRiscos.add( scrollRiscos, new TableLayoutConstraints( 0, 0, 0, 2 ) );
panelMedidas.add( scrollMedidas, new TableLayoutConstraints( 0, 0, 2, 3 ) );
panelMedidas.add( buttonMedidaAdd, new TableLayoutConstraints( 0, 4 ) );
panelMedidas.add( buttonMedidaRemove, new TableLayoutConstraints( 1, 4 ) );
panelMedidas.add( new JLabel("Medidas"), new TableLayoutConstraints( 3, 0 ) );
panelMedidas.add( textMedida, new TableLayoutConstraints( 3, 1 ) );
panelMedidas.add( new JLabel("Requisitos Legais"), new TableLayoutConstraints( 3, 2 ) );
panelMedidas.add( textRequisitosLegais, new TableLayoutConstraints( 3, 3 ) );
panelRelatorio.add( new JLabel("Data") , new TableLayoutConstraints( 0, 0 ) );
panelRelatorio.add( dateRelatorio , new TableLayoutConstraints( 0, 1 ) );
panelRelatorio.add( buttonSubmeterRelatorio, new TableLayoutConstraints( 2, 0, 2, 1 ) );
panelRelatorio.add( panelRiscos , new TableLayoutConstraints( 0, 2, 2, 2 ) );
panelRelatorio.add( panelMedidas , new TableLayoutConstraints( 0, 3, 2, 3 ) );
getContentPane().add( new JLabel("Empresa"), new TableLayoutConstraints( 0, 0, 1, 0 ) );
getContentPane().add( comboEmpresas, new TableLayoutConstraints( 0, 1, 1, 1 ) );
getContentPane().add( new JLabel("Estabelecimento"), new TableLayoutConstraints( 0, 2, 1, 2 ) );
getContentPane().add( comboEstabelecimentos, new TableLayoutConstraints( 0, 3, 1, 3 ) );
getContentPane().add( scrollVisitas, new TableLayoutConstraints( 0, 4 ) );
getContentPane().add( buttonCriarRelatorio, new TableLayoutConstraints( 0, 5 ) );
getContentPane().add( panelRelatorio, new TableLayoutConstraints( 1, 4, 1, 5 ) );
}
private void setupListeners()
{
comboEmpresas.addItemListener( new ItemListener()
{
@Override
public void itemStateChanged( ItemEvent e )
{
selectedEmpresa();
}
} );
comboEstabelecimentos.addItemListener( new ItemListener()
{
@Override
public void itemStateChanged( ItemEvent e )
{
selectedEstabelecimento();
}
} );
tableVisitas.getSelectionModel().addListSelectionListener( new ListSelectionListener()
{
@Override
public void valueChanged( ListSelectionEvent e )
{
if( e.getValueIsAdjusting() )
{
selectedVisita();
}
}
} );
buttonCriarRelatorio.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
criarRelatorio();
}
} );
}
private void criarRelatorio()
{
}
private void selectedEmpresa()
{
disableAndClearRelatorio( );
buttonCriarRelatorio.setEnabled( false );
tableVisitas.setEnabled( false );
modelVisitas.clearAll();
comboEstabelecimentos.removeAllItems();
Empresas empresa = (Empresas) comboEmpresas.getSelectedItem();
if( empresa != null )
{
for( Estabelecimentos estabelecimento : empresa.getEstabelecimentosArray() )
{
comboEstabelecimentos.addItem( estabelecimento );
}
comboEstabelecimentos.setEnabled( true );
}
else
{
comboEstabelecimentos.setEnabled( false );
}
}
private void selectedEstabelecimento()
{
disableAndClearRelatorio( );
modelVisitas.clearAll();
buttonCriarRelatorio.setEnabled( false );
Estabelecimentos estabelecimento = (Estabelecimentos) comboEstabelecimentos.getSelectedItem();
if( estabelecimento != null )
{
List<MarcacoesEstabelecimento> marcacoes = estabelecimento.getMarcacoesEstabelecimentoArray();
for( MarcacoesEstabelecimento marcacao : marcacoes )
{
if( !"y".equals( marcacao.getRealizada() ) )
{
marcacoes.remove( marcacao );
}
}
modelVisitas.setValues( new Vector<MarcacoesEstabelecimento>( marcacoes ) );
tableVisitas.setEnabled( true );
}
}
private MarcacoesEstabelecimento getSelectedVisita()
{
MarcacoesEstabelecimento result = null;
int row = tableVisitas.getSelectedRow();
if( row > -1 )
{
result = modelVisitas.getRowAt( row );
}
return result;
}
private void selectedVisita()
{
disableAndClearRelatorio( );
MarcacoesEstabelecimento visita = getSelectedVisita();
List<HsRelatorio> relatorios = visita.getHsRelatorioArray();
HsRelatorio relatorio = null;
for( HsRelatorio current : relatorios )
{
if( current.getDeletedDate() == null)
{
relatorio = current;
break;
}
}
if( relatorio == null )
{
buttonCriarRelatorio.setEnabled( true );
}
else
{
fillRelatorio( relatorio );
buttonCriarRelatorio.setEnabled( false );
}
}
private void fillRelatorio( HsRelatorio relatorio )
{
dateRelatorio.setDate( relatorio.getData() );
buttonSubmeterRelatorio.setEnabled( relatorio.getIsSubmetido() != null );
}
private void loadEmpresas()
{
comboEmpresas.removeAllItems();
for( Empresas empresa : new MedicinaDAO().getAllEmpresas() )
{
comboEmpresas.addItem( empresa );
}
}
public static void main( String[] args )
{
RelatorioWindow window = new RelatorioWindow();
window.setVisible( true );
window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
}

@ -0,0 +1,120 @@
package siprp.higiene.riscos;
import java.util.Date;
import javax.swing.tree.DefaultMutableTreeNode;
import leaf.ui.LeafLogic;
import siprp.database.cayenne.objects.BaseObject;
import siprp.database.cayenne.objects.HsMedida;
import siprp.database.cayenne.objects.HsRisco;
import siprp.database.cayenne.objects.HsRiscoMedida;
import siprp.database.cayenne.objects.HsRiscoTema;
import siprp.database.cayenne.providers.PlanoActuacaoDAO;
public class GestaoRiscosLogic extends LeafLogic
{
@Action(isSave = true)
public static final String ACTION_SAVE = "ACTION_SAVE";
@Action(isSave = true)
public static final String ACTION_REMOVE = "ACTION_SAVE";
@Action(isSave = false)
public static final String ACTION_LOAD = "ACTION_LOAD";
@Action(isSave = false)
public static final String ACTION_SELECTION = "ACTION_SELECTION";
@Action(isSave = true)
public static final String ACTION_TEMA_CRIAR = "ACTION_TEMA_CRIAR";
@Action(isSave = true)
public static final String ACTION_TEMA_REMOVER = "ACTION_TEMA_REMOVER";
@Action(isSave = true)
public static final String ACTION_RISCO_CRIAR = "ACTION_RISCO_CRIAR";
@Action(isSave = true)
public static final String ACTION_RISCO_REMOVER = "ACTION_RISCO_REMOVER";
@Action(isSave = true)
public static final String ACTION_MEDIDA_CRIAR = "ACTION_MEDIDA_CRIAR";
@Action(isSave = true)
public static final String ACTION_MEDIDA_REMOVER = "ACTION_MEDIDA_REMOVER";
@Action(isSave = false)
public static final String ACTION_CLEAR_SELECTION = "ACTION_CLEAR_SELECTION";
@Action(isSave = false)
public static final String ACTION_SELECT_TEMA = "ACTION_SELECT_TEMA";
@Action(isSave = false)
public static final String ACTION_SELECT_RISCO = "ACTION_SELECT_RISCO";
@Action(isSave = false)
public static final String ACTION_SELECT_MEDIDA = "ACTION_SELECT_MEDIDA";
public final PlanoActuacaoDAO provider = new PlanoActuacaoDAO();
@LeafLogicActionBinding(actions=ACTION_STARTUP)
public void load()
{
runAction( ACTION_LOAD, provider.getAllRiscoTemas() );
runActionLater( ACTION_REFRESH );
}
@LeafLogicActionBinding( actions = ACTION_TEMA_REMOVER )
public void removeTema( HsRiscoTema tema )
{
tema.setDeletedDate( new Date() );
provider.commit();
load();
}
@LeafLogicActionBinding( actions = ACTION_RISCO_REMOVER )
public void removeRisco( HsRisco risco )
{
risco.setDeletedDate( new Date() );
provider.commit();
load();
}
@LeafLogicActionBinding( actions = ACTION_MEDIDA_REMOVER )
public void removeMedida( HsRiscoMedida rel )
{
provider.deleteObject( rel );
load();
}
@LeafLogicActionBinding( actions = { ACTION_SAVE, ACTION_TEMA_CRIAR, ACTION_RISCO_CRIAR, ACTION_MEDIDA_CRIAR } )
public void saveObject( BaseObject object )
{
provider.saveObject( object );
load();
}
@LeafLogicActionBinding(actions=ACTION_SELECTION)
public void selectionChanged( DefaultMutableTreeNode object )
{
if( object == null )
{
runAction( ACTION_CLEAR_SELECTION );
}
else if( object instanceof NodeRiscoTema )
{
runAction( ACTION_SELECT_TEMA, object );
}
else if( object instanceof NodeRisco )
{
runAction( ACTION_SELECT_RISCO, object );
}
else if( object instanceof NodeMedida )
{
runAction( ACTION_SELECT_MEDIDA, object );
}
}
}

@ -0,0 +1,17 @@
package siprp.higiene.riscos;
import javax.swing.tree.DefaultMutableTreeNode;
import siprp.database.cayenne.objects.HsRiscoMedida;
public class NodeMedida extends DefaultMutableTreeNode
{
private static final long serialVersionUID = 1L;
public NodeMedida( HsRiscoMedida rel )
{
super( rel );
}
}

@ -0,0 +1,17 @@
package siprp.higiene.riscos;
import javax.swing.tree.DefaultMutableTreeNode;
import siprp.database.cayenne.objects.HsRisco;
public class NodeRisco extends DefaultMutableTreeNode
{
private static final long serialVersionUID = 1L;
public NodeRisco( HsRisco risco )
{
super( risco );
}
}

@ -0,0 +1,17 @@
package siprp.higiene.riscos;
import javax.swing.tree.DefaultMutableTreeNode;
import siprp.database.cayenne.objects.HsRiscoTema;
public class NodeRiscoTema extends DefaultMutableTreeNode
{
private static final long serialVersionUID = 1L;
public NodeRiscoTema( HsRiscoTema tema )
{
super( tema );
}
}

@ -33,7 +33,9 @@ public class UpdateList
new siprp.update.updates.V8_3_To_V8_4(), new siprp.update.updates.V8_4_To_V8_5(),
new siprp.update.updates.V8_5_To_V8_6(), new siprp.update.updates.V8_6_To_V8_7(),
new siprp.update.updates.V8_7_To_V8_8(), new siprp.update.updates.V8_8_To_V8_9(),
new siprp.update.updates.V8_9_To_V9_0(), new siprp.update.updates.V9_0To_V9_1() };
new siprp.update.updates.V8_9_To_V9_0(), new siprp.update.updates.V9_0_To_V9_1(),
new siprp.update.updates.V9_1_To_V9_2(), new siprp.update.updates.V9_2_To_V9_3(),
new siprp.update.updates.V9_3_To_V9_4() };
protected static Executer EXECUTER;
protected static double version = -1;

@ -17,11 +17,11 @@ import com.evolute.utils.db.Executer;
*
* @author fpalma
*/
public class V9_0To_V9_1
public class V9_0_To_V9_1
implements siprp.update.Update
{
public V9_0To_V9_1()
public V9_0_To_V9_1()
{
}
@ -35,7 +35,7 @@ public class V9_0To_V9_1
public double getStartVersion()
{
return 9.1;
return 9.0;
}
public double getEndVersion()

@ -0,0 +1,71 @@
/*
* V8_1_To_V8_2.java
*
* Created on December 19, 2007, 3:12 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.update.updates;
import com.evolute.utils.Singleton;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
/**
*
* @author fpalma
*/
public class V9_1_To_V9_2
implements siprp.update.Update
{
public V9_1_To_V9_2()
{
}
public String []listChanges()
{
return new String[]{
"Soft-delete nas tabelas de higiene e saude"
};
}
public double getStartVersion()
{
return 9.1;
}
public double getEndVersion()
{
return 9.2;
}
public void doUpdate()
throws Exception
{
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
Executer executer = dbm.getSharedExecuter();
com.evolute.utils.sql.Update update =
new com.evolute.utils.sql.Update(
"alter table hs_area add column deleted_date timestamp;" +
"alter table hs_equipamento_medicao add column deleted_date timestamp;" +
"alter table hs_legislacao add column deleted_date timestamp;" +
"alter table hs_legislacao_categoria add column deleted_date timestamp;" +
"alter table hs_medida add column deleted_date timestamp;" +
"alter table hs_normalizacao add column deleted_date timestamp;" +
"alter table hs_posto add column deleted_date timestamp;" +
"alter table hs_relatorio_medida add column deleted_date timestamp;" +
"alter table hs_relatorio_risco add column deleted_date timestamp;" +
"alter table hs_risco add column deleted_date timestamp;" +
"alter table hs_risco_tema add column deleted_date timestamp;"
);
executer.executeQuery( update );
}
public String toString()
{
return "v" + getStartVersion() + " para v" + getEndVersion();
}
}

@ -0,0 +1,75 @@
/*
* V8_1_To_V8_2.java
*
* Created on December 19, 2007, 3:12 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.update.updates;
import com.evolute.utils.Singleton;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
/**
*
* @author fpalma
*/
public class V9_2_To_V9_3
implements siprp.update.Update
{
public V9_2_To_V9_3()
{
}
public String []listChanges()
{
return new String[]{
"Adicionados campos ao relatorio"
};
}
public double getStartVersion()
{
return 9.2;
}
public double getEndVersion()
{
return 9.3;
}
public void doUpdate()
throws Exception
{
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
Executer executer = dbm.getSharedExecuter();
com.evolute.utils.sql.Update update =
new com.evolute.utils.sql.Update(
"alter table hs_relatorio_medida drop column severidade;" +
"alter table hs_relatorio_medida drop column probabilidade;" +
"alter table hs_relatorio_medida drop column classificacao_id;" +
"drop table hs_medida_classificacao;" +
"alter table hs_relatorio add column marcacao_id int4 REFERENCES marcacoes_estabelecimento;" +
"alter table hs_relatorio add column is_submetido timestamp;" +
"alter table hs_relatorio_risco add column probabilidade int4;" +
"alter table hs_relatorio_risco add column severidade int4;" +
"create table hs_relatorio_risco_valor_qualitativo" +
"(" +
" id serial PRIMARY KEY," +
" description varchar(64)" +
");" +
"alter table hs_relatorio_risco add column valor_qualitativo_id int4 REFERENCES hs_relatorio_risco_valor_qualitativo;" +
"alter table hs_relatorio_risco add column is_plano_actuacao char(1);"
);
executer.executeQuery( update );
}
public String toString()
{
return "v" + getStartVersion() + " para v" + getEndVersion();
}
}

@ -0,0 +1,71 @@
/*
* V8_1_To_V8_2.java
*
* Created on December 19, 2007, 3:12 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.update.updates;
import com.evolute.utils.Singleton;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
/**
*
* @author fpalma
*/
public class V9_3_To_V9_4
implements siprp.update.Update
{
public V9_3_To_V9_4()
{
}
public String []listChanges()
{
return new String[]{
"Adicionados postos de trabalho relatorio"
};
}
public double getStartVersion()
{
return 9.3;
}
public double getEndVersion()
{
return 9.4;
}
public void doUpdate()
throws Exception
{
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
Executer executer = dbm.getSharedExecuter();
com.evolute.utils.sql.Update update =
new com.evolute.utils.sql.Update(
"create table hs_relatorio_medida_area" +
"(" +
" id serial PRIMARY KEY," +
" description varchar(256) NOT NULL" +
");" +
"create table hs_relatorio_medida_posto" +
"(" +
" id serial PRIMARY KEY," +
" description varchar(256) NOT NULL," +
" area_id int4 REFERENCES hs_relatorio_medida_area(id)" +
");"
);
executer.executeQuery( update );
}
public String toString()
{
return "v" + getStartVersion() + " para v" + getEndVersion();
}
}

@ -1,7 +1,9 @@
<project name="SIPRP" basedir="." default="list">
<!-- COMMON PROPERTIES -->
<property name="common.lib.dir" value="${basedir}/lib.common" />
<property name="common.dir" value="${basedir}/common" />
<property name="common.src.dir" value="${common.dir}/src" />
<property name="common.lib.dir" value="${common.dir}/lib" />
<property name="common.lib.tools.dir" value="${basedir}/lib.tools" />
<!-- TOMCAT MANAGER PROPERTIES -->
@ -9,10 +11,6 @@
<property name="username" value="tomcat" />
<property name="password" value="tomcat" />
<!-- COMMON PROPERTIES -->
<property name="common.dir" value="${basedir}/common" />
<property name="common.src.dir" value="${common.dir}/src" />
<!-- APP PROPERTIES -->
<property name="app.name" value="SIPRP" />
<property name="app.dir" value="${basedir}/SIPRPSoft" />

Loading…
Cancel
Save