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
*/
public class Acesso extends AbstractPageBean {
public class Acesso extends AbstractPageBean
{
// <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
* here is subject to being replaced.</p>
*/
private void _init() throws Exception {
private void _init() throws Exception
{
}
private StaticText stWelcome = new StaticText();
public StaticText getStWelcome() {
public StaticText getStWelcome()
{
return stWelcome;
}
public void setStWelcome(StaticText st) {
public void setStWelcome(StaticText st)
{
this.stWelcome = st;
}
private DropDown drpEstabelecimentos = new DropDown();
public DropDown getDrpEstabelecimentos() {
public DropDown getDrpEstabelecimentos()
{
return drpEstabelecimentos;
}
public void setDrpEstabelecimentos(DropDown dd) {
public void setDrpEstabelecimentos(DropDown dd)
{
this.drpEstabelecimentos = dd;
}
private HtmlPanelGrid gridEstabelecimento = new HtmlPanelGrid();
public HtmlPanelGrid getGridEstabelecimento() {
public HtmlPanelGrid getGridEstabelecimento()
{
return gridEstabelecimento;
}
public void setGridEstabelecimento(HtmlPanelGrid hpg) {
public void setGridEstabelecimento(HtmlPanelGrid hpg)
{
this.gridEstabelecimento = hpg;
}
@ -72,7 +81,9 @@ public class Acesso extends AbstractPageBean {
/**
* <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">
// Initialize automatically managed components
// *Note* - this logic should NOT be modified
try {
try
{
_init();
} catch (Exception e) {
}
catch ( Exception e )
{
log("Acesso Initialization Failure", e);
throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
}
@ -137,18 +151,16 @@ public class Acesso extends AbstractPageBean {
public void prerender()
{
Utilizador u = getSessionBean1().getCurrentUser();
//String nomeUnicode = Utils.textToUnicode(u.getNome());
//System.out.println("NOME UNICODE : " + nomeUnicode);
String nomeHtml = Utils.unicodeToHTML( u.getNome() );
stWelcome.setText("Bem vindo(a) " + nomeHtml);
if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR)
if ( u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR )
{
initializeEstabelecimentos();
}
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>
*/
protected SessionBean1 getSessionBean1() {
return (SessionBean1)getBean("SessionBean1");
protected SessionBean1 getSessionBean1()
{
return ( SessionBean1 ) getBean("SessionBean1");
}
/**
* <p>Return a reference to the scoped data bean.</p>
*/
protected RequestBean1 getRequestBean1() {
return (RequestBean1)getBean("RequestBean1");
protected RequestBean1 getRequestBean1()
{
return ( RequestBean1 ) getBean("RequestBean1");
}
/**
* <p>Return a reference to the scoped data bean.</p>
*/
protected ApplicationBean1 getApplicationBean1() {
return (ApplicationBean1)getBean("ApplicationBean1");
protected ApplicationBean1 getApplicationBean1()
{
return ( ApplicationBean1 ) getBean("ApplicationBean1");
}
@ -218,7 +233,7 @@ public class Acesso extends AbstractPageBean {
{
JSFUtils.logout( fc, false );
}
catch(Exception ex)
catch ( Exception ex )
{
ErrorLogger.logException( ex );
}
@ -281,59 +296,34 @@ public class Acesso extends AbstractPageBean {
public String lnkPlanos_action()
{
Utilizador u = getSessionBean1().getCurrentUser();
// String curUser = "?user=" + u.getId().toString();
FacesContext fc = getFacesContext().getCurrentInstance();
Integer estabelecimento = null;
if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR)
if ( u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR )
{
estabelecimento = (Integer) drpEstabelecimentos.getSelected();
// if(estabelecimento.intValue() == -1)
// {
// getSessionBean1().setMsg("Falta estabelecimento!");
// return null;
// }
// else
// {
// u.setEstabelecimento(estabelecimento_outro);
u.setEstabelecimento_gestor(estabelecimento);
estabelecimento = ( Integer ) drpEstabelecimentos.getSelected();
u.setEstabelecimento_gestor( estabelecimento );
}
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 );
// }
Global.redirectToPlanos( fc, u );
return null;
}
private void initializeEstabelecimentos()
{
try
{
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
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));
}
catch(Exception ex)
{
ErrorLogger.logException( ex );
}
}
private void initializeEstabelecimentos()
{
try
{
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
com.sun.rave.web.ui.model.Option[] listGestorOptions = adp.getEstabelecimentosGestorList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean( true ) );
getSessionBean1().setEstabelecimentosGestorOptions( listGestorOptions );
drpEstabelecimentos.setSelected( new Integer( 0 ) );
}
catch ( Exception ex )
{
ErrorLogger.logException( ex );
}
}
}

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

@ -3132,43 +3132,35 @@ public class AnalisesDataProvider extends GenericDataProvider
return hash;
}
public byte[] getLogoByEmpresa( Integer empresaId ) throws Exception
public byte[] getLogoByEmpresa( Integer empresaID ) throws Exception
{
// Dblocal dblocal = new Dblocal();
// dblocal.connect();
// Statement st = dblocal.createStatement();
byte[] result = null;
String sql = "SELECT empresa_logo_id FROM empresas WHERE id = " + empresaID;
Statement st = createLocalStatement();
String sql = "select empresa_logo_id from empresas where id = " + empresaId;
ResultSet rslocal = st.executeQuery( sql );
if ( rslocal.isBeforeFirst() )
{
rslocal.first();
Integer logoId = new Integer( rslocal.getInt( "empresa_logo_id" ) );
byte[] logo = getLogo( logoId );
return logo;
result = getLogo( logoId );
}
return null;
return result;
}
public byte[] getLogo( Integer logoId ) throws Exception
private byte[] getLogo( Integer logoID ) throws Exception
{
// Dblocal dblocal = new Dblocal();
// dblocal.connect();
// Statement st = dblocal.createStatement();
Statement st = createLocalStatement();
System.out.println( "AnalisesDataProvider . getLogo( " + logoID + " ) : " );
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 );
rslocal.first();
byte[] logo = rslocal.getBytes( "image_data" );
System.out.println( "LOGO SIZE : " + logo.length );
return logo;
if ( rslocal.first() )
{
result = rslocal.getBytes( "image_data" );
}
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
*/
public class Global {
public class Global
{
public final static int ESTADO_SEG = 1;
public final static int ESTADO_RH1 = 2;
public final static int ESTADO_HS = 3;

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

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