Package br.com.kuntzer.rodrigo.cursoviasoft.entity

Examples of br.com.kuntzer.rodrigo.cursoviasoft.entity.Usuario


  @Override
  public UserDetails loadUserByUsernameAndCompany(String username, String company) {
    if(StringUtils.isNotEmpty(company) && NumberUtils.isNumber(company)){
      Long idempresa = Long.valueOf(company);
      Usuario usuario = usuarioRepository.obterUsuarioPorUsernameAndEmpresa(username, idempresa);
      if(usuario != null){
        Empresa empresa = empresaRepository.obterPorId(idempresa);
        return new UsuarioUserDetails(usuario, empresa);
      }
    }
View Full Code Here


    throw new UsernameNotFoundException("login.user.notfound");
  }

  @Override
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    Usuario usuario = usuarioRepository.obterUsuarioPorUsername(username);
    if(usuario != null){
      return new UsuarioUserDetails(usuario, null);
    }
    throw new UsernameNotFoundException("login.user.notfound");
  }
View Full Code Here

    Session session = (Session) entityManager.getDelegate();
    org.hibernate.Query consulta =  session.createQuery("select u from Usuario u where u.username =:param1")
        .setParameter("param1", username)
        .setCacheable(true).setCacheRegion("regiao1")
        .setCacheMode(CacheMode.NORMAL);
    Usuario usuario = (Usuario) consulta.uniqueResult()
    if(usuario != null){
      return usuario.getEmpresas();
    }
    return new ArrayList<Empresa>();
  }
View Full Code Here

TOP

Related Classes of br.com.kuntzer.rodrigo.cursoviasoft.entity.Usuario

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.