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

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Diogo Neves 15 years ago
parent 2ac1b9492e
commit bb74559145

@ -53,7 +53,7 @@ public class RiscoLogic
return result; return result;
} }
public boolean isRiscoTratado( Risco r ) private boolean isRiscoTratado( Risco r )
{ {
boolean result = false; boolean result = false;
@ -80,7 +80,6 @@ public class RiscoLogic
else if ( risco != null && user != null ) else if ( risco != null && user != null )
{ {
int userType = user.getTipo() == null ? -1 : user.getTipo().intValue(); int userType = user.getTipo() == null ? -1 : user.getTipo().intValue();
switch ( userType ) switch ( userType )
{ {
case Global.RESPONSAVEL_SEGURANCA : case Global.RESPONSAVEL_SEGURANCA :
@ -112,21 +111,25 @@ public class RiscoLogic
} }
case Global.TECNICO_HS : case Global.TECNICO_HS :
{ {
String verify = risco.getVerificacao_siprp(); isTratado = true;
isTratado = hasValue( verify );
List< Medida > medidas = risco.getMedidas(); if ( forceCheck )
for ( int i = 0; i < medidas.size() && isTratado; i++ )
{ {
Medida m = medidas.get( i ); String verify = risco.getVerificacao_siprp();
Integer estadoMedida = m.getValidarMedidaId(); isTratado = hasValue( verify );
isTratado &= estadoMedida != null; List< Medida > medidas = risco.getMedidas();
for ( int i = 0; i < medidas.size() && isTratado; i++ )
{
Medida m = medidas.get( i );
Integer estadoMedida = m.getValidarMedidaId();
isTratado &= estadoMedida != null;
}
} }
break; break;
} }
} }
} }
return isTratado; return isTratado;
} }
} }

@ -22,7 +22,7 @@ import planosactuacao.SessionBean1.PAGINATION_ENUM;
public abstract class Pagination implements Serializable public abstract class Pagination implements Serializable
{ {
// private static final String COLOR_TRATADO = "#000000"; // private static final String COLOR_TRATADO = "#000000";
private static final String DEFAULT_COLOR_NAO_TRATADO = "#FF5858"; private static final String DEFAULT_COLOR_NAO_TRATADO = "#CC9966";
private static final Map< Integer, String > COLOR_NAO_TRATADO = new HashMap< Integer, String >(); private static final Map< Integer, String > COLOR_NAO_TRATADO = new HashMap< Integer, String >();
static static
@ -162,7 +162,7 @@ public abstract class Pagination implements Serializable
{ {
String result = null; String result = null;
boolean isRiscoTratado = RiscoLogic.getInstance().isRiscoTratado( risco, null, true ); boolean isRiscoTratado = RiscoLogic.getInstance().isRiscoTratado( risco, user, true );
if ( ! isRiscoTratado ) if ( ! isRiscoTratado )
{ {
result = COLOR_NAO_TRATADO.get( user.getTipo() ); result = COLOR_NAO_TRATADO.get( user.getTipo() );

@ -33,7 +33,8 @@ import mail.Mail;
* *
* @author lluis * @author lluis
*/ */
public class EnviarCorrecao extends AbstractPageBean { public class EnviarCorrecao extends AbstractPageBean
{
// <editor-fold defaultstate="collapsed" desc="Managed Component Definition"> // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
/** /**
@ -41,51 +42,68 @@ public class EnviarCorrecao extends AbstractPageBean {
* This method is automatically generated, so any user-specified code inserted * This method is automatically generated, so any user-specified code inserted
* here is subject to being replaced.</p> * here is subject to being replaced.</p>
*/ */
private void _init() throws Exception { private void _init() throws Exception
{
} }
private StaticText lblMsg = new StaticText(); private StaticText lblMsg = new StaticText();
public StaticText getLblMsg() { public StaticText getLblMsg()
{
return lblMsg; return lblMsg;
} }
public void setLblMsg(StaticText st) { public void setLblMsg(StaticText st)
{
this.lblMsg = st; this.lblMsg = st;
} }
private TextArea txtObservacoes = new TextArea(); private TextArea txtObservacoes = new TextArea();
public TextArea getTxtObservacoes() { public TextArea getTxtObservacoes()
{
return txtObservacoes; return txtObservacoes;
} }
public void setTxtObservacoes(TextArea ta) { public void setTxtObservacoes(TextArea ta)
{
this.txtObservacoes = ta; this.txtObservacoes = ta;
} }
private DropDown drpIrPara = new DropDown(); private DropDown drpIrPara = new DropDown();
public DropDown getDrpIrPara() { public DropDown getDrpIrPara()
{
return drpIrPara; return drpIrPara;
} }
public void setDrpIrPara(DropDown dd) { public void setDrpIrPara(DropDown dd)
{
this.drpIrPara = dd; this.drpIrPara = dd;
} }
private Button butCancelar = new Button(); private Button butCancelar = new Button();
public Button getButCancelar() { public Button getButCancelar()
{
return butCancelar; return butCancelar;
} }
public void setButCancelar(Button b) { public void setButCancelar(Button b)
{
this.butCancelar = b; this.butCancelar = b;
} }
private Button butEnviar = new Button(); private Button butEnviar = new Button();
public Button getButEnviar() { public Button getButEnviar()
{
return butEnviar; return butEnviar;
} }
public void setButEnviar(Button b) { public void setButEnviar(Button b)
{
this.butEnviar = b; this.butEnviar = b;
} }
@ -94,7 +112,9 @@ public class EnviarCorrecao extends AbstractPageBean {
/** /**
* <p>Construct a new Page bean instance.</p> * <p>Construct a new Page bean instance.</p>
*/ */
public EnviarCorrecao() { public EnviarCorrecao()
{
} }
/** /**
@ -110,7 +130,8 @@ public class EnviarCorrecao extends AbstractPageBean {
* property values that were saved for this view when it was rendered.</p> * property values that were saved for this view when it was rendered.</p>
*/ */
@Override @Override
public void init() { public void init()
{
// Perform initializations inherited from our superclass // Perform initializations inherited from our superclass
super.init(); super.init();
// Perform application initialization that must complete // Perform application initialization that must complete
@ -120,9 +141,12 @@ public class EnviarCorrecao extends AbstractPageBean {
// <editor-fold defaultstate="collapsed" desc="Managed Component Initialization"> // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
// Initialize automatically managed components // Initialize automatically managed components
// *Note* - this logic should NOT be modified // *Note* - this logic should NOT be modified
try { try
{
_init(); _init();
} catch (Exception e) { }
catch (Exception e)
{
ErrorLogger.logException( e ); ErrorLogger.logException( e );
log("EnviarCorrecao Initialization Failure", e); log("EnviarCorrecao Initialization Failure", e);
throw e instanceof FacesException ? (FacesException) e: new FacesException(e); throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
@ -142,7 +166,9 @@ public class EnviarCorrecao extends AbstractPageBean {
* resources that will be required in your event handlers.</p> * resources that will be required in your event handlers.</p>
*/ */
@Override @Override
public void preprocess() { public void preprocess()
{
} }
/** /**
@ -154,7 +180,8 @@ public class EnviarCorrecao extends AbstractPageBean {
* this page.</p> * this page.</p>
*/ */
@Override @Override
public void prerender() { public void prerender()
{
initialize(); initialize();
lblMsg.setText(getSessionBean1().getMsg()); lblMsg.setText(getSessionBean1().getMsg());
getSessionBean1().setMsg(""); getSessionBean1().setMsg("");
@ -169,7 +196,9 @@ public class EnviarCorrecao extends AbstractPageBean {
* acquired during execution of an event handler).</p> * acquired during execution of an event handler).</p>
*/ */
@Override @Override
public void destroy() { public void destroy()
{
} }
/** /**
@ -177,7 +206,8 @@ public class EnviarCorrecao extends AbstractPageBean {
* *
* @return reference to the scoped data bean * @return reference to the scoped data bean
*/ */
protected SessionBean1 getSessionBean1() { protected SessionBean1 getSessionBean1()
{
return (SessionBean1) getBean("SessionBean1"); return (SessionBean1) getBean("SessionBean1");
} }
@ -186,7 +216,8 @@ public class EnviarCorrecao extends AbstractPageBean {
* *
* @return reference to the scoped data bean * @return reference to the scoped data bean
*/ */
protected ApplicationBean1 getApplicationBean1() { protected ApplicationBean1 getApplicationBean1()
{
return (ApplicationBean1) getBean("ApplicationBean1"); return (ApplicationBean1) getBean("ApplicationBean1");
} }
@ -195,11 +226,14 @@ public class EnviarCorrecao extends AbstractPageBean {
* *
* @return reference to the scoped data bean * @return reference to the scoped data bean
*/ */
protected RequestBean1 getRequestBean1() { protected RequestBean1 getRequestBean1()
{
return (RequestBean1) getBean("RequestBean1"); return (RequestBean1) getBean("RequestBean1");
} }
public void drpIrPara_processValueChange(ValueChangeEvent event) { public void drpIrPara_processValueChange(ValueChangeEvent event)
{
} }
private void initialize() private void initialize()
@ -226,7 +260,7 @@ public class EnviarCorrecao extends AbstractPageBean {
} }
public String butCancelar_action() public String butCancelar_action()
{ {
return "editar_plano"; return "editar_plano";
} }
@ -235,35 +269,35 @@ public class EnviarCorrecao extends AbstractPageBean {
Utilizador u = getSessionBean1().getCurrentUser(); Utilizador u = getSessionBean1().getCurrentUser();
// PlanosDataProvider pdp = new PlanosDataProvider(); // PlanosDataProvider pdp = new PlanosDataProvider();
PlanoActuacao p = getSessionBean1().getPlanoActuacao(); PlanoActuacao p = getSessionBean1().getPlanoActuacao();
p.setFase_anterior(p.getFase()); p.setFase_anterior( p.getFase() );
int dns_next_fase = 0; int dns_next_fase = 0;
int fase = 0; int fase = 0;
Integer irPara = (Integer)drpIrPara.getSelected(); Integer irPara = ( Integer ) drpIrPara.getSelected();
fase = irPara.intValue(); fase = irPara.intValue();
if(u.getTipo().intValue() == Global.DIRECTOR_LOJA) if ( u.getTipo().intValue() == Global.DIRECTOR_LOJA )
{ {
p.setValidacao_director_loja(new Boolean(false)); p.setValidacao_director_loja( new Boolean( false ) );
} }
else if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) else if ( u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA )
{ {
p.setValidacao_dns(new Boolean(false)); p.setValidacao_dns( new Boolean( false ) );
} }
p.setCorrecao("y"); p.setCorrecao( "y" );
p.setFase_antes_correcao(p.getFase()); p.setFase_antes_correcao( p.getFase() );
p.setFase(new Integer(fase)); p.setFase( new Integer( fase ) );
String observacoes = ""; String observacoes = "";
if(txtObservacoes.getText() != null) if ( txtObservacoes.getText() != null )
{ {
if(u.getTipo().intValue() == Global.DIRECTOR_LOJA) if ( u.getTipo().intValue() == Global.DIRECTOR_LOJA )
{ {
observacoes = "Observa&ccedil;&otilde;es do Director de Loja:&nbsp;"; observacoes = "Observa&ccedil;&otilde;es do Director de Loja:&nbsp;";
} }
else if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA) else if ( u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA )
{ {
observacoes = "Observa&ccedil;&otilde;es do Director Nacional de Seguran&ccedil;a:&nbsp;"; observacoes = "Observa&ccedil;&otilde;es do Director Nacional de Seguran&ccedil;a:&nbsp;";
} }
observacoes += (String)txtObservacoes.getText(); observacoes += ( String ) txtObservacoes.getText();
p.setObs_correcao(observacoes); p.setObs_correcao( observacoes );
} }
try try
{ {
@ -272,10 +306,10 @@ public class EnviarCorrecao extends AbstractPageBean {
enviarMail( p ); enviarMail( p );
return "lista_planos"; return "lista_planos";
} }
catch(Exception ex) catch ( Exception ex )
{ {
ErrorLogger.logException( ex ); ErrorLogger.logException( ex );
getSessionBean1().setMsg("Erro no envio do plano para a fase " + Global.FASES_TEXTO[fase-1]); getSessionBean1().setMsg( "Erro no envio do plano para a fase " + Global.FASES_TEXTO[ fase - 1 ] );
} }
return null; return null;
} }

Loading…
Cancel
Save