コード例 #1
0
  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());
    }
  }
コード例 #2
0
  /** ************************************************************ */
  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;
  }
コード例 #3
0
  public List<String> searchNome(String query) {
    List<String> suggestions = new ArrayList<String>();

    try {
      List<Funcionario> funcionarios = this.service.findListByNome(query);

      if (funcionarios != null) {
        for (Funcionario funcionario : funcionarios) {
          suggestions.add(funcionario.getNome());
        }
      }

    } catch (Exception e) {
      FacesUtils.error(e.getMessage());
    }

    return suggestions;
  }