public void saveSenha() { try { Integer idFun = serviceSession.getFuncionarioIdSession(); try { Funcionario oldFunc = service.findById(idFun); if (!SecurityUtils.md5(this.funcionarioSenha.getSenha()).equals(oldFunc.getSenha())) { FacesUtils.errorI18n("app.entity.funcionario.error.invalidPassword"); return; } if (!this.funcionarioSenha .getValidNovaSenha() .equals(this.funcionarioSenha.getNovaSenha())) { FacesUtils.errorI18n("app.entity.funcionario.error.invalidNewPassword"); return; } } catch (ApplicationMessageException e) { FacesUtils.error(e.getMessage()); } this.service.save(this.funcionarioSenha); this.init(); FacesUtils.infoI18n("app.generic.successSave"); } catch (BusinessMessageException e) { FacesUtils.info(e.getMessage()); } catch (ApplicationMessageException e) { FacesUtils.error(e.getMessage()); } }
public void selecionarFunc() { try { this.funcionario = service.findById(getFuncionarioSel().getFunId()); } catch (ApplicationMessageException e) { FacesUtils.error(e.getMessage()); } FacesUtils.clearForm(); }
public List<Funcionario> getFuncionariosCmb() { try { funcionariosCmb = service.findAll(); } catch (ApplicationMessageException e) { FacesUtils.error(e.getMessage()); } return funcionariosCmb; }
/** ************************************************************ */ public List<Funcionario> search() { try { Funcionario searchFunc = new Funcionario(); searchFunc.setNome(this.funcionarioSearch.getNome()); searchFunc.setAtivo(this.funcionarioSearch.getAtivo()); this.funcionarios = service.find(searchFunc); } catch (ApplicationMessageException e) { FacesUtils.error(e.getMessage()); } return this.funcionarios; }
@PostConstruct public void init() { this.funcionarioSearch = new FuncionarioDTO(); this.funcionario = new Funcionario(); this.funcionarios = this.search(); this.funcionarioSel = new Funcionario(); this.disableDepartamento = true; this.disableDepartamentoSearch = true; this.disableSite = true; this.numSeq = 1; Integer idFun = serviceSession.getFuncionarioIdSession(); try { this.funcionarioSenha = service.findById(idFun); } catch (ApplicationMessageException e) { FacesUtils.error(e.getMessage()); } }