private void validateSenha(String senha) {
    if (StringHelper.isBlank(senha)) {
      throw new HttpException(EXCEPTION_USUARIO_SENHA_MUST_NOT_BE_EMPTY, HttpStatus.NOT_ACCEPTABLE);
    }

    if (senha.length() > 128) {
      throw new HttpException(
          EXCEPTION_USUARIO_SENHA_MUST_NOT_BE_BIGGER_THAN_128_CHARACTERS,
          HttpStatus.NOT_ACCEPTABLE);
    }
  }
  @Transactional(readOnly = true)
  public void validateIgnoringIdAndPessoa(Usuario usuario) {
    if (usuario == null) {
      throw new HttpException(EXCEPTION_USUARIO_MUST_NOT_BE_NULL, HttpStatus.NOT_ACCEPTABLE);
    }

    if (usuario.getStatus() == null) {
      throw new HttpException(EXCEPTION_USUARIO_STATUS_MUST_NOT_BE_NULL, HttpStatus.NOT_ACCEPTABLE);
    }

    if (StringHelper.isBlank(usuario.getApelido())) {
      throw new HttpException(
          EXCEPTION_USUARIO_APELIDO_MUST_NOT_BE_EMPTY, HttpStatus.NOT_ACCEPTABLE);
    }

    if (usuario.getApelido().length() > 45) {
      throw new HttpException(
          EXCEPTION_USUARIO_APELIDO_MUST_NOT_BE_BIGGER_THAN_45_CHARACTERS,
          HttpStatus.NOT_ACCEPTABLE);
    }

    if (!usuario.getApelido().matches(Constants.TEXT_PATTERN_APELIDO)) {
      throw new HttpException(
          EXCEPTION_USUARIO_APELIDO_MUST_CONTAINS_ONLY_LETTERS_NUMBERS_UNDERLINES_DASHES_AND_POINTS,
          HttpStatus.NOT_ACCEPTABLE);
    }

    validateSenha(usuario.getSenha());

    if (usuario.getPerfis() != null) {
      for (int i = 0; i < usuario.getPerfis().size(); i++) {
        for (int j = 0; j < usuario.getPerfis().size(); j++) {
          if (j != i) {
            if (usuario.getPerfis().get(i) == usuario.getPerfis().get(j)) {
              throw new HttpException(
                  EXCEPTION_USUARIO_MUST_NOT_CONTAINS_DUPLICATED_PERFIS, HttpStatus.NOT_ACCEPTABLE);
            }
          }
        }
      }
    }
  }
 public String encryptSenha(String decryptedSenha) {
   return StringHelper.encryptSHA512AndHex(decryptedSenha);
 }