コード例 #1
0
  @Override
  public Object run(ExtratoAnalyseSwitches switches) throws ExtratoAnalyseException {
    checkParamValid(switches);

    manualRefList = makeManualRefList(switches);

    banco = getConta(switches.getNomeBanco());

    List<Lancamento> lancamentoSemExtratoList = getLancamentoSemExtratoList();

    List<ExtratoLancamento> extratoLancamentoOrfao = getExtratoLancamentoOrfao(banco);

    if (extratoLancamentoOrfao.size() == 0) {
      System.out.println();
      System.out.println(
          "Nenhum item de extrato órfão encontrado para o banco \"" + banco.getNome() + "\".");

      return null;
    }

    TextGrid grid = createGrid();
    List<ExtratoLineAnalyseResult> statuses;

    try {
      statuses = makeSync(lancamentoSemExtratoList, extratoLancamentoOrfao, switches);
    } catch (ExtratoLineParserException e) {
      throw new ExtratoAnalyseException(e);
    }

    grid.setValues(statuses);

    try {
      grid.show();
    } catch (TextGridException e) {
      throw new ExtratoAnalyseException(e);
    }

    System.out.println();
    System.out.println("Legenda:");
    System.out.println("  - : Não se aplica.");
    System.out.println("  U : Update.");
    System.out.println("  * : Insert.");
    System.out.println("  X : Delete.");
    System.out.println("  ! : Conta não encontrada.");

    return null;
  }
コード例 #2
0
 private void checkParamValid(ExtratoAnalyseSwitches switches) throws ExtratoAnalyseException {
   if (switches.getNomeBanco() == null) {
     throw new ExtratoAnalyseException("Nome do banco deve ser informado.");
   }
 }