Actualizado esquema de base de dados

Corrigidos erros de implementacao

git-svn-id: https://svn.coded.pt/svn/SIPRP@685 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
Tiago Simão 18 years ago
parent dfd78af525
commit 50b194db4f

@ -406,6 +406,8 @@
</db-entity> </db-entity>
<db-entity name="trabalhadores_ecd" schema="public"> <db-entity name="trabalhadores_ecd" schema="public">
<db-attribute name="analisador_id" type="INTEGER" length="10"/> <db-attribute name="analisador_id" type="INTEGER" length="10"/>
<db-attribute name="data_envio" type="DATE" length="13"/>
<db-attribute name="data_recepcao" type="DATE" length="13"/>
<db-attribute name="ecd_id" type="INTEGER" length="10"/> <db-attribute name="ecd_id" type="INTEGER" length="10"/>
<db-attribute name="ecd_oficial_id" type="INTEGER" length="10"/> <db-attribute name="ecd_oficial_id" type="INTEGER" length="10"/>
<db-attribute name="enviado" type="CHAR" length="1"/> <db-attribute name="enviado" type="CHAR" length="1"/>
@ -777,6 +779,8 @@
<obj-attribute name="observacao" type="java.lang.String" db-attribute-path="observacao"/> <obj-attribute name="observacao" type="java.lang.String" db-attribute-path="observacao"/>
</obj-entity> </obj-entity>
<obj-entity name="TrabalhadoresEcd" className="siprp.database.cayenne.objects.TrabalhadoresEcd" lock-type="optimistic" dbEntityName="trabalhadores_ecd" superClassName="siprp.database.cayenne.objects.BaseObject"> <obj-entity name="TrabalhadoresEcd" className="siprp.database.cayenne.objects.TrabalhadoresEcd" lock-type="optimistic" dbEntityName="trabalhadores_ecd" superClassName="siprp.database.cayenne.objects.BaseObject">
<obj-attribute name="dataEnvio" type="java.util.Date" db-attribute-path="data_envio"/>
<obj-attribute name="dataRecepcao" type="java.util.Date" db-attribute-path="data_recepcao"/>
<obj-attribute name="enviado" type="java.lang.Character" db-attribute-path="enviado"/> <obj-attribute name="enviado" type="java.lang.Character" db-attribute-path="enviado"/>
<obj-attribute name="estado" type="java.lang.Integer" db-attribute-path="estado"/> <obj-attribute name="estado" type="java.lang.Integer" db-attribute-path="estado"/>
</obj-entity> </obj-entity>

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

@ -34,7 +34,6 @@ import javax.swing.SwingUtilities;
public class LeafInputField<ObjClass extends Object> extends JPanel implements FocusListener, MouseListener, PropertyChangeListener public class LeafInputField<ObjClass extends Object> extends JPanel implements FocusListener, MouseListener, PropertyChangeListener
{ {
private static final Dimension SIZE = new Dimension( 0, 20 );
public static final String PROPERTY_CHANGED_CONSTANT = "LEAF_INPUT_PROPERTY_CHANGED"; public static final String PROPERTY_CHANGED_CONSTANT = "LEAF_INPUT_PROPERTY_CHANGED";
public static final String PROPERTY_CHANGED_CLICK = "LEAF_PROPERTY_CHANGED_CLICK"; public static final String PROPERTY_CHANGED_CLICK = "LEAF_PROPERTY_CHANGED_CLICK";
@ -46,6 +45,8 @@ public class LeafInputField<ObjClass extends Object> extends JPanel implements F
private int colorDec = defaultColorDec; private int colorDec = defaultColorDec;
public Dimension size = null;
private Color hot = null; private Color hot = null;
private Color cold = null; private Color cold = null;
private Color background = null; private Color background = null;
@ -544,6 +545,7 @@ public class LeafInputField<ObjClass extends Object> extends JPanel implements F
repaint(); repaint();
} }
} ); } );
size = thiz.getPreferredSize();
thiz.setOpaque( false ); thiz.setOpaque( false );
} }
} }

@ -23,13 +23,15 @@ import javax.swing.JScrollPane;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import com.evolute.utils.tables.models.SortableModel;
public class LeafOptionDialog<KeyClass extends Object> extends JDialog public class LeafOptionDialog<KeyClass extends Object> extends JDialog
{ {
private static final Dimension OPTION_SIZE = new Dimension( 200, 20 ); private Dimension OPTION_SIZE = new Dimension( 200, 20 );
private static final Dimension BUTTON_SIZE = new Dimension( 200, 20 ); private Dimension BUTTON_SIZE = new Dimension( 200, 20 );
private static final int MAX_VISIBLE_OPTIONS = 5; private int MAX_VISIBLE_OPTIONS = 20;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -157,11 +159,13 @@ public class LeafOptionDialog<KeyClass extends Object> extends JDialog
} }
((JComponent) getContentPane()).setBorder( BorderFactory.createRaisedBevelBorder() ); ((JComponent) getContentPane()).setBorder( BorderFactory.createRaisedBevelBorder() );
setSize( layout.preferredLayoutSize( this.getContentPane() ) ); setSize( layout.preferredLayoutSize( this.getContentPane() ) );
// setSize( optionsScrollPane.getPreferredSize().width, getSize().height );
setLocationRelativeTo( getParent() ); setLocationRelativeTo( getParent() );
} }
private void setupOptionsComponents( Iterator<KeyClass> iterator, Integer size ) private void setupOptionsComponents( Iterator<KeyClass> iterator, Integer size )
{ {
int maxWidth = OPTION_SIZE.width;
double[] cols = new double[] { double[] cols = new double[] {
TableLayout.PREFERRED TableLayout.PREFERRED
}; };
@ -196,7 +200,10 @@ public class LeafOptionDialog<KeyClass extends Object> extends JDialog
Boolean isEnabled = mapEnabledForKey.get( current ); Boolean isEnabled = mapEnabledForKey.get( current );
component.setClickable( isEnabled == null || isEnabled ); component.setClickable( isEnabled == null || isEnabled );
component.setPreferredSize( OPTION_SIZE ); if(component.size != null && component.size.width > maxWidth )
{
maxWidth = component.size.width;
}
optionsPanel.add( component, new TableLayoutConstraints( 0, i ) ); optionsPanel.add( component, new TableLayoutConstraints( 0, i ) );
addListenerToComponent( component ); addListenerToComponent( component );
} }
@ -207,7 +214,7 @@ public class LeafOptionDialog<KeyClass extends Object> extends JDialog
verticalScrollBar.setUnitIncrement( (int) OPTION_SIZE.getHeight() + 3 ); verticalScrollBar.setUnitIncrement( (int) OPTION_SIZE.getHeight() + 3 );
optionsScrollPane.setVerticalScrollBar( verticalScrollBar ); optionsScrollPane.setVerticalScrollBar( verticalScrollBar );
optionsScrollPane.setVerticalScrollBarPolicy( size > MAX_VISIBLE_OPTIONS ? ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS : ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER ); optionsScrollPane.setVerticalScrollBarPolicy( size > MAX_VISIBLE_OPTIONS ? ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS : ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER );
optionsScrollPane.setPreferredSize( new Dimension((int) OPTION_SIZE.getWidth() + 10 , size > MAX_VISIBLE_OPTIONS ? (MAX_VISIBLE_OPTIONS * ((int) (OPTION_SIZE.getHeight() + 3 )) ) : (size * ((int) (OPTION_SIZE.getHeight() + 3 )) ) )); optionsScrollPane.setPreferredSize( new Dimension( maxWidth + 30 , size > MAX_VISIBLE_OPTIONS ? (MAX_VISIBLE_OPTIONS * ((int) (OPTION_SIZE.getHeight() + 3 )) ) : (size * ((int) (OPTION_SIZE.getHeight() + 3 )) ) ));
} }
private KeyClass getKeyForValue( Object value ) private KeyClass getKeyForValue( Object value )

@ -8,6 +8,7 @@ import siprp.database.cayenne.objects.TrabalhadoresEcd;
import com.evolute.utils.tables.BaseTableModel; import com.evolute.utils.tables.BaseTableModel;
import com.evolute.utils.tables.models.SortableModel;
public class LeafTableModel extends BaseTableModel public class LeafTableModel extends BaseTableModel
{ {
@ -77,6 +78,15 @@ public class LeafTableModel extends BaseTableModel
fireTableDataChanged(); fireTableDataChanged();
} }
public void order(int ... colNumber )
{
if(colNumber != null)
{
map.order(colNumber);
fireTableDataChanged();
}
}
@Override @Override
public void appendEmptyRow() public void appendEmptyRow()
{ {

@ -69,7 +69,7 @@ public class OrderedMap<KeyClass extends Object> implements Iterable<KeyClass>
} }
/** /**
* returns the length of the biggest column * returns the length of the biggest line
* *
* @return * @return
*/ */
@ -135,6 +135,7 @@ public class OrderedMap<KeyClass extends Object> implements Iterable<KeyClass>
/** /**
* Adds arguments to the end of the row (on given order) * Adds arguments to the end of the row (on given order)
*
* @param key * @param key
* @param values * @param values
*/ */
@ -151,6 +152,7 @@ public class OrderedMap<KeyClass extends Object> implements Iterable<KeyClass>
/** /**
* Adds argument to the end of the row * Adds argument to the end of the row
*
* @param key * @param key
* @param value * @param value
*/ */
@ -181,30 +183,92 @@ public class OrderedMap<KeyClass extends Object> implements Iterable<KeyClass>
*/ */
public void order() public void order()
{ {
order( 0 );
}
public void order( int columnNumber )
{
order( new int[] {
columnNumber
}, 0, 0, order.size() - 1, order );
}
public void order( int[] colNumbers )
{
order( colNumbers, 0, 0, order.size() - 1, order );
}
private void order( int[] colNumbers, int currentColumnIndex, int fromLineNumber, int toLineNumber, List<KeyClass> order )
{
if( colNumbers != null && currentColumnIndex >= 0 && fromLineNumber < toLineNumber && toLineNumber < order.size() && currentColumnIndex < colNumbers.length )
{
int columnNumber = colNumbers[currentColumnIndex];
if( order != null && order.size() > 0 ) if( order != null && order.size() > 0 )
{ {
HashMap<Object, KeyClass> keyForObject = new HashMap<Object, KeyClass>(); List<Pair<String, KeyClass>> sortedList = new ArrayList<Pair<String, KeyClass>>();
List<String> sortedList = new ArrayList<String>(); for( int i = fromLineNumber; i < order.size() && i < (toLineNumber + 1); ++i )
for( KeyClass key : order )
{ {
KeyClass key = order.get( i );
List<Object> row = map.get( key ); List<Object> row = map.get( key );
Object value = null; String value = "";
if( row != null && row.size() > 0 ) if( row != null && row.size() > columnNumber && row.get( columnNumber ) != null )
{ {
value = row.get( 0 ); value = row.get( columnNumber ).toString();
keyForObject.put( value.toString(), key );
sortedList.add( value.toString() );
} }
sortedList.add( new Pair<String, KeyClass>( value, key ) );
} }
if( sortedList.size() == order.size() )
{
Collections.sort( sortedList ); Collections.sort( sortedList );
Vector<KeyClass> newOrder = new Vector<KeyClass>(); List<Pair<String, KeyClass>> equalEntries = new ArrayList<Pair<String, KeyClass>>();
for( String value : sortedList ) for( int i = 0; i < sortedList.size(); ++i )
{
Pair<String, KeyClass> entry = sortedList.get( i );
if( equalEntries.isEmpty() && i < (sortedList.size() - 1) )
{
equalEntries.add( entry );
}
else
{
Pair<String, KeyClass> previousEntry = equalEntries.get( 0 );
if( previousEntry.getCar().equals( entry.getCar() ) )
{
if( i < (sortedList.size() - 1) )
{
equalEntries.add( entry );
continue;
}
else
{
equalEntries.add( entry );
++i;
}
}
if( equalEntries.size() > 1 )
{
List<KeyClass> toSubOrder = new Vector<KeyClass>();
List<String> DEBUGLIST = new Vector<String>();
for( Pair<String, KeyClass> pair : equalEntries )
{
toSubOrder.add( pair.getCdr() );
DEBUGLIST.add( pair.getCar() );
}
order( colNumbers, currentColumnIndex + 1, 0, toSubOrder.size() - 1, toSubOrder );
for( int j = 0; j < toSubOrder.size(); ++j )
{
sortedList.set( i - toSubOrder.size() + j, new Pair<String, KeyClass>( "", toSubOrder.get( j ) ) );
}
}
equalEntries.clear();
if( i < (sortedList.size() - 1) )
{
equalEntries.add( entry );
}
}
}
for( int i = 0; i < sortedList.size(); ++i )
{ {
newOrder.add( keyForObject.get( value ) ); Pair<String, KeyClass> value = sortedList.get( i );
order.set( i, value.getCdr() );
} }
order = newOrder;
} }
} }
} }

@ -0,0 +1,48 @@
package leaf;
public class Pair<CarClass extends Comparable<CarClass>, CdrClass> implements Comparable<Pair<CarClass, CdrClass>>
{
private final CarClass car;
private final CdrClass cdr;
public Pair(CarClass car, CdrClass cdr)
{
this.car = car;
this.cdr = cdr;
}
public CarClass getCar()
{
return car;
}
public CdrClass getCdr()
{
return cdr;
}
@Override
public int compareTo( Pair<CarClass, CdrClass> toPair )
{
if(toPair == null)
{
return 1;
}
else if(car == null && toPair.getCar() == null)
{
return 0;
}
else
{
return getCar().compareTo( toPair.getCar() );
}
}
@Override
public String toString()
{
return "(" + (car == null ? "" : car.toString()) + ", "+ (cdr == null ? "" : cdr.toString()) + ")";
}
}

@ -7,6 +7,8 @@ package siprp.database.cayenne.objects.auto;
*/ */
public abstract class _TrabalhadoresEcd extends siprp.database.cayenne.objects.BaseObject { public abstract class _TrabalhadoresEcd extends siprp.database.cayenne.objects.BaseObject {
public static final String DATA_ENVIO_PROPERTY = "dataEnvio";
public static final String DATA_RECEPCAO_PROPERTY = "dataRecepcao";
public static final String ENVIADO_PROPERTY = "enviado"; public static final String ENVIADO_PROPERTY = "enviado";
public static final String ESTADO_PROPERTY = "estado"; public static final String ESTADO_PROPERTY = "estado";
public static final String TO_ANALISADOR_PROPERTY = "toAnalisador"; public static final String TO_ANALISADOR_PROPERTY = "toAnalisador";
@ -16,6 +18,22 @@ public abstract class _TrabalhadoresEcd extends siprp.database.cayenne.objects.B
public static final String ID_PK_COLUMN = "id"; public static final String ID_PK_COLUMN = "id";
public void setDataEnvio(java.util.Date dataEnvio) {
writeProperty("dataEnvio", dataEnvio);
}
public java.util.Date getDataEnvio() {
return (java.util.Date)readProperty("dataEnvio");
}
public void setDataRecepcao(java.util.Date dataRecepcao) {
writeProperty("dataRecepcao", dataRecepcao);
}
public java.util.Date getDataRecepcao() {
return (java.util.Date)readProperty("dataRecepcao");
}
public void setEnviado(Character enviado) { public void setEnviado(Character enviado) {
writeProperty("enviado", enviado); writeProperty("enviado", enviado);
} }

@ -91,17 +91,14 @@ public class MedicinaDAO extends MainDAO implements MedicinaConstants
public Collection<TrabalhadoresEcd> getPendingExamesForAnalisador( Prestadores currentAnalisador ) public Collection<TrabalhadoresEcd> getPendingExamesForAnalisador( Prestadores currentAnalisador )
{ {
Map<TrabalhadoresEcd, TrabalhadoresEcd> resultMap = new HashMap<TrabalhadoresEcd, TrabalhadoresEcd>(); Map<TrabalhadoresEcd, TrabalhadoresEcd> resultMap = new HashMap<TrabalhadoresEcd, TrabalhadoresEcd>();
SelectQuery query = new SelectQuery( TrabalhadoresEcdsDatas.class, /*ExpressionFactory.noMatchExp( TrabalhadoresEcdsDatas.DATA_ENVIO_PROPERTY, null ).andExp(*/ ExpressionFactory.matchExp(TrabalhadoresEcdsDatas.DATA_RECEPCAO_PROPERTY, null )/*)*/); SelectQuery query = new SelectQuery( TrabalhadoresEcd.class, ExpressionFactory.matchExp(TrabalhadoresEcd.DATA_RECEPCAO_PROPERTY, null ));
List<TrabalhadoresEcdsDatas> all = context.performQuery( query ); List<TrabalhadoresEcd> all = context.performQuery( query );
for( TrabalhadoresEcdsDatas data : all ) for( TrabalhadoresEcd ecd : all )
{ {
TrabalhadoresEcdsDatas data = ecd.getToTrabalhadoresEcdsDatas();
if(new Integer(MedicinaConstants.ESTADO_REALIZADO).equals( data.getEstado())) if(new Integer(MedicinaConstants.ESTADO_REALIZADO).equals( data.getEstado()))
{ {
List<TrabalhadoresEcd> ecds = data.getTrabalhadoresEcdArray();
if( ecds != null )
{
for(TrabalhadoresEcd ecd : ecds)
{
if(currentAnalisador.equals( ecd.getToAnalisador() )) if(currentAnalisador.equals( ecd.getToAnalisador() ))
{ {
resultMap.put( ecd ,ecd ); resultMap.put( ecd ,ecd );
@ -111,8 +108,6 @@ public class MedicinaDAO extends MainDAO implements MedicinaConstants
} }
} }
} }
}
}
return resultMap.values(); return resultMap.values();
} }

@ -257,6 +257,7 @@ public class TrabalhadorPanel extends JPanel
components.putDummy( TrabalhadorData.PERFIL ); components.putDummy( TrabalhadorData.PERFIL );
components.putDummy( TrabalhadorData.ESTABELECIMENTO ); components.putDummy( TrabalhadorData.ESTABELECIMENTO );
components.putDummy( TrabalhadorData.NOME_PLAIN ); components.putDummy( TrabalhadorData.NOME_PLAIN );
components.putDummy( TrabalhadorData.BI );
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NOME, nomeText ); // components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NOME, nomeText );
// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_NASCIMENTO, dataNascimentoPanel ); // components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_NASCIMENTO, dataNascimentoPanel );
@ -319,6 +320,9 @@ public class TrabalhadorPanel extends JPanel
{ {
trabalhador = ( TrabalhadorData ) JDO.load( TrabalhadorData.class, trabalhadorID ); trabalhador = ( TrabalhadorData ) JDO.load( TrabalhadorData.class, trabalhadorID );
String names[] = trabalhador.getFieldNames(); String names[] = trabalhador.getFieldNames();
System.out.println(names.length);
System.out.println(trabalhador.getHashData().size());
System.out.println(components.size());
ComponentController.fill( names, trabalhador.getHashData(), components ); ComponentController.fill( names, trabalhador.getHashData(), components );
// trabalhador = provider.load( FichaDataProvider.TRABALHADORES, new DBKey( trabalhadorID ) ); // trabalhador = provider.load( FichaDataProvider.TRABALHADORES, new DBKey( trabalhadorID ) );
// DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields(); // DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields();

@ -149,6 +149,7 @@ public class RecepcaoExamesWindow extends LeafWindow
} }
orderedMap.putLast( current, empresa, estabelecimento, trabalhador, current); orderedMap.putLast( current, empresa, estabelecimento, trabalhador, current);
} }
orderedMap.order( new int[]{ 0, 1, 2 } );
examesModel.setValues( orderedMap ); examesModel.setValues( orderedMap );
} }
} }
@ -168,12 +169,12 @@ public class RecepcaoExamesWindow extends LeafWindow
{ {
for( int i = 0; i < selectedRows.length; ++i) for( int i = 0; i < selectedRows.length; ++i)
{ {
Object ecd = examesModel.getKey( i ); Object ecd = examesModel.getKey( selectedRows[i] );
if(ecd != null) if(ecd != null)
{ {
if( ecd instanceof TrabalhadoresEcd) if( ecd instanceof TrabalhadoresEcd)
{ {
((TrabalhadoresEcd) ecd ).getToTrabalhadoresEcdsDatas().setDataRecepcao( fieldData.getObject() ); ((TrabalhadoresEcd) ecd ).setDataRecepcao( fieldData.getObject() );
result.add( (TrabalhadoresEcd) ecd ); result.add( (TrabalhadoresEcd) ecd );
} }
} }

@ -99,7 +99,7 @@ public class ProcessoAccoesPanel extends JPanel
public final LeafButton buttonFecharProcesso = new LeafButton( "Fechar Processo" ); public final LeafButton buttonFecharProcesso = new LeafButton( "Fechar Processo" );
@ActionActivation(onSelect = CREATE_FICHA, onChange = "") @ActionActivation(onSelect = CREATE_FICHA, onChange = "")
public final LeafButton buttonCriarFicha = new LeafButton( "Editar Ficha" ); public final LeafButton buttonCriarFicha = new LeafButton( "Ficha de Aptid"+atilde+"o" );
@ActionActivation(onSelect = { @ActionActivation(onSelect = {
CREATE_CONSULTA, CREATE_CONSULTA_MARCACAO CREATE_CONSULTA, CREATE_CONSULTA_MARCACAO

@ -571,7 +571,7 @@ public class ProcessoDadosPanel extends JPanel
TrabalhadoresConsultas consulta = consultaMarcacao.getToTrabalhadoresConsultas(); TrabalhadoresConsultas consulta = consultaMarcacao.getToTrabalhadoresConsultas();
if( consulta != null ) if( consulta != null )
{ {
String[] subjectAndBody = sendMail(consulta.getToTrabalhadores(), consultaMarcacao.getData(), SingletonConstants.LETTER_CONSULTA ); String[] subjectAndBody = sendMail(consulta.getToTrabalhadores(), consultaMarcacao.getDataString(), SingletonConstants.LETTER_CONSULTA, SingletonConstants.SUBJECT_CONSULTA );
if( subjectAndBody != null ) if( subjectAndBody != null )
{ {
email.setSubject( subjectAndBody[0] ); email.setSubject( subjectAndBody[0] );
@ -586,7 +586,7 @@ public class ProcessoDadosPanel extends JPanel
} }
} }
private String[] sendMail(Trabalhadores trabalhador, Date dataConsulta, String letter ) private String[] sendMail(Trabalhadores trabalhador, String data, String letterName, String subjectName )
{ {
String [] result = null; String [] result = null;
if( trabalhador != null ) if( trabalhador != null )
@ -599,25 +599,21 @@ public class ProcessoDadosPanel extends JPanel
String subject = ""; String subject = "";
String body = ""; String body = "";
subject = ( String ) Singleton.getInstance( subject );
String sedeNome = estabelecimento.getNome();
subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_VISITA );
if( subject == null) if( subject == null)
{ {
subject = ""; subject = "";
} }
subject = subject.replaceAll( CompanyDataLoader.NOME, sedeNome ); subject = subject.replaceAll( CompanyDataLoader.NOME, estabelecimento.getNome() );
String morada = estabelecimento.getMorada(); body = ( String ) Singleton.getInstance( letterName );
String data = DateFormat.getDateInstance( DateFormat.SHORT ).format( dataConsulta );
body = ( String ) Singleton.getInstance( letter );
if( body == null) if( body == null)
{ {
body = ""; body = "";
} }
body = body.replaceAll( CompanyDataLoader.DATA, data ); body = body.replaceAll( CompanyDataLoader.DATA, data );
body = body.replaceAll( CompanyDataLoader.NOME, sedeNome ); body = body.replaceAll( CompanyDataLoader.NOME, trabalhador.getNome() );
body = body.replaceAll( CompanyDataLoader.MORADA, morada ); // body = body.replaceAll( CompanyDataLoader.MORADA, morada );
body = body.replaceAll( "%0A", "<br>" ); body = body.replaceAll( "%0A", "<br>" );
Contactos estabelecimentoContacto = estabelecimento.getToContactos(); Contactos estabelecimentoContacto = estabelecimento.getToContactos();
@ -702,7 +698,7 @@ public class ProcessoDadosPanel extends JPanel
TrabalhadoresEcds exame = exameMarcacao.getToTrabalhadoresEcds(); TrabalhadoresEcds exame = exameMarcacao.getToTrabalhadoresEcds();
if( exame != null ) if( exame != null )
{ {
String[] subjectAndBody = sendMail(exame.getToTrabalhadores(), exameMarcacao.getData(), SingletonConstants.LETTER_EXAMES ); String[] subjectAndBody = sendMail(exame.getToTrabalhadores(), exameMarcacao.getDataString(), SingletonConstants.LETTER_EXAMES, SingletonConstants.SUBJECT_EXAMES );
if( subjectAndBody != null ) if( subjectAndBody != null )
{ {
email.setSubject( subjectAndBody[0] ); email.setSubject( subjectAndBody[0] );

@ -301,9 +301,31 @@ public class ProcessoTreePanel extends JPanel
addNodeTo( loadExame( current ), node ); addNodeTo( loadExame( current ), node );
} }
List<TrabalhadoresFichasAptidao> fichas = processo.getTrabalhadoresFichasAptidaoArray();
if( fichas != null )
{
TrabalhadoresFichasAptidao ficha = null;
for( TrabalhadoresFichasAptidao currentFicha : fichas )
{
if( ficha == null && ficha.getId() < currentFicha.getId() )
{
ficha = currentFicha;
}
}
if( ficha != null )
{
// addNodeTo( loadFicha( ficha ), node);
}
}
return node; return node;
} }
private FichaAptidaoMutableTreeNode loadFicha(TrabalhadoresFichasAptidao ficha)
{
return null;
}
private ECDsMutableTreeNode loadExame( TrabalhadoresEcds exame ) private ECDsMutableTreeNode loadExame( TrabalhadoresEcds exame )
{ {
ECDsMutableTreeNode node = new ECDsMutableTreeNode( exame ); ECDsMutableTreeNode node = new ECDsMutableTreeNode( exame );

@ -31,7 +31,7 @@ public class UpdateList
new siprp.update.updates.V7_9_To_V8_0(), new siprp.update.updates.V8_0_To_V8_1(), new siprp.update.updates.V7_9_To_V8_0(), new siprp.update.updates.V8_0_To_V8_1(),
new siprp.update.updates.V8_1_To_V8_2(), new siprp.update.updates.V8_2_To_V8_3(), new siprp.update.updates.V8_1_To_V8_2(), new siprp.update.updates.V8_2_To_V8_3(),
new siprp.update.updates.V8_3_To_V8_4(), new siprp.update.updates.V8_4_To_V8_5(), 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_5_To_V8_6(), new siprp.update.updates.V8_6_To_V8_7() };
protected static Executer EXECUTER; protected static Executer EXECUTER;
protected static double version = -1; protected static double version = -1;

@ -0,0 +1,66 @@
/*
* 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;
import com.evolute.utils.sql.Delete;
/**
*
* @author fpalma
*/
public class V8_6_To_V8_7
implements siprp.update.Update
{
/**
* Creates a new instance of V8_6_To_V8_7
*/
public V8_6_To_V8_7()
{
}
public String []listChanges()
{
return new String[]{ "Adicionados campos data_envio e data_recepcao a cada instancia de ECD" };
}
public double getStartVersion()
{
return 8.6;
}
public double getEndVersion()
{
return 8.7;
}
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 trabalhadores_ecd ADD data_envio DATE;" );
executer.executeQuery( update );
update =
new com.evolute.utils.sql.Update(
"ALTER TABLE trabalhadores_ecd ADD data_recepcao DATE;" );
executer.executeQuery( update );
}
public String toString()
{
return "v" + getStartVersion() + " para v" + getEndVersion();
}
}
Loading…
Cancel
Save