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

lxbfYeaa
Diogo Neves 15 years ago
parent 77d54ec388
commit 12d9b04875

@ -6,10 +6,13 @@
package phaselistener;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.timer.TimedEvent;
import com.evolute.utils.timer.Timer;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import planosactuacao.PlanosActuacao;
import shst.companydataloaders.SIPRPPropertiesLoader;
import utils.PlanosActuacaoLogger;
@ -19,7 +22,8 @@ import utils.PlanosActuacaoLogger;
*/
public class ContextListener implements ServletContextListener
{
private static final int IMPORT_INTERVAL = 300;
private static Boolean loggerIsLoaded = Boolean.FALSE;
static
@ -58,6 +62,46 @@ public class ContextListener implements ServletContextListener
ErrorLogger.logException( e );
System.out.println( "\n\n<---- ERROR ! " + e.getMessage() );
}
System.out.println( "\nScheduling Import Event ... " );
TimedEvent importEvent = new TimedEvent()
{
public void executeAction() throws Exception
{
try
{
PlanosActuacao planos = new PlanosActuacao();
}
catch ( Exception e )
{
ErrorLogger.logException( e );
}
Timer.resetEvent( this );
}
};
Timer.scheduleEvent( importEvent, IMPORT_INTERVAL );
System.out.println( "\tExecuting Import each " + ( IMPORT_INTERVAL / 60 ) + " minutes." );
// if ( ! getApplicationBean1().isTimerStarted() )
// {
// Timer.scheduleEvent( new TimedEvent()
// {
// public void executeAction() throws Exception
// {
// try
// {
// PlanosActuacao planos = new PlanosActuacao();
// }
// catch( Exception ex )
// {
// ErrorLogger.logException( ex );
// }
// Timer.resetEvent( this );
// }
// }, 300 );
// getApplicationBean1().setTimerStarted( true );
// }
}
public void contextDestroyed( ServletContextEvent sce )

@ -2090,8 +2090,7 @@ public class EditarPlano extends AbstractPageBean
{
processo_validado = true;
p.setValidacao_director_loja(new Boolean(true));
Date today = new Date();
p.setData_validacao_dir_loja(today);
p.setData_validacao_dir_loja( new Date() );
p.setUser_dir_loja(getSessionBean1().getCurrentUser().getId());
PanelGroup pg = (PanelGroup) gridObservacoes.findComponent("pgObsDl");

@ -6,9 +6,8 @@
package planosactuacao;
import com.evolute.utils.date.DateUtils;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.timer.TimedEvent;
import com.evolute.utils.timer.Timer;
import com.sun.data.provider.RowKey;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.component.Button;
@ -643,38 +642,6 @@ public class ListaPlanos extends AbstractPageBean
private void initialize()
{
// try
// {
// DbLocal dblocal = DbLocal.getInstance();
// dblocal.connect();
// }
// catch(Exception ex)
// {
// ErrorLogger.logException( ex );
// }
if ( ! getApplicationBean1().isTimerStarted() )
{
Timer.scheduleEvent( new TimedEvent()
{
public void executeAction() throws Exception
{
try
{
PlanosActuacao planos = new PlanosActuacao();
}
catch( Exception ex )
{
ErrorLogger.logException( ex );
}
Timer.resetEvent( this );
}
}, 300 );
getApplicationBean1().setTimerStarted( true );
}
Utilizador u = getSessionBean1().getCurrentUser();
Integer estabelecimento_id = null;
@ -688,7 +655,8 @@ public class ListaPlanos extends AbstractPageBean
if ( ! getSessionBean1().getIsSearchingPlanosActuacao() )
{
System.out.println( "\tGETTING INITIAL VALUES FOR EACH TABLE." );
long startedTime = System.currentTimeMillis();
List listPlanosActivos = getPlanosActivos(u);
getSessionBean1().getPlanosActualDataProvider().setList(listPlanosActivos);
@ -697,12 +665,19 @@ public class ListaPlanos extends AbstractPageBean
List listPlanosConcluidos = getPlanosConcluidos(u);
getSessionBean1().getPlanosConcluidosDataProvider().setList(listPlanosConcluidos);
long endedTime = System.currentTimeMillis();
System.out.println( "\nGot Planos List in : " + getTime( startedTime, endedTime ) );
//2010-11-12 : user scampos : 1 min (debug mode)
}
//checkPlanosDelayed();
}
private String getTime( long start, long end )
{
return DateUtils.getTimePassed( start, end );
}
private PlanoActuacao getTableActivosRowData()
{

@ -782,7 +782,7 @@ public class ViewPlano extends AbstractPageBean
{
StaticText visitaText = new StaticText();
visitaText.setEscape( false );
visitaText.setText( "Data da auditoria: " + DF.format( p.getData_visita() ) );
visitaText.setText( "Data da auditoria: " + ( p.getData_visita() == null ? "" : DF.format( p.getData_visita() ) ) );
gridValidacoes.getChildren().add( visitaText );
}
@ -792,7 +792,7 @@ public class ViewPlano extends AbstractPageBean
{
StaticText dispText = new StaticText();
dispText.setEscape( false );
dispText.setText( "Data de disponibilizacao online: " + DF.format( p.getData_disponibilizacao() ) );
dispText.setText( "Data de disponibilizacao online: " + ( p.getData_disponibilizacao() == null ? "" : DF.format( p.getData_disponibilizacao() ) ) );
gridValidacoes.getChildren().add( dispText );
}
@ -803,7 +803,7 @@ public class ViewPlano extends AbstractPageBean
StaticText segText = new StaticText();
segText.setEscape( false );
String nome = UtilizadoresLogic.getInstance().getNomeUtilizadorByID( p.getUser_seg() );
segText.setText( "Validado por " + nome + " (Seguran&ccedil;a) a " + DF.format( p.getData_validacao_seg() ) );
segText.setText( "Validado por " + nome + " (Seguran&ccedil;a)" + ( p.getData_validacao_seg() == null ? "" : " a " + DF.format( p.getData_validacao_seg() ) ) );
gridValidacoes.getChildren().add( segText );
}
@ -814,7 +814,11 @@ public class ViewPlano extends AbstractPageBean
StaticText valDirLojaText = new StaticText();
valDirLojaText.setEscape( false );
String nome = UtilizadoresLogic.getInstance().getNomeUtilizadorByID( p.getUser_dir_loja() );
valDirLojaText.setText( "Validado por " + nome + " (Director de Loja) a " + DF.format( p.getData_validacao_dir_loja() ) );
String validacaoText = "Validado por " + nome + " (Director de Loja)" +
( p.getData_validacao_dir_loja() == null ? "" : " a " + DF.format( p.getData_validacao_dir_loja() ) );
valDirLojaText.setText( validacaoText );
gridValidacoes.getChildren().add( valDirLojaText );
if ( p.getObservacoes_dl() != null && ! "".equals( p.getObservacoes_dl().trim() ) )
@ -839,7 +843,7 @@ public class ViewPlano extends AbstractPageBean
StaticText valDnsText = new StaticText();
valDnsText.setEscape( false );
String nome = UtilizadoresLogic.getInstance().getNomeUtilizadorByID( p.getUser_dns() );
valDnsText.setText( "Validado por " + nome + " (Director Nacional de Seguran&ccedil;a) a " + DF.format( p.getData_validacao_dns() ) );
valDnsText.setText( "Validado por " + nome + " (Director Nacional de Seguran&ccedil;a)" + ( p.getData_validacao_dns() == null ? "" : " a " + DF.format( p.getData_validacao_dns() ) ) );
gridValidacoes.getChildren().add( valDnsText );
if ( p.getObservacoes_dns() != null && ! "".equals( p.getObservacoes_dns().trim() ) )
@ -864,7 +868,7 @@ public class ViewPlano extends AbstractPageBean
StaticText valHsText = new StaticText();
valHsText.setEscape( false );
String nome = UtilizadoresLogic.getInstance().getNomeUtilizadorByID( p.getUser_hs() );
valHsText.setText( "Validado por " + nome + " (T&eacute;cnico de SHS) a " + DF.format( p.getData_validacao_hs() ) );
valHsText.setText( "Validado por " + nome + " (T&eacute;cnico de SHS)" + ( p.getData_validacao_hs() == null ? "" : " a " + DF.format( p.getData_validacao_hs() ) ) );
gridValidacoes.getChildren().add( valHsText );
}

Loading…
Cancel
Save