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

lxbfYeaa
Diogo Neves 14 years ago
parent 48dc1caf5a
commit 312bdc8a9b

@ -29,7 +29,8 @@ import utils.Utils;
* *
* @author lluis * @author lluis
*/ */
public class Acesso extends AbstractPageBean { public class Acesso extends AbstractPageBean
{
// <editor-fold defaultstate="collapsed" desc="Managed Component Definition"> // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
/** /**
@ -37,33 +38,41 @@ public class Acesso 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 stWelcome = new StaticText(); private StaticText stWelcome = new StaticText();
public StaticText getStWelcome() { public StaticText getStWelcome()
{
return stWelcome; return stWelcome;
} }
public void setStWelcome(StaticText st) { public void setStWelcome(StaticText st)
{
this.stWelcome = st; this.stWelcome = st;
} }
private DropDown drpEstabelecimentos = new DropDown(); private DropDown drpEstabelecimentos = new DropDown();
public DropDown getDrpEstabelecimentos() { public DropDown getDrpEstabelecimentos()
{
return drpEstabelecimentos; return drpEstabelecimentos;
} }
public void setDrpEstabelecimentos(DropDown dd) { public void setDrpEstabelecimentos(DropDown dd)
{
this.drpEstabelecimentos = dd; this.drpEstabelecimentos = dd;
} }
private HtmlPanelGrid gridEstabelecimento = new HtmlPanelGrid(); private HtmlPanelGrid gridEstabelecimento = new HtmlPanelGrid();
public HtmlPanelGrid getGridEstabelecimento() { public HtmlPanelGrid getGridEstabelecimento()
{
return gridEstabelecimento; return gridEstabelecimento;
} }
public void setGridEstabelecimento(HtmlPanelGrid hpg) { public void setGridEstabelecimento(HtmlPanelGrid hpg)
{
this.gridEstabelecimento = hpg; this.gridEstabelecimento = hpg;
} }
@ -72,7 +81,9 @@ public class Acesso extends AbstractPageBean {
/** /**
* <p>Construct a new Page bean instance.</p> * <p>Construct a new Page bean instance.</p>
*/ */
public Acesso() { public Acesso()
{
} }
/** /**
@ -99,9 +110,12 @@ public class Acesso 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 )
{
log("Acesso Initialization Failure", e); log("Acesso Initialization Failure", e);
throw e instanceof FacesException ? (FacesException) e: new FacesException(e); throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
} }
@ -137,18 +151,16 @@ public class Acesso extends AbstractPageBean {
public void prerender() public void prerender()
{ {
Utilizador u = getSessionBean1().getCurrentUser(); Utilizador u = getSessionBean1().getCurrentUser();
//String nomeUnicode = Utils.textToUnicode(u.getNome());
//System.out.println("NOME UNICODE : " + nomeUnicode);
String nomeHtml = Utils.unicodeToHTML( u.getNome() ); String nomeHtml = Utils.unicodeToHTML( u.getNome() );
stWelcome.setText("Bem vindo(a) " + nomeHtml); stWelcome.setText("Bem vindo(a) " + nomeHtml);
if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR) if ( u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR )
{ {
initializeEstabelecimentos(); initializeEstabelecimentos();
} }
else else
{ {
gridEstabelecimento.setRendered(false); gridEstabelecimento.setRendered( false );
} }
} }
@ -171,22 +183,25 @@ public class Acesso extends AbstractPageBean {
/** /**
* <p>Return a reference to the scoped data bean.</p> * <p>Return a reference to the scoped data bean.</p>
*/ */
protected SessionBean1 getSessionBean1() { protected SessionBean1 getSessionBean1()
return (SessionBean1)getBean("SessionBean1"); {
return ( SessionBean1 ) getBean("SessionBean1");
} }
/** /**
* <p>Return a reference to the scoped data bean.</p> * <p>Return a reference to the scoped data bean.</p>
*/ */
protected RequestBean1 getRequestBean1() { protected RequestBean1 getRequestBean1()
return (RequestBean1)getBean("RequestBean1"); {
return ( RequestBean1 ) getBean("RequestBean1");
} }
/** /**
* <p>Return a reference to the scoped data bean.</p> * <p>Return a reference to the scoped data bean.</p>
*/ */
protected ApplicationBean1 getApplicationBean1() { protected ApplicationBean1 getApplicationBean1()
return (ApplicationBean1)getBean("ApplicationBean1"); {
return ( ApplicationBean1 ) getBean("ApplicationBean1");
} }
@ -218,7 +233,7 @@ public class Acesso extends AbstractPageBean {
{ {
JSFUtils.logout( fc, false ); JSFUtils.logout( fc, false );
} }
catch(Exception ex) catch ( Exception ex )
{ {
ErrorLogger.logException( ex ); ErrorLogger.logException( ex );
} }
@ -281,59 +296,34 @@ public class Acesso extends AbstractPageBean {
public String lnkPlanos_action() public String lnkPlanos_action()
{ {
Utilizador u = getSessionBean1().getCurrentUser(); Utilizador u = getSessionBean1().getCurrentUser();
// String curUser = "?user=" + u.getId().toString();
FacesContext fc = getFacesContext().getCurrentInstance(); FacesContext fc = getFacesContext().getCurrentInstance();
Integer estabelecimento = null; Integer estabelecimento = null;
if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR) if ( u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR )
{ {
estabelecimento = (Integer) drpEstabelecimentos.getSelected(); estabelecimento = ( Integer ) drpEstabelecimentos.getSelected();
// if(estabelecimento.intValue() == -1) u.setEstabelecimento_gestor( estabelecimento );
// {
// getSessionBean1().setMsg("Falta estabelecimento!");
// return null;
// }
// else
// {
// u.setEstabelecimento(estabelecimento_outro);
u.setEstabelecimento_gestor(estabelecimento);
} }
Global.redirectToPlanos( fc, u );
Global.redirectToPlanos(fc, u);
// FacesContext fc = getFacesContext().getCurrentInstance();
// Utilizador u = getSessionBean1().getCurrentUser();
// String curUser = "?user=" + u.getId().toString();
// try
// {
// JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser);
// }
// catch(Exception ex)
// {
// ErrorLogger.logException( ex );
// }
return null; return null;
} }
private void initializeEstabelecimentos() private void initializeEstabelecimentos()
{ {
try try
{ {
AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
com.sun.rave.web.ui.model.Option[] listGestorOptions = adp.getEstabelecimentosGestorList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(true)); com.sun.rave.web.ui.model.Option[] listGestorOptions = adp.getEstabelecimentosGestorList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean( true ) );
//listGestorOptions[0].setLabel("-Seleccionar-"); getSessionBean1().setEstabelecimentosGestorOptions( listGestorOptions );
drpEstabelecimentos.setSelected( new Integer( 0 ) );
getSessionBean1().setEstabelecimentosGestorOptions( listGestorOptions ); }
drpEstabelecimentos.setSelected(new Integer(0)); catch ( Exception ex )
} {
catch(Exception ex) ErrorLogger.logException( ex );
{ }
ErrorLogger.logException( ex ); }
}
}
} }

@ -35,9 +35,12 @@ public class SessionBean1 extends AbstractSessionBean
* 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
} {
}
// </editor-fold> // </editor-fold>
private String logoEmpresaUrl = ""; private String logoEmpresaUrl = "";
private Boolean canAccessEstatisticas = false; private Boolean canAccessEstatisticas = false;
@ -53,43 +56,45 @@ public class SessionBean1 extends AbstractSessionBean
return canAccessEstatisticas; return canAccessEstatisticas;
} }
public void setCanAccessEstatisticas(Boolean canAccessEstatisticas) { public void setCanAccessEstatisticas( Boolean canAccessEstatisticas )
{
this.canAccessEstatisticas = canAccessEstatisticas; this.canAccessEstatisticas = canAccessEstatisticas;
} }
private Boolean isSearchingUtilizadores = false; private Boolean isSearchingUtilizadores = false;
/** /**
* <p>Construct a new session data bean instance.</p> * <p>Construct a new session data bean instance.</p>
*/ */
public SessionBean1() public SessionBean1()
{ {
msg = new String(""); msg = new String( "" );
currentUser = new Utilizador(); currentUser = new Utilizador();
analisesActualDataProvider = new db.providers.AnalisesActualDataProvider(); analisesActualDataProvider = new db.providers.AnalisesActualDataProvider();
analisesSeguimentoDataProvider = new db.providers.AnalisesSeguimentoDataProvider(); analisesSeguimentoDataProvider = new db.providers.AnalisesSeguimentoDataProvider();
analisesConcluidasDataProvider = new db.providers.AnalisesConcluidasDataProvider(); analisesConcluidasDataProvider = new db.providers.AnalisesConcluidasDataProvider();
trabalhadoresListDataProvider = new db.providers.TrabalhadoresListDataProvider(); trabalhadoresListDataProvider = new db.providers.TrabalhadoresListDataProvider();
setEstadosCorrecaoDataProvider(new db.providers.EstadosCorrecaoDataProvider()); setEstadosCorrecaoDataProvider( new db.providers.EstadosCorrecaoDataProvider() );
utilizadoresActivosListDataProvider = new db.providers.UtilizadoresActivosListDataProvider(); utilizadoresActivosListDataProvider = new db.providers.UtilizadoresActivosListDataProvider();
utilizadoresInactivosListDataProvider = new db.providers.UtilizadoresInactivosListDataProvider(); utilizadoresInactivosListDataProvider = new db.providers.UtilizadoresInactivosListDataProvider();
setNavFrom(""); setNavFrom( "" );
setAcidentado(null); setAcidentado( null );
setCurrentAnalise(null); setCurrentAnalise( null );
setLoggedIn(false); setLoggedIn( false );
modoEdicaoUtilizador = ""; modoEdicaoUtilizador = "";
setIdSequence(1); setIdSequence( 1 );
setNewUser(null); setNewUser( null );
setEditUser(null); setEditUser( null );
setUserDeleted(false); setUserDeleted( false );
setMudarPassword(false); setMudarPassword( false );
setFromAjuda(false); setFromAjuda( false );
setGravado(false); setGravado( false );
setSubmetido(false); setSubmetido( false );
setFromAnaliseDeletion(false); setFromAnaliseDeletion( false );
setIeBug(false); setIeBug( false );
setCorrecao(null); setCorrecao( null );
setCanAccessEstatisticas( false ); setCanAccessEstatisticas( false );
setIsSearchingUtilizadores( false ); setIsSearchingUtilizadores( false );
} }
@ -180,7 +185,7 @@ public class SessionBean1 extends AbstractSessionBean
*/ */
protected ApplicationBean1 getApplicationBean1() protected ApplicationBean1 getApplicationBean1()
{ {
return (ApplicationBean1)getBean("ApplicationBean1"); return ( ApplicationBean1 ) getBean( "ApplicationBean1" );
} }
private String msg; private String msg;
@ -190,7 +195,7 @@ public class SessionBean1 extends AbstractSessionBean
return msg; return msg;
} }
public void setMsg(String msg) public void setMsg( String msg )
{ {
this.msg = msg; this.msg = msg;
} }
@ -216,59 +221,73 @@ public class SessionBean1 extends AbstractSessionBean
private db.providers.UtilizadoresActivosListDataProvider utilizadoresActivosListDataProvider; private db.providers.UtilizadoresActivosListDataProvider utilizadoresActivosListDataProvider;
private db.providers.UtilizadoresInactivosListDataProvider utilizadoresInactivosListDataProvider; private db.providers.UtilizadoresInactivosListDataProvider utilizadoresInactivosListDataProvider;
public db.providers.AnalisesActualDataProvider getAnalisesActualDataProvider() { public db.providers.AnalisesActualDataProvider getAnalisesActualDataProvider()
{
return analisesActualDataProvider; return analisesActualDataProvider;
} }
public void setAnalisesActualDataProvider(db.providers.AnalisesActualDataProvider analisesActualDataProvider) { public void setAnalisesActualDataProvider( db.providers.AnalisesActualDataProvider analisesActualDataProvider )
{
this.analisesActualDataProvider = analisesActualDataProvider; this.analisesActualDataProvider = analisesActualDataProvider;
} }
public db.providers.AnalisesSeguimentoDataProvider getAnalisesSeguimentoDataProvider() { public db.providers.AnalisesSeguimentoDataProvider getAnalisesSeguimentoDataProvider()
{
return analisesSeguimentoDataProvider; return analisesSeguimentoDataProvider;
} }
public void setAnalisesSeguimentoDataProvider(db.providers.AnalisesSeguimentoDataProvider analisesSeguimentoDataProvider) { public void setAnalisesSeguimentoDataProvider( db.providers.AnalisesSeguimentoDataProvider analisesSeguimentoDataProvider )
{
this.analisesSeguimentoDataProvider = analisesSeguimentoDataProvider; this.analisesSeguimentoDataProvider = analisesSeguimentoDataProvider;
} }
public db.providers.AnalisesConcluidasDataProvider getAnalisesConcluidasDataProvider() { public db.providers.AnalisesConcluidasDataProvider getAnalisesConcluidasDataProvider()
{
return analisesConcluidasDataProvider; return analisesConcluidasDataProvider;
} }
public void setAnalisesConcluidasDataProvider(db.providers.AnalisesConcluidasDataProvider analisesConcluidasDataProvider) { public void setAnalisesConcluidasDataProvider( db.providers.AnalisesConcluidasDataProvider analisesConcluidasDataProvider )
{
this.analisesConcluidasDataProvider = analisesConcluidasDataProvider; this.analisesConcluidasDataProvider = analisesConcluidasDataProvider;
} }
public db.providers.TrabalhadoresListDataProvider getTrabalhadoresListDataProvider() { public db.providers.TrabalhadoresListDataProvider getTrabalhadoresListDataProvider()
{
return trabalhadoresListDataProvider; return trabalhadoresListDataProvider;
} }
public void setTrabalhadoresListDataProvider(db.providers.TrabalhadoresListDataProvider trabalhadoresListDataProvider) { public void setTrabalhadoresListDataProvider( db.providers.TrabalhadoresListDataProvider trabalhadoresListDataProvider )
{
this.trabalhadoresListDataProvider = trabalhadoresListDataProvider; this.trabalhadoresListDataProvider = trabalhadoresListDataProvider;
} }
public db.providers.EstadosCorrecaoDataProvider getEstadosCorrecaoDataProvider() { public db.providers.EstadosCorrecaoDataProvider getEstadosCorrecaoDataProvider()
{
return estadosCorrecaoDataProvider; return estadosCorrecaoDataProvider;
} }
public void setEstadosCorrecaoDataProvider(db.providers.EstadosCorrecaoDataProvider estadosCorrecaoDataProvider) { public void setEstadosCorrecaoDataProvider( db.providers.EstadosCorrecaoDataProvider estadosCorrecaoDataProvider )
{
this.estadosCorrecaoDataProvider = estadosCorrecaoDataProvider; this.estadosCorrecaoDataProvider = estadosCorrecaoDataProvider;
} }
public db.providers.UtilizadoresActivosListDataProvider getUtilizadoresActivosListDataProvider() { public db.providers.UtilizadoresActivosListDataProvider getUtilizadoresActivosListDataProvider()
{
return utilizadoresActivosListDataProvider; return utilizadoresActivosListDataProvider;
} }
public void setUtilizadoresActivosListDataProvider(db.providers.UtilizadoresActivosListDataProvider utilizadoresActivosListDataProvider) { public void setUtilizadoresActivosListDataProvider( db.providers.UtilizadoresActivosListDataProvider utilizadoresActivosListDataProvider )
{
this.utilizadoresActivosListDataProvider = utilizadoresActivosListDataProvider; this.utilizadoresActivosListDataProvider = utilizadoresActivosListDataProvider;
} }
public db.providers.UtilizadoresInactivosListDataProvider getUtilizadoresInactivosListDataProvider() { public db.providers.UtilizadoresInactivosListDataProvider getUtilizadoresInactivosListDataProvider()
{
return utilizadoresInactivosListDataProvider; return utilizadoresInactivosListDataProvider;
} }
public void setUtilizadoresInactivosListDataProvider(db.providers.UtilizadoresInactivosListDataProvider utilizadoresInactivosListDataProvider) { public void setUtilizadoresInactivosListDataProvider( db.providers.UtilizadoresInactivosListDataProvider utilizadoresInactivosListDataProvider )
{
this.utilizadoresInactivosListDataProvider = utilizadoresInactivosListDataProvider; this.utilizadoresInactivosListDataProvider = utilizadoresInactivosListDataProvider;
} }
@ -276,19 +295,23 @@ public class SessionBean1 extends AbstractSessionBean
private Integer anoChoice; private Integer anoChoice;
public Integer getAnoChoice() { public Integer getAnoChoice()
{
return anoChoice; return anoChoice;
} }
public void setAnoChoice(Integer anoChoice) { public void setAnoChoice( Integer anoChoice )
{
this.anoChoice = anoChoice; this.anoChoice = anoChoice;
} }
public com.sun.rave.web.ui.model.Option[] getAnoOptions() { public com.sun.rave.web.ui.model.Option[] getAnoOptions()
{
return anoOptions; return anoOptions;
} }
public void setAnoOptions(com.sun.rave.web.ui.model.Option[] anoOptions) { public void setAnoOptions( com.sun.rave.web.ui.model.Option[] anoOptions )
{
this.anoOptions = anoOptions; this.anoOptions = anoOptions;
} }
@ -296,19 +319,23 @@ public class SessionBean1 extends AbstractSessionBean
private Integer mesChoice; private Integer mesChoice;
public Integer getMesChoice() { public Integer getMesChoice()
{
return mesChoice; return mesChoice;
} }
public void setMesChoice(Integer mesChoice) { public void setMesChoice( Integer mesChoice )
{
this.mesChoice = mesChoice; this.mesChoice = mesChoice;
} }
public com.sun.rave.web.ui.model.Option[] getMesOptions() { public com.sun.rave.web.ui.model.Option[] getMesOptions()
{
return mesOptions; return mesOptions;
} }
public void setMesOptions(com.sun.rave.web.ui.model.Option[] mesOptions) { public void setMesOptions( com.sun.rave.web.ui.model.Option[] mesOptions )
{
this.mesOptions = mesOptions; this.mesOptions = mesOptions;
} }
@ -316,19 +343,23 @@ public class SessionBean1 extends AbstractSessionBean
private Integer diaChoice; private Integer diaChoice;
public Integer getDiaChoice() { public Integer getDiaChoice()
{
return diaChoice; return diaChoice;
} }
public void setDiaChoice(Integer diaChoice) { public void setDiaChoice( Integer diaChoice )
{
this.diaChoice = diaChoice; this.diaChoice = diaChoice;
} }
public com.sun.rave.web.ui.model.Option[] getDiaOptions() { public com.sun.rave.web.ui.model.Option[] getDiaOptions()
{
return diaOptions; return diaOptions;
} }
public void setDiaOptions(com.sun.rave.web.ui.model.Option[] diaOptions) { public void setDiaOptions( com.sun.rave.web.ui.model.Option[] diaOptions )
{
this.diaOptions = diaOptions; this.diaOptions = diaOptions;
} }
@ -336,19 +367,23 @@ public class SessionBean1 extends AbstractSessionBean
private Integer departamentoChoice; private Integer departamentoChoice;
public Integer getDepartamentoChoice() { public Integer getDepartamentoChoice()
{
return departamentoChoice; return departamentoChoice;
} }
public void setDepartamentoChoice(Integer departamentoChoice) { public void setDepartamentoChoice( Integer departamentoChoice )
{
this.departamentoChoice = departamentoChoice; this.departamentoChoice = departamentoChoice;
} }
public com.sun.rave.web.ui.model.Option[] getDepartamentoOptions() { public com.sun.rave.web.ui.model.Option[] getDepartamentoOptions()
{
return departamentoOptions; return departamentoOptions;
} }
public void setDepartamentoOptions(com.sun.rave.web.ui.model.Option[] departamentoOptions) { public void setDepartamentoOptions( com.sun.rave.web.ui.model.Option[] departamentoOptions )
{
this.departamentoOptions = departamentoOptions; this.departamentoOptions = departamentoOptions;
} }
@ -356,69 +391,83 @@ public class SessionBean1 extends AbstractSessionBean
private Integer seccaoChoice; private Integer seccaoChoice;
public Integer getSeccaoChoice() { public Integer getSeccaoChoice()
{
return seccaoChoice; return seccaoChoice;
} }
public void setSeccaoChoice(Integer seccaoChoice) { public void setSeccaoChoice( Integer seccaoChoice )
{
this.seccaoChoice = seccaoChoice; this.seccaoChoice = seccaoChoice;
} }
public com.sun.rave.web.ui.model.Option[] getSeccaoOptions() { public com.sun.rave.web.ui.model.Option[] getSeccaoOptions()
{
return seccaoOptions; return seccaoOptions;
} }
public void setSeccaoOptions(com.sun.rave.web.ui.model.Option[] seccaoOptions) { public void setSeccaoOptions( com.sun.rave.web.ui.model.Option[] seccaoOptions )
{
this.seccaoOptions = seccaoOptions; this.seccaoOptions = seccaoOptions;
} }
private String imageName; private String imageName;
public String getImageName() { public String getImageName()
{
return imageName; return imageName;
} }
public void setImageName(String imageName) { public void setImageName( String imageName )
{
this.imageName = imageName; this.imageName = imageName;
} }
private String navFrom; private String navFrom;
public String getNavFrom() { public String getNavFrom()
{
return navFrom; return navFrom;
} }
public void setNavFrom(String navFrom) { public void setNavFrom( String navFrom )
{
this.navFrom = navFrom; this.navFrom = navFrom;
} }
private Acidentado acidentado; private Acidentado acidentado;
public Acidentado getAcidentado() { public Acidentado getAcidentado()
{
return acidentado; return acidentado;
} }
public void setAcidentado(Acidentado acidentado) { public void setAcidentado( Acidentado acidentado )
{
this.acidentado = acidentado; this.acidentado = acidentado;
} }
private AnaliseAcidenteTrabalhoState analise_acidente_trabalho_state; private AnaliseAcidenteTrabalhoState analise_acidente_trabalho_state;
public AnaliseAcidenteTrabalhoState getAnalise_acidente_trabalho_state() { public AnaliseAcidenteTrabalhoState getAnalise_acidente_trabalho_state()
{
return analise_acidente_trabalho_state; return analise_acidente_trabalho_state;
} }
public void setAnalise_acidente_trabalho_state(AnaliseAcidenteTrabalhoState analise_acidente_trabalho_state) { public void setAnalise_acidente_trabalho_state( AnaliseAcidenteTrabalhoState analise_acidente_trabalho_state )
{
this.analise_acidente_trabalho_state = analise_acidente_trabalho_state; this.analise_acidente_trabalho_state = analise_acidente_trabalho_state;
} }
private AnaliseAcidente currentAnalise; private AnaliseAcidente currentAnalise;
public AnaliseAcidente getCurrentAnalise() { public AnaliseAcidente getCurrentAnalise()
{
return currentAnalise; return currentAnalise;
} }
public void setCurrentAnalise(AnaliseAcidente currentAnalise) { public void setCurrentAnalise( AnaliseAcidente currentAnalise )
{
this.currentAnalise = currentAnalise; this.currentAnalise = currentAnalise;
} }
@ -429,79 +478,93 @@ public class SessionBean1 extends AbstractSessionBean
return loggedIn; return loggedIn;
} }
public void setLoggedIn(boolean loggedIn) public void setLoggedIn( boolean loggedIn )
{ {
this.loggedIn = loggedIn; this.loggedIn = loggedIn;
} }
private String modoEdicaoUtilizador; private String modoEdicaoUtilizador;
public String getModoEdicaoUtilizador() { public String getModoEdicaoUtilizador()
{
return modoEdicaoUtilizador; return modoEdicaoUtilizador;
} }
public void setModoEdicaoUtilizador(String modoEdicaoUtilizador) { public void setModoEdicaoUtilizador( String modoEdicaoUtilizador )
{
this.modoEdicaoUtilizador = modoEdicaoUtilizador; this.modoEdicaoUtilizador = modoEdicaoUtilizador;
} }
private Integer tipoChoice; private Integer tipoChoice;
public Integer getTipoChoice() { public Integer getTipoChoice()
{
return tipoChoice; return tipoChoice;
} }
public void setTipoChoice(Integer tipoChoice) { public void setTipoChoice( Integer tipoChoice )
{
this.tipoChoice = tipoChoice; this.tipoChoice = tipoChoice;
} }
private com.sun.rave.web.ui.model.Option[] tiposOptions; private com.sun.rave.web.ui.model.Option[] tiposOptions;
public com.sun.rave.web.ui.model.Option[] getTiposOptions() { public com.sun.rave.web.ui.model.Option[] getTiposOptions()
{
return tiposOptions; return tiposOptions;
} }
public void setTiposOptions(com.sun.rave.web.ui.model.Option[] tiposOptions) { public void setTiposOptions( com.sun.rave.web.ui.model.Option[] tiposOptions )
{
this.tiposOptions = tiposOptions; this.tiposOptions = tiposOptions;
} }
private Integer estabelecimentoChoice; private Integer estabelecimentoChoice;
public Integer getEstabelecimentoChoice() { public Integer getEstabelecimentoChoice()
{
return estabelecimentoChoice; return estabelecimentoChoice;
} }
public void setEstabelecimentoChoice(Integer estabelecimentoChoice) { public void setEstabelecimentoChoice( Integer estabelecimentoChoice )
{
this.estabelecimentoChoice = estabelecimentoChoice; this.estabelecimentoChoice = estabelecimentoChoice;
} }
private com.sun.rave.web.ui.model.Option[] estabelecimentosOptions; private com.sun.rave.web.ui.model.Option[] estabelecimentosOptions;
public com.sun.rave.web.ui.model.Option[] getEstabelecimentosOptions() { public com.sun.rave.web.ui.model.Option[] getEstabelecimentosOptions()
{
return estabelecimentosOptions; return estabelecimentosOptions;
} }
public void setEstabelecimentosOptions(com.sun.rave.web.ui.model.Option[] estabelecimentosOptions) { public void setEstabelecimentosOptions( com.sun.rave.web.ui.model.Option[] estabelecimentosOptions )
{
this.estabelecimentosOptions = estabelecimentosOptions; this.estabelecimentosOptions = estabelecimentosOptions;
} }
private Integer estabelecimentoGestorChoice; private Integer estabelecimentoGestorChoice;
public Integer getEstabelecimentoGestorChoice() { public Integer getEstabelecimentoGestorChoice()
{
return estabelecimentoGestorChoice; return estabelecimentoGestorChoice;
} }
public void setEstabelecimentoGestorChoice(Integer estabelecimentoGestorChoice) { public void setEstabelecimentoGestorChoice( Integer estabelecimentoGestorChoice )
{
this.estabelecimentoGestorChoice = estabelecimentoGestorChoice; this.estabelecimentoGestorChoice = estabelecimentoGestorChoice;
} }
private com.sun.rave.web.ui.model.Option[] estabelecimentosGestorOptions; private com.sun.rave.web.ui.model.Option[] estabelecimentosGestorOptions;
public com.sun.rave.web.ui.model.Option[] getEstabelecimentosGestorOptions() { public com.sun.rave.web.ui.model.Option[] getEstabelecimentosGestorOptions()
{
return estabelecimentosGestorOptions; return estabelecimentosGestorOptions;
} }
public void setEstabelecimentosGestorOptions(com.sun.rave.web.ui.model.Option[] estabelecimentosGestorOptions) { public void setEstabelecimentosGestorOptions( com.sun.rave.web.ui.model.Option[] estabelecimentosGestorOptions )
{
this.estabelecimentosGestorOptions = estabelecimentosGestorOptions; this.estabelecimentosGestorOptions = estabelecimentosGestorOptions;
} }
@ -510,11 +573,13 @@ public class SessionBean1 extends AbstractSessionBean
// //
private Integer estabelecimentoOutroChoice; private Integer estabelecimentoOutroChoice;
public Integer getEstabelecimentoOutroChoice() { public Integer getEstabelecimentoOutroChoice()
{
return estabelecimentoOutroChoice; return estabelecimentoOutroChoice;
} }
public void setEstabelecimentoOutroChoice(Integer estabelecimentoOutroChoice) { public void setEstabelecimentoOutroChoice( Integer estabelecimentoOutroChoice )
{
this.estabelecimentoOutroChoice = estabelecimentoOutroChoice; this.estabelecimentoOutroChoice = estabelecimentoOutroChoice;
} }
@ -522,73 +587,87 @@ public class SessionBean1 extends AbstractSessionBean
private com.sun.rave.web.ui.model.Option[] estabelecimentosOutroOptions; private com.sun.rave.web.ui.model.Option[] estabelecimentosOutroOptions;
public com.sun.rave.web.ui.model.Option[] getEstabelecimentosOutroOptions() { public com.sun.rave.web.ui.model.Option[] getEstabelecimentosOutroOptions()
{
return estabelecimentosOutroOptions; return estabelecimentosOutroOptions;
} }
public void setEstabelecimentosOutroOptions(com.sun.rave.web.ui.model.Option[] estabelecimentosOutroOptions) { public void setEstabelecimentosOutroOptions( com.sun.rave.web.ui.model.Option[] estabelecimentosOutroOptions )
{
this.estabelecimentosOutroOptions = estabelecimentosOutroOptions; this.estabelecimentosOutroOptions = estabelecimentosOutroOptions;
} }
private Integer estabelecimentoMedChoice; private Integer estabelecimentoMedChoice;
public Integer getEstabelecimentoMedChoice() { public Integer getEstabelecimentoMedChoice()
{
return estabelecimentoMedChoice; return estabelecimentoMedChoice;
} }
public void setEstabelecimentoMedChoice(Integer estabelecimentoMedChoice) { public void setEstabelecimentoMedChoice( Integer estabelecimentoMedChoice )
{
this.estabelecimentoMedChoice = estabelecimentoMedChoice; this.estabelecimentoMedChoice = estabelecimentoMedChoice;
} }
private com.sun.rave.web.ui.model.Option[] estabelecimentosMedOptions; private com.sun.rave.web.ui.model.Option[] estabelecimentosMedOptions;
public com.sun.rave.web.ui.model.Option[] getEstabelecimentosMedOptions() { public com.sun.rave.web.ui.model.Option[] getEstabelecimentosMedOptions()
{
return estabelecimentosMedOptions; return estabelecimentosMedOptions;
} }
public void setEstabelecimentosMedOptions(com.sun.rave.web.ui.model.Option[] estabelecimentosMedOptions) { public void setEstabelecimentosMedOptions( com.sun.rave.web.ui.model.Option[] estabelecimentosMedOptions )
{
this.estabelecimentosMedOptions = estabelecimentosMedOptions; this.estabelecimentosMedOptions = estabelecimentosMedOptions;
} }
private Integer tecnicoChoice; private Integer tecnicoChoice;
public Integer getTecnicoChoice() { public Integer getTecnicoChoice()
{
return tecnicoChoice; return tecnicoChoice;
} }
public void setTecnicoChoice(Integer tecnicoChoice) { public void setTecnicoChoice( Integer tecnicoChoice )
{
this.tecnicoChoice = tecnicoChoice; this.tecnicoChoice = tecnicoChoice;
} }
private com.sun.rave.web.ui.model.Option[] tecnicosOptions; private com.sun.rave.web.ui.model.Option[] tecnicosOptions;
public com.sun.rave.web.ui.model.Option[] getTecnicosOptions() { public com.sun.rave.web.ui.model.Option[] getTecnicosOptions()
{
return tecnicosOptions; return tecnicosOptions;
} }
public void setTecnicosOptions(com.sun.rave.web.ui.model.Option[] tecnicosOptions) { public void setTecnicosOptions( com.sun.rave.web.ui.model.Option[] tecnicosOptions )
{
this.tecnicosOptions = tecnicosOptions; this.tecnicosOptions = tecnicosOptions;
} }
private Integer medicoChoice; private Integer medicoChoice;
public Integer getMedicoChoice() { public Integer getMedicoChoice()
{
return medicoChoice; return medicoChoice;
} }
public void setMedicoChoice(Integer medicoChoice) { public void setMedicoChoice( Integer medicoChoice )
{
this.medicoChoice = medicoChoice; this.medicoChoice = medicoChoice;
} }
private com.sun.rave.web.ui.model.Option[] medicosOptions; private com.sun.rave.web.ui.model.Option[] medicosOptions;
public com.sun.rave.web.ui.model.Option[] getMedicosOptions() { public com.sun.rave.web.ui.model.Option[] getMedicosOptions()
{
return medicosOptions; return medicosOptions;
} }
public void setMedicosOptions(com.sun.rave.web.ui.model.Option[] medicosOptions) { public void setMedicosOptions( com.sun.rave.web.ui.model.Option[] medicosOptions )
{
this.medicosOptions = medicosOptions; this.medicosOptions = medicosOptions;
} }
@ -596,133 +675,159 @@ public class SessionBean1 extends AbstractSessionBean
// Clock : // Clock :
private Integer horaChoice; private Integer horaChoice;
public Integer getHoraChoice() { public Integer getHoraChoice()
{
return horaChoice; return horaChoice;
} }
public void setHoraChoice(Integer horaChoice) { public void setHoraChoice( Integer horaChoice )
{
this.horaChoice = horaChoice; this.horaChoice = horaChoice;
} }
private com.sun.rave.web.ui.model.Option[] horasOptions; private com.sun.rave.web.ui.model.Option[] horasOptions;
public com.sun.rave.web.ui.model.Option[] getHorasOptions() { public com.sun.rave.web.ui.model.Option[] getHorasOptions()
{
return horasOptions; return horasOptions;
} }
public void setHorasOptions(com.sun.rave.web.ui.model.Option[] horasOptions) { public void setHorasOptions( com.sun.rave.web.ui.model.Option[] horasOptions )
{
this.horasOptions = horasOptions; this.horasOptions = horasOptions;
} }
private Integer minutoChoice; private Integer minutoChoice;
public Integer getMinutoChoice() { public Integer getMinutoChoice()
{
return minutoChoice; return minutoChoice;
} }
public void setMinutoChoice(Integer minutoChoice) { public void setMinutoChoice( Integer minutoChoice )
{
this.minutoChoice = minutoChoice; this.minutoChoice = minutoChoice;
} }
private com.sun.rave.web.ui.model.Option[] minutosOptions; private com.sun.rave.web.ui.model.Option[] minutosOptions;
public com.sun.rave.web.ui.model.Option[] getMinutosOptions() { public com.sun.rave.web.ui.model.Option[] getMinutosOptions()
{
return minutosOptions; return minutosOptions;
} }
public void setMinutosOptions(com.sun.rave.web.ui.model.Option[] minutosOptions) { public void setMinutosOptions( com.sun.rave.web.ui.model.Option[] minutosOptions )
{
this.minutosOptions = minutosOptions; this.minutosOptions = minutosOptions;
} }
private Integer causaChoice; private Integer causaChoice;
public Integer getCausaChoice() { public Integer getCausaChoice()
{
return causaChoice; return causaChoice;
} }
public void setCausaChoice(Integer causaChoice) { public void setCausaChoice( Integer causaChoice )
{
this.causaChoice = causaChoice; this.causaChoice = causaChoice;
} }
private com.sun.rave.web.ui.model.Option[] causasOptions; private com.sun.rave.web.ui.model.Option[] causasOptions;
public com.sun.rave.web.ui.model.Option[] getCausasOptions() { public com.sun.rave.web.ui.model.Option[] getCausasOptions()
{
return causasOptions; return causasOptions;
} }
public void setCausasOptions(com.sun.rave.web.ui.model.Option[] causasOptions) { public void setCausasOptions( com.sun.rave.web.ui.model.Option[] causasOptions )
{
this.causasOptions = causasOptions; this.causasOptions = causasOptions;
} }
private int idSequence; private int idSequence;
public int getIdSequence() { public int getIdSequence()
{
return idSequence; return idSequence;
} }
public void setIdSequence(int idSequence) { public void setIdSequence( int idSequence )
{
this.idSequence = idSequence; this.idSequence = idSequence;
} }
private NewUser newUser; private NewUser newUser;
public NewUser getNewUser() { public NewUser getNewUser()
{
return newUser; return newUser;
} }
public void setNewUser(NewUser newUser) { public void setNewUser( NewUser newUser )
{
this.newUser = newUser; this.newUser = newUser;
} }
private Utilizador editUser; private Utilizador editUser;
public Utilizador getEditUser() { public Utilizador getEditUser()
{
return editUser; return editUser;
} }
public void setEditUser(Utilizador editUser) { public void setEditUser( Utilizador editUser )
{
this.editUser = editUser; this.editUser = editUser;
} }
private boolean userDeleted; private boolean userDeleted;
public boolean isUserDeleted() { public boolean isUserDeleted()
{
return userDeleted; return userDeleted;
} }
public void setUserDeleted(boolean userDeleted) { public void setUserDeleted( boolean userDeleted )
{
this.userDeleted = userDeleted; this.userDeleted = userDeleted;
} }
private boolean mudarPassword; private boolean mudarPassword;
public boolean isMudarPassword() { public boolean isMudarPassword()
{
return mudarPassword; return mudarPassword;
} }
public void setMudarPassword(boolean mudarPassword) { public void setMudarPassword( boolean mudarPassword )
{
this.mudarPassword = mudarPassword; this.mudarPassword = mudarPassword;
} }
private Medico medico; private Medico medico;
public Medico getMedico() { public Medico getMedico()
{
return medico; return medico;
} }
public void setMedico(Medico medico) { public void setMedico( Medico medico )
{
this.medico = medico; this.medico = medico;
} }
private boolean fromAjuda; private boolean fromAjuda;
public boolean isFromAjuda() { public boolean isFromAjuda()
{
return fromAjuda; return fromAjuda;
} }
public void setFromAjuda(boolean fromAjuda) { public void setFromAjuda( boolean fromAjuda )
{
this.fromAjuda = fromAjuda; this.fromAjuda = fromAjuda;
} }
@ -730,68 +835,80 @@ public class SessionBean1 extends AbstractSessionBean
private boolean gravado; private boolean gravado;
public boolean isSubmetido() { public boolean isSubmetido()
{
return submetido; return submetido;
} }
public void setSubmetido(boolean submetido) { public void setSubmetido( boolean submetido )
{
this.submetido = submetido; this.submetido = submetido;
} }
public boolean isGravado() { public boolean isGravado()
{
return gravado; return gravado;
} }
public void setGravado(boolean gravado) { public void setGravado( boolean gravado )
{
this.gravado = gravado; this.gravado = gravado;
} }
private boolean fromAnaliseDeletion; private boolean fromAnaliseDeletion;
public boolean isFromAnaliseDeletion() { public boolean isFromAnaliseDeletion()
{
return fromAnaliseDeletion; return fromAnaliseDeletion;
} }
public void setFromAnaliseDeletion(boolean fromAnaliseDeletion) { public void setFromAnaliseDeletion( boolean fromAnaliseDeletion )
{
this.fromAnaliseDeletion = fromAnaliseDeletion; this.fromAnaliseDeletion = fromAnaliseDeletion;
} }
private boolean ieBug; private boolean ieBug;
public boolean isIeBug() { public boolean isIeBug()
{
return ieBug; return ieBug;
} }
public void setIeBug(boolean ieBug) { public void setIeBug( boolean ieBug )
{
this.ieBug = ieBug; this.ieBug = ieBug;
} }
private beans.Correcao correcao; private beans.Correcao correcao;
public beans.Correcao getCorrecao() { public beans.Correcao getCorrecao()
{
return correcao; return correcao;
} }
public void setCorrecao(beans.Correcao correcao) { public void setCorrecao( beans.Correcao correcao )
{
this.correcao = correcao; this.correcao = correcao;
} }
public String getLogoEmpresaUrl() { public String getLogoEmpresaUrl()
{
return logoEmpresaUrl; return logoEmpresaUrl;
} }
public void setLogoEmpresaUrl(String logoEmpresaUrl) { public void setLogoEmpresaUrl( String logoEmpresaUrl )
{
this.logoEmpresaUrl = logoEmpresaUrl; this.logoEmpresaUrl = logoEmpresaUrl;
} }
public Boolean getIsSearchingUtilizadores() { public Boolean getIsSearchingUtilizadores()
{
return isSearchingUtilizadores; return isSearchingUtilizadores;
} }
public void setIsSearchingUtilizadores(Boolean isSearchingUtilizadores) { public void setIsSearchingUtilizadores( Boolean isSearchingUtilizadores )
{
this.isSearchingUtilizadores = isSearchingUtilizadores; this.isSearchingUtilizadores = isSearchingUtilizadores;
} }
} }

@ -3132,43 +3132,35 @@ public class AnalisesDataProvider extends GenericDataProvider
return hash; return hash;
} }
public byte[] getLogoByEmpresa( Integer empresaId ) throws Exception public byte[] getLogoByEmpresa( Integer empresaID ) throws Exception
{ {
// Dblocal dblocal = new Dblocal(); byte[] result = null;
// dblocal.connect(); String sql = "SELECT empresa_logo_id FROM empresas WHERE id = " + empresaID;
// Statement st = dblocal.createStatement();
Statement st = createLocalStatement(); Statement st = createLocalStatement();
String sql = "select empresa_logo_id from empresas where id = " + empresaId;
ResultSet rslocal = st.executeQuery( sql ); ResultSet rslocal = st.executeQuery( sql );
if ( rslocal.isBeforeFirst() ) if ( rslocal.isBeforeFirst() )
{ {
rslocal.first(); rslocal.first();
Integer logoId = new Integer( rslocal.getInt( "empresa_logo_id" ) ); Integer logoId = new Integer( rslocal.getInt( "empresa_logo_id" ) );
byte[] logo = getLogo( logoId ); result = getLogo( logoId );
return logo;
} }
return result;
return null;
} }
public byte[] getLogo( Integer logoId ) throws Exception private byte[] getLogo( Integer logoID ) throws Exception
{ {
// Dblocal dblocal = new Dblocal(); System.out.println( "AnalisesDataProvider . getLogo( " + logoID + " ) : " );
// dblocal.connect();
// Statement st = dblocal.createStatement();
Statement st = createLocalStatement();
String sql = "select image_data from image where id = " + logoId; byte[] result = null;
String sql = "SELECT image_data FROM image WHERE id = " + logoID;
Statement st = createLocalStatement();
ResultSet rslocal = st.executeQuery( sql ); ResultSet rslocal = st.executeQuery( sql );
rslocal.first(); if ( rslocal.first() )
byte[] logo = rslocal.getBytes( "image_data" ); {
System.out.println( "LOGO SIZE : " + logo.length ); result = rslocal.getBytes( "image_data" );
return logo; }
System.out.println( "\tLOGO SIZE : " + ( result == null ? "null" : result.length ) );
return result;
} }
// private Statement createStatement()
// {
// Db db = new Db();
// return db.createStatement();
// }
} }

@ -28,7 +28,8 @@ import utils.JSFUtils;
* *
* @author lluis2 * @author lluis2
*/ */
public class Global { public class Global
{
public final static int ESTADO_SEG = 1; public final static int ESTADO_SEG = 1;
public final static int ESTADO_RH1 = 2; public final static int ESTADO_RH1 = 2;
public final static int ESTADO_HS = 3; public final static int ESTADO_HS = 3;

@ -12,6 +12,7 @@ import javax.faces.event.PhaseListener;
import analiseacidentestrabalho.SessionBean1; import analiseacidentestrabalho.SessionBean1;
import beans.Utilizador; import beans.Utilizador;
import com.evolute.utils.error.ErrorLogger; import com.evolute.utils.error.ErrorLogger;
import global.Global;
import javax.faces.component.UIViewRoot; import javax.faces.component.UIViewRoot;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import utils.JSFUtils; import utils.JSFUtils;
@ -55,9 +56,7 @@ public class AATMainPhaseListener implements PhaseListener
if ( sessionValid && loggedIn ) if ( sessionValid && loggedIn )
{ {
//insert logos //insert logos
Integer empresaId = new Integer( 32 ); String logourl = Logos.getInstance().getLogo( fc, new Integer( Global.AUCHAN ) );
Logos logos = new Logos();
String logourl = logos.getLogo( fc, empresaId );
session.setLogoEmpresaUrl( logourl ); session.setLogoEmpresaUrl( logourl );
} }
else else

@ -11,6 +11,8 @@ import global.Global;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
@ -18,40 +20,76 @@ import javax.servlet.ServletContext;
* *
* @author lluis * @author lluis
*/ */
public class Logos { public class Logos
{
public String getLogo(Integer empresaId)
private static Logos INSTANCE = null;
private Logos()
{
}
public static synchronized Logos getInstance()
{
if ( INSTANCE == null )
{
INSTANCE = new Logos();
}
return INSTANCE;
}
public String getLogo( Integer empresaID )
{ {
return null; return null;
} }
public String getLogo(FacesContext fc, Integer empresaId)
private final Map< Integer, String > LOGOS = new HashMap< Integer, String >();
public String getLogo( FacesContext fc, Integer empresaID )
{ {
try if ( ! LOGOS.containsKey( empresaID ) )
{ {
//get image from db : fetchLogoFromDB( fc, empresaID );
// AnalisesDataProvider adp = new AnalisesDataProvider(); }
AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); String result = LOGOS.get( empresaID );
byte[] logo = adp.getLogoByEmpresa(empresaId); System.out.println( "LOGO PATH : " + result );
int len = logo.length; return result;
}
ServletContext context = (ServletContext) fc.getExternalContext().getContext();
File logoFolder = new File(context.getRealPath(Global.LOGOS_FOLDER));
private void fetchLogoFromDB( FacesContext fc, Integer empresaID )
String logoFilename = logoFolder + "/logo_empresa" + empresaId.toString() + ".jpg"; {
String filepath = Global.LOGOS_FOLDER + "/logo_empresa" + empresaID + ".jpg";
OutputStream outImej = new FileOutputStream(logoFilename); File f = new File( filepath );
outImej.write(logo, 0, len); if ( ! f.isFile() )
System.out.println("LOGO PATH : " + logoFilename); {
outImej.close(); try
return Global.LOGOS_FOLDER + "/logo_empresa" + empresaId.toString() + ".jpg"; {
} byte[] logo = AnalisesDataProvider.getInstance().getLogoByEmpresa( empresaID );
catch(Exception ex) if ( logo != null )
{ {
ErrorLogger.logException( ex ); int len = logo.length;
return null;
} ServletContext context = ( ServletContext ) fc.getExternalContext().getContext();
File logoFolder = new File( context.getRealPath( Global.LOGOS_FOLDER ) );
String logoFilename = logoFolder + "/logo_empresa" + empresaID.toString() + ".jpg";
OutputStream outImej = new FileOutputStream( logoFilename );
outImej.write( logo, 0, len );
outImej.flush();
outImej.close();
LOGOS.put( empresaID, filepath );
}
}
catch ( Exception e )
{
ErrorLogger.logException( e );
}
}
} }
} }

Loading…
Cancel
Save