From 50b194db4f7e71f41adcaa1213c73c8b39ac1c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Sim=C3=A3o?= Date: Wed, 5 Mar 2008 15:32:19 +0000 Subject: [PATCH] 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 --- trunk/SIPRPSoft/src/SIPRPMap.map.xml | 4 + trunk/SIPRPSoft/src/SIPRPNode.driver.xml | 2 +- trunk/SIPRPSoft/src/leaf/LeafInputField.java | 4 +- .../SIPRPSoft/src/leaf/LeafOptionDialog.java | 17 ++- trunk/SIPRPSoft/src/leaf/LeafTableModel.java | 12 +- trunk/SIPRPSoft/src/leaf/OrderedMap.java | 118 ++++++++++++++---- trunk/SIPRPSoft/src/leaf/Pair.java | 48 +++++++ .../objects/auto/_TrabalhadoresEcd.java | 18 +++ .../cayenne/providers/MedicinaDAO.java | 17 +-- .../src/siprp/ficha/TrabalhadorPanel.java | 4 + .../exames/ui/RecepcaoExamesWindow.java | 5 +- .../processo/ui/ProcessoAccoesPanel.java | 2 +- .../processo/ui/ProcessoDadosPanel.java | 20 ++- .../processo/ui/ProcessoTreePanel.java | 22 ++++ .../src/siprp/update/UpdateList.java | 2 +- .../siprp/update/updates/V8_6_To_V8_7.java | 66 ++++++++++ 16 files changed, 299 insertions(+), 62 deletions(-) create mode 100644 trunk/SIPRPSoft/src/leaf/Pair.java create mode 100644 trunk/SIPRPSoft/src/siprp/update/updates/V8_6_To_V8_7.java diff --git a/trunk/SIPRPSoft/src/SIPRPMap.map.xml b/trunk/SIPRPSoft/src/SIPRPMap.map.xml index b12f3e94..b5f8b9d3 100644 --- a/trunk/SIPRPSoft/src/SIPRPMap.map.xml +++ b/trunk/SIPRPSoft/src/SIPRPMap.map.xml @@ -406,6 +406,8 @@ + + @@ -777,6 +779,8 @@ + + diff --git a/trunk/SIPRPSoft/src/SIPRPNode.driver.xml b/trunk/SIPRPSoft/src/SIPRPNode.driver.xml index 33554921..9634e304 100644 --- a/trunk/SIPRPSoft/src/SIPRPNode.driver.xml +++ b/trunk/SIPRPSoft/src/SIPRPNode.driver.xml @@ -1,6 +1,6 @@ - + diff --git a/trunk/SIPRPSoft/src/leaf/LeafInputField.java b/trunk/SIPRPSoft/src/leaf/LeafInputField.java index 6b82cc0b..7772ad6e 100644 --- a/trunk/SIPRPSoft/src/leaf/LeafInputField.java +++ b/trunk/SIPRPSoft/src/leaf/LeafInputField.java @@ -34,7 +34,6 @@ import javax.swing.SwingUtilities; public class LeafInputField 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_CLICK = "LEAF_PROPERTY_CHANGED_CLICK"; @@ -45,6 +44,8 @@ public class LeafInputField extends JPanel implements F private static final int defaultColorDec = 20; private int colorDec = defaultColorDec; + + public Dimension size = null; private Color hot = null; private Color cold = null; @@ -544,6 +545,7 @@ public class LeafInputField extends JPanel implements F repaint(); } } ); + size = thiz.getPreferredSize(); thiz.setOpaque( false ); } } diff --git a/trunk/SIPRPSoft/src/leaf/LeafOptionDialog.java b/trunk/SIPRPSoft/src/leaf/LeafOptionDialog.java index 8d62c053..d5cf8fb7 100644 --- a/trunk/SIPRPSoft/src/leaf/LeafOptionDialog.java +++ b/trunk/SIPRPSoft/src/leaf/LeafOptionDialog.java @@ -23,13 +23,15 @@ import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.ScrollPaneConstants; +import com.evolute.utils.tables.models.SortableModel; + public class LeafOptionDialog extends JDialog { - private static final Dimension OPTION_SIZE = new Dimension( 200, 20 ); - private static final Dimension BUTTON_SIZE = new Dimension( 200, 20 ); + private Dimension OPTION_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; @@ -157,11 +159,13 @@ public class LeafOptionDialog extends JDialog } ((JComponent) getContentPane()).setBorder( BorderFactory.createRaisedBevelBorder() ); setSize( layout.preferredLayoutSize( this.getContentPane() ) ); +// setSize( optionsScrollPane.getPreferredSize().width, getSize().height ); setLocationRelativeTo( getParent() ); } private void setupOptionsComponents( Iterator iterator, Integer size ) { + int maxWidth = OPTION_SIZE.width; double[] cols = new double[] { TableLayout.PREFERRED }; @@ -196,7 +200,10 @@ public class LeafOptionDialog extends JDialog Boolean isEnabled = mapEnabledForKey.get( current ); 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 ) ); addListenerToComponent( component ); } @@ -207,7 +214,7 @@ public class LeafOptionDialog extends JDialog verticalScrollBar.setUnitIncrement( (int) OPTION_SIZE.getHeight() + 3 ); optionsScrollPane.setVerticalScrollBar( verticalScrollBar ); 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 ) diff --git a/trunk/SIPRPSoft/src/leaf/LeafTableModel.java b/trunk/SIPRPSoft/src/leaf/LeafTableModel.java index 6b13fdad..7fc01839 100644 --- a/trunk/SIPRPSoft/src/leaf/LeafTableModel.java +++ b/trunk/SIPRPSoft/src/leaf/LeafTableModel.java @@ -8,6 +8,7 @@ import siprp.database.cayenne.objects.TrabalhadoresEcd; import com.evolute.utils.tables.BaseTableModel; +import com.evolute.utils.tables.models.SortableModel; public class LeafTableModel extends BaseTableModel { @@ -76,7 +77,16 @@ public class LeafTableModel extends BaseTableModel this.map = (OrderedMap) map; fireTableDataChanged(); } - + + public void order(int ... colNumber ) + { + if(colNumber != null) + { + map.order(colNumber); + fireTableDataChanged(); + } + } + @Override public void appendEmptyRow() { diff --git a/trunk/SIPRPSoft/src/leaf/OrderedMap.java b/trunk/SIPRPSoft/src/leaf/OrderedMap.java index 6b8dbd61..49472f05 100644 --- a/trunk/SIPRPSoft/src/leaf/OrderedMap.java +++ b/trunk/SIPRPSoft/src/leaf/OrderedMap.java @@ -23,7 +23,7 @@ public class OrderedMap implements Iterable public OrderedMap(Collection allPrestadores) { Iterator iterator = allPrestadores.iterator(); - while(iterator.hasNext()) + while( iterator.hasNext() ) { KeyClass value = iterator.next(); this.putLast( value, value ); @@ -69,7 +69,7 @@ public class OrderedMap implements Iterable } /** - * returns the length of the biggest column + * returns the length of the biggest line * * @return */ @@ -124,25 +124,26 @@ public class OrderedMap implements Iterable Object result = null; if( row < order.size() ) { - List line = map.get( order.get( row )); - if( column < line.size()) + List line = map.get( order.get( row ) ); + if( column < line.size() ) { result = line.get( column ); } } return result; } - + /** * Adds arguments to the end of the row (on given order) + * * @param key * @param values */ - public void putLast( KeyClass key, Object ... values) + public void putLast( KeyClass key, Object... values ) { - if( values != null) + if( values != null ) { - for( Object currentValue: values ) + for( Object currentValue : values ) { putLast( key, currentValue ); } @@ -151,6 +152,7 @@ public class OrderedMap implements Iterable /** * Adds argument to the end of the row + * * @param key * @param value */ @@ -181,30 +183,92 @@ public class OrderedMap implements Iterable */ public void order() { - if( order != null && order.size() > 0 ) + 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 order ) + { + if( colNumbers != null && currentColumnIndex >= 0 && fromLineNumber < toLineNumber && toLineNumber < order.size() && currentColumnIndex < colNumbers.length ) { - HashMap keyForObject = new HashMap(); - List sortedList = new ArrayList(); - for( KeyClass key : order ) + int columnNumber = colNumbers[currentColumnIndex]; + if( order != null && order.size() > 0 ) { - List row = map.get( key ); - Object value = null; - if( row != null && row.size() > 0 ) + List> sortedList = new ArrayList>(); + for( int i = fromLineNumber; i < order.size() && i < (toLineNumber + 1); ++i ) { - value = row.get( 0 ); - keyForObject.put( value.toString(), key ); - sortedList.add( value.toString() ); + KeyClass key = order.get( i ); + List row = map.get( key ); + String value = ""; + if( row != null && row.size() > columnNumber && row.get( columnNumber ) != null ) + { + value = row.get( columnNumber ).toString(); + } + sortedList.add( new Pair( value, key ) ); } - } - if( sortedList.size() == order.size() ) - { Collections.sort( sortedList ); - Vector newOrder = new Vector(); - for( String value : sortedList ) + List> equalEntries = new ArrayList>(); + for( int i = 0; i < sortedList.size(); ++i ) + { + Pair entry = sortedList.get( i ); + if( equalEntries.isEmpty() && i < (sortedList.size() - 1) ) + { + equalEntries.add( entry ); + } + else + { + Pair 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 toSubOrder = new Vector(); + List DEBUGLIST = new Vector(); + for( Pair 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( "", 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 value = sortedList.get( i ); + order.set( i, value.getCdr() ); } - order = newOrder; } } } @@ -264,10 +328,10 @@ public class OrderedMap implements Iterable public Object getValue( KeyClass key, int i ) { Object result = null; - if(key != null && order.contains( key)) + if( key != null && order.contains( key ) ) { List row = map.get( key ); - if(row != null && row.size() > i) + if( row != null && row.size() > i ) { result = row.get( i ); } diff --git a/trunk/SIPRPSoft/src/leaf/Pair.java b/trunk/SIPRPSoft/src/leaf/Pair.java new file mode 100644 index 00000000..d7777e5e --- /dev/null +++ b/trunk/SIPRPSoft/src/leaf/Pair.java @@ -0,0 +1,48 @@ +package leaf; + +public class Pair, CdrClass> implements Comparable> +{ + + 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 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()) + ")"; + } + +} diff --git a/trunk/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcd.java b/trunk/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcd.java index cabbbbc6..7888046f 100755 --- a/trunk/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcd.java +++ b/trunk/SIPRPSoft/src/siprp/database/cayenne/objects/auto/_TrabalhadoresEcd.java @@ -7,6 +7,8 @@ package siprp.database.cayenne.objects.auto; */ 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 ESTADO_PROPERTY = "estado"; 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 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) { writeProperty("enviado", enviado); } diff --git a/trunk/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java b/trunk/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java index 4829016e..b2cc5c82 100644 --- a/trunk/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java +++ b/trunk/SIPRPSoft/src/siprp/database/cayenne/providers/MedicinaDAO.java @@ -91,17 +91,14 @@ public class MedicinaDAO extends MainDAO implements MedicinaConstants public Collection getPendingExamesForAnalisador( Prestadores currentAnalisador ) { Map resultMap = new HashMap(); - SelectQuery query = new SelectQuery( TrabalhadoresEcdsDatas.class, /*ExpressionFactory.noMatchExp( TrabalhadoresEcdsDatas.DATA_ENVIO_PROPERTY, null ).andExp(*/ ExpressionFactory.matchExp(TrabalhadoresEcdsDatas.DATA_RECEPCAO_PROPERTY, null )/*)*/); - List all = context.performQuery( query ); - for( TrabalhadoresEcdsDatas data : all ) - { + SelectQuery query = new SelectQuery( TrabalhadoresEcd.class, ExpressionFactory.matchExp(TrabalhadoresEcd.DATA_RECEPCAO_PROPERTY, null )); + List all = context.performQuery( query ); + for( TrabalhadoresEcd ecd : all ) + { + TrabalhadoresEcdsDatas data = ecd.getToTrabalhadoresEcdsDatas(); if(new Integer(MedicinaConstants.ESTADO_REALIZADO).equals( data.getEstado())) { - List ecds = data.getTrabalhadoresEcdArray(); - if( ecds != null ) - { - for(TrabalhadoresEcd ecd : ecds) - { + if(currentAnalisador.equals( ecd.getToAnalisador() )) { resultMap.put( ecd ,ecd ); @@ -109,8 +106,6 @@ public class MedicinaDAO extends MainDAO implements MedicinaConstants { resultMap.put( ecd, ecd ); } - } - } } } return resultMap.values(); diff --git a/trunk/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java b/trunk/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java index c44cbc9d..649ac03e 100644 --- a/trunk/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java +++ b/trunk/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java @@ -257,6 +257,7 @@ public class TrabalhadorPanel extends JPanel components.putDummy( TrabalhadorData.PERFIL ); components.putDummy( TrabalhadorData.ESTABELECIMENTO ); components.putDummy( TrabalhadorData.NOME_PLAIN ); + components.putDummy( TrabalhadorData.BI ); // components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NOME, nomeText ); // 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 ); 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 ); // trabalhador = provider.load( FichaDataProvider.TRABALHADORES, new DBKey( trabalhadorID ) ); // DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields(); diff --git a/trunk/SIPRPSoft/src/siprp/medicina/exames/ui/RecepcaoExamesWindow.java b/trunk/SIPRPSoft/src/siprp/medicina/exames/ui/RecepcaoExamesWindow.java index a89880b7..1b7e0a5d 100644 --- a/trunk/SIPRPSoft/src/siprp/medicina/exames/ui/RecepcaoExamesWindow.java +++ b/trunk/SIPRPSoft/src/siprp/medicina/exames/ui/RecepcaoExamesWindow.java @@ -149,6 +149,7 @@ public class RecepcaoExamesWindow extends LeafWindow } orderedMap.putLast( current, empresa, estabelecimento, trabalhador, current); } + orderedMap.order( new int[]{ 0, 1, 2 } ); examesModel.setValues( orderedMap ); } } @@ -168,12 +169,12 @@ public class RecepcaoExamesWindow extends LeafWindow { for( int i = 0; i < selectedRows.length; ++i) { - Object ecd = examesModel.getKey( i ); + Object ecd = examesModel.getKey( selectedRows[i] ); if(ecd != null) { if( ecd instanceof TrabalhadoresEcd) { - ((TrabalhadoresEcd) ecd ).getToTrabalhadoresEcdsDatas().setDataRecepcao( fieldData.getObject() ); + ((TrabalhadoresEcd) ecd ).setDataRecepcao( fieldData.getObject() ); result.add( (TrabalhadoresEcd) ecd ); } } diff --git a/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoAccoesPanel.java b/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoAccoesPanel.java index 087bb8b0..cbc5129a 100755 --- a/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoAccoesPanel.java +++ b/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoAccoesPanel.java @@ -99,7 +99,7 @@ public class ProcessoAccoesPanel extends JPanel public final LeafButton buttonFecharProcesso = new LeafButton( "Fechar Processo" ); @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 = { CREATE_CONSULTA, CREATE_CONSULTA_MARCACAO diff --git a/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoDadosPanel.java b/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoDadosPanel.java index 9c88ff89..f0d3e2af 100755 --- a/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoDadosPanel.java +++ b/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoDadosPanel.java @@ -571,7 +571,7 @@ public class ProcessoDadosPanel extends JPanel TrabalhadoresConsultas consulta = consultaMarcacao.getToTrabalhadoresConsultas(); 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 ) { 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; if( trabalhador != null ) @@ -599,25 +599,21 @@ public class ProcessoDadosPanel extends JPanel String subject = ""; String body = ""; - - String sedeNome = estabelecimento.getNome(); - subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_VISITA ); + subject = ( String ) Singleton.getInstance( subject ); if( subject == null) { subject = ""; } - subject = subject.replaceAll( CompanyDataLoader.NOME, sedeNome ); + subject = subject.replaceAll( CompanyDataLoader.NOME, estabelecimento.getNome() ); - String morada = estabelecimento.getMorada(); - String data = DateFormat.getDateInstance( DateFormat.SHORT ).format( dataConsulta ); - body = ( String ) Singleton.getInstance( letter ); + body = ( String ) Singleton.getInstance( letterName ); if( body == null) { body = ""; } body = body.replaceAll( CompanyDataLoader.DATA, data ); - body = body.replaceAll( CompanyDataLoader.NOME, sedeNome ); - body = body.replaceAll( CompanyDataLoader.MORADA, morada ); + body = body.replaceAll( CompanyDataLoader.NOME, trabalhador.getNome() ); +// body = body.replaceAll( CompanyDataLoader.MORADA, morada ); body = body.replaceAll( "%0A", "
" ); Contactos estabelecimentoContacto = estabelecimento.getToContactos(); @@ -702,7 +698,7 @@ public class ProcessoDadosPanel extends JPanel TrabalhadoresEcds exame = exameMarcacao.getToTrabalhadoresEcds(); 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 ) { email.setSubject( subjectAndBody[0] ); diff --git a/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoTreePanel.java b/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoTreePanel.java index 20a03f30..49e77c69 100755 --- a/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoTreePanel.java +++ b/trunk/SIPRPSoft/src/siprp/medicina/processo/ui/ProcessoTreePanel.java @@ -300,9 +300,31 @@ public class ProcessoTreePanel extends JPanel { addNodeTo( loadExame( current ), node ); } + + List 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; } + + private FichaAptidaoMutableTreeNode loadFicha(TrabalhadoresFichasAptidao ficha) + { + return null; + } private ECDsMutableTreeNode loadExame( TrabalhadoresEcds exame ) { diff --git a/trunk/SIPRPSoft/src/siprp/update/UpdateList.java b/trunk/SIPRPSoft/src/siprp/update/UpdateList.java index 4d0751d2..1f41206c 100644 --- a/trunk/SIPRPSoft/src/siprp/update/UpdateList.java +++ b/trunk/SIPRPSoft/src/siprp/update/UpdateList.java @@ -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.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_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 double version = -1; diff --git a/trunk/SIPRPSoft/src/siprp/update/updates/V8_6_To_V8_7.java b/trunk/SIPRPSoft/src/siprp/update/updates/V8_6_To_V8_7.java new file mode 100644 index 00000000..603d9282 --- /dev/null +++ b/trunk/SIPRPSoft/src/siprp/update/updates/V8_6_To_V8_7.java @@ -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(); + } +}